Five bad habits that must be avoided to become a good programmer

Source: Internet
Author: User
This article mainly introduces the five bad habits that must be avoided to become a good programmer. It is very good to write. I will summarize my own set of things no matter what I do, for more information, see

This article mainly introduces the five bad habits that must be avoided to become a good programmer. It is very good to write. I will summarize my own set of things no matter what I do, for more information, see

When you start to become a programmer, it is easy to fall into some bad habits described below.

As a programmer, making mistakes is inevitable. This is part of your programming course. In your career, you will make many mistakes-some special and some common-through these mistakes, you can learn how to avoid making the same mistakes again in the future.

But if you are a beginner, you may make more mistakes than others. So how can we avoid the common mistakes that most programmers make every day?

To avoid errors, you must understand them. That's why I want to share with you some common mistakes that impede our growth in our programmer career.

Before you start, you may want to know why I know these are errors, not the best way?

One simple answer is that I have encountered all these situations in my career. In some cases, it is often encountered, and in some cases it is only encountered several times. Every time I make a mistake, I regret it.

The worst case is that you have no idea what I am doing wrong. Once I realized that I was doing something wrong, I began to avoid these mistakes. At least, the code I write now is much better than the previous one.

Now you can also avoid these errors. First, you must know that what you are doing is wrong. I know that programmers in major departments will not do anything wrong, because they think it is correct, so their behavior will adversely affect the career growth of programs and programmers.

The vast majority of bad programming habits stem from ignorance, and there is no other reason.

To become a good programmer, we must remove these ignorance one by one. This is what these good programming books try to show us.

Part of the reason we make these mistakes is that they have completed their work. It's not what we do-let's run the program and complete our daily work.

But it's only part of your work. If you want to make your application easy to use, you will have to update it regularly and fix any new bugs, which may become frequent. In this way, you can easily follow good programming practices.

In addition, even if you can get rid of these errors in small programs, you may encounter them in large programs.

If you still make these mistakes, your program may still run normally and be able to complete the required tasks, but it will become prone to bugs, inefficient code, and difficult to maintain. In addition, when you look at its Code for a long time, you will find it hard to understand the code.

As programmers, our job is not only to let our programs work, but to let users handle bugs. Our job is to ensure that users do not get unexpected results even if they enter an error.

Therefore, to create high-quality applications, make sure that you do not make the following common errors during programming:

Copy code without understanding

You often find that the code you need is in some other programs. It is tempting to copy the entire code segment and use it in this way without worrying about understanding every line of code.

Sometimes the code you copy may be too large to fully understand it. If you copy any code like this, it may make your program vulnerable and prone to bugs.

This may make the work complete, but what if this code produces some unexpected behavior under some circumstances? What will happen if your program slows down or malicious behavior occurs? Therefore, you need to properly understand the code or be absolutely sure of the source of the code you copied.

If a bug occurs in the future, you will find it difficult to understand the code, because you have never written it. Even you will find it difficult to locate bugs and fix them, especially if you copy a lot of code in different places of the program.

So be careful when copying code, even if there are few codes. Make sure you fully understand it. If you have used a piece of code before and can ensure that it can work, it is secure and available. But if not, be careful.

Start from scratch every time

This is totally the opposite of what I said before, but it is indeed another mistake that beginners can easily make.

Maybe you think it will be good to start from scratch, but it actually wastes too much resources-time, energy, and thinking. You can better use them in other aspects.

If you need something already exists, use them. Do not repeat the basic things.

You can use this time to make your applications better in other aspects.

If an API, framework, or game engine makes your tasks easier, you have no reason not to use them. Your goal is not to demonstrate how good you are, nor to prove that you can complete any task independently. Your goal is to ensure that your applications work perfectly and spend as little resources as possible to create them.

If you do this, you can spend less time doing the same job. Time is money. Even if you work for yourself, you should try to make more money at the same time.

Start Google without your own attempts

Many times, out of habit, you will find a solution through Google every time you encounter new problems. This is not a good method for programs. If you do not always search for answers by using external methods, your thinking will never be challenged.

When your thinking stops challenging, your own programming skills will stop growing. Practice your skills well, and you can solve the problem yourself. This is also suitable for program development.

You create an existing object, and you never create an original object. Is that what you really want to do?

Searching for existing solutions looks very clever, but it will blind your eyes and your laziness will prevent you from becoming a good programmer. If you really want to find a solution, at least at the beginning, you should spend some time thinking about this issue.

Maybe you can solve it without spending too many events. Maybe you will solve it better than others. Maybe your solution is more accurate than others.

If you do not try, you will never know.

Ignore warning

This is another mistake I made when developing programs in the early days. I cannot tell you that when there are hundreds of alarm signs in your program and there is no big difference at once-the most important thing is to ignore it and there will be new problems.

Warning is usually a sign that what you do may not work normally every time. Sometimes, ignoring these warnings can cause serious security problems. But the real problem usually occurs when the program has hundreds of warnings, or the program cannot work normally.

It is difficult to determine the cause of the error. You must spend more time analyzing every warning to find out the root cause of the problem. Instead, you can handle it when a warning occurs.

Generally, you only need to use the correct variables or functions to handle these warnings. It won't take you a few hours, but it takes a few minutes to get rid of them.

Handle warnings as soon as possible. Clean code looks comfortable and can work very well. Remember-treating warnings is the same as treating errors.

Quick Fix instead of permanent fix

Yes, I am sorry for this. I am not proud of this. But usually, we just fix it and seldom solve it fundamentally.

It works properly and the problem is also handled. However, if you are not careful, the problem will appear again in different ways.

No matter how you fix a problem, make sure that you do not destroy the entire system. The fix should improve the running status of the entire system, rather than making it slower or heavier.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.