Use Case diagram for board game - uml

I'm creating a use case diagram for a checkers game that I programmed. How in-depth are you really supposed to go when making these? I read that they are supposed to be simple, but that is kind of vague. Do I need to create more arrows, for example between "move regular" (which means move a regular piece, as oppose to a king) and "jump"? Or is it fine not having a connection there? I just don't want to make too many arrows because it will begin to look pretty messy. Any input will be appreciated.

1) ..UML..diagram..how in-depth are you..supposed to..do I need..more arrows..don't want..it..look..messy..?
How in-depth and how simple depends on many factors, basically on an answer to "why you need it" and "who will read it".
Actually the set of questions and guides and other practices that can help you decide can be quite long. Especially useful one is listed in the chapter Agine Modeling: Agile/Lean Documentation: Strategies for Agile Software Development in Scott W. Ambler's online book.
One thing that you should get absolutely clear is what kinds of UML diagrams you need/want
2) UML..use case diagram..more arrows..or..no..connection..too many arrows..?
The arrows in use case diagrams are not an arbitrary connection lines but instead they have precise meaning, especially the <<include>> and <<extend>> relationship, see http://www.uml-diagrams.org/use-case-reference.html for their definition and examples
Besides being graphical bubbles the use case represent how an actor interacts with the System Under Design. Content of the bubbles is then described in more/less formalized text form, see Wikipedia: Use case and especially Alistair Cockburn's use case pages as he basically defined meaning of the term (later adopted by UML) his opinion matters.
3) I'm creating a..UML..diagram for a checkers game that I programmed..
In your case the King Piece bubble does not seem to be included-in or extending the Start Game bubble initiated by the Player and I don't see what sequence of steps might be hidden inside its textual representation (or in your code).
The things you began to draw look much more like UML Activity Diagram, an example
and some explaining links:
overview Debenedetti Emanuele, Activity diagrams in UML 2.0
background by Conrad Bock (one of UML authors), UML 2 Activity and Action Models, The Journal of Object Technology
UML 2 Activity and Action Models
UML 2 Activity and Action Models, Part 2: Actions
UML 2 Activity and Action Models, Part 3: Control Nodes
UML 2 Activity and Action Models, Part 4: Object Nodes
UML 2 Activity and Action Models, Part 5: Partitions
UML 2 Activity and Action Models, Part 6: Structured Activities
tool manuals
PaceStar UML Diagrammer, UML Diagramming Guide - http://www.pacestar.com/uml/udg60.pdf
Sparx Enterprise Architect, Using UML Part Two – Behavioral Modeling Diagram - http://www.sparxsystems.com.au/downloads/whitepapers/UML_Tutorial_Part_2_Introduction.pdf
Microsoft Visual Studio, UML Activity Diagrams - http://msdn.microsoft.com/en-us/library/vstudio/dd409360.aspx

There are much less use cases here. Pls refer to the following diagram drawn by myself:
The other requirements can be written in use case specification, specially the business rules.
Use case name: Move piece
Actors: Player (Primary)
Pre-conditions: ******
Post-conditions: ******
Stakeholders and Interests: ******
Basic Path:
Player selects one piece and the destination square, and submit a move request.
System validates destination square.
System moves the piece and calculates the moving.
System displays the moving result.
Exception Path:
2a. destination square is not valid:
2a1. System ****
Business Rule:
valid destination square : ……
calculating rule, such as king piece, win game……

Related

Send message between swim lanes in a flowchart

When designing flowchart models for my programing, I sometimes ask myself if I am drawing email communication between swim lanes the best way. Perhaps there are some who has better suggestions to describe the following process?
A wants a specific customer list from B. To do that, A has to send a request to B - it could be an email. B creates the list and sends it back to A.
UPDATE
My initial illustration wasn't UML so I try with this instead - ready for your comments:
Actually this is a perfect and overall used approach. Rather than using swim lanes, which are just graphical elements on the diagram, you should use ActivityPartitions (which are real UML elements) which you can classify with the actors in question.
Further you should use ActivityInitial (full circle) and ActivityFinal (hollow circle with large dot in center) to mark the start and end of your flow.
For more examples see here.
N.B. Just noticing this is tagged with Visio. Since Visio is a pure drawing tool you should consider using a real UML modeling tool instead.
P.S. I see that Geert removed the UML tag. So I may have been deceived by the question and thinking of this as being an UML activity diagram. So that's what my answer refers to. Anyhow, since flow charts are ancestors of activity diagrams this might help as well.

From user stories to sequence diagram

