How do you decide what should be a class versus what should be an attribute when modeling a real-world system?
Last updated
Make it a class if it has its own behavior, rules, identity, or lifecycle, or groups related data that travels together (e.g.
Address).Make it an attribute if it is a simple descriptive value (name, count, color) with no meaning apart from its owner.
Promote an attribute to a class once it sprouts rules and related data (avoid "primitive obsession").