I am fairly new to using patterns and although I understand some of them to a point I find it difficult to work out which one(s) to use in a particular situation.
I am trying to wrap up an existing db schema into a number of objects and am not sure if I should simply be using inheritance or a mixture some patterns
I have an options table, holding the base properties for an item thus:
id type code name
These options also has availability - stored in another table
id (from option table) fromdate todate
and prices in another table
id (from option table) validfrom fromdate todate price
and lastly a booked table this time keyed on the option id and the person who has booked it
id (from option table) personid bookedPrice
Just to add more into the mix, there are also a couple of particular option types which have additional properties that are unique to them. Thinking maybe I should use inheritance for the most part - as the price/availability bits are used for ALL option types and then decorate the unique options with these extra bits in those particular cases.
So in different circumstances this data will need to be loaded into various objects I wonder if its best to inherit from the base option - making an AvailabilityOption and a PricedOption etc and extending the base option like that or decorating the base option with the extended properties.
Not sure if there is enough information here to answer that. I wonder if someone could explain the benefits and pitfalls of each so I don't end up getting myself into a cul de sac?