20

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:

  1. Language-agnostic real world problem
  2. Small : Something that takes an hour to two at max to solve (or has sub-parts that can fit this constraint).
  3. Not Algorithm centred : Not be focussed on just solving a computational task. (There are multiple sites that serve this category.) Involve > 2 interacting entities.
  4. 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.

Community
  • 1
  • 1
Gishu
  • 134,492
  • 47
  • 225
  • 308
  • 1
    There is no such thing as "the correct solution" when it comes to real world problems. –  Aug 21 '09 at 07:30
  • 1
    @Neil Doesn't need to. The intent is to experience and study the process of arriving at a solution. – Gishu Aug 21 '09 at 11:53
  • I'm the second one here looking for the same, have you found anything of sort eventually? – user3357257 Apr 02 '20 at 09:16

7 Answers7

3

http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata

Gishu
  • 134,492
  • 47
  • 225
  • 308
2

http://schuchert.wikispaces.com/Monopoly%28r%29

Gishu
  • 134,492
  • 47
  • 225
  • 308
2

Jeff Bay's Object Calisthenics. Following these will improve your OO skills.

kyoryu
  • 12,848
  • 2
  • 29
  • 33
  • 1
    These seem to be rules of thumb or guidelines for better OO design. I am looking for short problem statements or scenarios to try and model in an OO manner – Gishu Aug 21 '09 at 09:42
  • I see what you're saying, but they're generally presented as a set of rules to follow in the context of a ~1000 line program - developing in this manner, regardless of the problem being solved, will help your design skills. I think that for really learning, the specific problem is not as important as forcing yourself to learn new techniques in solving it. – kyoryu Aug 22 '09 at 07:30
2

Bill Wake's spreadsheet TDD challenge

Community
  • 1
  • 1
Gishu
  • 134,492
  • 47
  • 225
  • 308
1

Dave Thomas' CodeKata

Kindness,

Dan

Daniel Elliott
  • 22,647
  • 10
  • 64
  • 82
  • Any specific kata you had in mind? A majority of the exercises are focussed on developing your algorithm thinking & programming skills - except the supermarket pricing one.. which is good. – Gishu Aug 21 '09 at 09:38
  • Doing the BinaryChop exercise is a favourite of mine. The examining different approaches part is what keeps me coming back to it. I try to do it for a week or so every couple of months. Kindness, Dan – Daniel Elliott Aug 21 '09 at 10:26
1

From the AGPPnP book by Robert Martin aka UncleBob
CoffeeMaker Mark IV - Page 2 has the problem statement

Gishu
  • 134,492
  • 47
  • 225
  • 308
1

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 of Questions, but do you also want Categories? Can a Question 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 a QuestionRenderer? 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?

Community
  • 1
  • 1
ngm
  • 7,277
  • 1
  • 53
  • 62