“This code is a tangled mess” complained Mark. “I have no idea how I’m going to get it under test. I really want to test this one private method in here, but it is difficult to get at. Maybe I can just make it public.”
“Well,” replied Danielle, “what’s the method called?”
“Okay, what’s the class?”
“Huh,” said Danielle, “it sounds to me like that class is doing too many things. Is it a pass checker or a start date calculator?”
“It’s both. We need the start date to check if the pass is valid, so it makes sense that they both live in the same class.”
“Okay, well which class would have to change if we added a new type of pass?”
“Probably the PassValidationChecker ...
With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.