Code Quality – Learn, Measure and Organize Awareness
Posted by Jai on April 12, 2009
How many times it has happened to you that when you join a new project and start looking at the code first time or when some new member joins the project then people usually say that what the crap is this code and we need to improve this and that. As time passes you seldom get the chance to correct it and the same thing passes over and over.
I would like to start the discussion with the simple list of questions which sooner or later comes in the mind of every developer like:
- What to learn to write good code?
- How can I figure out the code in front of me is of good or bad quality?
- What makes the piece of code fall under WTFs?
- What are the good or bad code quality factors or criteria?
- Is there any documents, books etc. which can help me here?
- Can any tool help me to check my code for quality problems?
- How to approach the code to solve the quality problem?
- How to transform the bad code into good code?
- How can I share the WTFs and solution with my team?
And many more similar questions which bother many developers a lot of times.
As very well put in words, the topics like:
So, when we first encounter a new software system we are, in Dunning and Kruger’s terminology, incompetent compared to the programmers that wrote it.
Of course, a developer will never deliberately produce bad code. So in order to improve quality, the developers have to gain quality awareness.
The reason that they think the old code is a mess is because of a cardinal, fundamental law of programming:
It’s harder to read code than to write it.
On a general idea I would try to put some light on how you can approach to get better idea of the different quality standards and principles and to become more aware of the things so that at least you become aware of these WTFs and can find it out and can apply the right solution.There are many code quality measurement tools and how you can integrate those as part of the development process itself and how the team itself handles the quality awareness among the team members.
I am planning to cover this in details in separate blogs, each giving more insight of:
- how to learn more about the code quality aspects
- how you can measure the quality of code as part of regular development process
- how to share and organize code quality awareness among the team.
How to learn about Code Quality Aspects:
Many a times, developers write bad code because they are not aware of it. Having better understanding of the followings is a good start:
- Focus on Fundamentals – OOPs and Design Patterns
- How to write clean code – Clean Code
- Figure out WTFs and improve code quality – Refactoring
Read Code Quality – Learn: OOPs, Desing Patterns, Clean Code and Refactoring fore more details.
What are different Code Quality Measurement Tools:
There are many open source tools available for static code analysis like PMD, Findbugs, CheckStyle, Simian, Cobertura etc. which you can integrate with in your project, may be part of your development process or application build process, to check the code quality.
Read Code Quality – Measurement (Static Code Analysis) Tools for more details.
How to organize quality awareness with in the team:
Different teams plan it different way to put a check on the quality standards and organize it in different way to share the knowledge and making people aware of quality standards and learning. We will be looking more into some of the ways like pair programming, share knowledge etc. that you can plan in Agile teams to make it more effective.
Read Code Quality – Organizing awareness with in the team for more details.
Like the technology thing in the software world is evolving and changing thing, so as these standards and principles. There is no single pill which can help you to get ready with it and can make you perfect or great programmer but definitely keeping these few things would definitely help you to be a good programmer.