November 2024
Intermediate to advanced
300 pages
7h 12m
English
The Profile class defines two responsibilities:
To improve your system’s design, you’ll split responsibilities into two classes, each small and adherent to the SRP. To do so, you’ll extract the code related to the profile-matching behavior to another class, Matcher. As with all refactoring, you’ll take an incremental path—make a small change and then run the tests to make sure they still pass.
For your first change, move the calculateScore logic into Matcher. Start by changing the code in matches to declare your intent: rather than call calculateScore directly from matches, construct a new Matcher object with the ...
Read now
Unlock full access