While ago while I was looking for some papers I found out an old sticky note. On the sticky note, there are only four lines. They are:

  • No duplication;
  • One thing;
  • Expressiveness;
  • Tiny abstractions.

Of course, I am not the author of it. The same set and order of rules I got from a book. I can not recall right now, but It is a book by Uncle Bob or Martin Fowler (if you haven’t read any of theirs books, I highly recommend you to do it).    

I remember I wrote that sticky note back in the days, and it stayed stuck on my monitor for ages. Why? Because in these four lines, you can find almost everything needed for a young developer (In code quality guidance).

You can find the essence of many of the well-known principles and best practices incorporated here.

Be better with

No duplication

Do not copy and paste code. When you find yourself copying a block of code, extract it to a proper structure – method, class, module, etc. and reuse it.

One thing

Every single method, class, module must have only one responsibility. When you catch yourself adding a new responsibility to an already existing one, you should extract the code and introduce a new method/class/module or place it in the proper place.

Expressiveness

We all know that naming is the most challenging part of programming 😊. For our code to be easy to read and understand, we must set proper variable and other programming structures names. Don’t try to be cool with the names, and don’t be lazy. Think for the next guy who will read your code.

  What are some good and bad practices writing code comments

Tiny abstractions

Stay away from deep abstractions and inherit/implement only what is needed. Experienced developers will notice here that we talk about the interface segregation principle. A class should implement only what it needs. If interfaces it implements include things that are not required, these interfaces should be split into smaller ones, and then the class should implement only needed ones.

An old sticky note with four principles to be a better software developer.

On the image, you can see how much importance I give to these simple principles. I even used duct tape after the glue was worn out.

After writing this article, I will place the sticky note again to my monitor. I suggest you do the same.

Write A Comment