Re: difference between extends and generalization in Use case diagrams?



The extend relationship exists where one use case optionally has its
behavior inserted into another. The extend relationship defines one or
more extension points within the extended use case and a condition.
When the first extension point is reached, the condition is evaluated
and the decision is made to insert the actions of the extending use
case or not.

The generalization relationship is good old fashioned inheritance. It
represents a taxonomic (eg "is a") relationship. In this case, the
specializing use case provides more specific actions that correspond to
the actions of the use case, but are special cases of those actions.

Ultimately, I think the difference here is comparable to the difference
between inheritance and composition of objects, just applied to use
cases. An extending use case may be reusable in ways that don't depend
on the extended case. For example, a retailer might extend a "make
payment" use case with "apply for credit card". The latter use case
need not be tied solely to the "make payment" use case.

The generalization relationship between use cases is under used in
practice, probably because there aren't many examples out there showing
how to use it. An example of this would be "make payment" generalizing
"make payment by check", "make payment by credit card", "make payment
by gift certificate" etc... Each of these specializations accomplishes
the actions of "make payment".

I personally, think generalization use cases are very useful, because
they allows you to outline a generic set of actions before enumerating
special cases that need special treatment. To use an extend
releationship, the extended use case has to identify the extensions,
including which use cases, the extension points, and the conditions.
Not so with a generalization. If tomorrow the system requirements
change so that payment via paypal is accepted, I do not have to rewrite
the "make payment" use case.

The biggest problem that prevents wider use of generalization is that
it seems hard to figure out a good way to document it when writing out
the use case steps in the typical actor action / system response
format. Some authors suggest a "do one of the following" step in the
general use case. I think that defeats the whole purpose of allowing
the parent not to care about what children exist or whether they even
do exist. I just imagine a "select payment type" question that will be
added at design time (or runtime via deployment descriptors, etc...) to
allow navigation to the use cases that specialize "make payment".

In UML 2.0 there are three kinds of directed relationships between use
cases: extend, include, and generalization. I actually think that
include is a special case of extend (occuring where the condition is
always true). These relationships have been revised several times, and
I still think they are somewhat confusing.


rohan_from_mars wrote:
> Plz tell me the difference between extends relationship and
> generalization relationship. i think they are almost same.

.



Relevant Pages

  • Re: Use case generalization?
    ... redundancy and kept the primary use cases more manageable. ... I'm looking to avoid the use of ... already provided by include and extend. ... wasn't missing something about generalization. ...
    (comp.object)
  • Re: Use case generalization?
    ... Any opinions for or against using use case generalization ... > an extend relationship, ... HTH, ...
    (comp.object)
  • Re: Bipedality
    ... Bipedalism is merely an extension of extensionism. ... All animals ... extend themselves in one circumsance or another. ...
    (sci.anthropology.paleo)
  • Re: Design for Extension
    ... Actually I think "Design for Extension" can work very well with XP. ... extend a class, you cannot just make a subclass and override a method; ... you need to refactor the base class and add an extension hook somewhere ...
    (comp.lang.java.programmer)
  • Re: Design for Extension
    ... Actually I think "Design for Extension" can work very well with XP. ... extend a class, you cannot just make a subclass and override a method; ... you need to refactor the base class and add an extension hook somewhere ...
    (comp.lang.java.programmer)