The original address, http://www.cnblogs.com/xrq730/p/5260294.html, reprint please indicate the source, thank you!

 

preface

This article was created because of the appointment with colleagues and LZ himself likes to summarize after finishing a thing. Most of this article is aimed at the entire programmer community, but since LZ itself is Java development, some of it is also aimed at us Java programmers.

Simple, first LZ coordinates, hangzhou, 13th session of undergraduate course graduation, calculate on alibaba B2B business before the interview last year, a total of his interview with six companies (because the LZ don’t want to leave, so just every night to go to other company, so the interview companies less), which has four of success, the other two fail because:

1, alibaba B2B group interview, two rounds of technical interviews are passed, the last round of the interview is the other side of the head, because I heard that technology interview had basically 90% of this success, so now is no scruples in conversation with the supervisor’s, speak up, a lot of things they between know and don’t know all direct blurt out, The result was repeatedly asked by the other side on the question was speechless. In hindsight, ambiguous answers are the most taboo in an interview, and this failure also made LZ take each interview seriously

2, another failure is a small company, only about 20 people, the whole team is alipay out of business, very powerful. After the interview, LZ got to know more about me. They think my basic skills are good, but they still lack practical project experience. Because they are entrepreneurial companies, they need people to get started, so I am not particularly suitable for their team at this time

As for the other four successful companies, LZ’s interviews were all very good, but LZ didn’t want to keep track of them, so instead of enumerating the interview process for each company, LZ talked about some of the skills and other insights that a Java programmer who has been working for about three years should have.

 

Several stages of the programmer

Every programmer, or every worker, should have his or her own career plan. If you see people here who don’t have their own career plan, I hope you can think about your future.

LZ often thinks about his future, and he summarizes some things from his thinking as part one. LZ believes that a programmer should have several phases (all of which count as internship) :

  • The first phase —- three years
    • I think three years is the first threshold for programmers, and that phase will weed out a bunch of people who are not good enough to write code. At this stage, we go out of the campus, into the society, become a programmer, formally from the book content to the real enterprise development. We know how to work together as a team, how to use project management tools, how to control project version, how to test and run our code online and so on. We have accumulated certain development experience, and also have a certain in-depth understanding of the code, which is a relatively pure Coder stage
  • The second stage —- five years
    • Five years is the second threshold to distinguish programmers. Some people will study nothing in their spare time except to finish their work in three years. These people will always be Coder, and the older ones will be replaced by younger ones. Some people in three years, in addition to writing code, also keen to study all kinds of technical implementation details, see N many good books, writing some blog, share technology in the making, these people in five years must have the ability to acquire the technically and clear the development direction of the future, from a Coder gradually towards a systems analyst or an architect, Be an integral part of the project team
  • The third stage —- ten years
    • Ten years is another threshold, and that’s when you switch careers or continue to be a programmer. If you had stuck to the idea and worked hard in the first few years, at this point in the decade, someone would have grown up to be a programmer with deep knowledge of the industry, deep knowledge of the technology, and the ability to analyze a product from scratch. It’s an honor to be a CTO, a technical specialist, a chief architect, and other key positions in the company, and your boss will not take advantage of you financially

To sum up, I think there are three things you should keep thinking about as you get older and learn more about life:

  1. Am I cut out to be a programmer?
  2. Should I be a programmer for the rest of my life?
  3. What kind of attitude do I have toward programming? Is it enough or do I keep studying?

Finally, define your own career plan, take responsibility for your own plan and work towards it.

 

About project Experience

On the Internet, LZ often saw some other friends asking questions about project experience. According to LZ’s feeling in the interview, the interview mainly depends on the following points: project experience + basic skills + personal potential (that is, whether it is worth cultivating).

As for the project experience, I think teacher Fang Tengfei, founder of Concurrent Programming network, said a very good passage:

When introducing a product, the interviewer will examine the communication ability and thinking ability of the candidate. Most of the time, we are doing a function or a module of the product. But even if so, have we made clear the whole system architecture or product, and can explain why we are doing this system? What is the value of this system? What are the functions of this system? What are the pros and cons? If you could redesign the system, how would you design it?

