Very simple OOP question

Posted by Mosty Mostacho on Programmers See other posts from Programmers or by Mosty Mostacho
Published on 2014-06-08T18:26:57Z Indexed on 2014/06/08 21:39 UTC
Read the original article Hit count: 325

I was creating and discussing a class diagram with a partner of mine. To simplify things, I've modify the real domain we're working on and made up the following diagram:

one

Basically, a company works on constructions that are quite different one from each other but are still constructions. Note I've added one field for each class but there should be many more.

Now, I thought this was the way to go but my partner told me that if in the future new construction classes appear we would have to modify the Company class, which is correct. So the new proposed class diagram would be this:

two

Now I've been wondering:

  1. Should the fact that in no place of the application will there be mixed lists of planes and bridges affect the design in any way?
  2. When we have to list only planes for a company, how are we supposed to distinguish them from the other elements in the list without checking for their class names?
  3. Related to the previous question, is it correct to assume that this type of diagram should be high-level and this is something it shouldn't matter at this stage but rather be thought and decided at implementation time?

Any comment will be appreciated.

© Programmers or respective owner

Related posts about object-oriented

Related posts about inheritance