DEV Community

Cover image for 3 Coding Stages: Writing. Avoiding. Deleting.
Hüseyin Polat Yürük
Hüseyin Polat Yürük

Posted on • Originally published at huseyinpolatyuruk.com

3 Coding Stages: Writing. Avoiding. Deleting.

Iceberg

This is how I see all the hidden facts that we developers usually forget or tend to ignore when we are excited about writing code or implementing something new.

In the form of an iceberg…

The iceberg looks small and beautiful from the outside, so people tend to forget its actual size and what hides beneath the peak. What people see from the outside is actually just the tip.

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 it may cost you down the road. Or, you ignore it.

As the years pass, all your experience and the mistakes you make teach you that what you used to ignore is actually the most important thing you must 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

In the beginning, you just see the code. You think, what can go wrong? 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 of the iceberg. To see that, you have to pass through the three coding stages in your programming life.

Let's speed up time and check each of the stages together.

1. Writing code as much as possible

Remember this time? You had just started your programming career as a junior developer. You were hungry, foolish. You were always on the lookout to write some more code lines and for problems to solve. You said yes to every possibility that required you to write code. You were too excited. You spent 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 program. 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 time, maybe four to five years, you start learning 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.

This is the stage where you see that every code has to be read, understood, tested, debugged. You've just understood how 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 knew how much it can cost you.

In this stage, you were learning when not to write code to avoid being a victim of another horror story. You were still excited about writing code, but you were wise enough to know that less code is better. Simplicity is your ultimate guide here. You understood that it's harder to read code than to write it. That's why you started focusing on more readable, understandable, and simpler code.

In this stage, you followed a few simple rules that transformed 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 understand exactly what Ken Thompson was trying to say with the above sentence.

You know that the more code you have, the more places there are 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 understand 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, more elegant ones, you can decrease defects in your software.

In this stage, you discovered all parts of the iceberg. You know what is under the sea. The next time you see a new iceberg, you will be more careful, and you will not make the same mistake as the Titanic did.

The key idea of this piece 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 accept the burden that comes along.

Don't surround yourself with unnecessary codes.

Top comments (3)

Collapse
 
michaeltharrington profile image
Michael Tharrington

This is great!

Just a heads up, I think that the heading "Deleting code as much as possible" got a bit screwed up. Guessing it's supposed to be #3.

Collapse
 
h_polatyuruk profile image
Hüseyin Polat Yürük

Thank you for feedback. I corrected it.

Collapse
 
pavelloz profile image
Paweł Kowalski • Edited

Amen.

It is obvious that you are experienced developer. :)