Copy the code

I think that’s enough. Maybe you have only worked for one year, or maybe you are working on a trivial module in a project. Of course, these must be your weaknesses and cannot be changed, but how to make up for this weakness? I summarize the following points from Teacher Fang’s words:

  1. Define what your project does and what it does
  2. Identify the overall structure of your project, and be able to draw it clearly to the interviewer during the interview and clearly indicate where to call from and how to call
  3. Identify your module’s place and role in the overall project
  4. Figure out what technologies are used in your modules and, better yet, what technologies are used in the project as a whole

In the event that you can’t change your years of work or your less-than-convincing project experience (which must be a penalty), this is a way to compensate and increase your interviewer’s goodwill to a certain extent.

In addition, there is one question that 90% of you will never answer in an interview about your project: talk about a complex problem that you solved during the project. This requires constant discovery and exploration at work, not much, as long as you find one or two things you can talk about in your current project. A tip is that even if the problem is not your problem but someone else’s, and you understand it well enough, you can still approach the interview as if it was your problem —- After all, who cares if it was your problem?

 

About Professional Skills

After writing the project, write about the skills that a Java programmer with 3 years of experience should have. This is probably something that Java programmers are concerned about. I want to make it clear that not all of the following is necessary —- but the more you know, the higher your ratings and salary will be.

1. Basic grammar

This includes the use of static, final, transient, foreach loops, and so on. If you answer static modifiers, modifiers, I will think you qualified, if you answer static blocks, I will think you are good, if you answer static inner classes, I will think you are good, I will be very satisfied with you, because I can see that you are very keen on research technology.

In the most in-depth interview, LZ remembered that the interviewer asked me directly about the underlying implementation of volatile. (By the way, the interview and the interviewis themselves are relative, and the interviewer’s ability to ask this question also makes the interviewer feel that the interviewer is also interested in research technology, which makes the interviewer feel good about the company. LZ ultimately chose the company that asked this question), don’t think this is too critical —- the simpler the question, the more you can see the level of a person, the vast majority of your technical consideration is based on depth first, breadth second as the standard, remember.

2, collections,

It’s very important and it’s a must-ask. List, Map, Set, etc.

ArrayList, LinkedList, Hashtable, HashMap, ConcurrentHashMap, HashSet, etc. ConcurrentHashMap is one of the most frequently asked questions in interviews, probably because it can generate so many questions. For ConcurrentHashMap, I would like to offer three answers or research directions:

(1) Lock segmentation technique of ConcurrentHashMap

(2) Should read of ConcurrentHashMap be locked? Why

(3) Whether the iterator of ConcurrentHashMap is strongly consistent or weakly consistent

3. Design patterns

I thought it was an important part of the content, but I was only asked once in the interview of Alibaba B2B Business Division, when I asked about the decorator mode.

Of course, we can not be so utilitarian, in order to learn the interview, design mode is still very important in the work, very useful, 23 kinds of design mode focus on the study of more than ten kinds of common can be, the interview about the design mode of the question and answer are mainly three directions:

(1) What design patterns have been used in your project and how

(2) Know the strengths and weaknesses of common design patterns

(3) Able to draw UML diagrams of common design patterns

4. Multi-threading

This is also a must ask a piece. Because of three years of working experience, I will basically not ask you how to achieve multi-threading, I will ask some in-depth questions, such as the difference and connection between Thread and Runnable, how to start a Thread many times, what state the Thread has. Of course, this is just the most basic. Unexpectedly, several interviews were almost simultaneously asked the same question in different ways, which summed up the following meaning:

If Thread1, Thread2, Thread3, and Thread4 count the size of C, D, E, and F respectively, and all the threads are handed over to Thread5 for summary, how should this be implemented?Copy the code

Do the smart Internet have an answer to this question? Not hard, there are already classes available under java.util.Concurrent.

In addition, thread pool is also a relatively common question, how many common thread pool? What are the differences and connections between these thread pools? How does thread pooling work? To be realistic, you will be given some scenarios to answer which thread pools are appropriate for this scenario.

