问题
I'm trying to model some requirements and I saw some examples in the web with use cases generalization, but the UML 2.5 standard review doesn't say anything about generalization in Use Case Diagrams, or I can't find it.
So, is generalization supported by standards?
回答1:
Since a UseCase is a Classifier, they can be generalized. The UML 2.5 spec contains an example of this in Fig. 18.11 on p. 686 (the "ATM Services" example).
回答2:
Tricky.
While the Generalization relationship is defined as going between two Classifiers, and a Use Case is itself a specialization of a Classifier, the semantics of the Generalization relationship are primarily focused on Features (eg Attributes). These are inherited, but relationships are not.
On the other hand, the UML specification itself includes an example of use case generalization (2.4.1 Superstructure, fig 16.7, p 609).
Back on the first hand, the same specification omits generalization in table 16.1, "Graphic nodes included in use case diagrams" (p 611-613), but does include the two main intra-use case relationships; Extend and Include.
On the other hand again, the same table includes Actor but excludes the Association between Actor and Use Case.
Sadly, the UML specification is in many respects a horrifying mess, and the 2.5 version is in part an attempt to rectify this.
On balance, I would say no - you can't generalize between use cases.
回答3:
I don't know if use case generalization is "supported" by an official UML standard. But
- it is supported by Kirill Fakhroutdinov's online book (a site that I personally use as "standard" reference) at http://www.uml-diagrams.org/use-case.html#abstract-use-case
- it is supported by the Agile Modeling online book at http://www.agilemodeling.com/essays/useCaseReuse.htm#InheritanceUC
- it is supported by the Sparx Systems Enterprise Architect tool
- it is supported by the Modelio the open source modeling environment tool
So my conclusion is that use case generalization is supported just enough and practically you can use if you need it.
But more usual way to express that one use case is specialization of another use case is (IMO) through the <<extend>> relationship. See http://www.uml-diagrams.org/use-case-extend.html and http://www.batimes.com/articles/use-case-goals-scenarios-and-flows.html (and Wikipedia) for some more detailed discussion
回答4:
As gwag has mentioned, generalization/specialization is indeed included in the use case spec. What's more, there are plenty of situations where it is useful. Here's an example, from this page:
来源:https://stackoverflow.com/questions/25498665/does-generalization-exist-in-uml-use-case-diagrams