Author Topic: Include or extend?  (Read 6945 times)

Bill Egge

  • EA User
  • **
  • Posts: 93
  • Karma: +0/-0
    • View Profile
Include or extend?
« on: April 15, 2005, 12:27:01 pm »
I am new with UML and having a little difficulty determining between including and extending a use case.

Take these 3 cases.

1.  A use case named "Manage Employee", then 2 other use cases named "Create Employee", and "Update Employee"

Do Update and Create Extend  Manage Employee, or are they included in Manage Employee?

2.  I created a report builder.  I have discovered I need to add some debugging features to it.  So, I create a use case named "Debug" and then 2 other use cases named "View XML", and "View script field results".

Do these extend or are they included?

3.  Suppose I have a use case for reading a book named "Read Book", and then 1 use cases named "Turn Page".  Is this use case included in read book?

My guess is that the difference between extend and include are the fact that the "main" use case can or cannot functionally exist without the other use case.  If it cannot, then the other use cases are included, else the other extend.

Is that right?




Bruno.Cossi

  • EA User
  • **
  • Posts: 803
  • Karma: +0/-0
    • View Profile
Re: Include or extend?
« Reply #1 on: April 15, 2005, 12:38:10 pm »
Hi Bill,

to start with, you should re-think what do you consider a Use Case.
For example, Turn Page does not sound like a Use Case to me. Use Case by definition represents an interaction between the actor (Reader?) and the system, and provides something of value to the actor. Would someone say "I want to be able to turn a page"? Likely not, they would say "I want to be able to read a book". Read Book would be a Use Case, but Turn Page would not, Turn Page is merely one step in the scenario that describes the details of Read Book.
It seems that you are going the functional decomposition route, trying to break the use cases down to elementary discreet tasks. As a result of that, your use cases lose the meaning they carry, and the final use case diagram won't be clear and readable.
If you re-visit your list of Use Cases, most (not all) of your need for inclusion/extension will go away. Do not try to connect all Use Cases together no matter what, in Use Case diagram it is not necessary.

Hope this helps!
Bruno

Quote
I am new with UML and having a little difficulty determining between including and extending a use case.

Take these 3 cases.

1.  A use case named "Manage Employee", then 2 other use cases named "Create Employee", and "Update Employee"

Do Update and Create Extend  Manage Employee, or are they included in Manage Employee?

2.  I created a report builder.  I have discovered I need to add some debugging features to it.  So, I create a use case named "Debug" and then 2 other use cases named "View XML", and "View script field results".

Do these extend or are they included?

3.  Suppose I have a use case for reading a book named "Read Book", and then 1 use cases named "Turn Page".  Is this use case included in read book?

My guess is that the difference between extend and include are the fact that the "main" use case can or cannot functionally exist without the other use case.  If it cannot, then the other use cases are included, else the other extend.

Is that right?




http://wiki.eausergroup.org - WIKI for all things EA

Rob_M

  • EA User
  • **
  • Posts: 58
  • Karma: +0/-0
    • View Profile
Re: Include or extend?
« Reply #2 on: April 15, 2005, 05:01:27 pm »
I would suggest read a book, specifically
"Writing Effective Use Cases by Alistair Cockburn.

He deals with the include/extends this way, quote

"If you spend much time studying and worrying about the graphics and the relations you are expending energy in the wrong place. Put it instead into writing easy-to-read prose. In prose, th relation between use cases are straightforward, and you won't understand why other people are getting tied up in knots about them.

... a panel at OOPSLA '98 ... a series of questions surfaces around the difference between includes and extends and the trouble with the exploding number of scenarios and ellipses. Bruce [Anderson] stated that his groups don't run into scenario explosion and the don't get confused. [because he said] "I just do what Alistair said to do," which is to spend time writing clear text and staying away from extends, and not worrying about diagrams"

Good advice I would say.

Rob

thomaskilian

  • Guest
Re: Include or extend?
« Reply #3 on: April 18, 2005, 01:21:30 am »
The summary of Bittner et al.: Writing Use Cases is synthesis (putting things together) not analysis (dividing them up). Take this as essence and it will really bring you forward.

slavko

  • EA Novice
  • *
  • Posts: 17
  • Karma: +0/-0
    • View Profile
Re: Include or extend?
« Reply #4 on: April 18, 2005, 02:04:20 am »
Without getting into the merits of your example use cases try the below test to easily distinguish between a include and extent and/or inheriting associations.


-Use the “Is Like” Rule to test an extend and inheriting association:
•The sentence “the [inheriting/extend use case name] is like the [parent use case name]” should make sense.
•When attempting to do this with include association the sentence will not make sense.
•Same rule can be applied to actor inheritance.
•The sentence “the [inheriting actor name] is like the [parent actor name]” should make sense.


It harder to describe the difference between inheriting and extending associations and that may a much longer topic of discussion.  

I would also discourage the use of all three of the associations whenever possible, since not many people reading them will know what they mean.

-Slavko

Bill Egge

  • EA User
  • **
  • Posts: 93
  • Karma: +0/-0
    • View Profile