I would like to know:
how to convert users stories into sequence diagrams?
and what is the most easy diagram to understand (for customer)?
Traditionally, a use case is converted into sequence diagrams (through a "use case realization" collaboration for traceability). User stories are different from use cases in that the latter provide a set of distinct steps to take whereas the former concentrate on a need and reason.
If you were to to take a use case, each of the steps in the use case would be represented by messages in the sequence diagram. The use case actor (the "user" in the user story) would be the initiating timeline and a second timeline would be the "system". You could then iterate on that sequence diagram to extract various system components (thereby building a domain model for your application).
Does that make sense to you?
how to convert users stories into sequence diagrams?
There is no straightforward easy way. There is not enough information as user story is basically one or few sentences of text. Converting use cases to sequence diagrams is easier and can be partially automated
what is the most easy diagram to understand (for customer)?
it depends on who is the customer. In general, overview diagrams, e.g. BPMN style should be easy to read. See my answer to the question "UML diagram for dependency between systems" for some options and useful links
suggested readings
Enterprise Architect video - how to convert use case into a diagram -http://www.sparxsystems.com/resources/demos/use-case-analysis/structured-use-case-scenarios.htm
Enterprise Architect - various ways how to capture requirements and communicate them to stakeholders - http://www.sparxsystems.com/products/ea/requirements.html
Mike Cohn's page (defined the term "user story") about user stories - http://www.mountaingoatsoftware.com/agile/user-stories
Alistair Cockburn's page (defined the term "use case") about use cases - http://alistair.cockburn.us/Use+Cases
Some examples of tools for creation of sequence diagrams: https://www.websequencediagrams.com/, http://creately.com/diagram-type/uml-sequence-diagrams, you can Google out many more examples both free and payed both online and offline
In my opinion, what works best with the customers are not use cases. They are too abstract and complicated even for the most of developers. And when they are finally approved, you're never sure whether the customers actually understood them correctly.
I suggest the mix of UML activity diagrams and user interface prototypes (non UML) as far the best tool to work on this level of analysis with non technical business people.
Activities model their business in an intuitive, easy to understand and clear way.
UI Prototypes as well, so they can see how they business maps to screens.
Behind the curtains, I like to support activities with a formal and accurate domain class model, invisible to customers of course, but open to developers and making a nice technical backbone of the future system.
User stories fit perfectly in this modelling set, you can even make them less formal and more high-level, as the rest will fill the information gap. Sequences can now be build using domain objects, connecting 2 views - customers' and developers'.
I avoid use cases strongly, whenever possible (although I personally like them).

UML diagram for dependency between systems

Which UML diagram is the best for showing dependency between our IT system and other external IT systems?
For example I would like to show on diagram:
system A gets data from system B
system B can call some functionality from system A
I'm wondering between component diagram and sequence diagram.
What do you think?
your question is not very specific as all UML diagrams display some kind of dependency or pathway how to get data or make a call, so I'm not sure if I got substance of your question right
1. there is no such thing as one best UML diagram to show it all
There is usually one system that you are modeling (+ some black boxes in its surrounding environment) and one UML model. At best the tool you use should support Model Driven Architecture (MDA) and perhaps even Executable UML so that the result of your modeling can be more then set of "pictures". It can become skeleton of source code forming the backbone of the application or it can be even model-click-and-run product.
In order to provide full or sufficient description of the system you'll usually need more UML diagrams each representing different point of view with focus on different aspects with different level of detail (yet all of them being parts of one model).
(This ↑ was the hard part for me to understand)
2. before deciding which diagrams to use make some paper & pencil prototypes
It is quite importtant to make sure which diagram fits your needs before you start drawing it in a good looking sharable form using a tool. Even drawing in Enterprise Architect takes some time to get used to and to get it right.
Very good guide how to do a paper & pencil diagrams and which of them is used for what and how to spend only as much time as is needed:
Agile Modeling - Start Here
...
Agile Modeling - UML 2 Component Diagrams: An Agile Introduction
Agile Modeling - UML 2 Sequence Diagramming Guidelines
...
3. sequence diagrams are expressive simple and useful for programmers
There are even tools that can turn sequence diagrams into code or tools that can turn source code into a sequence diagram.
overview UML sequence diagrams overview of graphical notation
overview IBM Rational Edge - UML basics: The sequence diagram
tutorial Enterprise Architect - 14 minute video - Create Sequence Diagram
4. activity diagrams are expressive and useful for programmers
overview Debenedetti Emanuele, Activity diagrams in UML 2.0
background by Conrad Bock (one of UML authors), UML 2 Activity and Action Models, The Journal of Object Technology
UML 2 Activity and Action Models
UML 2 Activity and Action Models, Part 2: Actions
UML 2 Activity and Action Models, Part 3: Control Nodes
UML 2 Activity and Action Models, Part 4: Object Nodes
UML 2 Activity and Action Models, Part 5: Partitions
UML 2 Activity and Action Models, Part 6: Structured Activities
tool manuals
PaceStar UML Diagrammer, UML Diagramming Guide - http://www.pacestar.com/uml/udg60.pdf
Sparx Enterprise Architect, Using UML Part Two – Behavioral Modeling Diagram - http://www.sparxsystems.com.au/downloads/whitepapers/UML_Tutorial_Part_2_Introduction.pdf
Microsoft Visual Studio, UML Activity Diagrams - http://msdn.microsoft.com/en-us/library/vstudio/dd409360.aspx
5. high level overview diagrams useful for programmers and others (not UML)
poster Business Process Model and Notation
Wikipedia - Business Process Model and Notation
clear expressive language easy to comprehend ARIS Event-Driven Process Chain (EPC) (my favorite since the first time I met it back in 1999)
6. = 1 + 2 + you
make some paper & pencil sketches and decide yourself which diagrams best suit your needs
Further to your thoughts and what Aleks has said, people usually use a combination of both to articulate the inter-system relationships
EA allows you to reuse components in component diagram & Sequence diagram, which allows you to update model from one diagram and have the changes reflected in the other.
Below snapshots show how two components in the model are used in a component diagram (for structural relationships) and sequence diagram(for behavioral flow)
Components definitelly, and dependencies. Dependency does not go in direction of the data-flow, but from the component that "knows" other component (invokes something from it, creates an object, etc).
The following diagram shows the idea.
It is common (and highly recommendable) practice, to use interfaces between the components and channel dependencies through interface. This permits clearer specification and better design (if possible of course).
Sequence diagram can further be used to specify concrete usage scenario and is also recommendable. So, components for structural, static dependencies and sequence for dynamic behavior.

