Good programming

Good Programming

  • What is “disposable code”?
    • Not designed
    • Incomprehensible 1 year, 1 month, 1 week later
    • Just barely works, no idea why
    • “write-only”
    • Long, ugly methods
    • Bad or meaningless naming

Rules and Slogans

QUOTE Know the rules well, so you can break them effectively. (Dalai Lama)
  • Slogans
    • DRY: “Do Not Repeat Yourself”.
    • YAGNI: “You’re Not Gonna Need It”
    • NIH: “Not Invented Here”
    • BUFD: “Big Up Front Design “
  • Discussion about hard and fast rules
  • Tools to automatically check: Automatic Code Reviews

  • Other basic hygene
    • What’s the right amount of code commenting?
    • How important is proper formatting?
    • Why is naming important and what is it’s connection to commenting?
  • ‘Sandy Metz’ Rules
    • Classes can be no longer than 100 lines of code
    • Methods can be no longer than five lines of code
    • Pass no more than four parameters into a method
    • Controllers (Rails) can insantiate only one object. Therefore views can only know about one instance variable, and only send methods to that object. (@view_presenter.user.username is not allowed)