• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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.
 
You may have just won ten million dollars! Or, maybe a tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic