Created
July 31, 2012 23:47
-
-
Save brianstorti/3221767 to your computer and use it in GitHub Desktop.
Working effectively with legacy code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unit tests run fast. If they don't run fast, they aren't unit tests. | |
A test is not a unit test if: | |
- It talks to a database | |
- It communicates across a network | |
- It touches the file system | |
- You have to do special things to your environment to run it (such as editing config files) | |
-------------------- | |
Dependency is one of the most critical problems in software development. Much legacy code involves breaking dependencies so that change can be easier. | |
The legacy code dilemma: When we change code, we should have tests in place. To put tests in place, we often have to change code. | |
-------------------- | |
When you have to make a change in a legacy code base, there is an algorithm you can use. | |
1. Identify change points | |
2. Find test points | |
3. Break dependencies | |
4. Write tests | |
5. Make changes and refactor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment