Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Code Refactoring

145 views

Published on

An introduction to code refactoring, the process of restructuring existing computer code without changing its external behavior. This keynote will also include common techniques of doing code refactoring, with real-code demonstration.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Code Refactoring

  1. 1. Code Refactoring Presented by Steven Dec. 2016
  2. 2. Why 2
  3. 3. 3
  4. 4. 4
  5. 5. Fast Runnable 5
  6. 6. Fast Runnable 6
  7. 7. Spaghetti Code ● program flow is conceptually like a bowl of spaghetti, i.e. twisted and tangled. ● complex and confusing control structures that are barely understandable 7
  8. 8. 8
  9. 9. What 9
  10. 10. ● Code refactoring is the process of restructuring existing computer code without changing its external behaviour. Code Refactoring 10
  11. 11. 在不改變軟體的外在行為下,改 善既有軟體的內部設計。 11
  12. 12. 2 Advantages 6 Techniques 12
  13. 13. Advantages 13
  14. 14. Expressiveness 14
  15. 15. Expressiveness Complexity 15
  16. 16. Expressiveness Complexity Readability 16
  17. 17. 17
  18. 18. Expressiveness Complexity Readability 18
  19. 19. Maintainability Expressiveness Complexity Readability 19
  20. 20. Maintainability Expressiveness Complexity Readability Extensibility 20
  21. 21. Maintainability Extensibility 21
  22. 22. Techniques 22
  23. 23. Generalization ExtractionEncapsulation Pulling-up Pushing-downRenaming 23
  24. 24. Generalization ExtractionEncapsulation Pulling-up Pushing-downRenamingcommon: private / (default) / protected / public 24
  25. 25. Generalization ExtractionEncapsulation Pulling-up Pushing-downRenamingcreate more general types, e.g., super-classes 25
  26. 26. Generalization ExtractionEncapsulation Pulling-up Pushing-downRenaming extract {classes, methods, funcions} fewer methods → clearer purpose and functionality 26
  27. 27. Generalization ExtractionEncapsulation Pulling-up Pushing-downRenaming rename {methods, fields} 27
  28. 28. Generalization ExtractionEncapsulation Pulling-up Pushing-downRenaming moving methods between parent/child classes 28
  29. 29. Generalization ExtractionEncapsulation Pulling-up Pushing-downRenaming http://refactoring.com/catalog/index.html29
  30. 30. How 30
  31. 31. Encapsulation 31
  32. 32. Encapsulation 32
  33. 33. data / field → private Setter & Getter Encapsulation 33
  34. 34. Generalization 34
  35. 35. Generalization 35
  36. 36. Generalization 36
  37. 37. Generalization 37
  38. 38. Generalization 38
  39. 39. Renaming 39
  40. 40. Renaming 40
  41. 41. Conclusion 41
  42. 42. ● what 42
  43. 43. ● what Maintainability Extensibility 43
  44. 44. 44
  45. 45. 45

×