I've been searching the web for some time now. I am looking for small sample exercises for OOD practice (& for some internal TDD workshops).
If there is one single place, where this need is being served, please point me to it.. and close this question
Constraints:
- Language-agnostic real world problem
- Small : Something that takes an hour to two at max to solve (or has sub-parts that can fit this constraint).
- Not Algorithm centred : Not be focussed on just solving a computational task. (There are multiple sites that serve this category.) Involve > 2 interacting entities.
- Solved by multiple people, preferably yourself : Goodness verified. Links preferred. Please do not post something that may be a good exercise... subjective
Similar SO question 60109, but the answers dont meet my need here. I found that I've lost my touch (was thrashing ideas) with OOD after prolonged exposure to a day-job. Need to get it back..
Update: Are we collectively out of short OOP exercises ? I was hoping that I'd have a bunch to pick from. However my web-searches (this is a diff exercise in formulating the right search string) and the lack of responses here seem to indicate otherwise. Maybe I posted to SO at a bad time.. in which case bumping this thread for more responses.
Questionnaire Practice Problem
A problem I've worked on in a couple of different jobs is that of writing some generic, data-driven survey/questionnaire functionality. It's not majorly complex, but has enough interesting avenues to be a good OOD practice problem I think. It's definitely real-world and crops up in a lot of places.
You can start off thinking about how to structure a
Survey
. It is obviously made up ofQuestions
, but do you also wantCategories
? Can aQuestion
have subquestions? Can a subquestion have subquestions? How deep can you go?A question probably needs to have potential
Scores
. What types of scores can you have? What types of questions can you have (multiple choice, multiple answer, freetext, etc.)?Once you've got the basic business logic, you can also think about how you display a survey . Maybe you have a
SurveyRenderer
and aQuestionRenderer
? How do you decide how to render different types of questions? (Maybe you use a Strategy pattern... as in this SO question.) How do you render a read-only version of the survey?You can also think about persistence. How do you record responses to a blank questionnaire? How does your object graph of a survey get mapped into a database (or some other backing store), and vice versa?