Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Taming the Codebase: Strategies for Refactoring...

Avatar for Posedio Posedio PRO
October 12, 2024

Taming the Codebase: Strategies for Refactoring Legacy Code

Inheriting a codebase riddled with technical debt is a common developer nightmare. This talk tackles the seemingly paradoxical challenge of making unmaintainable code maintainable. We'll explore real-world scenarios where new developers face a tangled mess left behind by previous team members. Through practical techniques and battle-tested approaches, we'll delve into strategies for safely refactoring and potentially migrating code without introducing new errors. The session will cover topics like: Identifying Code Smells: Learn to recognize common signs of unmaintainable code and prioritize your refactoring efforts. Test-Driven Refactoring: Explore how to write unit tests that not only identify bugs but also guide your refactoring process. Incremental Improvement: Discover how to break down complex refactoring tasks into smaller, manageable steps that minimize risk. Effective Communication: Learn how to collaborate with stakeholders and the remaining development team to ensure successful codebase improvements. This session is designed for developers who have inherited legacy code and are looking for practical strategies to tame the codebase monster.

Avatar for Posedio

Posedio PRO

October 12, 2024
Tweet

More Decks by Posedio

Other Decks in Programming

Transcript

  1. Wir entwickeln Softwarelösungen: Cloud-native Softwareentwicklung Data insights Beratung, Workshops und

    Reviews Wir steigern die Effizienz von IT- Abteilungen: Platform Engineering Cloud Infrastructure Software Modernisierung Was wir machen?
  2. 5 WHAT IS LEGACY CODE? • No longer maintained or

    supported by the original developers. • Code was written in a now-obsolete programming language or for a platform that is no longer in demand. • The code is difficult or very costly to modify. • There are no automated tests or (up-to-date) documentation for the code.
  3. 8 MIGRATION STRATEGIES (6RS) 1. Rehost (Lift and Shift): •

    Applications are moved to a new infrastructure (often the cloud) without changes to the underlying code. • Pro: Quick and easy to implement, requires no code changes. • Con: Doesn’t fully leverage cloud benefits; can be more expensive and inefficient in the long term.
  4. 9 MIGRATION STRATEGIES (6RS) 2. Replatform • Minor changes to

    the application to optimize it for the new environment without rearchitecting. • Pro: Improves efficiency and cost while utilizing some cloud benefits • Con: Requires moderate development resources and effort.
  5. 10 MIGRATION STRATEGIES (6RS) 3. Replace • Replacing the legacy

    application with a new solution, often a SaaS (Software as a Service) product. • Pro: Less maintenance and faster to implement. • Con: Potential limitations due to out-of-the-box features and the complexity of data migration.
  6. 11 MIGRATION STRATEGIES (6RS) 4. Retire • Applications or parts

    of them are not migrated but decommissioned because they are no longer needed. • Pro: Reduces complexity and cost. • Con: Requires a thorough analysis of system dependencies before retiring.
  7. 12 MIGRATION STRATEGIES (6RS) 5. Retain • Applications remain in

    their current environment, either because they aren’t ready for migration or because they will be addressed later. • Pro: Avoid unnecessary changes where no immediate value can be gained. • Con: Delays future migration.
  8. 13 MIGRATION STRATEGIES (6RS) 6. Refactoring / Rearchitecting • Fundamental

    redesign of the application architecture to take full advantage of the new plattform. • Pro: Maximum flexibility and ability to utilize advanced features of the new platform. • Con: Higher cost, complexity, and time-consuming.
  9. 14 SOFTWARE MIGRATION INSURANCE SOFTWARE Requirements: • Host to Cloud

    migration • Refactor existing Java applications • Cobol to Java refactoring • Infrastrucutre replacement • Step by step migration
  10. 16 SOFTWARE MIGRATION INSURANCE SOFTWARE Analyzing the code - How

    significant is the technical debt? - Analysis of infrastructure and surrounding systems. - Is a documentation available? - Do we have tests? - How much will it cost? How long will it take?
  11. 19

  12. 21 SOFTWARE MIGRATION INSURANCE SOFTWARE - Test-Driven Refactoring o write

    tests for the existing codebase - The Boy Scout Rule o Leave it cleaner than you found it
  13. 23

  14. 28