Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the bad habits that must be avoided to be a good programmer

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "what are the bad habits that must be avoided to be a good programmer". In daily operation, I believe that many people have doubts about the bad habits that must be avoided to become good programmers. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "what bad habits you must avoid to be a good programmer". Next, please follow the editor to study!

When you start to become a programmer, it's easy to fall into some of the bad habits described below.

As a programmer, making mistakes is inevitable as part of your programming lessons. You will make a lot of mistakes in your career-some special and some common-through which you can learn how to avoid making the same mistakes in the future.

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

If you want to avoid mistakes, you must know something about them. That's why I want to share with you some common mistakes that hinder our growth in our programmers' careers.

Before you begin, you may want to know why I know that these are mistakes and not the best way.

There is a simple answer-all of these situations have occurred to me in my career. Some situations are often encountered, and some have only been encountered a few times. Every time I make a mistake, I regret it.

The worst-case scenario is that you have no idea what I'm 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 before.

Now you can avoid these mistakes, too. First of all, you need to know that what you are doing is wrong. I know that most programmers don't do anything wrong because they think it's right, so their behavior can adversely affect programs and programmers' career growth.

The vast majority of bad programming habits stem from ignorance and for no other reason.

To be a good programmer, we must get rid of this ignorance one by one. This is what the good programming books try to show us.

Part of the reason we make these mistakes is that they do get the job done. It's not what we do-get our programs running and do our day-to-day work.

But it's just part of your job to make it work. If you want to make your application work, you will have to update and fix any new bug regularly, which is likely to become frequent. The way to make your job easier is to 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 work properly and be able to accomplish the required tasks, but it will become easy to bug, full of inefficient code, and difficult to maintain. And when you look at the code after a long time, you will find the code difficult to understand.

As programmers, our job is not just to make our programs work, but to let users handle bug. Our job is to make sure that users don't get unexpected results even if they make a typo.

So to create high-quality applications, make sure you don't make the following common mistakes when programming:

Copy the code without understanding

You will often find that the code you need is in some other program. It's tempting to copy the whole piece of code and just use it without worrying about understanding each line of code.

Sometimes the code you copy may be too big to have time to fully understand it. If you copy any code like this, there is a risk of making your program vulnerable to bug.

This may get the work done, but what if this code produces some unexpected behavior under certain circumstances? What happens if you slow down your program or do something malicious? So you need to have a proper understanding of the code, or you need to be absolutely sure of the source of the code you copied.

If bug is generated later, you will find it difficult to understand the code because you have never written it. You may even find it difficult to find bug and fix it, especially if you copy a lot of code in different parts of the program.

So be careful when copying code, even if there is very little code. Make sure you fully understand it. If you have used a piece of code before and are 100% sure that it will work, then it is safe to use. But if not, be careful.

Start from the beginning every time

This is the exact opposite of what I said before, but it is another mistake that beginners are easy to make.

You may think it would be nice to start from scratch every time, but in fact it wastes too many resources-time, energy and thinking, and you can better use them in other ways.

If the things you need already exist, use them. Don't repeat the basics over and over again.

You can use this time to make your application better in other ways.

If an API, framework, or game engine makes your tasks easier, there's no reason why you shouldn't apply them. Your goal is not to show how good you are, nor to prove that you can accomplish any task on your own. Your goal is to ensure that your applications work perfectly and spend as few resources as possible to create them.

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

Start Google without trying it yourself.

Many times, out of habit, every time a new problem arises, you will use Google to find a solution. This is not a good idea for programs. If you always search for answers through external methods without trying it yourself, your mind will never be challenged.

When your mind stops challenging, your own programming skills will stop growing. If you practice any of your skills well, you can solve problems on your own, which also applies to program development.

You are creating something that already exists, and you never make it original. Is this really what you want to do?

Searching for existing solutions may seem smart, but it will blind you, and your laziness will prevent you from becoming a good programmer. If you really want to search for a solution, at least, you should spend a little bit of time thinking about it at first.

Maybe you can solve it without spending much time on your own. Maybe you can solve it better than anyone else. Maybe your solution is more accurate than others'.

If you don't try, you'll never know.

Ignore warning

This is another mistake I made early in program development. I can't tell you that there's a big difference between hundreds of alarms in your program and none at all-the most important thing is to ignore it and create new problems.

A warning is usually a sign that what you do may not work 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 when the program doesn't work properly.

It's hard to determine what caused the error, and you have to spend more time analyzing each warning to find out the root cause of the problem. Instead, you can dispose of the warning as soon as it occurs.

Usually you just need to use the right variable or the right function to handle these warnings. It won't take you a few hours, just a few minutes to get rid of them.

Deal with the warning as soon as possible. Clean code looks comfortable and works high. Remember-treat warnings as well as mistakes.

Quick repair rather than permanent solution

Yes, I feel guilty about doing this. I'm not proud of it. But usually, we just fix it hastily and rarely solve the problem fundamentally.

It works properly and the problem is solved. But if you are not careful, the problem will reappear in different ways.

No matter how you fix a problem, make sure you don't destroy the whole system. Fixes should improve the health of the entire system, not make it slower or bulkier.

At the same time, a repair should be able to solve the problem permanently. Long-term, not short-term. Sometimes, because of laziness and ignorance, we usually like to solve the problem quickly rather than spend too much time on it. This is why the code we write works well, but not in all cases.

If you ignore it at work, you will spend more time later.

Knowing the above mistakes can help you avoid them. If you know what you are doing is wrong, generally speaking you will not do it.

In order to do a good job, you should love what you do. If for some reason you don't like programming, you rarely spend extra effort writing good maintainable programs.

If you are going to write a good program, then you should change your view of programming.

You have to think of programming as an art and you are an artist. Then you won't make mistakes because of laziness and carelessness.

Will the writer publish an unfinished article? Will the painter sell the unfinished paintings? Will the singer sing useless lyrics in his songs?

Never.

The same is true for programming. Under no circumstances should you write half-baked code that has not been tested. Don't release your program until it's finished. Don't write useless code that won't be used.

These are some general mistakes we make because we like to spend less time at work and do other things. But it won't work, and sooner or later you'll be responsible for making sure your code doesn't go wrong.

The sooner you practice correct programming, the better for your users and yourself. Sometimes being a good programmer means you don't make the same mistakes as bad programmers.

At this point, the study of "what are the bad habits that must be avoided as a good programmer" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report