Working Effectively with Legacy Code
Rate it:
Open Preview
Read between November 14 - December 10, 2024
67%
Flag icon
you can use a technique called gleaning dependencies. You write tests for the logic that you need to preserve. Afterward, you extract things that the tests do not cover. When you do this, you can at least have confidence that you are preserving the important behavior.
70%
Flag icon
working in legacy code is surgery, and doctors never operate alone.
72%
Flag icon
Move toward interfaces that communicate responsibilities rather than implementation details. This makes code easier to read and easier to maintain.
72%
Flag icon
one pervasive problem in legacy code bases is that there often aren’t any layers of abstraction; the most important code in the system often sits intermingled with low-level API calls.
72%
Flag icon
Code is harder to understand when it is littered with wide interfaces containing dozens of unused methods. When you create narrow abstractions targeted toward what you need, your code communicates better and you are left with a better seam.
76%
Flag icon
Static methods and data really do act as if they are part of a different class. Static data lives for the life of a program, not the life of an instance, and statics are accessible without an instance. The static portions of a class can be seen as a “staging area” for things that don’t quite belong to the class. If you see a method that doesn’t use any instance data, it is a good idea to make it static to make it noticeable until you figure out what class it really belongs on.
77%
Flag icon
Extract and Override Call is a very useful refactoring; I use it very often. It is an ideal way to break dependencies on global variables and static methods. In general, I tend to use it unless there are many different calls against the same global.
81%
Flag icon
Quantum physicists didn’t discover “spooky action at a distance”; in software, we’ve had it for years.
91%
Flag icon
effect sketch    A small hand-drawn sketch that shows what variables and method return values can be affected by a software change. Effect sketches can be useful when you are trying to decide where to write tests.
91%
Flag icon
feature sketch    A small hand-drawn sketch that shows how methods in a class use other methods and instance variables. Feature sketches can be useful when you are trying to decide how to break apart a large class.
« Prev 1 2 Next »