Finally, although this interview does not ask many questions, but multi-threaded synchronization, locking is also important. The difference between synchronized and ReentrantLock, synchronized lock ordinary method and static method, deadlock principle and troubleshooting methods, etc., about multithreading, I have summarized in some previous articles about multithreading 40 problems, you can see 40 Java multithreading problems summary.

5, IO

Add IO again, I forgot to write earlier.

I/O is divided into File I/O and Socket I/O. File I/O is basically not asked. It is good to use File I/O, and remember that File I/O is blocking IO.

Socket IO is an important part, to understand the difference between blocking/non-blocking, synchronous/asynchronous, to understand the blocking IO, non-blocking IO, multiplexing IO, asynchronous IO these four IO models, how Socket IO and these four models associated. It was a little bit basic, but if I went deeper, I would ask about the principle of NIO, which IO model NIO belongs to, and the three components of NIO, etc. It was a bit difficult, and I also studied for a long time before I could understand NIO. NIO, by the way, is not strictly a non-blocking IO but rather a multiplexing IO, and that’s a detail to keep in mind when you’re answering an interview, saying that NIO blocks in the Selector select method will make the interviewer think better of you.

If you’ve ever used Netty, you might want to ask about Netty. After all, it’s one of the best NIO frameworks out there (Mina is actually good, but not as good as Netty in general), and most Internet companies use Netty.

JDK source code

To get a high salary, JDK source must be read. The above content may also be linked to specific scenarios, JDK source code is to see you usually love to study. The hashCode() method of String is used in the Java JDK. The hashCode() method of String is used in the Java JDK. JDK source code in fact, there is no good summary, purely personal, summary of the more important source code:

(1) List, Map, Set implementation class source code

(2) ReentrantLock, AQS source code

(3) AtomicInteger implementation principle, mainly can explain the CAS mechanism and AtomicInteger is how to use the CAS mechanism to achieve

(4) The implementation principle of thread pool

(5) Methods in the Object class and the role of each method

In fact, these requirements are quite high, LZ last year a whole year basic JDK important class source code research all over, really spend time, spend energy, of course, looking back, is worth —- not only for the interview.

7, framework,

It’s a cliche. It’s an interview question. In general, I will ask you about the framework you are using in your project, and then I will give you some scenarios to ask you how to use the framework, such as how I want to do something when Spring initializes the bean, how I want to do something when the bean is destroyed, the difference between $and # in MyBatis, etc. All these are practical. Usually accumulated well, how much learning framework use details naturally are not a problem.

If you answered the above questions well, the interviewer will often ask in depth how the framework works. One of the most frequently asked questions is the implementation principle of Spring AOP. Of course, this is very easy to do in two sentences, even if you don’t have to prepare for it. One of the weirdest encounters was asking LZ to draw a UML diagram of Spring’s Bean factory implementation, an insightful question THAT LZ was absolutely unable to answer

8. Database

Nine times out of ten, the database will ask. Some basic differences such as union and Union all, left join, several indexes and their differences are not discussed, more important is the database performance optimization, if you know nothing about database performance optimization, then have time, It is also recommended that you spend a day or two prior to the interview preparing specifically for SQL basics and SQL optimization.

However, the database is not to worry about, a company often has many departments, if you are not familiar with the database and the basic technology is very good, nine chengdu will ask you, it is estimated that you will be put into the database use is not very high requirements of the department exercise.

9. Data structure and algorithm analysis

Data structure and algorithm analysis, for a programmer, is better than never and definitely comes in handy in the workplace. Array, linked list is the basis, stack and queue in-depth but also not difficult, tree is very important, more important tree AVL tree, red black tree, can not understand their specific implementation, but to know what is a binary search tree, what is a balanced tree, AVL tree and red black tree difference. I remember an interview, and an interviewer and I were talking about the index of the database, and he asked me,

Do you know which data structure is used for the index implementation?Copy the code

