Recently I had an interview with dev team in a company. The team uses agile + TDD. The code exercise implements a video rental store which generates statement to calc total rental fee for each type of video (new release, children, etc) for a customer. The existing code use object like:
- Statement to generate statement and calc fee where big switch statement sits to use enum to determine how to calc rental fee
- customer holds a list of rentals
- movie base class and derived class for each type of movie (NEW, CHILDREN, ACTION, etc)
The code originally doesn't compile as the owner was assumed to be hit by a bus. So here is what I did:
- outlined the improvement over object model to have better responsibility for each class.
- use strategy pattern to replace switch statement and weave them in config
But the team says it's waste of time because there is no requirement for it and UAT test suite works and is the only guideline goes into architecture decision. The underlying story is just to get pricing feature out and not saying anything about how to do it. So the discussion is focused on why should time be spent on refactor the switch statement.
In my understanding, agile methodology doesn't mean zero design upfront and such code smell should be avoided at the beginning. Also any unit/UAT test suite won't detect such code smell, otherwise sonar, findbugs won't exist.
Here I want to ask:
- is there such a thing called agile design in the agile methodology? Just like agile documentation.
- how to define agile design upfront? how to know enough is enough? In my understanding, ballpark architecture and data contract among components should be defined before/when starting project, not the details. Am I right?
- anyone can explain what the team is really looking for in this kind of setup? is it design aspect or agile aspect?
- how to implement minimum viable product concept in the agile process in the real world project? Is it must that you feel embarrassed to be MVP?