Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any difference between UML Use Case "extends" and inherance?

Tags:

oop

uml

Or the "extends" is a use case inheriting another?

--update

Just a clarification, I've read books and made a lot of diagrams. But I just can't see any difference between extends on UML and on inherance. As Bill said, UML extends indicates optional behavior, but in inherance either you get new behavior you can or not use. So, what's the difference?

like image 516
The Student Avatar asked Sep 24 '10 20:09

The Student


4 Answers

I think in UML the difference is in that "extends" is based on extension points, which means there has to be a named point in the use case where the extension will be applied. The semantics are not very precise about this. Inheritance for use cases means changing some behaviour, not exzactly specifying where.

Another important point is about the inheritance and the Liskov substitution principle. You should be able to use one use case, which inherits from another, in any place you can use the another one. This does not hold for the way "extends" is understood. When one use case is extended by another, it means that one might be modified by another, but still it contains the main scenario path, which might be forked and joined by the extending use case. This is, I think, about the difference between structural and behavioural inheritance. Inheritance is about achieving the same goal and satisfying the same interests - same responsibility and behaviour constraints, where extension is about modification of the structure of the path of scenario, which might be triggered by additional interests - like error checking.

Inheritance actually is not a very good mechanism to be used for use cases, combined with actor inheritance, which makes more sense, it can lead to unwanted paradoxes. Following the advice of Alistair Cockburn (Writing effective Use Cases), inheritance should be used only for expressing variations in technical details or data formats for a particular use case.

like image 142
Gabriel Ščerbák Avatar answered Oct 19 '22 07:10

Gabriel Ščerbák


This is very similar to inheritance. See a detailed description of this concept here.

Enjoy!

like image 25
Doug Avatar answered Oct 19 '22 07:10

Doug


In the tool I use in my company we have modeling restrictions.

Inheritance: From Actor to Actor, from UseCase to Usecase, from System to System. You can't have other inheritances in your diagram because I got a forbidden sign.

Extend can only be done between two Usecases and not between other elements.

I don't really see the difference between inheritance and extends between two usecases. I will keep on reading the next posts because after reading all answers I still don't understand:-)

like image 2
UML GURU Avatar answered Oct 19 '22 07:10

UML GURU


Extends is used to add additional, optional, behavior to the use case that is being extended, but does not change any of the behavior in the base use case.

An inheriting use case would replace one or more of the behaviors of the inherited use case. In other words changing the behavior of the base use case, rather than simply adding new functionality. Note that use case inheritance is not quite the same as class inheritance.

See this article.

like image 2
Bill W Avatar answered Oct 19 '22 08:10

Bill W