[Home] [By Thread] [By Date] [Recent Entries]
On Mon, Nov 23, 2009 at 7:46 AM, Costello, Roger L. <costello@m...> wrote: > The OO form frames ones thoughts in this way: > > Â Book stores contain a collection of Book objects > Â and Magazine objects. The Book and Magazine types > Â inherit from an abstract Publication type. > Sorry but this is wrong. Bookstores do not *contain* a collection of Book objects. It seems you have now spent so much time with XML, that XML has colored your thinking to the point where you try to fit everything into an XML model. What you describe is an XML description. Don't worry. It happens to everyone. It's just that I'm used to seeing people try to force XML to fit the OO or relational models instead of the other way around. :-) The OO description is that a bookstore contains a *pointer* to a collection of Book objects. Very rarely would a bookstore object actually contain the books. The distinction is subtle, but critical most especially when attempting to serialize object graphs into XML trees or relational tables. Two different bookstore objects can have pointers to the same books. However, two different bookstore elements can't contain the same books. Trees are a restricted subset of graphs, and this is why naive approaches to serialization are doomed to fail. (Sophisticated approaches to serialization are also doomed to fail, but for more complex reasons.) -- Elliotte Rusty Harold elharo@i...
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |

Cart



