From: Magnus <ma...@th...> - 2003-08-05 22:53:07
|
At 14:18 2003-07-24 -0400, Brad Bollenbach wrote: > > Well, if there's going to be composite keys, that might as well be > > generalized to all the columns (i.e., any attribute could be a composite > > of several columns). > >What's the use case for this? For instance money objects that consist of an amount and a currency. You could make them full objects with an identifier and do: order_line |id |order_id|spec |money_id| +---+--------+--------------+--------+ | 1| 123|Dog collar | 1| | 2| 123|Dog food | 2| money |id |amt |currency| +---+-------+--------+ | 1|12.50 |EUR | | 2|0.34 |USD | But is seems simpler to just do: order_line |id |order_id|spec |price_amt|price_currency| +---+--------+--------------+---------+--------------+ | 1| 123|Dog collar |12.50 |EUR | | 2| 123|Dog food |0.34 |USD | In this case you could say that the price is a value from a design point of view, but an object from a programming point of view. Martin Fowler calls such objects "Value Objects" in the book "Patterns of Enterprise Application Architechture". -- Magnus Lycka (It's really Lyckå), ma...@th... Thinkware AB, Sweden, www.thinkware.se I code Python ~ The Agile Programming Language |