Skip to content


March 22, 2010

Does a blog have posts?

It’s not a stupid question. The answer may seem obvious but when modelling object-oriented systems even seemingly obvious questions may require closer examination.

In this case, for example, I’d suggest that there isn’t a HAS-A relationship between a Blog and a Post. Why? Because a Blog is just one possible way, out of many, that a person might use to get their hands on Posts. You might also use an Author, Category, a Tag or even a plain old Date object to get Post objects.

Sure, some of these relationships aren’t as central as the others. But is the relationship between Blog and Posts really any more “primary” than the relationship between Author and Posts? I’d suggest not. And since the HAS-A relationship should be unique — Blogs and Authors can’t both HAS-A Post objects — I’d propose neither does.

The fact that there are so many different ways to get to Post objects suggests that the concept of a Post is in fact more important than any of the other concepts — like Blog, Author, Category, Tag and Date — that can be used to group a collection of Posts. That is these other concepts are secondary to Post precisely because they’re all just different ways of organizing the universe of Post objects. The relationship between Blog and Posts might then best be understood as an ORGANIZES-A relationship than a HAS-A relationship.

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: