Upgrade to Pro — share decks privately, control downloads, hide ads and more …

refactoring

 refactoring

a talk about making code more betterer. Contains invented words and a little swering

coldclimate

July 16, 2012
Tweet

More Decks by coldclimate

Other Decks in Technology

Transcript

  1. Refactoring
    Oli Wood @coldclimate

    View full-size slide

  2. What
    How
    Tools
    When

    View full-size slide

  3. 2,300 lines
    single file
    no classes
    2 years old

    View full-size slide

  4. "too important to
    risk breaking it"

    View full-size slide

  5. "make it do this..."

    View full-size slide

  6. replacing what is
    there with
    something new

    View full-size slide

  7. that does exactly
    the same thing

    View full-size slide

  8. same functionality

    View full-size slide

  9. ...extendable

    View full-size slide

  10. ...maintainabler

    View full-size slide

  11. ...more better

    View full-size slide

  12. work out what it
    actually does
    (you think)

    View full-size slide

  13. ...high level

    View full-size slide

  14. fits into a couple
    of paragraphs

    View full-size slide

  15. ...low level

    View full-size slide

  16. function by
    function
    docblock it

    View full-size slide

  17. find out what it
    actually does

    View full-size slide

  18. including the bits
    everybody forgot

    View full-size slide

  19. document its
    API/interface/what
    ever

    View full-size slide

  20. high level logical
    grouping

    View full-size slide

  21. Class structure

    View full-size slide

  22. ...think design
    patterns (maybe)

    View full-size slide

  23. work out where
    you are going

    View full-size slide

  24. ...and get there
    step at a time

    View full-size slide

  25. ...nail the bit
    you're working on

    View full-size slide

  26. ...don't have too
    many balls in the
    air

    View full-size slide

  27. ...#TODO this
    thing you will
    forget

    View full-size slide

  28. ...#SHOULDDO
    ace thing you
    might do later

    View full-size slide

  29. ...keep running
    the tests

    View full-size slide

  30. ...and stop at 80%

    View full-size slide

  31. sublime text

    View full-size slide

  32. ghetto tests
    (curl > Apache
    logs > *nix > diff)

    View full-size slide

  33. code formatters

    View full-size slide

  34. php codesniffer

    View full-size slide

  35. php coding
    standards fixer

    View full-size slide

  36. Refactoring is a
    good sign you're
    thinking about the
    code

    View full-size slide

  37. ...constant
    refactoring is
    geek circle jerk

    View full-size slide

  38. ...man up and live
    with it

    View full-size slide

  39. ...when it stops
    you doing
    something more
    important

    View full-size slide

  40. ...when you know
    what you're doing

    View full-size slide

  41. ...once the cost of
    not doing it out
    weighs that of
    doing it

    View full-size slide

  42. ...when can't
    stand it any more

    View full-size slide

  43. 16 files
    object orientated
    does exactly the
    same thing

    View full-size slide

  44. 2 new modules
    Several £k income
    Multi-developer

    View full-size slide

  45. A confession

    View full-size slide