Please enable JavaScript.
Coggle requires JavaScript to display documents.
Surviving to a legacy codebase
How we take back control of legacy…
Surviving to a legacy codebase
How we take back control of legacy codebases - PietroDiBello
Surviving Principles
-
-
-
-
-
-
without those understandings, our journey will be erratic and unclear!
If you can't build it and run it on your local dev machine, that's where you should start first
-
-
tiny steps
"Tidying up works through a series of small, safe steps."
-
-
-
During the two hours it takes to safely refactor some large function, I’m probably going to spot 14 potentially-useful refactorings. I can’t chase every bunny, no matter how cute they are. I need to write those ideas down, get them out of my head, and get back to the tricky surgery at hand - JB
Reduce the information overload you face when you look at code that you (still) don't understand :scream:
Decide deliberately which battle you want to fight now and which battles it's better to fight later on
-
-
-
Isolate tidying. This can be tough when you run across the chance to tidy in the midst of writing new code. Either finish and then tidy or revert, tidy, and make your changes. - Kent Beck
-
-
Parking Lot
-
-
-
Kent Beck's "tidying up code" rules
If it’s hard, don’t do it
Tidying up works through a series of small, safe steps
-
-
Two reds is a revert
If I tidy, run the tests, and encounter a failed test, then if I can fix it immediately I do. If I try to fix it and fail, I immediately revert to the last known good state
-
Practice
sometimes I want to see how things might play out, I perform a sequence of tidyings and revert. The second time will go much faster!
Isolate tidying
-
Either finish and then tidy or revert, tidy, and make your changes
-
-
-
-
-
What is Legacy Code BTW?
-
-
-
-
Legacy code is not just old code, or stuff other people wrote, or even code that is in production. Legacy code is any code that significantly and continually resists the reflection of on-going requirements change. -- Anthony Lauder http://wiki.c2.com/?LegacyCode
-
Surviving tactics
-
-
Cleaning the Deck
-
"Whenever I work on unfamiliar code I start extracting methods. I look for chunks of code that I can name - then I extract them. Even if I inline the methods I’ve extracted later, I have a way of temporarily hiding details so that I can see the overall structure." - M.Feathers
-
-
-
-
-
-
The purpose of characterization testing is to document your system’s actual behavior, not check for the behavior you wish your system had
-
-
-
If you make a mistake, just revert and start again
-
"Two reds is a revert. If I tidy, run the tests, and encounter a failed test, then if I can fix it immediately I do. If I try to fix it and fail, I immediately revert to the last known good state"
-
Practice!
"Perform a sequence of tidyings and revert.
The second time will go much faster and you’ll be more familiar with which bumpy spots to avoid."
-
-