Friday, February 02, 2007

Analogies for composition and inheritance: zoo and animal kingdom phyla

I was reading "DDD Quickly" the other day when I decided to ask about entities and value objects.  Jo and I are both reading up on UML and DDD, as well as warehouse systems these days and it's really overwhelming so we asked Owie about the concepts like entities, composition, etc.  Before we knew it, both Calen and Owie were teaching us the concepts!  And we were using one of our many whiteboards. (I swear, if an office has a lot of whiteboard, you just got to use them all the time hahahaha.)  Anyhow, we used the warehouse as an example.  More like a thing we could use so that we could understand and relate to the concepts better.

So for inheritance we had a discussion of ceramic products and for the discussion on composition, we discussed the different packages that a company can offer when it comes to selling such products. The warehouse example wasn't quite enough for us to fully grasp the concept.  But considering how Calen drew the UML diagrams, we thought that inheritance could be more understandable to us if we think of it in terms of hierarchy, like in taxonomy.  Having said that, our example became the animal kingdom.  Wherein the concept of inheritance is seen in the different phyla and classes and species, whereas composition was seen in how there are different zoos out there.  In a way, it was kind of funny because the easiest way for us to remember these concepts is by thinking of cute and furry animals ;)  But I think that if you are talking to non-programmers like me and Jo, things have to be quite different so we could have a better understanding and recall of such topics.

No comments:


Blog Archive

The Learner

My photo

a crafty cat who loves food, linux, anime and crafting.

business analyst by day, blogger by night. also a frustrated artist.