• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Does Clean Code Involve...

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does clean code involve "Programming to an interface" and keeping methods as Generic as possible?
 
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Author
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic