Get rid of 14 kinds of bad habits, junior programmer minute of Advanced Senior Programmer

Many people will have such doubts, in particular, for years was a merciful into the bottom of a small partner staff today to tell you how you qualify for advanced programmers. At the same time reflect on what he still insufficient.

It is to analyze the mistakes junior programmers love what?

First, the name is not standardized
naming very casual, especially when writing code High, what are the weird name: xiaonaigou, xxxx, j1, jl , llst.

Totally unaware of the value and meaning full name specification. But this may be good reasons for not working habits. In particular, some older small programmers have this problem.

Second, the non-standard log
log? That is what the hell, eat it?

There was a Pactera from a small partner, the back-end three years of experience engineer, a problem I do not know how to solve.

I had to restart.

I'm looking to help, and asked him, how wrong?

do not know.

Log it?

No.

Halo, how to solve that problem, the gods get it working ah.

Later we learned that they are local problem-solving change the code and then directly deploy, re-visit to see the error did not disappear, no local disappearance continues to change the source code.

I can say my brother Pactera later interview, I do not Tucao his Mody

Third, refused to write false data interfaces and
a chicken dish is not terrible, terrible is experiencing food chicken dish chicken. There was two chicken dishes a project, a front end of a back-end, they are cheerful tune the interface, do not write the document, two people particularly efficient.

Until one day, I found that the project might not finish and need to assist the other two chicken dishes at the front.

The two new chicken dish to get the data back end, I do not know Url address of the interface, not knowing Get or Post, do not know the parameters and return values ​​sent. So write!

I did not even think could write the code, two chicken dishes very happy! Clapping and cheering: pass, pass, pass!

I said, what you pass it? They say that the interface finally pass! They turned the page between the two reference, abruptly stop trying again and again, so the interfaces guessed!

That's the fun of it?

There do not write false data. There was a horse named little brother, little brother vowed to Zhaoxing said: three days, give me three days, I really give you the data.

So Zhaoxing brother believed. In this way, three days and three days, three days and three days, three days and three days, three days and three days, three days and three days.

A full month and a half, Zhaoxing little brother did not get all the data!

Fourth, do not write unit tests
precisely, is not developed by TDD manner. In the habit now such a powerful IDE, the first to write unit tests, rigor is not just the code, and it is synonymous with efficiency ah.

But a lot of chicken dishes can not understand the value of unit testing, it does not matter, until the code refactoring, when requirements change, the cry all cry!

Good unit tests, your logic is bound to clear.

Fifth, the first integrated, re-testing, then give up
.
In many cases, chicken dishes in time to introduce third-party libraries, frameworks, interfaces or services, the most favorite thing is to direct and integrate their existing code.

What is the result? Suddenly not be used, not up and running, do not know what the problem, and did not tell they going to issue a third party or their own problems.

What better way is? Xianpao through the official Demo, think of ways to add a little bit of their own business.

Sixth, the reason is not clear logic, by doing guess
the front end of a particularly large problem here, do pay, the payment process is not clear, and could not tell the definition, always thought that the front end interface to handle the data show good or leave it.

Many chicken dishes will have such a habit, this is not good, first logic to handle, clear process, we go hands again.

Seven, do not do the program
do plan on behalf of what the meaning of it? It is completely intuitive to walk ah.

Close your eyes like Guangyao Zi.

The good habit of writing code in his head should be the first to go over all the details of the requirements, implementation details out.

Zhang last month, there is a side dish of chicken, make an anonymous comment feature.

Basically no experience, not so that the brain, is given by way of what you guess it?

Users refresh started for the user to insert a data table, the default password is a random nickname.

Not much to say all the tears I've seen too many people Mudeng dog stay program, looking at the full screen code, how wrong you help him tune tuning, the best way is a complete rewrite.

The benefit of the program too much.

Eight, does not care about performance
does not care about the wrong performance is also very easy to make the newcomers. What is the performance of it. And it is back-end response time TPS, it is the front-end response time.

Many programmers new habit is to do things out, and then re-optimization.

The last thing to do is to come out and optimize the left to others.

Focus on the performance of the average programmer is promoted to the most critical skill points. When writing code, experienced engineers already know how this kind of performance this method functions in this function points, where bottlenecks.

Nine, fear of reconstruction
, "the greatest courage is to look at the code programmers write their own before three months."

