Skip to content

Commit 73a7906

Browse files
committed
legacy code feathers examples
1 parent 9665a7a commit 73a7906

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

461 KB
Loading

presentation/slides.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,33 @@ Seams: Change the behavior of a program without changing the program. Virtual me
10761076
Sensing Variable: Introduce a variable that can be tested against.
10771077
-->
10781078

1079+
---
1080+
layout: default
1081+
---
1082+
1083+
# Legacy Code
1084+
1085+
## Techniques from Feathers
1086+
1087+
<v-clicks>
1088+
1089+
- **Characterization Tests** — Document current behavior with tests before refactoring
1090+
- **Sprout Method/Class** — Add new code in testable units and call it from legacy
1091+
- **Extract and Override** — Make method virtual, override in test subclass
1092+
1093+
</v-clicks>
1094+
1095+
<div v-click class="mt-8 text-center italic text-gray-500">
1096+
1097+
Working Effectively with Legacy Code — Michael Feathers
1098+
1099+
</div>
1100+
1101+
<!--
1102+
Characterization Tests: Don't test what it SHOULD do, test what it DOES. Capture current behavior as a safety net before making changes.
1103+
Sprout Method: When you need to add a feature, write it in a new testable method and call it from the legacy code.
1104+
Extract and Override: Extract code to a protected virtual method, then subclass in tests to override behavior.
1105+
-->
10791106

10801107
---
10811108
layout: default
@@ -1272,12 +1299,16 @@ h1:
12721299
</div>
12731300

12741301
---
1275-
layout: quote
1302+
layout: default-aside
12761303
---
12771304

12781305
# And Remember...
12791306

1280-
![](./images/meme-code-is-dark.jpg)
1307+
<img src="./images/meme-code-is-dark.jpg" class="h-72 mx-auto mt-4" />
1308+
1309+
::image::
1310+
1311+
![](./images/circle-bugs-insects.jpg)
12811312

12821313
<!-- No matter how much testing is done on each level of the testing pyramid, no system is entirely bug free. -->
12831314

0 commit comments

Comments
 (0)