Being a good developer is hard, but being a bad one is easy. There’re many ways to make ourselves a bad developer.
In this article, we’ll look at some ways that we can become a bad developer.
Assume There Are No Bugs in Our Code
Assuming that there are no bugs in our code is always a big mistake. It’s just impossible to have no bugs in our code unless the app it’s a very simple app.
Otherwise, we’re making a very bad assumption since it’s very hard to write any code.
Every line can do something that we may not expect. If we don’t think hard enough and take into account all the cases that something can go wrong, then something will go wrong.
Most apps are at least thousands of lines if they’re used by people in production and people are paying for it, so we better look at everything line and think of all the edge cases and risks that can arise from our code.
Computers are dumb. They just run the code that’s in our programs, so we shouldn’t assume that there’re no bugs since every line can go wrong and computers can’t read our minds.
Write Code Without Reasoning
Before we put code into a file, we should make sure that the code makes sense before we put it in.
We can’t just try random things and hope that something works. Doing that definitely makes us a bad developer since we’ll probably end up with something that doesn’t work.
Also, the code we put in must serve a purpose. Otherwise, the code is useless and they don’t help anyone.
Take Pleasure in Writing More Code
We shouldn’t write any more code than we need to. The desire to write more code should be stopped.
Writing useless code just makes our code more complex and long and annoys other people reading the code.
The more code there is the more mistakes that we make. Each extra line of code adds more risk for bugs and undesirable behavior.
Therefore, the more code there is, the more ways we can screw up. More code also adds more burden of testing, code reviews, and many more tasks that we can do less of if we have less code.
Writing Code for Machines Rather Than Humans
Writing code for machines will get us trouble eventually. Code with names that we don’t understand or badly formatted code will get us eventually.
No one including the write will understand it given enough time.
Another way to write code for machines is spaghetti code. Spaghetti code is just code that has messy workflows, branching, and whatever other ways we can think of to make a mess.
That’s just not acceptable by any means since they are impossible to change because of the mess that the code had turned to.
By writing very long functions and classes, we’re also writing code for machines. We don’t want that since again, only a machine can get it.
No human can read long functions and classes and understand it completely. Therefore, it’s one more thing that we should avoid.
Instead, we should look at the principles of Clean Code and write our code based on that. The first half of the book applies to any programming language, so focus on the first half.
Thinking emotionally definitely makes us a bad developer. We shouldn’t take constructive criticism personally.
They help us improve our code. Also, we shouldn’t let our egos get in the way of rational thinking. We should take useful suggestions and apply them if the way we did things were deficient.
Also, we shouldn’t just code by feeling. We should test our stuff so that we can be sure that stuff works the way that we expect them to.
There’re many ways to become a bad developer. We can assume that our code never has bugs.
Also, we can let our egos and feelings get in our way of rational thinking.
Furthermore, we can write code that machines can read with bad formatting and non-descriptive names.
Finally, we can just put code that’s useless or has no reason to be there.