Skip to content

Instantly share code, notes, and snippets.

@Mikeyheu
Last active August 29, 2015 13:57
Show Gist options
  • Save Mikeyheu/9528698 to your computer and use it in GitHub Desktop.
Save Mikeyheu/9528698 to your computer and use it in GitHub Desktop.

Revisions

  1. Mikeyheu revised this gist Mar 14, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions ood_notes.md
    Original file line number Diff line number Diff line change
    @@ -99,6 +99,7 @@ Controller should have no business logic and more concerned about routing

    https://github.com/thoughtbot/guides/tree/master/best-practices

    Moving to presenters over helpers



  2. Mikeyheu revised this gist Mar 14, 2014. 1 changed file with 29 additions and 1 deletion.
    30 changes: 29 additions & 1 deletion ood_notes.md
    Original file line number Diff line number Diff line change
    @@ -76,4 +76,32 @@ what if i didn't know where i came from
    assignment -
    redo bottles up to refactoring to strategy pattern
    do miracle
    do home
    do home

    Sandi Metz's rules
    1. Classes can be no longer than one hundred lines of code.
    2. Methods can be no longer than five lines of code.
    3. Pass no more than four parameters into a method. Hash options are parameters.

    If bigger than that - if was going to break these into 2 objects what would they be?
    One instance variable
    Can only know 2 other class names

    Never test controllers - no logic in controllers!

    Never test helpers - no helpers!
    Put logic in things that she owns that she can create fast unit tests for

    Have to use presenters if I can't have helpers
    Have to write a ruby class that does what normally what would be in the helper

    Controller should have no business logic and more concerned about routing

    https://github.com/thoughtbot/guides/tree/master/best-practices





    4. 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).
    5.
  3. Mikeyheu revised this gist Mar 13, 2014. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion ood_notes.md
    Original file line number Diff line number Diff line change
    @@ -71,4 +71,9 @@ naming convention - be specific
    otherwise use composition


    what if i didn't know where i came from
    what if i didn't know where i came from

    assignment -
    redo bottles up to refactoring to strategy pattern
    do miracle
    do home
  4. Mikeyheu revised this gist Mar 13, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion ood_notes.md
    Original file line number Diff line number Diff line change
    @@ -68,4 +68,7 @@ Refactor away from composition
    ruby

    naming convention - be specific
    otherwise use composition
    otherwise use composition


    what if i didn't know where i came from
  5. Mikeyheu revised this gist Mar 13, 2014. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions ood_notes.md
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,12 @@ Copy don't cut

    Robert Martin Bowling Kata

    Looslely coupled - not tied tightly to other objects
    Highly cohesive - all parts about the same thing
    Easily composable - like legos
    Context independent - can use in other contexts



    List of things we don't like

  6. Mikeyheu revised this gist Mar 13, 2014. 1 changed file with 49 additions and 1 deletion.
    50 changes: 49 additions & 1 deletion ood_notes.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Refactoring
    _____
    -----

    Find the things that are most similar and make them the same

    @@ -15,3 +15,51 @@ Copy don't cut

    Robert Martin Bowling Kata


    List of things we don't like

    Then fix the thing that is the easiest to fix

    lot of private methods all related to one public method
    number is a magic number
    number -1
    constant passing of a number
    prevalence of cases
    are there 2 logical classes here? If this were 2 classes

    pick a small object strategy
    you must have good unit tests to employ this strategy!!!

    modules are an inconvenint lie

    when applying recipe to refactoring code if you hit a roadblock you may be missing a concept
    Less arguments is better

    poodr
    domain driven design
    responsibly driven design
    implementing domain driven design
    goosgbt
    clean code
    code complete

    avdi grimm:
    objects on rails
    confident ruby

    ruby tapas
    destroy all software




    Draw a line in the sand to have a maximum class size like 100 lines total

    only subclass if the subclass is using most if not all of the superclasses methods
    inheritence needs to shallow, not deep, subjects are leaf nodes in object graph
    Refactor away from composition

    ruby

    naming convention - be specific
    otherwise use composition
  7. Mikeyheu revised this gist Mar 13, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ood_notes.md
    Original file line number Diff line number Diff line change
    @@ -13,3 +13,5 @@ Always be in the green

    Copy don't cut

    Robert Martin Bowling Kata

  8. Mikeyheu renamed this gist Mar 13, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion gistfile1.txt → ood_notes.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    Refactoring:
    Refactoring
    _____

    Find the things that are most similar and make them the same

  9. Mikeyheu created this gist Mar 13, 2014.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    Refactoring:

    Find the things that are most similar and make them the same

    Then collapse them and do it over and over and over again

    Then find the things that are similar

    Very small steps

    Always be in the green

    Copy don't cut