UML indicating the inheritance of many separate use case diagrams - uml

I understand the appropriate use of extend and include , however all the examples I could find draw single large use case diagram with extend or include within the system boundary of that single use case diagram.
Our current project has a base use case diagram with different specialisations from that base use case diagram. Each diagram is on a different page in the document and due to their combined size, including all of them into a single diagram is not a good idea. I would like to know if there is a standard or conventional way of communicating this inheritance tree of separate use case diagrams? If there is not, what would you recommend is the best way to go forward with this dilemma?

Uses Cases inheritance
Does this image extracted from UML speficitaion helps you ?
A point which is not clear for me, are you dealing with Use case inheritance or diagram inheritance ? To tell the truth, I never used diagram inheritance and I am not sure if this is possible and the meaning of a such usage of inheritance.

Related

Class Diagrams: Does Every Use Case Need to Be Drawn With Repeating Classes?

I have several use cases I have to represent in a UML class diagram. Apparently repeating classes is not encouraged, and several of my use cases reuse the same classes. I've one particular use case that reuses several classes I have already drawn up, without any unique new classes: does that mean I can leave that particular use case out?
Thank you.
Any diagram you create from a UML is an aspect of the whole model. To transport the whole picture you take many pictures from several aspects. Choosing the right number is an art as well as designing the model. A single diagram will in almost all cases not fit. So break them down and create e.g. a single or multiple diagrams per use case (one to highligh requirements, one for the actions, another one for the classes collaborating).
Further it is advisable to create a collaboration that realizes a use cases which holds and separates the realization of the requirements/descriptive part of a use case.
The core difficulty you have stems from an unclear understanding of the UML constructs and their interdependence.
A use case describes an interaction between an actor of the system to achieve a specific purpose. A class is a collection of system data and functions. Of course, different use cases make use of the same classes. Imagine a shop system. The class Product describing the products offered by the shop will be used by use cases like Show all products of a specific category, Show product details for a specific product, Order product, Generate bill for delivered product.
Fortunately, this repeated use of a class won't clutter your diagrams. In a use case diagram, you don't describe classes, and in a class diagram, you don't describe use cases.
A good approach comes from two directions. Use the input coming from your users to describe use cases: situations when they want to use the application, and the behavior they expect from it. Use your domain knowledge to describe data structures and operations to support these use cases, and describe these in a class model.

Is the Sequence Diagram per use case in UML or we draw it for the System in general?

I discuss with my friend our project and we are in a way to draw the sequence diagram ( UML 2).
He told me that the sequence diagram is drawn by the use case. It means that for each use case we should draw a Sequence Diagram.
Is it correct ?
Thank you for any suggestion.
Well, taken as dogma it is not correct. A sequence diagram (SD) shows the behavior of objects in the way they interchange messages (and also if needed their lifetime and some minor additional information). You "can" also use a sequence diagram to describe scenarios in use cases. But simply speaking, a SD is more technically oriented (class design/programmers) rather than business (business design/stakeholders). To visualize a use case scenario you're better off using activity diagrams (AD). And even better if you dive into BPMN (which brings ADs to a new level).
It is possible though, to convert ADs to SDs and vice versa without information loss (if you forget about the afore mentioned bits and pieces).
Now another point: you will not necessarily need a diagram for each use case. I found that often use cases are more easily (and even clearly) described in a textual way (see Cockburn or Bittner/Spence) rather than diagrammatically. Especially if you have UC scenarios that are very linear in their single actions. So you can leave out the AD for those and just fall back to simple text. You should further avoid describing UC scenarios in both ways (i.e. text and diagram) as this introduces unwanted redundancy (means you would need to maintain always both when changes happen; and they happen often; and people are lazy -> so which one holds the truth: text or diagram?).
Generally, as Thomas points out, use case detail is set forth in an activity diagram. As he also mentions, a use case scenario would use a sequence diagram, when necessary. A use case scenario is a single path through a use case.
Sequence diagrams aren't good at diagramming multiple simultaneous behaviors and multiple decision points, and use cases generally have both of these features in their behavior. Activity diagrams do these things very well. A single path through a use case, by definition, doesn't have simultaneous behaviors and decision points, so a sequence diagram is more appropriate.
Googling "use case scenario sequence diagram" gives a number of links that explain the use of sequence diagrams for use case scenarios in detail, of which this is an example.
UseCase is declaration of behavior (service or usefull behavior) of system which is executed by system with collaboration (interaction) with system's actors.
Any type of diagram defined in UML could by used to describe behavior on any level of abstraction. All of diagrams could be also used to describe both business or technical aspects of system.
UseCase is declaration of behavior, it means that UseCase does not define behavior at all. UML does not define scenarios of UseCase ,scenarios are usually defined in methodology not in UML.
If you need to describe behavior of system in context of UseCase you can use some of behavior diagrams defined in UML for each UseCase.