In fact, reconstruction should not be in a few months after the reconstruction, the best way is the real-time reconstruction. One day write the code, 70% of the time put on the reconstruction can not be overstated.

The newcomers do, knock knock Panpan completed a function, just like dominoes domino Hornet made of the same, what you dared to touch his code to try? He will be with you desperately.

You let him try to move one line of code?

Not reconstructed in a way also means that your code can not be achieved remodeling.

Ten, do it just fine, elegant solutions without considering
that a word is called best practices, in fact, coding standards and best practices, is an important manifestation of programming skills.

Elegant scheme can be considered as an upgraded version of best practice, and it continued the above mentioned reconstruction go hand in hand.

What program is it bad? Mostly hard-coded, no scalability, a very ugly way to complete the function.

The last time they do a program about the audition class, how many people can listen to a lesson, the normal logic should be in the user's list of Riga to represent a field.

Demand is written to invite a few people, how many lessons can listen, so they just do it to determine how many classes audition directly in the table by inviting people of query.

After completely fail to consider how, if I transform a trial class to determine the conditions do?

In fact, this should be disassembled into two parts, one is to generate conditions audition class, which is an independent module, plus a trial class is confirmation of.

Examples like this too much, and also not to plan, without considering the extension of a relationship. I am going to say.

XI does not consider future changes in demand
level engineers, in fact, can be divided into the following phases (Madan before I can not find the answer in which the written):

Function-oriented programming

Performance Oriented Programming

Future-oriented programming

The first thing that needs to get the engineer should gather the following questions:

The first demand is what I've done before

The second demand which is likely to change

There are several schemes third, respectively, what kind of support the changing needs

But almost programmer will not consider so far, one is not familiar with the business, it does not determine what the needs might be a difference, is a master of much of the optional programs, there is no room for optional , there is no such habits of mind, I could not tell what is to be done now and what the future might support or change.

Twelve, will not encounter problems when trial and error
and this is a common problem novice. Many times couples will encounter problems, not solve, look for an experienced engineer, experienced engineers do this, probably you have never encountered such a situation, but his ideas to solve the problem clearly ah.

Try this for a while, while delete delete that code, quickly ran through.

Problem-solving skills to see is a very technical point, but there is a lot of methodology, prior to summarize some, a simple list over:

1. find the correct code

2. The reason clearly correct execution order

3. reproduce the error

4. minimize errors generated scenes

5. modify the code to a known type of error

wait wait wait.

Problem analysis is a process of reasoning, but over here, behind the foundation is that you know a lot of what is certainly wrong small axioms, and then one by one to locate possible errors link in the decomposition process is the most basic work.

XIII, pseudo code will not write
what pseudo-code is it? Natural language ah. In fact, only three programmed logic control block, sequence, cycle, is determined.

So long as you use natural language to describe it, what to do first, what to do, when to cycle, when judgments,

Write the code of the problem is not large.

This is a first to write pseudo code to write the details of the process. You do not start up on the tile to write code (the code I have said before elegant way, are interested can listen to the additive group, highlight some of the how to write elegant code).

Tiling code is the way most food, good code is structured, there are different levels of abstraction.

The first step, why.

The second step, why.

The third step is doing.

The first column is clear, this is the first stage of pseudo code.

Then comment out, this is the second stage.

Comment deleted becomes a function name, this is the third level.

So, good programmers write code that does not require comment, does not mean you delete the comment, but to give you complete this three-step distillation process.

Write good code, naming conventions, you see really is a poem, is a programming language, is to complete a description of the function of the language, this sense of the art of programming industry is very straightforward, you see those unhappy code is simply a. .

XIV not estimate the amount of data
back-end engineers often overlooked in the pre-data size of the amount, not the film into a good habit.

Write code only focus on functionality, there is no concept of the amount of data.

In fact, this place also and performance is consistent, in terms of performance, the front and rear ends and there is not much difference.

Recommended practice is that the programmer must be very sensitive to the data, the back-end to know the size of each table may have much the size of the current system can support a database table is how much, and need to know before and after the end of each operation, which are divided into several steps, each step takes time is the amount of memory used is probably what.

To do this is not difficult, difficult is the habit, junior engineer's eyes to see that the code and function, mid-level engineers eyes see is the date and time.

Guess you like

Origin www.cnblogs.com/xuegod/p/11322745.html