I'm trying to learn proper object-oriented design, with class relations and avoiding anemic domain models. I'm creating an application to store and retrieve information about "cyberattacks". There are five relevant classes to this question:
- Directory: the class representing the collection of the data indicated below
- Group: a group of attackers known to be related to each other
- Hacker: a person who makes an attack
- Attack: a hacking attack, including information such as severity and cost to repair the damage
- Type: attacks are classified into these types, i.e. denial of service, information leak and so on. These types are entered by the user when they add an attack.
The kinds of questions users of the application will ask are:
Which Attacks have been performed by a specific Hacker? The response includes information about the damage of each Attack, as well as which Type it has.
For a specific Group, which attacks have been made? By whom, and which was caused the highest damage cost?
For a specific Type, which attacks are made? Who did them? What is the total damage cost?
The naive way to solve this would include a lot of circular dependencies between these classes (i.e. a Hacker has Attacks, but Attacks also have Hackers, and a Type has Attacks, but an Attack also has a Type, and so on.) As circular dependencies are unwanted, how would I solve this with proper OO design?