• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

UML: generalization vs. extend use case

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

From an online tutorial:

A use case generalization shows that one use case is simply a special kind of another.



An extend relationship indicates that one use case is a variation of another.



I don't know, but both these definitions look the same to me. Can you help me understand what is the difference between generalization and extend?

Thanks.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Joseph Sweet:
I don't know, but both these definitions look the same to me. Can you help me understand what is the difference between generalization and extend?



It's a matter of direction. For an extension you are looking from the basic to the derived (from the general to the more specialized). For a generalization you are looking from the specialized to the more general.

So generalization and extension are opposite views of the same thing.

Quite often you are dealing with multiple similar cases and you are looking for the commonalities between them - you are looking for a generalization. Then later you discover more cases an add them as extensions of your generalization.

Commonality-variability analysis
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know... two problems with your answer:

1. So you say it's the same thing, but from different directions. So I build a diagram, and if I put the arrow this way then it's extend, but if I put it that way then it's a generalization? Seems weird to me.....

2. Look at the image in the link.... "Pay Bill" is the super case (the general case). Both "Defer Payment" and "Bill Insurance" are special cases of that case.... but you reach from "Defer Payment" to "Pay Bill" by saying "Defer Payment extends Pay Bill", while you reach from "Bill Insurance" to "Pay Bill" buy saying "Pay Bill is a generalization of Bill Insurance".... So even the arrows are at the same direction, because the titles on the arrows match to inverted sentences in English.....
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Should have looked at the diagram to get those neurons firing again.

The generalization is "more like" inheritance. The parent captures the commonality of the children - the parent could be abstract. Each child is a full description of a use case.

An extend is more like a "plugin" or "module" that plugs into the extension points of the base use case. So to get the full extended use case you have to look at "base + extend". The base case can specify multiple extension point names - the extension can then insert segments into these extension point to modify the behavior of the base case.

Then there is also the "include" which typically is a fragment can be shared between multiple use cases.

Agile Modeling: Use Case Reuse

Frankly, use case diagrams are of limited usefulness � they just serve as an overall map of your use cases.

UML for Java� Programmers (amazon US) p.66:

Of all the diagrams in UML, use case diagrams are the most confusing, and the least useful. With the exception of the system boundary diagram, which I�ll describe in a minute, I recommend that you avoid the them entirely.



If you have to expend any effort on use cases (instead of User Stories) you should focus on the text-based use cases:

Alistair Cockburn: Use case fundamentals
Alistair Cockburn: Structuring use cases with goals
Writing Effective Use Cases (amazon US).

Unfortunately text-based use cases aren�t as pretty as use case diagrams
[ September 25, 2007: Message edited by: Peer Reynders ]
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Peer Reynders:

UML for Java� Programmers (amazon US) p.66:



That chapter is actually available online: http://www.objectmentor.com/resources/articles/Use_Cases_UFJP.pdf

And it has this to say on use case relationships:


Use case relationships fall into the category of things that �seemed like a good idea at the time�. I suggest that you actively ignore them. They�ll add no value to your use cases, or to your understanding of the system, and they will be the source of many never ending debates about whether or not to use �extends� or �generalization�.

 
reply
    Bookmark Topic Watch Topic
  • New Topic