What is the UML analogue to the Data Flow Diagram from Structured Analysis?

Back in the Dark Ages (mid-1980s), I used Data Flow Diagrams from Structured Analysis a fair amount, and found them very useful.
My current employer loves UML. I normally use BOUML, which doesn't do non-UML drawings.
What is the UML drawing that corresponds to the Data Flow Diagram?
If there isn't one, what is the recommended UML diagram to present the corresponding data?
Probably the closest thing is the activity diagram. It's not quite the same; more influenced by flow chart than dfd. However: you can do some of the useful things in DFDs, e.g. ADs do support concurrency and differentiate control flow from dataflow.
More details on comparisons & differences in this question.
[fwiw, I still use DFDs: they're simpler and more elegant in many circumstances]
hth.
UML 2 has a very good analogue to a data flow diagram:
the "information flow diagram".
Information flow diagrams are explained here:
https://web.archive.org/web/20121118061853/http://www.uml-diagrams.org/information-flow-diagrams.html
Note that UML 2.5 has information flows and information items, but the term "information flow diagram" is not part of official UML 2.5 diagram taxonomy. So formally, you just create a class or component diagram with lots of information flows in it to obtain your "information flow diagram".
I do this all the time, using information items of UML to represent my data.
There is no equivalent model in OOD. The emphasis on DFD's is data separated from the function. This is most helpful when dealing in a procedural way. DFD's scale much better than OOD, if you try to scale out (to the world view) using OOD you end up using Use Case diagrams, which are useful for capturing essences. I loved DFD's they are so high level, and yet can be expanded by opening up a DFD box and calling it level 1 etc.
I am currently in the process of learning the Go programming language, this does not use Objects whatsoever and in some respects I feel that DFD modelling would suit it much better.
I too am looking for a diagram that could do this sort of work. In Go structs are used intensively which are basic data types. You can have a primitive extension method attached to it which resembles OO but in fact if you look at the Assembly code it appears to be syntax sugar for a function, who's first parameter is the struct you wish the function to operate on.
My advice, is that if you're doing OO code, then use OOD. They map better, and do help in the thinking about a system. It takes a while to get your head out of Procedural code, especially if you're coming from programming from the 80's/90's. Once you're in the zone with thinking about objects then the OOD methods work fine. Its not strictly a methodology as there is no straight answer to which parts you use, just thinking in objects I find to be the hardest part. A good book on this is "Object Thinking--David West"...it helps to think about objects first. Once you start its very difficult to stop, you may even like some end up getting trapped in the kingdom of the nouns which is a horrible place to be, because you write endless boiler plate code, just so that the system is described perfectly. This is a form of coding hell which I have stayed clear of for many years.
If you are coding in a language that allows procedural code, or even mixed OO/Procedural, you need to decide your paradigm before you start coding, for example in both Python and Object Pascal (Delphi) you can go either route of OO or procedural coding mixing the code up into a mess of paradigms. This will decide which diagramming tools that should be used, and how you are going to analyze the system.
Recently there have been shifts in Java and c# to provide functional programming techniques. These I have discovered don't fall into either category of programming (OO or procedural). Trying to map functional programming code into an object is a nightmare.
I am sorry I haven't provided an answer, but it depends on what code you are writing.
There is no direct analogue, since UML emphasises OO design wheras DFD comes from structured systems analysis and design (SSAD). In UML a number of diagrams, specifically those in the with interaction diagrams group have characteristics that might model elements of data flow and processing. A Communication Diagram can be used to reflect most aspects of a DFD in general, while a sequence diagram may model specific sequences of flow. If you wanted to suggest DFD semantics then you could use stereotyped objects for data process and data store, and use actors for external entities.
It may be worth noting that Sparx Systems Enterprise Architect, while primarily a UML tool includes DFD as an extension.
Similar diagrams would be:
information flow diagram
communication diagram
sequence diagram
Theoretically, new diagram kinds can be defined in UML, optionally extending of one or more conventional diagram kinds. The canonical diagram kinds defined in UML are essentially defined as a part of the UML metamodel itself.
Formally, a definition of the UML metamodel is provided in the UML specification published by the Object Management Group (OMG), as well as the corresponding meta-metamodel defined of MOF - to which there is also a corresponding specification - moreover as accompanied with the formal OCL specification, as with regards to definitions of constraints in UML models in applications of the OCL language in UML - and then there's the XMI specification, as with regards to specifications for how UML models may be stored in machine-readable format.
Ostensibly, all of these specifications may be combined for application as though "Under the hood" of any single framework for UML modeling - whether in applications of the Ecore subset of the UML metmodel, or in canonical UML.
Reviewing a short academic presentation about Data Flow Diagrams -although somewhat in departing from formal definitions of UML diagram kinds, but nonetheless in a broader context of applications of the MOF meta-metamodel - perhaps the canonical BPMN metamodel - in its conventional, graphical abstract syntax - perhaps BPMN may serve to provide something of an analogy to Data Flow Diagrams?
Of course, modeling practices may vary by vendor and by application environment.
I consider a Data Flow Diagram as a Sequence Diagram, with Data Producers and Data Consumers creating, using and destroying Data objects by means of synchronous and/or asynchronous messages.
I use Enterprise Architect 'Dynamic View' Analysis diagram.
Control = Process
Information = Data Store
In many ways their Analysis diagram is much better than a data flow diagram, as you can also show events in the form of sending and receiving and there is a process symbol too but I prefer Control. It includes object and decision.

Flowchart diagrams vs. UML activity diagrams

What is the practical difference between using flowchart diagrams and UML activity diagrams?
I have some thoughts, but maybe I'm missing an elephant in the room?
Flowchart diagram:
Widely used;
Easily understood by non-programmers;
Old?
UML Activity diagram:
Standardized;
Supports concurrency;
Less known syntax, but still simple enough.
For my case of ad-hoc documenting a particular block of application logic, I decided to go with the flowchart diagrams. More people in the company will be able to understand them.
It might seem as a preference, but if we have a standardized language for describing software systems, Why do we use something else? This can lead to bad habit of overusing flowcharts. Activity diagrams are really simple. But if you decide to describe a more complicated aspect of the system or try to change the part you are describing, you might have to switch anyway. So just use UML and prevent confusion in the future.
As you note, Activity diagrams inherently can include concurrency and timing. If you look at this example cribbed from Wikipedia, shown below, you can observe the section with two heavy horizontal bars, and two parallel activities of "present idea" and "record idea". That is read as "start these activities in parallel, and continue only when both are complete." Flowcharts can't express this within the notation.
Practically, using activity diagrams lets you think clearly about concurrent processes. I think you'll find that anyone who can read a flowchart will quickly adapt.
Activity diagram by ​spanish Wikipedia user Gwaur CC BY-SA 3.0, via Wikimedia Commons:
According to the Agile Modeling site:
In many ways UML activity diagrams are the object-oriented equivalent of flow charts and data flow diagrams (DFDs) from structured development.
From IBM:
However, flow charts do not include And states, and flow charts for operations cannot receive events.
Probably this is why flow charts are easier to understand because activity diagrams have the notion of object-oriented development and concurrency.
You can generate source code from UML, and vice versa; hence the "standardized" characteristic you talked about.
UML in itself is used to share your understanding. Share the understanding in a standardized way. Since your case is ad hoc and the primary usage of an UML diagram is to provide an informal sketch, activity diagram can be used here. But so can flow charts as there are no parellism involved here. I have always found the following argument to be helpful. The artifct that i am producing is going to benefit whom? And can i express the flow in a self explanatory way using a flow chart. And if yes, then you should go ahead and use flow chart. But if your class diagrams, sequence etc are in UML format, it would make sense to have your activity diagrams in UML as well for consistency sake(The argument here would be, if people can understand class,sequence UML semantics, then y not activity diagrams.).

Resources