LZ, I think it’s a Hash table. Wrong. Do you know why trees are used? LZ explained that because Hash tables are likely to have a lot of conflicts, they can greatly increase the complexity of lookup time in the face of tens or even hundreds of millions of data levels. And the tree is more stable, basic guarantee up to 20 or 30 times can find the data you want, the other party said not completely right, finally we still communicate about this problem, I also understand why to use a tree, here do not say, friends think index why to use a tree to achieve it?

As for algorithmic analysis, forget it. I was asked in an interview what sort method collections.sort used. Of course, in order to show the LZ erudite, there is a certain analysis of the algorithm (⊙﹏⊙) B, LZ or stiff upper lip said a may be bubbling sort bar. The answer, of course, is no. For those interested, check out the source code for the collections.sort method, which uses a sort called TimSort, or enhanced merge sort.

10. Java VIRTUAL Machine

To LZ’s surprise, the Java virtual machine (JVM) was an important part of the story, and it was asked almost zero percent of the time at these companies. Last year, LZ spent a lot of time studying Java virtual machine. He read Zhou Zhiming’s “In-depth Understanding of Java Virtual Machine: Advanced JVM Features and Best Practices” more than five times.

Without further ado, the Java Virtual Machine has not been mentioned, but I think it is worth researching. LZ will briefly outline some of the most important aspects of the Java Virtual machine:

  1. Memory layout of the Java VIRTUAL machine
  2. GC algorithm and several garbage collectors
  3. The class loading mechanism, also known as the parent delegate model
  4. Java memory model
  5. Happens-before rules
  6. Rules for using the volatile keyword

Maybe the interview is useless, but on the way to the big bull, can not.

11. Web issues

Java is primarily web-oriented, so some questions about the Web are also mandatory. The two most common questions LZ gets are:

Discuss several ways to implement distributed SessionCopy the code

There are four common answers that are naturally very satisfying to the interviewer. Another common question is:

Let's talk about the difference and connection between Session and Cookie as well as the realization principle of Session

Copy the code

In addition to these two questions, the content of web.xml is the key. Filters, servlets, and listeners are not only clear about how they are implemented, but at least how they are used. In addition, some details such as get/ POST differences, forward/ redirect differences, and HTTPS implementation principles may also be examined.

Oh, come to think of it, the consistent Hash algorithm seems to have been asked a few times, and LZ has written two blog posts on this topic before, so it’s easy for LZ to answer. The article is a detailed reading of MemCache and an in-depth look at consistent Hash algorithms, Java code implementations, and in particular, LZ is not really advertising its own previous articles.

Finally, if you are interested and have time, I suggest you learn and study SOA and RPC, service-oriented systems, large-scale distributed architecture is a must, saving a life, cure-all, and successful every time.

 

About the HR Interview

If you’ve successfully crossed all the technicalities, congratulations, you’re one step closer to getting that raise, becoming the CEO, marrying a rich woman, and reaching the top of your life. But before it’s time to negotiate salary, there’s one final test: the HR interview. Basic all big companies have this round of interviews, do not look down on HR interview, many companies of HR for the interviewer have veto —- even if the interview in front of your evaluation again high.

Therefore, this round of interviews must also pay attention to, the HR interview mainly asks the following points:

  1. Include reasons for leaving your previous employment in your resume
  2. Current company salary
  3. What kind of company do you expect to work for
  4. Personal direction in the future

Let me just mention point 2. Some people may be more repellent and do not want to say this, BUT I personally hold an open state, asked to say, of course, some exaggeration is necessary, the current company pay more than a thousand yuan is completely no problem (after all, it is an Internet company always more or less some subsidies ah). Because it has little to do with the salary you can get at your new company. The salary you can get at your new company will be determined by the overall salary situation in the company and your position in the company based on the interview situation. HR ask this basically also is in the mind have a number and see you whether good faith —- some companies will ask you to provide a recent unit of the bank serial number.

HR interview here, summed up in four words: water. Be positive throughout the interview and don’t be negative or pessimistic (especially when it comes to previous company situations, no matter how much dissatisfaction there may be) and you’ll be fine.

 

On interview Mentality

Well, LZ has actually interviewed a few people in the company, and more than half of them answer questions with shaky legs and shaky voice. In LZ’s opinion, this is not necessary and this is a penalty, the two most basic requirements when answering questions:

  1. Neither fast nor slow, calm
  2. coherent

