So, how do you design a class to represent a particular real world entity?
Two alternatives among lots of possible strategies:
Firstly, define properties of entity (ask which information should be stored.). Then create required getters/setters. Find associations with other entities. Finally add operations for extra business logic.
Firstly, define which information the entity should provide (design an interface including only getters). Then decide how the class provides required information. (Implement the interface and add some operations with side effects.) You may create properties and setters, you may calculate return values. (Create a public operation calculating desired info), etc.
For example, let's consider Student entity. It has name, id, etc. A student attends some courses. He enrolls courses with some limitations and he takes grades. You want to get his academic transcript.
Now, how do you start to write a
Student class. What are your considerations? How do you make sure that the class complies requirements?