Home  >  Article  >  Backend Development  >  8 bad habits to overcome in software development

8 bad habits to overcome in software development

伊谢尔伦
伊谢尔伦Original
2016-11-26 10:28:061300browse

In the field of software development, many problems are caused by some bad programming habits. Eliminating these bad habits will make your development easier and more efficient.

8 bad habits to overcome in software development

1. There are spelling errors in the code

Don’t be surprised, this is a very common problem, and the most crazy thing about it is that it has nothing to do with your programming ability. Still, a misspelled variable or function name can have disastrous consequences, and they can go unnoticed.

So how to solve it? You should use a good integrated development environment (IDE) or a programming-specific code editor, both of which can greatly help you reduce spelling errors. Another way is to deliberately choose names that are easy to spell as variable and function names, so that errors can be easily found. Avoid words that are easily misspelled. For example, receive is easy to misspell as recieve, and they are difficult to spot.

2. The code is not indented or formatted

Indenting or formatting the code can make it easier for people to read and locate errors. In addition, because it is in a coherent format, it is easier for others to maintain your code.

If the IDE you are using cannot automatically unify the format of the code, you can consider using a code beautifier like Uncrustify, which can format the code according to your settings.

3. Do not make the code modular

Let each function implement and only implement one function. This will make the function shorter and easier to understand and maintain. Longer functions usually have many paths in them, which is difficult to test.

A good rule of thumb is that a function should not be longer than your screen. Also, if there are more than 10 if statements or loop statements in a function, then it is too complex and needs to be rewritten.

4. You mistakenly think that your IDE is safe

IDE and other tools can improve the efficiency of writing code. They can suggest (complete) your variable names or other based on your existing input and scope. content. However, this type of tool is not safe enough. You will choose some options just because they look like the one you need. In fact, you do not have the option that is the one you want. In fact, it just reduces your thinking, but you still need to confirm.

5. Premature optimization of code

The legendary programmer Donald Knuth once said: "Programmers spend a lot of time thinking about non-critical parts of the code. Such optimization will actually improve subsequent debugging and maintenance. On the downside. “Trying to make it run a little faster makes your code harder to debug and maintain. A really good strategy is to write your code clearly first, and then if there is a part of the program that really needs to be optimized to improve performance, you do that work.

6. No advance planning

What is your project used for? How big do you expect it to be? How many users will use it? How fast can it run? The answers to these questions are not ready and certain, but if you misestimate them, how do you choose a suitable development framework to meet the needs?


7. Increase manpower to speed up progress

Almost all software development projects are behind schedule. Increasing manpower for the project is theoretically possible and very good. But this is actually a common misunderstanding. In fact, this usually reduces overall efficiency.

8. Use wrong time expectations

Again, don’t be under the illusion that you can catch up behind schedule. If you're already behind schedule, it's because your estimate was wrong, and you should re-evaluate the entire project cycle instead of blindly sticking to the wrong schedule.


Statement:
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