Anh T. Dang
Anh T. Dang Chief Technology Officer @ Osemnai

10 Things I’ve Learned to Avoid in My 15 Years as a Software Engineer

Good Programmer vs Bad Programmer.
28.03.20226 min
10 Things I’ve Learned to Avoid in My 15 Years as a Software Engineer

Writing software is hard but writing good software is very hard. There are many existing terms related to programming techniques such as Clean Code, STUPID principle, SOLID principle, and so on. They help us to become a good programmer and avoid things those bad programmers did. Today let me help you to look at them carefully.

1. Don’t learn only to code

For any programming language, there is a set of principles that acts as the foundational basis like syntaxes, keywords, concepts, and so on. Don’t learn programming syntax first, let’s study concepts. Syntax is different for every programming language.

What you really should learn are the concepts like OOP (Object Oriented Programming), FOP (Functional Oriented Programming), POP (Procedural Oriented Programming); branching (if-else, while-do), iteration (for) or design patterns. If you can write if-else blocks but you don’t know how to use them it means that you learn syntax but don’t understand foundational concepts.

2. Avoid outdated information

Follow tech news (blog, newsletter, and so on) with new updates emerging almost every day like my page. But keep in mind that each of these types of sources has different advantages and disadvantages. Technology changes very quickly and you are cut down to run into issues from using old resources. So let make sure that you checked the date of published information before you are looking at it further.

In practice, I have learned very many concepts and knowledge daily. I already keep up with emerging techs. You also should check the versions of libraries that you are using in your programs to get the latest version.

3. But don’t forget old books

Let’s read old books. Some information is more than 10 years old but it’s still very useful. Human beings have been around for a long time.  So almost every problem you have has probably been written about by some other human living before you.

4. Stop using else keyword in your program

In some simple cases, you are allowed to use else keyword.

if (codition) {
    if statements
} else {
    else statements
}


As a good programmer, you use switch-case statements. But in a complex case, good programmers don’t use the else keyword (or switch-case statements). Instead of the else keyword, they use state-machines. If you don’t know any about state-machines, you are not a good programmer.

Also, as a good programmer, you should use De Morgan to simplify your logic. There are two ways to re-write boolean expressions are shown below.

!(a || b || c) == (!a && !b && !c)
!(a && b && c) == (!a || !b || !c)

5. Don’t write bad comments

In my opinion, comments are unnecessary. Bad comments are truly worse than no comments at all. A comment is of zero value if it is wrong. Here is a bad comment that should avoid since only if the comment describes what the code is doing.

/* set the value of the age integer to 32 */
int age = 32;


Comments often attempt to explain what or how which tends to merely repeat the code. So, keep in mind that if you use comments in your program, it should explain why not how. Also don’t add comments to explain bad names (variables, methods, and classes). Let’s take time and fix the names!

6. Don’t be a STUPID programmer

They’re 6 OOP code smells that we should avoid while writing programs.

Singleton pattern

It is one of the simplest design patterns. It ensures there can only ever be a single instance of a given class. But programs using global state are very difficult to test. Programs that rely on global state hide their dependencies.

Try and avoid Tight Coupling

Tightly coupled modules are difficult to reuse. And also hard to test.

Untestability

Whenever you don’t write unit tests because you don’t have time. The real issue is that your code is bad, but that is another story.

The Dangers of Premature optimization

There’s a famous quote by Donald Knuth, author of the legendary “The Art of Computer Programming”. It is also an old book. Premature optimization is the root of all evil. There are only two rules to optimize an application. Don’t do it. Or don’t do it yet.

Indescriptive Naming

You write code for people, not for computers. Computers just understand 0 and 1. Programming languages are for humans.

Duplication is waste.

Duplicated code is bad. When you duplicate code, you hide the repeated structure, and you copy all of the existing bugs. So please Don’t Repeat Yourself and also Keep It Simple, Stupid.

7. Don’t build everything from scratch

Don’t reinvent the wheel. We have to make sure that we do the right things and don’t do unnecessary things. Let’s use tools and libraries developed by others. Also, there are coding guidelines across languages. Try to understand what solutions exist in the world before venturing into building something from scratch.

8. Don’t focus on hiring the best people

If you had not spent any time preparing for the meeting. And there isn’t any thought to the specific information you would need to decide whether the candidate was a good choice. This failure didn’t just cost you the chance to evaluate your candidate, it lost you your candidate.

Don’t focus on hiring the best people. The best people may or may not be the right members of your team. When you recruit a great leader, the rest will follow guy. Let’s hire the right people and keep them happy.

9. Avoid bias in your hiring interview

There are various types of cognitive biases that affect the hiring process. Another harmful one is a personal bias, the basic human instinct to surround yourself with people who are like you. People have a natural desire to hire those with similar characteristics: educational background, professional experience, functional expertise, and similar life experiences. Such slight similarities typically have nothing to do with performance. And it leads to un-diverse workforces with a narrower field of vision.

10. Stop being afraid to ask for help

Sometimes you stuck in a problem. You can not know everything. Everyone is always ready to share. Never be afraid or too proud to reach out and ask other people for advice. Even if you have crazy questions.



Check our Polish IT Community Report 2022 and compare your situation with other professionals similar to you.

Check our Job offers and find jobs that match you.

Also read other articles that will help you in your career:

<p>Loading...</p>