Conditional class relationship diagram

Asked

Viewed 2,833 times

0

I made a diagram and modeled the Partners class to involve customers, suppliers, service providers, etc., which will inherit attributes from the abstract classes Pessoa->Física or Pessoa->Jurídica. But I’m not sure if it’s right, if one class can choose to relate to two others directly without some sort of condition since it won’t relate to two at the same time. Would you please make a general assessment and tell me if it’s incorrect, which I need to correct?

Diagrama de classes:

1 answer

1


It has no problem to relate to more than one table at the same time, although in this case it is not at the same time, because it is conditional or relates to one or the other.

Data structure is not an algorithm, so the conditional is only in the concept, there is nothing to indicate this.

I cannot say if everything is correct because I do not know the requirements and they are in charge of what is right or wrong. Except for the salario was float that is certainly wrong.

I just disagree with Colaborador be derived from Fisica, Although this is almost lost, almost everyone thinks so, because the examples, wrong, of orientation to objects are always shown like this. Collaboration is just a role that a person plays in the model, it is not a relationship of is a to be inheritance. By the way almost every time you inherit from a concrete class is wrong, at least in domain modeling. Not that this is a golden rule for everyone, but it’s my perception after 30 years of doing this. Rare cases I’ve seen it work and yet it was always possible to inherit from abstractions instead of inheriting from concrete.

I haven’t looked at every aspect of the model.

  • I got it... so I thought I needed some different kind of relationship as some decision structure... I will also edit the salary type for Decimal I will try to understand better about this subject... !!!

  • Here on the website is a lot of information about this. But if you don’t understand you’re using a mechanism you don’t understand, so the right thing to do is to learn more about it before using it, then make whatever decision you want, but because you want it not because you don’t understand it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.