👀 My perspective on writing good code

Photo of a laptop on a wooden table, screen illuminated with a programming IDE displaying professional and efficient code.


A few words about writing code

Today, I want to share my perspective on writing code. Does the code I write look like the tutorials and snippets presented on many websites? Is it maintainable, clear, and understandable? Can other developers easily pick up where I left off and understand what I had in mind? Do I use design patterns?

To all the above questions, I can confidently answer - it depends - but I always strive to ensure that the code I produce is of the highest quality. I expect the same from the people I work with. However, from experience, I know that just like me, you can’t always deliver top-quality code at all costs. As a developer, you should value not only the quality but also the delivered functionality. Even the best patterns will fail if your functionality is inappropriate. Why? Because no one will use it. Ultimately, when producing code, we want to deliver specific functionality to a specific user group.

Don’t worry if your code isn’t perfect. Mine isn’t either. Moreover, the best-written code will be seen as ‘horrible’ in six months. The end result is delivered functionality and customer satisfaction. (Please don’t confuse imperfect code with sloppy code).

In situations where I have spare time for a project, I can afford the best practices along with the highest quality. However, there are times when time is limited, which results in a drop in code quality - but this can’t affect the end functionality - it has to work 100%. In case of time constraints, we simply have to deliver more functionality. However, from experience, even in such situations, one uses habits and acquired practices. If your habit is writing good code, the project quality won’t suffer too much. It all depends on experience and, honestly, the number of lines of code written. The more quality code, the faster the work, and the smaller the drop in quality during more dynamic situations.

How to Write Good Code?

Above all - write, write, and write again. Learning through practice works best here. If you don’t apply practice, theory will quickly fade. Everything comes with time.

For me, good code is code that:

  • has undergone a code review and, consequently, all inaccuracies have been highlighted and feedback has been given on how to do better,
  • has tests written,
  • is a reflection of practices that can be observed in the repositories of other large projects.

How to Learn to Write Good Code?