Hello all. I'm developing an asset management system in which users can place orders for various items. An administrator then assigns available items to the order which is then dispatched, received, returned etc.
The problem involves two main classes:
OrderItem - Keeps track of when it was hired, for how long etc
Item - Represents a specific item holding location, condition etc which is then assigned to an OrderItem
The problem I have is that OrderItem maintains a state with values such as: awaiting_assignment, dispatched, received, returned etc
It also then has methods such as assign, dispatch, receive which 'push' the OrderItem through it's various states.
My issue is that the above setup just doesn't feel quite right to me. For instance should OrderItem have a method such as dispatch()? Surely this is more suited to Item? Ideally I'd like to have OrderItem register itself as a listener of Item so it's state can change in sync with the Item status but I can't guarantee that both objects will be in memory at the same time. As such I've been using AOP to replicate this behaviour as best I can, loading the required OrderItem when needed and updating it 'manually'.
I apologise if this is turning into a ramble but it's a difficult problem to explain. If any further explanation is required ( which I suspect is highly likely ) I'd be happy to expand.
Any thoughts on the subject would be greatly appreciated
The problem involves two main classes:
OrderItem - Keeps track of when it was hired, for how long etc
Item - Represents a specific item holding location, condition etc which is then assigned to an OrderItem
The problem I have is that OrderItem maintains a state with values such as: awaiting_assignment, dispatched, received, returned etc
It also then has methods such as assign, dispatch, receive which 'push' the OrderItem through it's various states.
My issue is that the above setup just doesn't feel quite right to me. For instance should OrderItem have a method such as dispatch()? Surely this is more suited to Item? Ideally I'd like to have OrderItem register itself as a listener of Item so it's state can change in sync with the Item status but I can't guarantee that both objects will be in memory at the same time. As such I've been using AOP to replicate this behaviour as best I can, loading the required OrderItem when needed and updating it 'manually'.
I apologise if this is turning into a ramble but it's a difficult problem to explain. If any further explanation is required ( which I suspect is highly likely ) I'd be happy to expand.
Any thoughts on the subject would be greatly appreciated