Labels

Saturday, October 20, 2012

What is Clean Code

Hi Friends,

These days I'm reading a book about clean code. so thought of sharing some new things I have learned. Thing I was wondering when reading was, Why do we write Bad codes????  What is Clean Code???

 WHY do we write bad code?? 

  • Can be because of the rush, deadline is so near and have to do to complete so many functionalists.
  •  Boss would be angry with you if you took the time to clean up your code.
  • Perhaps you were just tired of working on this program and wanted it to be over. 


Some times when we write codes we think of cleaning up the code later after we done writing the whole program or some times we plan to do it tomorrow or many be next week. like wise when we delay to clean the code , code get more messy and difficult to clean the mess. 

LeBlanc’s law: Later equals never.


What is clean Code???


what is clean code? this is the Big question I had when I was reading. Simply if You write a piece of code that should be easily understandable for others. code should be elegant and efficient. The logic should be straightforward to make it hard for bugs to hide.

  •  Contains no duplication;
  •  Expresses all the design ideas that are in the system
This is the 'Big' Dave Thomas's idea about the clean code,
" Clean code can be read, and enhanced by a developer other than its original author. It has unit and acceptance tests. It has meaningful names. It provides one way rather than many ways for doing one thing. It has minimal dependencies, which are explicitly defined, and provides a clear and minimal API. Code should be literate since depending on the  language, not all necessary information can be expressed clearly in code alone "
“Big” Dave Thomas, founder of OTI, godfather of the Eclipse strategy

After reading this post hope You guys get an idea of What is clean code.
Have Fun :)
  



No comments:

Post a Comment