November 2024
Intermediate to advanced
300 pages
7h 12m
English
Your loop is a bit easier to read—great! But code in the newly extracted isMatch method has nothing to do with the Profile object itself—it interacts with Answer and Criterion objects. One of those two classes is probably a better place for the isMatch behavior.
Criterion objects already know about Answer objects, but Answer isn’t dependent on Criterion. As such, move the newly extracted matches method to the Criterion record. Moving it to Answer would create a bidirectional dependency with Answer and Criterion objects depending on each other. Such a tight coupling would mean that changes to either type could propagate to the other, which in turn could create other problems.
In IntelliJ IDEA, move the method ...
Read now
Unlock full access