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.

Sandro Mancuso – Testing and refactoring legacy code @ I T.A.K.E. Unconference 2013, Bucharest

6,575 views

Published on

Check out the video of the presentation: http://www.youtube.com/watch?v=WpKb1XqSiUs

Published in: Technology, Education
  • Be the first to comment

Sandro Mancuso – Testing and refactoring legacy code @ I T.A.K.E. Unconference 2013, Bucharest

  1. 1. Testing and Refactoring Legacy Code Sandro Mancuso @sandromancuso craftedsw.blogspot.com
  2. 2. What is this session about?
  3. 3. Business Requirements Imagine a social networking website for travellers • You need to be logged in to see the content • You need to be a friend to see someone else’s trips
  4. 4. Legacy Code Rules • You cannot change production code if not covered by tests – Just automated refactoring (via IDE) is allowed, in case it is needed for writing a test
  5. 5. Show me the code
  6. 6. Start refactoring from deepest to shortest branch Start testing from shortest to deepest branch Working with Legacy Code Tips
  7. 7. Trip Service - Problems TripService +findTripsByUser(User) : List<Trip> <<Singleton>> UserSession +getInstance() : UserSession +getLoggedUser() : User TripDAO +findTripsByUser(User) : List<Trip>
  8. 8. Let’s write some code
  9. 9. Start refactoring from deepest to shortest branch Start testing from shortest to deepest branch Working with Legacy Code Tips
  10. 10. Craftsmen at work • Write readable and maintainable code and tests – Code must express business rules • Strive for simplicity • Know your tools well (i.e. frameworks, shortcuts) • Work in small and safe increments – Commit often • Embrace changes, be brave • Boy scout rule / No broken windows
  11. 11. Thanks Sandro Mancuso @sandromancuso craftedsw.blogspot.com https://github.com/sandromancuso/trip-service-kata leanpub.com/socra

×