Re: Include or extend?
« Reply #5 on: April 18, 2005, 06:00:49 am »
Thanks,

Is there a concise definition of extends and include instead of explanatory descriptions?


thomaskilian

  • Guest
Re: Include or extend?
« Reply #6 on: April 18, 2005, 06:32:35 am »
Read 16.3.3 and 16.3.5 of UML 2.0 Superstructures.

alexj

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Include or extend?
« Reply #7 on: April 20, 2005, 08:02:25 am »
Bill,

1. You need to choose a concise definition of Use Case first. There are different oppinions, not all of them work. Get trained, or get a really good book.
2. Use the definition of Extension that comes with your definition of Use Case.

As a preliminary answer, you can use extension when one Use Case "causes" another, but does not "include" (i.e. readin with "include" sounds odd).

Comments:
Cockburn's book is great for _writing_ Use Cases. Although a must if you try to get your own understanding of Use Cases, it does not provide good _diagramming_ guidelines.

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: Include or extend?
« Reply #8 on: April 20, 2005, 03:35:07 pm »
On my planet...

"extends" means that the extended use case may optionally under some circumstances include the dialogue specified in the extension use case.

"includes" means that the base use case dialog is extended at certain points by the dialog specified in the included use case.

Is that perfectly clear  :-X

OK - "include" is a sort of subroutine dialogue that must occur in the dialogue of the base use case, includded use cases normally  are (but not always) included in more than one use case.  Its a way of specifying common dialogues.  However, in high-church UML the included use case should be capable of stand alone occurrence.

Extend is something different.  Consider..

UC1: Take customers money.

UC2: Sell burger
UC3: Sell fries
UC4: Sell burger and fries


UCs 2,3 and 4 all <<include>> UC1

UC4 can be represented as a simple use case that includes   both UC2 and UC3, or it can be represented by having a UC2<---- <<extends>> ---- UC3 (if we only ever sell fries with a burger), or
UC3<---- <<extends>> ---- UC2 (if we only ever sell burgers with fries).

We could model
                       <---- <<extends>> -----
UC2                                                                                                                                                                                                                                  UC3
                        ----- <<extends>> ----->

but I severely doubt whether this would add clarity to the model.

hth
bruce

... and they said that Arts degree was useless ;)
« Last Edit: April 20, 2005, 04:00:15 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

alexander

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Include or extend?
« Reply #9 on: April 22, 2005, 06:02:11 am »
Quote
Thanks,

Is there a concise definition of extends and include instead of explanatory descriptions?



Search for 'extend' or 'include' in the EA help, they include the UML specification definition for terms like those.

On another note, i try to distinct 'include' from 'extend' with a 'purposse' question. If the use case wich will include or extend the other functionality is fullfilling the same purpose as the original one but with an additional process i use 'extend' but if the purposse of the second use case is entirely different from the original one, and is in fact, another business function, i use 'include'.

fballem

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Include or extend?
« Reply #10 on: April 25, 2005, 05:07:18 pm »
On a recent project, where we were using UML for the first time at this client site, we adopted the following convention:

1/ A Use Case was a full description of a process that provided some tangible business benefit to the user (such as "Register a Customer", "Do Compliance Check", "Transfer Customer Data to X System"). These were not functional decompositions, but descriptions of full processes.

2/ A Use Case was included in another (the Base Use Case) if the Base Use Case if the Included Use Case described a business process that was required in the Base Use Case. For example, one of the requirements for registering a customer is that a compliance check needed to be performed before the customer could be registered. In this case the Do Compliance Check would be diagrammed as an included use case with Register a Customer.

3/ A Use Case extended another if it added additional functionality to the Base Case. In our case, once a Customer was registered, the data had to be transferred to a lot of individual systems. So, the Transfer Customer Data to X System (all of them) were diagrammed as Extended Use Cases to the Register a Customer Use Case.

4/ The only exception was the Login Use Case, which is traditionally included in those Use Cases where specific credentials were required (Logging into a System does not normally provide a tangible business benefit to the User).

Identify the Use Cases first, making sure that they provide a tangible business value. A Use Case should stand on its own, and so must be written at a relatively high level. Once that is done, then look at the Use Cases to determine if there are relationships (Include or Extend). We found it much easier to do this way, since it kept the Use Cases to a manageable number. More importantly, our Users found it easier.

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: Include or extend?
« Reply #11 on: April 26, 2005, 01:32:28 am »
quot homines, tot sententiae ...

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6319
  • Karma: +109/-91
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Include or extend?
« Reply #12 on: April 26, 2005, 01:43:02 am »
Quote
quot homines, tot sententiae ...


Quis custodiet, ipsos custodes?  ;D

Qui docent discit!  :)

Quid quid latine dictum sit, altum videtur!  :P
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: Include or extend?
« Reply #13 on: April 26, 2005, 01:44:02 am »
Ita vero !

thomaskilian

  • Guest
Re: Include or extend?
« Reply #14 on: April 26, 2005, 03:42:01 am »
Thank god I could recall Bruce' link http://lysy2.archives.nd.edu/cgi-bin/words.exe and was able to translate it ;D

Haensulus Gretulaque in silvam migrant...