sequence diagram for books exchange

Please can anyone suggest any improvements or corrections in the attached sequence diagram. The diagram is regarding student registration and search book.
You should not think on classes creation being in sequence diagram. Make a class diagram, maybe an object diagram, and after that make your sequence diagram with instances of created classes as timelines. Add a class diagram here, without it it is impossible to answer your questions.
As is, you are working with elements of use case diagram (agents), not classes. It is acceptable, too. But then you should create a component diagram and use components as timelines.
So, your problem is that you have minimally one diagram less than you should. A whole diagram, not a block in one.
So, for this task you can use the following sets of diagrams:
The fullest one: Use Case + State + Component + Communication + Sequence + Class + Object + Composite Structure
The wide refactoring of your diagram: Component + Sequence + Class + Object
The minimalistic refactoring: Sequence + Class
Of course, you can make more than one diagram of any kind mentioned. Also, some diagrams if they are small, can be combined in one - UC+State, for example.
The normal process is creation one diagram after another, returning to the previous ones. Behaviour/structure diagrams of the same level can be created simultaneously. If you have problems with some thought on one diagram, try to express it on another one.
Yes, you can do a sequence diagram for every action of use case or even of Activity/communication diagram. But if your seniors won't make you to do it, it is enough to create only these diagrams that are needed for better understanding of the process.
Sequence diagrams, in the context you're using them, should be modeling a single path through a use case. Think of it this way: a use case diagram models the different things that a system does and who interacts with it. An activity diagram models out the behavior of a single use case. A sequence diagram models out a single path through a use case (in other words, a single path through an activity diagram that models a use case).
In the case of your above sequence diagrams, it looks like you have two use cases: "Login" and "Create Account". Create account extends login. I would suggest that you first document in detail what each use case does (google "Use case narrative" for more information). Use an activity diagram if it helps clarify the narrative. Then look at the individual paths through the use case (google "use case scenario" for more information), using sequence diagrams to help clarify the scenarios as necessary.

UML replacement for context diagram

