Could someone help me with object-oriented design please? If I have to simulate tokens going through in different stages (from start to end with 3 middle stages) in a process, where a token can be moved from a stage to another at any point (except from end stage backwards), what would be the better design?
- A process class that contains 5 lists:
List<Token>
start,List<Token>
middle1, etc. - A process class that contains only 1 list:
List<Token>
with the Token class having a String stage variable that determines in which state the token is currently.
A process can have unlimited tokens in it at any stages. A token can be moved between stages as mentioned before. And a process can be listed with all of it's tokens in it.
Putting the question in another way: should a token object be aware of its own stage/state/location, or not.
Any other recommendations? Thanks in advance