Sunday, July 15, 2007

M359 - Oh no - its back to front!

I have just made a startling discovery....all through this course I have been mis-reading E-R Diagrams with regards to participation. I just don't believe it. Take a diagram that has two entities and lets call them Teacher and Student. Now, suppose there is a relationship between them such that a Teacher can teach many students and a Student can be taught by many teachers. Seams reasonable. Lets also assume that not all teachers are always teaching - sometimes that will take time out to research (I have a friend who is a Professor of Law. Sometimes he has PhD Students to supervise, othertimes he is researching and writing books and has no students). So there is a many-to-many relationship but the participation is different at each end - for Teacher it is optional but for Students it is mandatory (otherwise they are not students). So far, so good. The error that I have made to date is to think that the symbols for participation, which on this course is an open or closed circle, went at the end of the relationship that also give the degree of participation. What I have done in the past is to place the symbol at the end that also shows the degree of participation - but what I really should have been doing is placing it at the end adjacent to the entity type that it relates to. Thus, if the Teacher entity type has an optional participation, then the open circle goes at the Teacher end. It seems so &%**"~ obvious now that I find it hard to believe that I thought it was different from that.

(Yes, I know that Students sometimes take a gap-year, so in that period they don't have a teacher - but I guess that they are still students. But that doesn't alter the main point of me realisation!)

1 comment:

Simon said...

Just to reply to my own posting....it seems that this is all tosh. From the Teacher point of view, it is optional whether they have any Students. The Open Circle (to indicate that it is optional) still goes at the Teacher end of the relationship but it indicates that it is the Student (at the far end) that it optional.

Similarly, at the Student end there will be a filled in circle (to indicate Mandatory participation) because the Student HAS to have a Teacher - so it is the Teacher that is Mandatory, but the symbol for that goes at the Student end of the relationship.

Clear as mud!

Blog Watch