Thursday, March 15, 2012

Good Cs of Code Quality


Correctness: The code should be correct and do what it is expected to do.
Cohesion: represents unity of purpose.
A good cohesion indicates that the classes that are related and are dependent on each other are co-located.
This will ensure that when changes need to be made the change will be within a limited area of code
This will limit the mistakes that the developers will make when making changes
Clarity: A good clarity indicates that code can be read and understood.
New developers will be able to read and understand the code
It will reduce the errors during change as the code is clear and understandable
Comments (Why? How it can be used?): The comments say why a piece of code exists and how it can be used are good comments.
Categorical: The code should be Categorical about what it does and it should do that one single thing “Categorically”. It should not do more than that one thing.
If the code does only one thing the reader of the code is not misled
Concise: The code should be as small as reasonable and should provide a clear picture of what it is doing.
This makes reading and maintenance easy, reducing possibility of errors.

No comments: