Skip to content

Instantly share code, notes, and snippets.

@joshuajhun
Created February 1, 2016 03:46
Show Gist options
  • Save joshuajhun/e5e966c1ceb5168a94c1 to your computer and use it in GitHub Desktop.
Save joshuajhun/e5e966c1ceb5168a94c1 to your computer and use it in GitHub Desktop.
The Rules

The Rulez

  • Classes can be no longer than one hundred lines of code.
  • Methods can be no longer than five lines of code.
  • Pass no more than four parameters into a method. Hash options are parameters.
  • Controllers can instantiate only one object. Therefore, views can only know about one instance variable and views should only send messages to that object (@object.collaborator.value is not allowed).

break only if...

  • pair allows you
  • you have good reason to

What would be the hardest rule to follow?

  • I think that the most difficult rule to follow is the 5 line rule. In my experience in JavaScript (which isn't too much) I've found that keep certain methods short is diffucult. Also what makes this rule particularly difficult to follow is not being able to use the If Else blocks. The benifit to this is having functions that are particulary lean and only allow you to have one function. What I find great about this is the ability to debugg your methods if they are writtent this lean. Being able to know where they break and why they break is great. It also allows you the ability to transfer methods over to other applications.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment