14 Rules That Every Developer Should Stick To
#7: It’s OK to not know everything
Having a set of rules can help you function better because you make decisions ahead of time instead of having to make all of these decisions on the fly. The right set of rules can be used as a tool to improve yourself as a developer.
In this article, we’ll go over 14 rules (although some of them may look more like guidelines) that every developer should stick with in order to help you grow. Although it might be hard to stick to all of these rules, you should try to stick to at least a few of them.
1. Functional Beats Elegant
Functional code beats elegant code nine times out of 10. For example, adding a design pattern to your codebase just because it's elegant isn’t a good reason to implement it. Especially when the alternative way to solve this problem can be implemented by a few simple lines of code.
Although the design pattern might be the more elegant solution, it adds technical debt to the project and takes more time to build and test.
2. Don’t Over-Engineer
Over-engineering is one of the bad habits that many developers tend to have. When looking at a codebase, you’ll find over-engineered pieces of code more often than not.
What over-engineering basically comes down to is that you make the design of a product more robust or complicated than is necessary. One way over-engineering gets introduced into a codebase is when a developer is already adding code that he thinks might be helpful in the future.
This additional piece of code gets added to the codebase but it probably never gets used. The main reason this happens is based on speculation. Maybe the best way to explain over-engineering is that it’s code that solves problems that don’t exist.
Only build what’s asked for in the requirements and don’t anticipate possible new — and most of the time unnecessary — features.
3. Be Open to Feedback and Criticism
You should be open to both feedback and criticism, especially when working in a team. Don’t be overconfident when it comes to your own abilities. Once you start getting overconfident, you’ll be most likely ignoring the feedback and criticism that you’re getting.
Appreciate the fact that people are willing to give you feedback — no matter who gives it to you. Use the feedback that you receive as an opportunity to grow. It’s an easy way to get to know your areas of improvement.
4. Be Realistic When It Comes to Estimates
Let’s face it — estimating how much time certain tasks cost is one of the hardest things in software development. Sometimes the requirements aren’t that well defined. Other times the requirements seem to never stop changing.
It’s good to know that missing your estimates happens all the time. Be realistic when it comes to estimates and know that you will sometimes be horribly wrong. And that’s fine — an estimate is just an estimate. It’s not a deadline that you’re committing to.
What’s more important than good estimations is good communication. Whenever you’re spending more time than you’ve estimated on a certain task, communicate about it.
5. Create a Plan
Never start coding without a plan. Before you start writing your first letter of code you should know what it’s supposed to do. Otherwise, what are you going to code? Chances are that without a plan your code isn’t well thought out, and as a result, the code gets unnecessarily complex.
There are certain questions that you should ask yourself before you dive into coding. How can you tackle this certain problem? What structure will you implement? What are the overall goals that you’re implementing?
These are all great questions to ask before you start coding. And these questions can make you more aware of the fact that there’s a lot to think about before writing code.
6. Test Your Own Code
Nothing frustrates a tester more than when your code that just got deployed to the test environment fails on the first click. In order to prevent this from happening, you should test your own code. Preferably by writing automated tests, but if that’s way over your head at least make sure to test it manually.
The main reason why developers slack on testing is that most developers don’t like testing. It takes a lot of time and effort that they prefer to spend on writing code for new features.
Despite the fact that testing isn’t their favorite part of the job, every developer understands why it should be done. Respect the time of the testers; their time is just as valuable as your own. Therefore, you should have the discipline to test your own code.
7. It's OK to Not Know Everything
It’s important to be aware of the fact that it’s impossible to know everything that’s going on in the software development world. It’s simply too much.
Being aware of the fact that you don’t know everything is something you could use to your advantage. You have to know that it’s not a sign of weakness. Knowing what you don’t know could help you focus on the things you do know.
What’s more important than knowing everything is the ability to learn things quickly. You don’t have to memorize all the methods that are available in a certain framework. It’s more valuable to be able to get started quickly once you read the documentation of a framework.
8. Strive to Keep Things Simple
It’s very easy to understand why you should keep things as simple as possible in your code, but bringing this into practice is very hard. There’s even a coding principle dedicated to this — the KISS principle. KISS stands for “keep it simple, stupid.”
This kind of code is considered simple, straightforward, and it might even be dumb code. However, writing dumb and simple code is one of the biggest qualities that a developer can have when it comes to programming.
Code should only do what it needs to do without the need for tons of abstraction and inheritance. Don’t be fancy when it comes to writing code!
If you manage to keep your code as simple as possible, you’ll experience a lot of benefits when it comes to readability and maintainability.
Consistency really is key when it comes to software development. The problem with being inconsistent comes from the unavoidable fact that time destroys software. The longer a piece of software exists and the more people that work on it, the more chaos comes in.
It doesn’t matter what you do as long as you do it consistently. Are you declaring all your variables in camel case? That’s perfectly fine as long as you stick with that way to declare your variables. Don’t start declaring your variables in snake case because you think it’s easier to read.
This also means that you have to respect the conventions in an existing project. Don’t mix up the conventions that are used in a codebase with your own preferences.
10. Sometimes Shortcuts Are Necessary
A great developer knows when it’s allowed to take a shortcut. Even though it might sound counterintuitive, it can be perfectly fine to write code that’s suboptimal.
Quick and dirty might be the preferred way in certain situations. When code has a short lifetime, for example. Most of the time you can justify a quick and dirty solution if you don’t need the code in the long run. This might be in a codebase that you’re going to replace in the near future or when planning on using code once.
Keep in mind that when you need code in the long run, fixing things quick and dirty will come back to bite you. Knowing when to apply quick and dirty solutions is a skill that could save you a lot of time.
11. Take Responsibility for Your Mistakes
Mistakes are made everywhere and all the time. Especially if you’re working in a team. Making mistakes is inevitable and it shouldn’t bother you too much. Making mistakes is actually fine as long as you learn from them. It’s the most common way to grow as a developer.
Just make sure you take responsibility for your own mistakes.
When things go south, try to give options instead of excuses. Think about how you can fix your mistake, discuss possible solutions, and don’t pass on the blame.
12. Learn New Things Along the Way
New technologies emerge on a daily basis, and sometimes it might seem hard to catch up with all the latest trends. Though you should never stop learning. Because the day you stop learning is the day that you stop growing.
Learning new things is the only way to stay relevant in this ever-changing technology era that we’re living in.
“Learning is a constant process of discovery, a process without end.” —Bruce Lee
13. Automate Repetitive Tasks
Besides the fact that doing repetitive tasks is boring, you should also value your time. Automating all your repetitive tasks helps you free up an enormous amount of time that you could spend on other tasks. This should be the main motivation to automate as much as possible.
On top of that, automating repetitive tasks removes the human aspect, which makes it less error-prone.
14. Master the Tools You Use
Every craft has a set of tools that are needed to do the work. This is especially true in software development. Jeff Bezos has a great quote that says: “We first change our tools and then our tools change us.” Without tools, developers wouldn’t be able to do get their work done as efficiently.
Knowing what tools to use and how to properly use them can help you get things done much faster. You should take some time to get to know the different tools that are available.
From browser plugins to your IDE and command-line tools, there are a lot of decisions to be made when it comes to selecting your set of tools. Once you’ve handpicked your set of tools, take the time to experiment with them and try to master them as fast as possible.