Restructuring (EVO 2008)

  • Published on
    29-Nov-2014

  • View
    1.100

  • Download
    0

Embed Size (px)

DESCRIPTION

I used this set of slides at a lecture I gave at the University of Bern.

Transcript

<ul><li> 1. Restructuring Tudor Grba www.tudorgirba.com </li> <li> 2. fo rw g rin ar ee d gin en gin en ee se rin erv g re { { { { { { } { { } } actual development } } } { } } } </li> <li> 3. fo rw g rin ar ee d gin en gin en ee se rin erv g re { { { { { { } { { } } restructuring } } } { } } } </li> <li> 4. cycle ginee ring life Reen fo rw g rin ar ee d gin en gin en ee se rin erv g re { { { { { { } { { } } restructuring } } } { } } } </li> <li> 5. { { What? { { { { } { { } } restructuring } } } { } } } </li> <li> 6. Restructuring is often taken as a synonym of refactoring </li> <li> 7. Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior </li> <li> 8. Refactoring is behavior-preserving transformation </li> <li> 9. Restructuring is transforming a program to t current needs </li> <li> 10. Why? { { What? { { { { } { { } } restructuring } } } { } } } </li> <li> 11. Software should be habitable </li> <li> 12. The secret to tidiness is to have a place for every thing Denker Markus </li> <li> 13. The secret to tidiness is to nd the right place for every thing Denker Markus </li> <li> 14. If it stinks, change it Be ck Gr andma </li> <li> 15. How? Why? { { What? { { { { } { { } } restructuring } } } { } } } </li> <li> 16. Take a critical look at design </li> <li> 17. A God Class centralizes too much intelligence Class uses directly more than a few attributes of other classes ATFD &gt; FEW Functional complexity of the class is very high AND GodClass WMC ! VERY HIGH Class cohesion is low TCC &lt; ONE THIRD 006 ari nescu 2 L anza, M </li> <li> 18. ModelFacade from ArgoUML </li> <li> 19. p God Class Split u ModelFacade from ArgoUML 2 er etal 200 Demey </li> <li> 20. d than done Easi er sai 2 er etal 200 Demey </li> <li> 21. also w rap it You can 2 er etal 200 Demey </li> <li> 22. you do not Maybe uch it at all need to to God Class in the last version isGodClass(last) AND Harmless God Class Stable throughout the history Stability &gt; 90% 4 Ratiu etal, 200 </li> <li> 23. Client Provider service() </li> <li> 24. Client Intermediary Provider getProvider() service() </li> <li> 25. Client Intermediary Provider getProvider() service() this.intermediary.provider.service(); </li> <li> 26. Provider2 service2() Client Intermediary Provider getProvider() service() Provider3 service3() this.intermediary.provider.service(); this.intermediary.provider2.service2(); this.intermediary.provider3.service3(); </li> <li> 27. Provider2 service2() Client Intermediary Provider getProvider() service() Provider3 service3() this.intermediary.provider.service(); this.intermediary.provider2.service2(); this.intermediary.provider3.service3(); to str angers eter : D ont talk of Dem T he Law </li> <li> 28. Code te Nav igation E limina Provider2 service2() Client Intermediary Provider fullService() service() Provider3 service3() this.intermediary.fullService(); 2 er etal 200 Demey </li> <li> 29. ge inte rfaces ad to hu t: This can le Provider2 Cavea service2() Client Intermediary Provider fullService() service() Provider3 service3() this.intermediary.fullService(); 2 er etal 200 Demey </li> <li> 30. Middl e Man R emove Provider2 service2() Client Provider service() Provider3 service3() this.provider.service(); this.provider2.service2(); this.provider3.service3(); Fow ler 1999 </li> <li> 31. An Envious Metho...</li></ul>