Presentation skills are definitely one of the most important things to look for in an interview. What we do is a programmer, what we pay attention to is teamwork, not writing or drawing, a pen, a person on the line, a programmer who is not good at expression, what’s the use?

Beyond that, keep a good attitude. The old saying said well, as long as kung fu deep, iron pestle ground into a needle, the success of the interview, is the accumulation of at ordinary times, temporary hold for it’s useless to see two of the interview questions, as long as you work hard enough at ordinary times, success is the natural thing, less research techniques at ordinary times, that’s just a matter of a resignation, can fully display their own learning.

So in my opinion, instead of treating it like an interview, treating it like a technical exchange, changing the mindset of the interview from “I’m going to find a job” to “I’m going to find my weaknesses and improve myself through the interview” will be much more peaceful and there won’t be so much disappointment if I fail.

In addition, if you are usually keen on research technology friends, really want to have confidence, do not think that others interview you others than you. The interviewer may not be better than you. The questions he or she asks are usually questions that he or she has studied a lot. You have a lot of research that the interviewer may not know about.

 

On Java

There is a common saying on the web that Java is simpler. To some extent, this will discourage Java programmers —- originally we usually use this kind of pediatric stuff ah, in my opinion, this idea is not necessary, this part I will talk about the view on this topic.

This kind of view is partial, have to be divided into two parts, I use four self summary is: easy to learn difficult to master.

1. Easy learning

I think there are two reasons why Java is easy to learn:

  • Many training companies, including seniors, study Java for jobs, mostly because it’s easy to learn. Java evolved from C/C++, thanks to the wisdom of the past, it eliminates the most complex and confusing syntax in C/C++, it eliminates platform differences, it does not require the user to manually free up memory space, it avoids the interaction between Java programmers and the native language, allowing programmers to focus only on the syntax level and application level
  • As an object-oriented language, Java has shown its incomparable characteristics in enterprise development. The whole development process is relatively fixed and modular, and it is relatively easy to analyze requirements. Let me give another example of his former, when I was a freshman learning C language, C language to write a book management system wrote 2000 + line of code, after senior learn C + +, using the object-oriented language C + + replace process oriented language C language to write a function similar to that of books management system management system, only wrote 1100 rows, This is the advantage of object orientation

2, the difficult part

Now let’s talk about the hard part.

The designers of the Java language have helped Java programmers do so much, which is both good and bad. The benefits of making Java easy to learn have already been covered, but the disadvantages are equally obvious. What should I do if I encounter errors at the syntax level and outside the application level during application execution? What if you run out of memory in your online environment? What if the GC time is too long? IO does not respond for a long time? Method throws an unintelligible exception?

All of this is not a person who can only write if… else… This requires a lot of experience, a lot of practice, a lot of research into the details of Java’s underlying implementation, and this is often the hardest and most challenging part for Java programmers. Some people don’t want to go into it at all.

Why is Java difficult to master? That’s the reason. Unless you’re extremely advanced, a Java programmer with less than five years of experience would be a fool to write “Proficient in Java” on their resume.

 

conclusion

At this point, it feels like a chicken soup article, so let’s end with the last chicken soup.

In a previous blog post, LZ wrote about the confusion of programmers approaching 30, roughly speaking, switching careers after the age of 30, leaving the following comment:

With these words encourage yourselves and all together. The harder you work, the luckier you are. If you are not an official, rich or red, then please remember that diligence is the only shortcut to change your fate.

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =



I can’t guarantee that everything I write is right, but AT least I can guarantee that there is no copying, no pasting, and that every sentence and line of code has been carefully examined and considered. Behind each article, I hope I can see my attitude towards technology and life.



I believe Steve Jobs when he said that the people who are crazy enough to think they can change the world can do so. In the face of pressure, I can burn the midnight oil and stay awake. In the face of difficulties, I am willing to rise to the occasion and never shrink back.



What I’m trying to say is, I’m just a programmer, and that’s all MY life is now.



= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =