🌱 Simple Rules for Simpler Code

Source

more like guidelines than actual rules

  • Captain Barbosa
  1. don’t abbreviate
  2. don’t use else
    • fail early
  3. single level of indentation
    • start from the outside in
    • pull complex logic into methods
    • tell don’t ask
  4. limit instance variables (property on an object that is another object)
    • 4 max
    • extract responsibility
  5. wrap primitives and strings (SOMETIMES) 1. when it brings clarity 2. when there is behavior connect to the value 3. when there is validation connected (consistency required) 4. when it is an important domain concept
Made by Brandon . If you find this project useful you can donate.