This is review of the 6th chapter from the book-”Clean Code: A Handbook of Agile Software Craftsmanship” by Robert C. Martin.

In this chapter, Robert points out the important difference between Objects and Data Structures. Former are classes with expose a well defined behaviour- hiding the data, while the latter are all about data and have no behavior to offer.

Data abstraction is simply not about making all the members private and provide access to them via public setter\getter. This doesn’t hide the data . It simply exposes the data via the setter\getters !!!

This is perhaps the most misunderstood concept behind OOP. For eons- people have related encapsulation to simply making all members as private . No sir. It takes more than that.

Interaction between objects should be a series of commmands- each asking the other to do something. Kind of “Tell. Don’t Ask” . By asking for – you are basically asking the other class to expose it’s internals to you.

It also increases the chatiness between classes.

For review of other chapters- please see this post.

 

This is review of the 5th chapter from the book-”Clean Code: A Handbook of Agile Software Craftsmanship” by Robert C. Martin.

Well formatted code is the first clue  to what to expect when you start to read.

Bad formatting reflects either laziness or chaos or negligence or simply ignorance- all signs for code which is fast deteriorating.

In this chapter , Robert discusses rules regarding formatting the code- indentation, spacing, alignment,density,  consistency within the team

The important thing to keep in mind is that a team is like a melting pot- you leave aside your personal preferences on formatting aside and use what the team has agreed upon – collectively and when you join an existing project- you do what others are doing.

This can be made further easier by using uniform code formatters withing the team

For review of other chapters- please see this post.

 

This is review of the 4th chapter from the book-”Clean Code: A Handbook of Agile Software Craftsmanship” by Robert C. Martin.

In a true clean code- comments have little place. You comment your code to explain what the code is doing. But if your code is well written in the first place- you will have little need to write any comments at all.

In this chapter- Robert mostly strikes back at the practise of writing comments to compensate for lack of clarity in the code. And other forms of bad comments like those which cause noise by plainly repeating what the code says. And the dangerous comments like the ones which are not in synch with the code any longer and  then my favourite- comments used to strike out pieces of code.

He however does recognize some “Good Comments” like legal notices ,explanation of intent e.g. why the method is marked as synchronized , TODO comments

For other chapters- please see this post.

© 2011 Technology Cafe Suffusion theme by Sayontan Sinha