-
Notifications
You must be signed in to change notification settings - Fork 0
AOC-024: Day 7: The Sum of Its Parts #71
base: master
Are you sure you want to change the base?
Conversation
… multiple times with same result
… multiple times with same result
# Conflicts: # src/main/java/org/basseur/adventofcode/advent2018/days/day07/Day07.java
* | ||
* @return time it takes to complete all the tasks | ||
*/ | ||
private int determineTime() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This of course is like a "doMagic()" method. Although I am sure that it does what it is supposed to do, it is way to long for somebody to understand who is reading the code for the first time. Not because it is not good to read and not well structured, only because of the underlying complexity of what it does.
Also, consider what would happen if we refactored it? The test would break if we make a mistake, but we would not have a clue about why - or do we (also because we don't test it since it is a private method=?
To improve this, I would attempt to make it testable. For that, maybe moving it to a new class would be the first step, and splitting it into smaller, simpler methods. Then testing each of them in the new class.
If you feel that you have to test a private method, it has gotten too complex/large and something is wrong by design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right.. hmpfgrmbl. ;)
Day 07 has been completed!