Answer the question
In order to leave comments, you need to log in
What is the difference between "Generalization", "Implementation" relationships and "Implementation" on a UML class diagram?
I can't figure out how (and if there is) a fine line between the following types of relationships in a UML class diagram:
Answer the question
In order to leave comments, you need to log in
The interpretation is not entirely correct, I will now state my opinion, and comparing our views is not an easy task)) The main problem is the difference between concepts in UML and OOP.
In general, by definition : On the client side, each specific class has: an interface (which consists of methods, properties and other language pieces) and an abstraction (this is some kind of behavior that is implied when interacting with its interface).
generalization. When classes have the same behavior, it turns out that their interfaces can be reduced to a single one - to generalize. A generalization diagram shows the similarity of some aspect of the behavior and the absolute similarity of the interface.
Realization.When part of the behavior of an object is taken out in a separate class, this is called an implementation. In programming, this technique is usually called delegation, but the UML seems to think otherwise.
implementation. In UML terminology, this just means the decomposition of an object into its component parts. In programming, this term means something completely different…
This is very entertaining ... I have never dug so deeply, and now ...
Even in Russian, “realization” and “implementation” are translated as implementation - I kind of knew this, but I have not seen such a division anywhere in the literature. Searching for "realization" on the wiki also did nothing, which is already alarming. But about implementation it is written that this is realization :)
“Implementation is the realization of an application, or execution of a plan, idea, model, design, specification, standard, algorithm, or policy.”
Okay, I think it's the same thing.
Then we have that generalization is just inheritance, it does not matter whether it is from an abstract class or not.
Implementation is an implementation of an interface (or a purely abstract class).
So, I don't know what to say about the first question, but I expressed my opinion.
On the second, it is possible, with some clarification, that this will be implemented (realized, implemnted) already by a real method, which simply could not be implemented in the interface simply because it is an interface.
According to the third, there will be just a few connections, depending on the type - for example, if several interfaces are implemented, then there will be several “implementation” connections, the same applies to generalization.
According to the fourth, if a vlass extends the abstract and does not implement anything itself (i.e., it is also abstract), then there simply cannot be an implementation (implementation, realization) - i.e. here is purely generalization. And if something is actually implemented, then we can talk about implementation (realization).
1) Like implementation, this is the implementation. The concept of inheritance and implementation seems to be correct.
2) Well, both of these relationships are relationships at the object level, but whether realization can be considered a subtype of the generalization relationship, I will not answer you.
3) I think generalization.
4) It seems to me not, since generalization is used, the state is inherited too.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question