The Holy Java

Building the right thing, building it right, fast

Becoming A Better Programmer Through The Study of Good And Bad Code & Design

Posted by Jakub Holý on May 19, 2013

Reading books about good design and good coding practices such as Clean Code is very helpful but it isn’t enough to become a good programmer. We need to see both good and bad code in practice, perhaps many times, to start to really understand and appreciate the principles and qualities of clean/good code. (And, of course, we must write code.) However our chances of encountering a noteworthy good or bad piece of code and realizing its qualities (or lack thereof) are limited and highly dependant on the project and people we work with. In an attempt to increase the chances and help other – especially junior – developers to encounter and evaluate more interesting pieces of code, I have started a new blog, Wonders of Code. When I encounter a code snippet lacking in some qualities, I re-implement it in a better way and publish both together with an analysis of their pros and cons and relating those to the  principles of readability, maintainability, and clean code in general.

This is an experiment and I hope to hear from the community if this is something that can really help people or not. I would also love to get contributions from other developers, to cover a broader range of opinions and examples. Comments and contributions are welcomed and appreciated!


I should add that criticizing others’ code is a rather arrogant activity. I am certainly not a master of clean code and do not write perfect code myself. I try to approach every source code from the perspective that it is the best code the given developer could have created under the particular circumstances (time, knowledge, etc.) and that essentially any code can be improved upon. So we usually can’t really blame the author for the lack of some qualities and the lack of perfection. Additionally, quality is, into a certain extent, in the eye of the beholder. Programming, as everything else, is about compromises between various forces and these compromises differ based on experience and preferences. We can’t always say that one is better than another. But I believe that it is still valuable to analyze and try to improve upon a piece of source code, however relative my particular values and preferences are, and that it can help others form their understanding, opinion, and critical thinking.

Now please head for Wonders of Code, read the examples already there, comment, contribute! Thank you.

About these ads

Sorry, the comment form is closed at this time.

 
%d bloggers like this: