8.19 Moving a Method via Mikado
We could consider a WAV snippet, or possibly a WAV snippet writer, as an abstraction of its own. The name of our primary class, WavReader, already suggests that anything to do with writing snippets is an inappropriate responsibility. Further, we are making extensive changes to the snippet logic and want to isolate the changes to a class with smaller scope.
As a short-term Mikado Goal, we want to extract the
writeSnippet
function into its own class, Snippet. Once we complete the immediate goal, we plan to clean the Snippet code considerably. One goal at a time, however.
Given the space constraints of a book, this is a smaller example, but it’s no less real than your regular refactoring challenges. It’s also ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access