Thursday, January 10, 2013

The Juncture Design Pattern

It's 2 am, but if I don't write this now, I probably won't get to it with the same verve.

Lets imagine we are building an object oriented software system to handle everything a school does.  Students register for a class section.

a one to one relationship.  One college, one president.

many to one.  One teacher, several classes.  Store information about the relationship in the class info.

Now a student can be in several sections, and each section will have multiple students.

many to many relationship.

You can use callbacks, so that the section has a pointer to the student, and the student has a pointer to the section.  But what about information regarding the relationship between the two?  The grade they are getting?

That information deserves it's own object. In the middle, with two many to one relationships.

Or something.  In this example, it's not clear why.  Need to Look up the gang of 4.


No comments:

Post a Comment