It's not a secret anymore!*
The moose likes Agile and Other Processes and the fly likes Does Clean Code Involve... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Agile and Other Processes
Bookmark "Does Clean Code Involve..." Watch "Does Clean Code Involve..." New topic
Author

Does Clean Code Involve...

greg fuentes
Greenhorn

Joined: Sep 12, 2008
Posts: 3
Does clean code involve "Programming to an interface" and keeping methods as Generic as possible?
Katrina Owen
Sheriff

Joined: Nov 03, 2006
Posts: 1357
    
  17
Originally posted by greg fuentes:
Does clean code involve "Programming to an interface" and keeping methods as Generic as possible?


Yes and no.

It involves a whole lot more than programming to an interface. The book talks about coding so that your program tells its story well, how to name variables and functions and classes so that they are expressive, how not to name variables, functions, and classes. It talks about using whitespace to help visually clarify your code, about how not to use comments, about how long methods and classes should be, about writing clean tests.

Should a method be as generic as possible? Not necessarily.

In some cases, it should be as specific as possible - especially if you are only using it once.

It talks about writing dirty code and then cleaning it up, step by step, under the protection of automated tests.

Clean code is about writing code that is a pleasure to read, easy to understand, easy to extend and modify, easy to maintain, easy to pass on to another developer.

... and so much more.
Robert Martin
Author
Ranch Hand

Joined: Jul 02, 2003
Posts: 76
Originally posted by greg fuentes:
Does clean code involve "Programming to an interface" and keeping methods as Generic as possible?


Sure. At lease that's good clean design. But clean code is a lot more than just programming to interfaces. It's clean names, small functions, well partitioned classes, minimal comments, and a whole host of other practices.


---<br />Uncle Bob.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Does Clean Code Involve...
 
Similar Threads
cruise control : how to call maven commands from cruise control
Accessing Outer Class
can we call destroy() method inside service()
Test driven refactoring vs composite refactoring
Clean Code: Java only?