According to UML context diagram context diagram doesn't exists.
So my question is which one of UML diagrams is good to show something like this and how to paint this?
I've just found the following definition: http://en.wikipedia.org/wiki/System_context_diagram
That's probably what you need. :)
A context diagram defines a boundary between the system, or part of a system, and its
environment, showing the entities that interact with it.
There is no single diagram in UML that would map to this definition, but I have some good news - there are several diagrams (out of total of 14) that can show the frontier between the system and its surrounding world from different perspectives. This is much more flexible than only a context diagram.
First of all, I would mention a special UML element - a boundary. It can be used in any diagram type to show some kind of delimitation. You might want to optionally use it to visually delimit between the system and its environment, especially in situations when this is not explicit.
The following diagrams can show the boundary between the system and its environment:
Use case diagram (your example) support the context explicitly on the functional level. Use cases are elements of the system under development, while the actors are extern entities (systems or human users). Before mentioned boundary is often used to visually delimit between the system and its environment.
Component diagram is used to model some kind of software modules (applications, DBs, external systems, libraries, etc). You can use it to show both internal and external components and the way they interact. A boundary can be used to clearly draw the separation line.
Activity diagram can show your system/business/usage processes. Some activities can be performed internally, others externally. Here you don't need the boundary, but the so called swimlanes to depict who does what.
Sequence/collaboration diagrams are another option. They show the communication sequences between several objects. If you split those objects in internal and external ones and wrap them up with the boundaries, there is another context diagram. :)
UML is flexible, there are probably further options, but I think this is enough to get the idea.
Names of your association are services. UseCase in center of diagram is context of services definition. See usecase diagram:
It could be done with a use case
http://en.wikipedia.org/wiki/Use_case
EDIT:
Reconsidering it, use case diagram should be the next step once the operations are defined so first you shouls make a system sequence diagram.
http://en.wikipedia.org/wiki/System_sequence_diagram
If you're happy with going into the not complete superset of UML that is SysML, you can have proper Context diagrams there.
However, context diagrams in SysML are simply Block Diagrams showing system context… and Block Diagrams happen to be the same as UML2 Class diagram, where the classes are of stereotype «SysML::Block».
So you can define your context diagram in terms of aggregation of blocks to your system, with the relevant stereotypes, basing it on UML2 Class diagrams.
I tend to use collaboration diagrams for this. So for each major scenario of each use case, draw a collaboration diagram showing the actors, with the application as a single entity in the middle, and messages travelling around that show how the application interacts with the actors in order to fulfil the scenario.
(I don't put too much detail in the messages -- I only want to show that there is a delegation of responsibility and some kind of interaction, but I don't care about details of actual messages, views, data etc.)
I find the context diagram does have a particular appeal. It sits well with business users, showing them the scope & parties of a system in a very easy way. So, I tend to create a context diagram, even in contexts where UML is prevalent.

Class diagram from use case, should I include the system?

I am trying to build a class diagram from use case. But I am not sure if I should include the system in class diagram. I have system as actor in use case diagram. If I include it in the case diagram can I use it without attributes....
"I have system as actor in use case diagram" - Actor can be human or non-human system external to your subject that is your whole system. For example, card payment system or buyer are actors for net stores. You can show your system in the use case diagram, too, but it will be a rectangle, containing ALL use cases - not really so much useful thing. But showing of SUBsystems can be useful.
Later you can draw a deployment diagram - if different subsystem lie on different computers. And maybe, some dynamic diagrams of how they talk to each other and actors.
If we are talking on static diagrams, your next step will be component diagram - you'll divide your system in smaller parts and show who talks to who and here already the classes of messages being sent can appear.
Later - you'll plan what packages will contain your classes and what will be visible from which. Package diagram.
Later - yes, at last we are here - you create the class diagram(s). Maybe, several - for different components. So, you are a bit too in a hurry.
Sometimes, especially, if you work with some special objects of some class(es), you need Object Diagram.
And don't forget - there are also dynamic diagrams, I have mentioned static ones only.
Can you please elaborate your question with specific example in order to get better knowledge about the scenario?
As far my knowledge, one can use the system such as any controller class which is again an actor here as class in the class diagram.
"I am trying to build a class diagram from use case"
Use-cases are a very abstract and user-centric view of the system while class diagrams are fine-grained and technically focused.
So you should not try to infer your classes directly from a UC diagram. Instead, use the repertoire UML gives you (component-, activity-, sequence diagrams etc.)
In my experience, I usually create Object interaction Diagram from Use Cases. Mostly, the nouns on the Use Cases are Classes ... In Object Interaction Diagrams, I can have clear ideas about the methods and lifespan of the Classes ...
"Object Interaction Diagrams" or "Interaction Diagrams" are usually to elaborate a single use Case ..
A simple google search gave me this link and it gives you some idea ...
http://www.cs.unc.edu/~stotts/145/CRC/Interactions.html

Resources