There was one infamous quote from Steve Jobs: “The problem with Microsoft is that they simply have no taste”.
This is clearly biased. Apart from the mater of taste, Microsoft has lots of other issues; and the “taste” here emphysis more on the aesthetic side, rather than engineering. While I believe that the reason for a project to fail, engineeringly, is mostly because of the taste issue. A taste of clean code.
It is very hard to write clean code. By
clean it means:
DRY: do not repeat your self
This is the most important point about
clean code, and it is mostly ignored by
It is very hard to keep code DRY. When people first start coding, there is no clear structure yet, and the specification is never complete. Thus similiar issues would be encountered again and again when coding, and people tends to be lasy therefore just copy from the previous solution, and make modification accordingly.
As time passing, the duplicate code got rooten and the code smells.
Thus the code needs to be refactored often.
Write test for the code, before actual code
Handle Special Cases
Function should do one thing, and do it well
Do what the function declared to do, nothing more, nothing less
Try not to write comments. If needed, write
Keep Code Short
Separation of Logic, Decoupling
, have clear boundary, do not cross the line
- Follow a clear Design Pattern
- Document the interface well