The technical director talks about how good programmers write code

WBOY
Release: 2016-07-25 08:51:52
Original
736 people have browsed it
To judge whether a programmer is a good programmer, it mainly depends on the code he writes, because the most important thing for a programmer is to write code.
Even if you don’t understand the intention of the code, you can basically tell the code written by good programmers and the code written by poor PHP programmers at a glance. The code written by good programmers is neat and standardized, and has a natural visual beauty. The white space is well-proportioned, the comments are just right, and the naming and typesetting follow unified standards. Code written by poor programmers often has problems such as overly long functions, inconsistent naming and layout, too deep nested structures, very complex expressions, and numbers everywhere.
If you read more briefly, you will be more confident about whether you are a good programmer or a bad programmer. Good programmers write code that has a carefully crafted consistency. Good programmers will always adhere to a unified naming method, such as camelCase, while poor programmers' variable naming will deviate from the unified standard from time to time. Good programmers will have almost no visible spelling errors in their code, while poor programmers will have far more spelling errors. A good programmer will not use this verb now and that synonym for the same type of action, such as adding/insert. Good programmers use consistent abbreviation rules, while bad programmers sometimes do not abbreviate and sometimes abbreviate. Good programmers will pay great attention to which adjective or noun comes first and which comes last in the name, while poor programmers have no rules and sometimes come first and sometimes come last. Good programmers rarely write large sections of repetitive code, but poor programmers often struggle with repetitive code. It is difficult for them to extract a unified concept from the repetitive code for reuse. Good programmers will pay attention to the consistency between comments and code for external APIs, while poor programmers often have inconsistent parameter names and function definitions in comments. Good programmers rarely leave garbage code that is commented out or enclosed with #if 0. They are determined and want the code if it is useful and don't want it if it is not. Poor programmers are different. They are often not sure. Whether a piece of code is really needed or not, they lack the habit of keeping code clean, so they let junk code stay.
As above, even if you don’t understand the language he uses, you still care about the logic of the program, and you can make an indistinguishable judgment on whether a good programmer is a bad programmer. The quality of programs almost always depends on whether they are beautiful. I have never seen a good program other than C++ STL source code. (If you look a little closer, the STL source code, although not beautiful enough, still meets the requirements proposed here. the principle of consistency). And good and beautiful code can be found everywhere, such as Linux Kernel, InnoDB, JDK, JUnit and so on.
If you read it carefully, it will be more accurate. The code written by good programmers seems to be natural, simple and straightforward. Functions are usually shorter, and the name of the function reflects exactly what the function is supposed to do. The logic is simple and natural, and it makes you sigh like this sincerely when you read it. However, the code of poor programmers often makes you think like this? What are you doing again? question. Good programmers will add finishing touches at critical moments. Poor programmers either have no comments, or the comments are just repetitions of code and are pure nonsense. What's worse is that the comments are wrong and misleading.
A good programmer is not necessarily a language lawyer, that is, the kind of guy who understands every detail of the language very clearly and uses it everywhere when programming. Good programmers don't often show off their skills and carefully construct some original pieces in the code. They occasionally do it, but most of the time they always express it in straightforward language.
The teamwork spirit of a programmer can also be seen from the code. Programmers who pay attention to teamwork will write code strictly in accordance with team norms, while programmers whose styles are inconsistent with team norms are likely to lack team spirit. Programmers who pay attention to teamwork will pay attention to important explanations of the external interface of the module, such as preconditions, postconditions, whether parameters can be NULL, etc. Programmers who do not pay attention to teamwork are too lazy to deal with these details.
The productivity difference between good programmers and poor programmers is huge. The longer the project cycle, the more complex the project, and the higher the quality requirements of the project, the greater the value of good programmers. There is also a huge difference in management costs between good programmers and poor programmers. A good programmer only needs to work with him to determine the design, and the code does not need to be read. A poor programmer's code often needs to be reviewed multiple times, and it is still possible Not up to the ideal quality.
To become a good programmer, you must first establish the ambition to become a good programmer, and practice more frequently. As time goes by, you will get better and better. These people are not afraid of aging. People without ambition will never become good programmers, and these people will become useless if they don't become managers before they grow old.
Passing a two-hour written test and a half-hour interview is not enough to judge a programmer. Through written tests and interviews, you can judge whether a programmer has basic knowledge such as algorithms and data structures, whether he has mastered the characteristics of programming languages, and whether he is concerned about technology. However, you need to know whether he can really It's not enough to do a good job without writing code.
Those who appear to be passionate about technology may not necessarily be good programmers. These people may be very happy to engage in innovative work, but the subsequent coding, testing, debugging, and copywriting work may bore them. They may come up with good ideas, but often fail to follow through on them. The company doesn't need many of these people.
So the way of recruitment needs to be improved. Recruitment is the most important because once you're in, it's hard to get out, even on probation. The conditions for becoming a full-time employee are clearly written in black and white. As long as you meet the requirements, you can become a regular employee. It is not very difficult to achieve the qualifications. There are many new people in the department this year. Not all of them are excellent, but they are indeed qualified and should naturally become regular employees.
The way to improve recruitment is to ask him to write a program. You can ask two questions, one to ask him to write a program, and the other to ask him to reconstruct an existing long program, and complete it within one day. If you can test him for half a month, then refactoring is not necessary, but one day is too short. Through refactoring, you can test your ability to read and understand the code, and turn decay into magic through refactoring. Those who are unwilling to write other people's code, are unwilling to accept other people's code, and often have to do it over again are not ideal.
Two people took a similar approach this year. There was a person with an excellent resume who took two programming questions and was rejected. There was a person with an average resume and interview who passed the programming test and was hired. I feel it is more accurate than a simple written test and interview.
Receive LAMP Brothers’ original PHP tutorial CD/"Essential PHP in Detail" for free. For details, please contact the official website customer service: http://www.lampbrother.net
PHPCMSSecondary development http: //yun.itxdl.cn/online/phpcms/index.php?u=5
WeChat development                                                                               
Mobile Internet Server Side Development http://yun.itxdl.cn/online/server/index.php?u=5
JavascriptCourse http:// yun.itxdl.cn/online/js/index.php?u=5
CTOTraining Camp                                                                                             5

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!