I C E B E R G.
This is how I see all the hidden facts that we, developers usually forget or tend to ignore when we are too excited about writing code or implementing something new. In the form of iceberg…
The iceberg looks small and beautiful from the outside, so people tend to forget its actual size and what it hides beneath the peak. What people see from the outside is actually just the tip of the iceberg.
Writing code is the same thing.
When you start writing code, you are too focused on what you have to write and you don’t focus on how much cost it may bring to you. Or, you ignore it.
As the years pass, all your experience and the mistakes you made teach you that what you used to ignore is actually the most important thing that you have to consider.
So what are those important facts that as a developer you usually forget?
Every line of code you write is:
- code that has to be read and understood by other programmers
- code that has to be tested and debugged
- code that will increase defects in your software
- code that probably will introduce new bugs in the future
Like an iceberg ha?
In the begining, you just see the code. You think, what can go wrong, right? But actually, it’s just the tip of the iceberg.
In a developer’s programming life, it takes some time to develop the ability to see the whole part of the iceberg. To see that, you have to pass through the 3 coding stages in your programming life.
Let’s speed up the time and check each one of the stages together.
1. Writing Code As Much As Possible
Remember this time. When you just started your programming career as a junior developer. You are hungry, foolish. You are always on the lookout to write some more code lines and for problems to solve. You say YES to every possibility that requires you to write code. You are too excited. You spend hours and days on it. You forget about sleeping.
Being too excited and writing code as much as you can in that stage is good. This is how it should be. This is how we learn to programme. This is how we practice being a better developer. In the meantime, while we are writing that bunch of code, we make a lot of mistakes too. And that is totally fine. They are just small mistakes. Nothing can stop you from writing code.
After some years, (approximately 4–5 years), you start meeting the new programming facts that you didn’t know before. You face the reality beyond the code. You have just seen the tip of the iceberg with writing code and now you are curious to see what is under the sea.
How does the rest of the iceberg look like?
This is the stage where you see that every code has to be read, understood, tested, debugged. You’ve just understood how much important future maintenance is for your software to last longer.
2. Learning When Not To Write Code
After you experienced a few programming horror stories, you found yourself thinking about how you can avoid writing unnecessary code because you know how much it can cost you.
In this stage, you are learning when not to write code to avoid being a victim of another horror story. You are still excited about writing code but you are wise enough to know that less code is better. Simplicity is your ultimate guide here. You exactly understand that it’s harder to read code than to write it. That’s why you start focusing on more readable, understandable and simpler code.
In this stage, you follow a few simple rules that will transform you into a better programmer.
- Writing less code.
- Keeping your codebase small
- Saying YES to what is essential and saying NO to rest of it
Knowing when not to code is possibly the most important skill a programmer can learn. -The Art Of Readable Code
3. Deleting Code As Much As Possible
One of my most productive days was throwing away 1000 lines of code. — Ken Thompson
In this stage of coding, you exactly understand what Ken Thompson was trying to say with the above sentence.
You exactly know that the more code you have, the more places for bugs to appear. It takes longer checkouts or compiles. It takes longer for a new employee to understand your system. There’s more stuff to move around if you have to refactor.
Furthermore, more code often means less flexibility and functionality. You understood it based on your own experience. You know when not to code but at the same time, you know that by deleting the unnecessary codes or refactoring complex solutions with simpler elegant ones can decrease defects in your software.
In this stage, you discovered all parts of the iceberg. You know what is under the sea. Next time when you see a new iceberg (writing code) you will be more careful and you will not make the same mistake as Titanic did:)
The key idea of this article is not that writing code is your enemy. You are a programmer. Writing code is your passion and it will always be. It will cover a big part of your life. I just want you to understand what is behind all of that code writing and that with each line of code you have written you will accept all its burden too that comes along.
Don’t surround yourself with unnecessary codes.