Currently, I'm working on construction of relationships between classes.
Consider the situation.
We have a working shift. It's duration is 24 hours. A shift has many properties, for instance: IsOpened, IsOver, RevenuePerSession and so on.
Okay. The state is stored in a special device called M100. It has independent memory and it's own low-level interface of interaction.
A shift, truly, shoud be synchronized between M100 and a fiscal registrator (FR - it is a device in several countries which is used to track all financial operations and is forced and controlled by the government). Lay it down as an axiom. Okay.
It's pretty obvious that we must implement two classes which will interact with a fiscal registrator and M100.
We have a Shift class in our domain.
Where should reside OpenShift, CloseShift methods? In FR? In M100? In some kind of synchronizer only? In FR and M100 and synchronizer? I should add that occasionally (and we can't avoid that) we face FR and M100 unsynchronized and in this case we should give a user the ability to synchronize them by hands (explicitly using UI). By the way, FR has it's own independent memory store.
Ha-ha, pretty interesting task, yes?)))
Ok, let's go further.
M100 is a card reader. It can read MIFARE cards, for instance. We have card dispensers. Card dispensers can capture a card given by a user. Card dispenser capture a card abd move it to the position from which M100 can read a card through the external antenna (it has three antennas: internal antenna, external 1 and external 2. The last two antennas are placed above the place to which card dispensers move a card for reading.
The question is where should reside ReadCard method? In CardDispenser class? In M100 class? Should M100 know about card dispensers directly or indirectly?
I'm looking forward for a very interesting discussion :)