1 / 17

You want me to do what???

You want me to do what???. Refactoring legacy applications aka : fixing someone else’s “bad” code. Niel Zeeman Team Foundation Consulting nielz@teamfoundation.co.za. Team Foundation. Consulting. Who am I…. projects. Altering internal structure without changing external behavior.

jess
Download Presentation

You want me to do what???

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. You want me to do what??? Refactoring legacy applications aka : fixing someone else’s “bad” code Niel ZeemanTeam Foundation Consulting nielz@teamfoundation.co.za

  2. Team Foundation Consulting Who am I… projects

  3. Altering internal structure without changing external behavior Refactoring

  4. Small transformations Refactoring Remain fully working Sequence of transformation can produce significant restructuring

  5. If it stinks, change it.—Grandma Beck, discussing child-rearing philosophy What Anaemic domains Duplicated code Mixed Responsibility Long methods Smells Temporary fields Long param lists Large classes

  6. Why Give ability….. • Testability • Maintainability • Changeability • Comprehend ability • Applicability

  7. To Refactor Not to Refactor When Code smells Deadlines or Intuition Re-write

  8. How Begin with the end in mind Write SOLID code!

  9. SOLID • Single Responsibility • Open - closed • Liskov substitution • Interface segregation • Dependency inversion

  10. Decompose conditional Replace data value with object Replace parameters with parameter object Inline Temp Extract Method Inline Method Patterns Remove middle man Replace method with method object Move method Replace constructor with factory method Replace record with object Extract interface Extract class Separate domain from presentation interface

  11. Patterns

  12. presentation persistence validation Business logic

  13. Presentation Services Controllers View Models Repository DOMAIN

  14. Show me…

  15. Step 1 Extract Class / Controller

  16. Step 2 Separate Responsibilities

  17. Q&A • http://refactoring.com/ • http://sourcemaking.com/refactoring • http://goo.gl/WYIfV (MS PNP) • http://goo.gl/ostFM (MS Enterprise Patterns) Niel ZeemanTeam Foundation Consulting nielz@teamfoundation.co.za http://blogs.teamfoundation.co.za

More Related