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

6f44c2cc7923c18417bb5a4126152fb2?s=128

coldclimate

July 16, 2012
Tweet

Transcript

  1. Refactoring Oli Wood @coldclimate

  2. What How Tools When

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

  4. "too important to risk breaking it"

  5. "make it do this..."

  6. what

  7. replacing what is there with something new

  8. that does exactly the same thing

  9. same functionality

  10. ...faster

  11. ...securer

  12. ...extendable

  13. ...maintainabler

  14. ...more better

  15. how

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

  17. ...high level

  18. fits into a couple of paragraphs

  19. ...low level

  20. function by function docblock it

  21. find out what it actually does

  22. including the bits everybody forgot

  23. document its API/interface/what ever

  24. unit tests*

  25. Redesign it

  26. high level logical grouping

  27. Class structure

  28. ...think design patterns (maybe)

  29. work out where you are going

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

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

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

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

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

  35. ...keep running the tests

  36. ...and stop at 80%

  37. tools

  38. sublime text

  39. redacted

  40. grep -Rin

  41. phpunit

  42. Selenium

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

  44. code formatters

  45. php codesniffer

  46. php coding standards fixer

  47. when

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

  49. ...constant refactoring is geek circle jerk

  50. ...man up and live with it

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

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

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

    of doing it
  54. ...when can't stand it any more

  55. 16 files object orientated does exactly the same thing

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

  57. A confession

  58. FIN