Skip to content

Instantly share code, notes, and snippets.

@jeremy-w
Created October 14, 2013 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jeremy-w/6970380 to your computer and use it in GitHub Desktop.
Save jeremy-w/6970380 to your computer and use it in GitHub Desktop.
Notes taken while listening to Robert Annett's talk on Modern Legacy Systems at QCon London 2012.

Modern Legacy Systems

Presented by Robert Annett at QCon London, 14 Sep 2012.

Notes by Jeremy W. Sherman, 2013–10–13.

“Legacy”

What is legacy?

  • Often an insult, but how odd, not like that in normal English (cf. inheritance).
  • Also perhaps defined as “as opposed to its alternatives, it’s the software that actually works”.
  • Often a mechanization of an earlier paper or Excel-based system.

Modern legacy systems

  • Mix of older versions of current tools, or old tools that failed.
  • Old hardware, old languages, old tech.
  • Often still working, but everyone hates it.

What do you do?

Common problems

No documentation

  • Usernames and passwords to administrate the database might be missing.
  • What was the last release branch? Even if it’s in SCM, that doesn’t mean you know what got baked into the last release.
  • What’s the communication protocol? Needs reverse-engineering sometimes.
  • How is the network structured?
  • No licenses accompanying third-party code – can we still legally use this?

No overarching design

  • Organic “agile” software
  • Like London’s growth
    • The “Magic Roundabout” - anticlockwise flow around big roundabout, with 6 smaller spoke roundabouts with clockwise flow; can actually go clockwise around big roundabout by looping each intermediate smaller roundabout.

Lost Knowledge

  • Old standing agreements not documented
  • Example: Deleting a file someone else is using in /tmp at 2 am via FTP

Hidden Knowledge

  • Only one person knows how to generate a report.
  • Job security – “last man standing” from the original team.

Unused Functionality

  • A lot of maintenance work to maintain useless code.

Fragility

  • Vs. Stability
  • If it looks fragile, then no-one will let you touch it.

Coupling

  • Tight requires big lockstep coordinated releases
  • Loosely coupled systems hide dependencies - big space for lost knowledge problems

Zombie Technologies

  • Buying 10 year old machines off eBay because that’s what your business-critical system can run on.

Licensing

  • Often a big issue when you move to VM land; often not allowed by past licenses without high expenses (per-hardware machine vs. per-VM).

Regulation

  • Regulation changes can render a legacy system’s behavior illegal.

Politics

  • Damned if you do and fail
  • Damned if you do and succeed (who’s out a job now?)
    • Note: They might cloak their hidden knowledge from you.
  • No-one likes changes except developers!

Not All Bad!

  • People care about your work.
  • You have actual users already to talk to.
  • You can learn a lot about the industry via its system.

Strategies

Ignore It

NO. You will run into trouble.

Investigate

Might be enough to remove the system. It could be entirely superfluous. “This service costs $10k per year and just runs unix2dos and emails it?”

Maintenance

Sweat those assets!

Upgrade

Speaking of infrastructure components. Don’t wipe out everything, just update to latest APIs, latest version of language, etc.

Migration

Move to an entirely new system and platform.

Incremental improvement

Don’t just chuck in features willy-nilly, or you’re just increasing technical debt.

Replace It

Still have to maintain the old system alongside the new till it’s ready. Then have to retrain everyone (users and ops) to use the new system. This is likely unnecessary!

Executing Your Strategy

Locate Stakeholders

Good news: You actually have some. Yay legacy systems.

Diagram the System

Recommends Simon Brown’s Software Architecture for Developers on Leanpub.

C4 system:

  • Context: What is in there, who uses it, and how does it fit into the current flow?
  • Containers: What are the high-level tech decisions? Where do you stick new code?
  • Components: What are the services in the system? Which container do they go in?
  • Classes: You know how this one goes.

Deeper Analysis

Needs. Moar. Diagrams.

BEWARE: What you have running might not be what is in your SCM!

Making Changes

Virtualization is your friend!

  • Re-create the production system as a test system.
    • Take a snapshot and then migrate it into a virtualized sandbox. (VMWare gets mentioned a lot here.)
  • Run tests and metrics for the copy.
  • Make sure you can swap out containers within the virtual system, can build, and redeploy within that test system.
  • This makes you confident you can deploy and rollback as needed, on a per-component basis!

Preparation

  • Create some systems tests
    • Make them realistic uses of the systems
    • Report runs you can compare
    • Consider “test” data in the real system
  • Build, virtualize, and deploy production

Stabilize

  • Cleanse data
  • Archive data
  • Remove unused components
  • Shift resources (virtualized)
  • Tune applications/DBs
  • Code changes only if required
  • Proves competence, removes unneeded work, and ensures you understand the system from top to bottom.

Third-Party Products

  • Hard to upgrade/migrate
  • Functional and non-functional behavior will change!
  • Be prepared to rollback if (when) necessary
  • NOTE: Test and rollback should be methodical at this point in the process.

Legacy Code Modification

  • Before you refactor, format everything, so you have a base that you can sanely diff.
  • If you reformat as you make changes, all your changes are masked by layout and format changes.
  • After that, read Michael Feathers’ Working Effectively with Legacy Code.

Leaving a Good Legacy

Document All The Things

All that stuff that was missing when you went in? Write it and store it somewhere. Write up build and deploy instructions. Put together an asset register. Give it to your accountants. They will hold onto it for all eternity. BCP/Failover/Backup plans, for when things go wrong and fall apart in 10 years. Draw diagrams! Especially of the overall architecture.

Tests

  • System
  • Integration
  • Functional
  • Non-Functional
  • UAT
  • Accessibility
  • Automate it all, and leave documentation.

System Design

Write up a document. Doesn’t need to be 200 pages; does need to be what you’d draw on a whiteboard when explaining it to someone today.

Consider Tech Consistency & Scope

  • Beware new stuff – will it still be around in 10 years, or will your successors be forced to migrate?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment