Your SlideShare is downloading. ×
0
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Taming the Monster Legacy Code Beast
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Taming the Monster Legacy Code Beast

1,825

Published on

Does that legacy code beast stifle your creativity? Do you stay up late at night frightened that someone might touch *that* piece of code? Learn some practical steps on how you can slay the legacy …

Does that legacy code beast stifle your creativity? Do you stay up late at night frightened that someone might touch *that* piece of code? Learn some practical steps on how you can slay the legacy code beasts, divide and conquer, and deliver value to your customers.

Published in: Technology, Sports
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,825
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
16
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • take a minute to have student “read” test and talk out what it’s doing.
  • Build out slide.. Before you click through: take a minute to have student “read” test and talk out what it’s doing.
  • Transcript

    • 1. Taming Legacy Code Monsters<br />
    • 2. *<br />Caleb<br />* I’m here to help.<br />
    • 3.
    • 4. Last year<br />10Reasons yoursoftwareSucks<br />(and the 10 practicesto fix it)<br />
    • 5. Building teams that engineer better software<br />Development ∙ Team Work ∙ Process<br />
    • 6. back to…<br />Taming Legacy Code Monsters<br />
    • 7. back to…<br />Taming Legacy Code Monsters<br />
    • 8. Definition “Legacy”<br />n. Software that I’m afraid to maintain, extend, or change it actually scares me to touch that code.<br />
    • 9. What’s the differencebetween an application and<br />
    • 10. Legacy Monster<br />
    • 11. Legacy Monster<br />Processor<br />Static Config<br />Static Proxy<br />Processor Settings<br />Data Connections<br />Rules Configurations<br />Coupling<br />Coupling<br />Coupling<br />Coupling<br />Coupling<br />Rules<br />Data<br />Coupling<br />
    • 12. Legacy Monster<br />Solution contained over 68 projects.<br />Most of which were notused.<br />No horizontal layers.<br />Required IIS 6 / legacy URL rewriter / 32 bit C Lib / IIS Rules export/import / Database Connections / Proper Configuration X 3<br />To run or test ANY part on a dev box…<br />
    • 13. Strategy #1<br />Know your Foe<br />
    • 14. Strategy #1<br />nDepend<br />
    • 15. Strategy #1<br />Visual Studio Dependency Graph<br />
    • 16. Strategy #1<br />Demo<br />Using theVisual Studio Dependency Graph<br />
    • 17. Strategy #1<br />Demo<br />Pro tip:Look for big blobs&amp; thick linesto concrete types<br />
    • 18. Strategy #2<br />Create aSafety Net<br />
    • 19. Source Control+ Test<br />Strategy #2<br />
    • 20. Strategy #2<br />Source Control+ Test<br />
    • 21. Strategy #2<br />Source Control<br />
    • 22. // source<br />// svn / git / tfs .. <br />// r1.1<br />// r1<br />// r2<br />// r3<br />// trunk<br />// trunk<br />Branching for FUN!<br />//<br />
    • 23. Strategy #2<br />Unit TestsIntegration<br />Regression<br />Load Tests<br />Etc…<br />Tests<br />
    • 24. Isolation and White box Unit Testing for .NET<br />Demo: Safety Net<br />Legacy Monster<br />“Pexautomatically generates test suites with high code coverage.…[and] finds interesting input-output values of your methods, which you can save as a small test suite with high code coverage. Microsoft Pex is a Visual Studio add-in for testing .NET Framework applications.”<br />Processor<br />Static Config<br />Static IProxy<br />Processor Settings<br />Data Connections<br />Rules Configurations<br />http://research.microsoft.com/en-us/projects/pex/<br />Rules<br />Data<br />
    • 25. what about hard to test code?<br />refactoring testability<br />
    • 26. privateIList&lt;Bean&gt; goodBeans { get; set;}<br />privateIList&lt;Bean&gt; badBeans { get; set;}<br />publicvoidAddBean(Bean bean){<br /> if(bean.size &gt; 10)<br />goodBeans.Add(bean);<br /> else<br />badBeans.Add(bean);<br />}<br />publicvoidUpdateBeans(){<br />BeanData.Update(goodBeans);<br />goodBeans.Clear();<br />badBeans.Clear();<br />}<br />
    • 27. 1<br />Clearly an arbitrary example<br />Does represent actual production code that I have worked with<br />2<br />3<br />AddBean(b); AddBean(b), UpdateBeans();<br />Usage scenario is<br />How can we test the AddBean() Logic?<br />
    • 28. publicIList&lt;Bean&gt; GoodBeans{ get; private set;}<br />privateIlist &lt;Bean&gt;badBeans{ get; set;}<br />publicvoidAddBean(Bean bean){<br />if(bean.size &gt; 10)<br />GoodBeans.Add(bean);<br />else<br />badBeans.Add(bean);<br />}<br />publicvoidUpdateBeans(){<br />BeanData.Update(goodBeans);<br />GoodBeans.Clear();<br />badBeans.Clear();<br />}<br />privateIList&lt;Bean&gt; goodBeans { get; set;}<br />privateIList&lt;Bean&gt; badBeans { get; set;}<br />publicvoidAddBean(Bean bean){<br /> if(bean.size &gt; 10)<br />goodBeans.Add(bean);<br /> else<br />badBeans.Add(bean);<br />}<br />publicvoidUpdateBeans(){<br />BeanData.Update(goodBeans);<br />goodBeans.Clear();<br />badBeans.Clear();<br />}<br />A: create a readonlyaccessor to “sense” thegoodBean state externally<br />
    • 29. What about the UpdateBeans() method?<br />publicvoidUpdateBeans(){<br />BeanData.Update(goodBeans);<br />goodBeans.Clear();<br />badBeans.Clear();<br />}<br />publicvoidUpdateBeans(){<br />BeanData.Update(goodBeans);<br />goodBeans.Clear();<br />badBeans.Clear();<br />if (OnBeansUpdate != null)<br />OnBeansUpdate();<br />}<br />publiceventActionOnBeansUpdate;<br />
    • 30. Code Coverage + Continuous Integration<br />Not a silver bullet<br />still need to make sure that we are testing “the right” things, and not just hitting some magical number<br />still need to make sure we have healthy tests<br />Pro tip<br />
    • 31. Code Coverage + Continuous Integration<br />Creates a base line or smoke test to look for<br />Watch trends over magic percent numbers<br />Pro tip<br />
    • 32. Code Coverage + Continuous Integration<br />Team City Code Coverage<br />
    • 33. Code Coverage + Continuous Integration<br />Sonar<br />
    • 34. Strategy #3<br />
    • 35. Strategy #3<br />Divide and Conquer <br />(pick your battles)<br />
    • 36. 36<br />Commitment<br />
    • 37. 37<br /> Raise your hand and repeat after me,<br />Commitment<br />
    • 38. 38<br /> Raise your hand and repeat after me,<br />Commitment<br />I will not practice bad code. <br />
    • 39.
    • 40. “Resist Legacy Coupling”<br />
    • 41. “Resist Legacy Coupling”<br />tight coupling = change anywhereaffects everything<br />Legacy Monster<br />Processor<br />Static Config<br />Static Proxy<br />Processor Settings<br />Data Connections<br />Rules Configurations<br />New Functionality<br />Coupling<br />Needs IProxy<br />Coupling<br />static Config class leads to Heavy Weight testing<br />Coupling<br />Coupling<br />Coupling<br />Rules<br />Data<br />don’t reference Config Monster<br />Coupling<br />use DI for only what you need (IProxy)<br />
    • 42. Introduce SOLID principals on new development… gradually improve code over time<br />http://developingux.com/di/<br />
    • 43. wrap up<br />
    • 44. Know your Foe <br />wrap up<br />Use a Safety Net<br />Divide and Conquer<br />
    • 45. Thank you!<br />Proaction<br />MentorS<br />@calebjenkins<br />http://developingux.com<br />@proactionmentor<br />caleb@proactionmentors.com<br />
    • 46. Photo Credits<br />© Michael Cummings - http://dreaminpictures.com<br />http://www.flickr.com/photos/boogeyman13/2432667459/<br />http://www.flickr.com/photos/stopthegears/50553611/<br />http://www.flickr.com/photos/pochateca/324414459<br />http://www.flickr.com/photos/27620885@N02/2594362917<br />
    • 47. http://www.flickr.com/photos/27620885@N02/2594363003<br />http://www.flickr.com/photos/flyingturtle/3976070342/<br />http://www.flickr.com/photos/jfravel/1001472806/<br />http://www.flickr.com/photos/flyingturtle/3976076272/<br />http://www.lostechies.com/blogs/derickbailey/archive/2009/02/11/solid-development-principles-in-motivational-pictures.aspx<br />

    ×