It’s thirty minutes ’till the phone interview I’ve been discussing here, and I’ve once again returned to looking at the diagram I asked about in this post, and I’ve come to the conclusion that, well IMO, it’s flawed. Perhaps this is a fault in my character, but the reason why I’ve been struggling with it is because it’s counter to how I would design the program. Consider the relationships in the diagram given in the problem (and presented in that post) (oh and please correct me if I’m wrong here):
EmploymentContract can have either no Person object or 1 Person object
Person has exactly one EmploymentContract
EmploymentContract has >=0 Company objects
Company has exactly one EmploymentContract
Now, perhaps I’m reading too much into this, and perhaps this is a sign I hang out with too many lawyers (lol), but why would an EmploymentContract contain a Person if an EmploymentContract is a tangible object that a Person can have? An employment contract is an agreement between the employee and the company, and should contain information about the company (and shouldn’t it be ONE company per contract?), how much they’re going to get paid, benefits, whatever. And a person is able to work at one or more jobs, thus Person should be allowed to have >=0 EmploymentContract objects.
Employment contracts should have no knowledge of the people signing them, that should be in another class, perhaps called Employees, which exists for every Company and shows which Person has signed the EmploymentContract for that company. Thus every Company has an EmploymentContract for each type of employee they have (janitors and programmers may want different contracts, heh), so Company has >=1 EmploymentContract objects, and >=1 Person objects.
I’ll post a diagram when I have the time (if there’s even any interest lol), but yeah, all those two-way relationships where relationships shouldn’t exist (IMO)…unnecessarily complicated.

