Rollerskate Example
Here is an example of how to draw a class diagram and and object diagram to model the following example
scenario of people rollerskating.
Here's what we want to model:
- There should be people who can rolerskate about a skating rink
- The rink should have a maximum capacity, and should be able to have more people join in
- We should be able to tell if no one is skating
- These people should all have names
- Everyone skating should have on two skates
- skates have four wheels and a color
- the skates also have a color
Here is what the class diagram could look like:
Now imagine that somewhere in the middle of our computation, the a rollerskating rink has ten skaters,
one of whom is named Ellen. Ellen is wearing one green skate and one blue skate. Here is what the object
diagram would look like: