Wednesday, April 2, 2014

Coding convention

    The objective of everything is memoriless:
  1. You still know your code when 10 years after you come back and look at it.
  2. You know exactly where to change the stuff

  3. Method Signature is important
  4. Common sense (clear when judging the signature itself)
  5. Brief (don't put createNewNode, put create Node)
  6. General e.g.
  7. Not so good
     private string getNewName(string prefix, string suffix, List<TreeNode> trs, int startNumber)
     private string getNewName(string prefix, string suffix, List<string>  usedName,  int startNumber)

    Organization is important, separate when necessary
  8. Separate specific from general (hiearchical relationship)
  9. Separate task like UI and logic

  10. Naming
  11. Use precise name, not first name in your mind like if it is a start number used startNumber, don't use counter
  12. Remove redundant node like createNewNode->createNode

  13. Coding
  14. Code one function by one function, other leave as stuff and code later
  15. Make the correct architecture when start coding, so any additional task you can add later

No comments:

Post a Comment