-6

Description

Its a follow up question of writing use cases.

Taking from nouns defined in my user story and requirement I found the following candidates to be classes:

  1. User
  2. Question
  3. Session
  4. Attempt/UserAnswer
  5. Score
  6. Category/Topic
  7. Hint

I think the following relationship holds between these objects:

  • User (o2m) Session
  • User (o2m) Attempts
  • User (m2m) Question
  • Question (m2o) Category
  • Question (m2m) Attempt
  • Question (o2m) Hint
  • Attempt (o2o) Score
  • Session (m2m) Question

Questions

  1. Do I need to declare collection type for each objects like Users, Questions, Sessions and Attempts?

  2. How to identify the object relationship between class of objects defined above? and who is the owner of the relationship?

  3. Is it a good idea to find behaviours after finding object relationships?

  4. Am I on the correct level of abstraction? or missing any class?

CodeYogi
  • 2,186

1 Answers1

2
  • ad 1: not if your programming language provides you with generic collections you can use for any of your classes

  • ad 2: you analyse your use case description and see how those objects are related. It seems you did this already, so do you really have a question here? "Ownership" is not important at that level of abstraction, you should not worry about it before you start implement some use cases in code. Then it is early enough to decide if, for example, a User needs a collection of Sessions, or each Session needs a reference to its User, or both.

  • ad 3: it is IMHO better idea to start soon with some coding and implement a first small feature or spike, then you will find out which behaviours your objects need.

  • ad 4: after your final edit, your list seems pretty complete. But this is an example invented by yourself, so only you know if it is complete "enough".

As a general recommendation: do not overanalyse this case, better start getting into the cycle "analyse a little - implement a little - test a little - refactor". This brings you likely much more feedback about your design than anything we can tell you here.

Doc Brown
  • 218,378