I have an Order object to represent a Prospective Order/Receipt. This is an entity. It has an identity.
I have a Writer object to read the Order object's properties and display it nicely.
It is a bit of a chore to have individual getters for all the pieces of the Client's Billing Details.
So, I am thinking of letting the Writer object get a Client's Billing Details Value Object from the Order object. (I guess the Client's Billing Details Value Object is called a 'dependency' - correct me if i am wrong)
Now, if I do this, I'd like this dependency to 'know' if the raw persistent data changes
i.e. if countryId changes from '214' to '35'
So that the depency can return the new countryAsPrettyString 'Mexico', say, instead of the old value for 'Ecuador'.
So I guess I would have a factory method in the Order Object and can inject the Order Object into the Client's Billing Details Value Object's constructor so the Billing Details Object always derives it properties from the Order's raw persistent data properties.
Is your reaction to this plan of action:
A: Blimey that's obvious this is pretty much the only way to do it
or
B: My Gosh! Put aside some time for some serious headaches in a few months time - you'll create a tangle of associations - i feel for you.
or C: [Other]
I am asking cos this seems like a bi-directional association to me.
The Order has a Billing Details Object
and
The Billing Details Object has the Order
and i have read that bi-directional associations are bad OOP practice.