This article is authorized to be reproduced from: https://www.cnblogs.com/javaa
Awesome Java: https://github.com/snaillimb
My interview criteria
Last week, I interviewed a number of Java backend candidates intensively, with work experience of 3 to 5 years. My criteria are not complicated:
- First can work;
- The second is Java;
- Third, it is better to be familiar with the distributed framework;
I believe that other companies should follow this standard when recruiting for primary development.
I also know that many candidates are not poor in ability, but they are not prepared or will not say during the interview. Such a person may be able to meet the expectations after working in the team, but may not pass the interview, but the interviewer always judges according to the interview situation.
But the reality is that most people may not be prepared before the interview, or the preparation method is not appropriate. You know, we usually work more business oriented, and can’t touch a lot of questions such as algorithm, data structure, and underlying code. In other words, the interview preparation point and the usual work point match very little.
As an interviewer, I can only decide the interview result according to the candidate’s answer. However, it’s convenient to meet people, so I’ll introduce the preparation skills of interview through some common questions in this article. You will be sure to sigh after reading: as long as the method is appropriate, it is not difficult to prepare for the first interview, and the second time will not be too much.
Framework is the key, but don’t let people feel that you can only copy other people’s code
Before the interview, I will read the resume to check the candidate’s experience in the framework project. In the introduction of the candidate’s project, I will also focus on the candidate’s recent framework experience. At present, SSM is more popular.
However, most candidates who work in 5 years are only able to “copy” other people’s code, that is to say, they can extend new functional modules based on the existing framework and follow the process written by others. For example, to write a function module of stock listing, we will imitate the existing order process, and then from the front end to the back end and then to the database, and write it again according to the same drawing, at most changing the code points related to the function.
In fact, we all come here like this, but in the interview, if you only show such ability, you will be almost at the level of most people. At this point, you will not be able to show your advantages.
We know that most projects will suffer if we only use SSM framework. For example, the database performance is poor, or the business module is complex, and the concurrency is high. The controller in spring MVC cannot meet the jump requirements. So I usually ask: what other changes have you made in addition to writing business code according to the existing framework?
The answer I heard is: redis cache is added to avoid frequent calls to some unchanging data. Or, in the XML of mybitas, if the where condition of the select statement has isnull, that is to say, if the value has a where condition, a query condition without isnull will be added to any where, so as to prevent the statement from scanning the whole table when all the incoming parameters are null. Or, to put it simply, the amount of data returned asynchronously by the back-end is large and the time is long. In the project, I increased the maximum time of asynchronous return, or compressed the returned information to increase the network transmission performance.
For this question, I don’t care what answers I hear, I only care that the answers are illogical. Generally, as long as the answer is correct, I will give “I have my own experience and certain understanding at the framework level”. Otherwise, I will only give “I can only write framework code under the leadership of the project manager, and I don’t know much about the framework itself”.
In fact, when preparing for the interview, it’s not difficult to summarize the key points in the framework. I don’t believe that everyone has accumulated little in the project. As long as you say it, you can say that you have crushed nearly 70% of the competitors in this respect.
Don’t just look at the framework of the stand-alone version, understand the distribution properly
In addition, when describing the framework technology in the project, it’s better to bring some distributed technology. Here are some of the distributed technologies that you can prepare.
- In terms of reverse proxy, the basic configuration of nginx, such as how to set rules through Lua language and how to set session stickiness. If you can, look at the underlying layer of nginx, such as protocol, cluster settings, failover, etc.
- For the aspect of remote calling Dubbo, you can see the knowledge points of the integration of Dubbo and zookeeper, and then further understand the underlying transport protocol and serialization mode of Dubbo.
- In terms of message queuing, you can see how Kafka or any component is used. For simplicity, you can see configuration, workgroup settings, and then go deeper. You can see Kafka cluster, the way of persistence, and whether messages are sent by long connection or short interception.
For example, you can also see redis cache, log framework, MYCAT sub database and sub table. There are two ways to prepare. The first is to know how to use it. This is relatively simple. You can build a functional module through a configuration file. The second is to properly read some underlying code to understand the protocol, cluster, failover and other advanced knowledge points.
If you can talk about the bottom layer of distributed components in the interview, you will get a better evaluation, such as “deep understanding of the bottom layer of the framework”, or “rich experience in the framework”. In this way, you can interview architects, let alone advanced development.
In terms of database, don’t know how to add, delete, modify or search. You need to know about performance optimization
In actual projects, most programmers may only use addition, deletion, modification and query, which is more common when we use mybatis. But if you do the same in an interview, you’re probably as good as your competitors.
In this regard, you can prepare the following skills:
- Advanced aspects of SQL, such as group by, having, left join, subquery (with in), row to column, etc.
- In terms of table building, you can consider whether your project uses three paradigms or anti paradigms. Why?
- Especially for optimization, you can prepare how to view SQL statement improvement points through execution plan, or other ways to improve SQL performance (such as index building).
- If you feel capable, you can also prepare some skills of MySQL Cluster and MYCAT sub database and sub table. For example, LVS + preserved is used to realize MySQL load balancing and MYCAT configuration. Also, if you can, look at the underlying code.
Even if you are average in the first three points, you can at least surpass nearly average candidates. Especially when you are very good in SQL optimization, when you are interviewing for advanced development, the database level must be up to standard. If you answer the fourth point very well, Congratulations, your ability in database even reaches the level of primary architecture.
Java core aspect, prepare interview questions around data structure and performance optimization
In Java core, there are many interview questions on the Internet, but in addition, you should also focus on the two parts: Collection (i.e. data structure) and multithreading concurrency. On this basis, you can prepare some design patterns and virtual machine rhetoric.
Here are some of the questions I usually ask:
- What is the result of string a = 123; string B = 123; a = B? This includes memory, string storage and many other knowledge points.
- When do hashcode methods and equal methods in HashMap need to be rewritten? What are the consequences of not rewriting? You can learn more about the underlying implementation of HashMap (or even concurrent HashMap).
- What is the difference between the underlying implementation of ArrayList and LinkedList? Where are they applicable? You can also learn about the underlying code.
- What is the role of volatile keyword? From this, you can understand the difference between thread memory and heap memory
- Completable future, a new feature in JDK 1.8, how to realize multithreading concurrency control through it?
- In the JVM, where is the new object? Go deeper and ask how to view and optimize JVM virtual machine memory.
- What’s the difference between static and dynamic agents in Java? It’s better to combine it with the underlying code.
Through the above questions, I don’t just stay at the “can use” level, for example, I won’t ask how to put elements in the ArrayList. As you can see, the above problems include details such as “multithreading concurrency”, “JVM optimization”, “data structure object underlying code”, etc. you can also draw inferences from one example. By looking at some advanced knowledge, you can prepare more similar interview questions.
We know that currently java development is mainly based on web framework, so why ask Java core knowledge points? I have my own experience.
I have met two people in my team before. One is able to work. The specific performance is that I can use Java core and basic API, and I have no intention to understand it in depth (I don’t know how to understand it in depth). The other one usually specializes in advanced knowledge of Java concurrency, virtual machine, etc. After half a year, the latter’s ability is rapidly upgraded to advanced development. As we have a thorough understanding of Java core knowledge points, it is not a big problem to see the underlying implementation of some distributed components. And the former, has been in the repetition of labor, the ability has only remained in the “will work” level.
In the real interview, if you are not familiar with Java core knowledge points, it is estimated that it will be difficult to upgrade to advanced development, let alone interview architect level positions.
For Linux, at least know how to look at log troubleshooting
If candidates can prove that they have the ability to “troubleshoot” and “solve problems”, this is definitely a bonus item, but how to prove it?
At present, most of the Internet projects are deployed on Linux, that is to say, the logs are on Linux. Here are some actual Linux operations.
- You can open a file by using the less command, shift + G to the bottom of the file, and then search for information by using the “+” keyword.
- You can use grep to query keywords. The specific usage is: grep keyword filename. If you want to search the result twice, use grep keyword 1 filename | keyword 2 — color. Finally — color is the highlighted keyword.
- Can edit files through VI.
- You can use Chmod to set file permissions.
Of course, there are more and more practical linux commands, but in the actual interview process, many candidates do not even know a Linux command. Or this sentence, even if you know something very basic, it is better than ordinary people.
Read through a section of underlying code as a bonus
How to prove that you know a lot about a knowledge point? Nothing can be explained through the underlying code. When I communicate with a lot of programmers with working experience within 5 years, many people think it is difficult? It is true that it is not easy to understand the distributed components by reading the underlying code, but it is not difficult to understand the underlying code in the following parts.
- The underlying code of ArrayList and LinkedList contains the implementation methods based on array and linked list. If you can clearly expand the capacity by this way, you can definitely prove yourself by “traversing through enumerator” and other methods.
- The HashMap directly corresponds to the data structure of the hash table. In the bottom code of the HashMap, there are operations such as put and get of the hashcode. Even in the concurrent HashMap, there is also the logic of lock. I believe that if you look at the concurrent HashMap in the interview, and then combine it with the words and pictures on the paper, you will surely conquer the interviewer.
- You can see the implementation methods of static agent and dynamic agent, and then you can see the implementation code in spring AOP.
- Maybe the underlying implementation code of spinning IOC and MVC is difficult to understand, but you can say some key classes and describe their implementation methods according to the key process.
In fact, the preparation of the underlying code is not necessarily many, but not limited to any aspect, such as TreeSet based on red black tree in the collection, open source framework based on NiO, and even Dubbo of distributed components. Besides, you don’t have to memorize all the bottom layers when preparing (in fact, it’s hard to do). You just need to be able to combine some important classes and methods and make clear your ideas (for example, how to quickly locate HashMap through hashcode).
So how do you find a good opportunity to say the underlying code you are ready for in an interview? During the interview, you will always be asked about the collection, spring MVC framework and other relevant knowledge points. When you answer, by the way, “I also know the underlying implementation of this”. Then the interviewer will definitely ask, so you can say it.
Don’t underestimate the help to candidates. Once you say it, as long as the meaning is in place, you can get at least a positive professional evaluation. If the description is clear, the evaluation will be upgraded to “familiar with Java core skills (or spring MVC), and the basic skills are solid”. You know, in an interview, very few people can explain the underlying code clearly, so if you throw out this topic, even if you fail to achieve the expected results, the interviewer will not lower your evaluation. So, preparing for this is definitely a money making business with “hundreds of profits without any harm”.
All in all, embed these skills in the projects you’ve done
In the interview process, I often hear some more regrettable answers. For example, the candidate has a good command of SQL optimization skills, but at last I know that this is what he usually learned by himself and is not used in the actual project.
Of course, this is better than not, so I will write down “I have taught myself SQL optimization skills at ordinary times”, but if I have practiced it in the project, I will write down “I have actual database SQL optimization skills”. You can compare the difference between the two. One is that we emphasize theory, the other is that we can work directly. In fact, in many scenarios, I don’t believe that I haven’t practiced SQL optimization skills in actual projects.
From this case, I want to tell you that you have spent a lot of time (in fact, it doesn’t take much effort to get the method direction) preparing a lot of skills and words, which should finally be implemented into your actual project.
For example, you have the experience of searching for keywords in Linux logs. When describing, you can bring a sentence, which I did in previous projects. For another example, you can see the difference between TreeSet and HashSet and their application scope by looking at the underlying code. Then you can recall your previous projects. Is there a scenario only applicable to TreeSet? If yes, then you can properly describe the requirements of the project, and then say, by reading the underlying code, I understand the difference between the two, and in this actual demand, I used TreeSet, and I also made a special comparative test, and found that TreeSet is XX percentage points higher than HashSet.
Please remember that “practical experience” must be worth more than “theoretical experience”, and most of the theoretical experience you know must have been used in your project. So if you just make the interviewer feel like you have “theoretical experience,” it’s a loss.
Summary: This article talks about more ways to prepare for an interview
The interview questions given in this paper are not many, but this paper does not intend to give too many interview questions. From this article, you can see more about the pain points of many candidates found by the interviewer.
The purpose of this article is to let everyone stop repeating the mistakes of others, which does not count. This article also provides many ways to prepare for the interview. Your ability may be superior to others, but if you prepare for an interview in the same way as others, or just talk about your work in the project without summarizing your highlights in the project, then the interviewer will really look down on you.
If the methods and skills mentioned in this article can help you, please forward them, or click the button below to “recommend this article”, or participate in the discussion through comments.
This article is welcome to reprint, but please indicate the source of the article. Please also give the interview tutorial of connecting Java Web lightweight development and Java core technology and interview guide of the two books I wrote.
Thank you again for reading this article.
Open source project recommendation
Other open source projects recommended by the author:
- Java Guide: [java learning + interview guide] covers the core knowledge that most Java programmers need to master.
- Spring boot Guide: suitable for novice and experienced developers to consult the spring boot tutorial (in spare time maintenance, welcome to maintain together).
- Programmer advancement: I think technicians should have some good habits!
- Spring security JWT Guide: get started from scratch! Spring security with JWT (including permission verification) backend part code.