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.

Evolve your application

52 views

Published on

Presentation give at NetPoint 21st meeting in Porto

Published in: Software
  • Be the first to comment

  • Be the first to like this

Evolve your application

  1. 1. EvolveYour Application DO NOT LET REFACTORING SCARE YOU Mário Nogueira | Software Engineer
  2. 2. Legacy Code
  3. 3. Legacy Code • Must be maintained. • New developments must be done. • No one wants to touch it, or parts of it. • A simple bug fix may require large refactoring.
  4. 4. Legacy Code • We end up doing it like a carpenter and smashing a nail on to it. • And hope we didn’t break anything in the process.
  5. 5. CAM2
  6. 6. CAM2 2018
  7. 7. CAM2 2018 The Good • Market leader in metrology software • Has existed for over 20 years. • Continues to evolve in each release • Adding new features and enhancements
  8. 8. CAM2 2018 The Not So Good • Features were getting harder and harder to develop • Part of the code base was built over 20 years ago. • Customer were reporting bugs faster than we could solve them • Fix 1 bug, 2 were created. 0 2 4 6 Bugs Reported Bugs Solved
  9. 9. CAM2 2018 • We decided that enough was enough and was time to revert this situation • We would no longer do easy fixes • Only when no other option was available • When going through parts of the code and a refactor was calling out to be made, we would do it.
  10. 10. CAM2 2018 • For each bug that we were solving we created an automation test • Our automation test suite quickly grew • These tests allowed us to detect breaking behaviour faster, and fix it before releases. 0 200 400 600 800 1000 1200 1400 Start Release 1 Release 2 Release 3 Release 4 Series 1
  11. 11. CAM2 2018 • Number of new bugs being reported decrease to nearly zero. • We’ve also added: • Remote logging • Crash Detection • We started detecting bugs and fixing them before customers had the time to report them.
  12. 12. Ready for refactor
  13. 13. Release Cycles
  14. 14. Release Cycle • Two Major Releases per year. • New Features and Enhancements • One Minor Release each month. • Only Bug fixing
  15. 15. Continuous Deployment
  16. 16. Solution PERSISTENCE DOMAIN SERVICES
  17. 17. Persistence • Document based application. • Every thing that was important for our customers is placed in it. • Loosing or corrupt the information is not an option.
  18. 18. Persistence • Binary serialization. • After serialized you can’t read it. • What is in memory gets flushed to a file. • Can go from 2MB in disk to 400MB very quickly • Persisted Services • Application worked on top of it
  19. 19. New Persistence • Our document infrastructure works as stream holder • Basically a zip file • Moving away from binary serialization • Migrating old data to new format • No longer persist services
  20. 20. New Persistence • For now we are using SQLite • Saving as required instead of flushing • Saving a document is just compacting the entire stream into a .fcd
  21. 21. New Persistence • Creating new streams • One for SQLite database • One for each plugin FCD Document (Decompressed) Binary Data SQLite Database Plugins Plugin1 Plugin 2
  22. 22. New Persistence • Persistence is no longer our core, but a detail DetailUI Domain Persistance Detail
  23. 23. Domain
  24. 24. Domain • Not really like that, but messy • A lot of dependencies • Years of development on top of it • Unit testing was hard due to a higher number of dependencies • Couldn’t stop new developments in order to refactor
  25. 25. Domain • Scattered through the solution • Mixed with non-domain concerns • Refactoring away was not an option • That would take years… 40 years for a single developer
  26. 26. Domain
  27. 27. Domain Component Component
  28. 28. Services Refactoring Component Internal Implementation Entry Point Exit Point IntegrationTests
  29. 29. Services Refactoring Component Internal Implementation Entry Point Exit Point IntegrationTests Refactored Implementation UnitTesting
  30. 30. MOB Programming
  31. 31. MOB Programming
  32. 32. Conclusion
  33. 33. Refactoring is Fun • You shouldn’t be afraid of it • You can learn a lot from it • Refactoring will evolve your application and your expertise's
  34. 34. Bedtime reading
  35. 35. We are Hiring • Software Engineer • Software Quality Assurance Engineer • Software Research – Computer Graphics
  36. 36. Questions?
  37. 37. Patrocinadores “GOLD”
  38. 38. Patrocinadores “Silver”
  39. 39. Patrocinadores “Bronze”
  40. 40. http://bit.ly/2I6HujY * Para quem não puder preencher durante a reunião, iremos enviar um email com o link à tarde Formulário de Avaliação

×