I want to question and/or perhaps challenge the school of thought on UML behavioral diagrams.
Firstly, I want to ask, what comes first: Use Case or Activity?
I was taught that Use Case diagrams come first and then for each Use Case, you have one or more Activity diagrams to represent successful and alternate flows. From the Activity diagrams, you can identify nouns to establish classes.
I have, however, read other articles which say you create an Activity diagram for the end to end process and then from that, you can identify Use Cases.
I can see both scenarios working, and am confused, as to me it seems a case of hierarchy. For example, say I have a high level business process which is 'Grading Student Results'. If I map it as an Activity diagram, within which I would see swim-lanes. I would be able to pick out Use Cases, such as 'Determine Grade Boundaries,' 'Submit Results,' 'Convert Result to Grade,' and so on.
You could argue they are the same thing, i.e. both diagrams would meet this process modeling need. I then want to model the next level, for example, how you 'Submit Results.'
Can someone advise on the best practice: whether a Use Case diagram comes before or after an Activity diagram?
First:
There is no competition between any of the UML diagrams to be the "first
one". Sometimes it is better to work on some diagrams simultaneously and iteratively.
Second:
Each diagram can be used in different contexts and for different purposes.
Use Case Diagram vs. Activity Diagram
"Use Cases" are scenarios which show how the user will use the system to achieve their goals.
So:
Instead of showing this "scenario" with written use cases, you
can visualize its' steps with an activity diagram.
But in order to find use cases, you should discover the system requirements to some degree, (e.g. the scope, broad feature set, priority, cost, etc.).
In some business domains, such as for an automation project, in order to discover requirements/use cases, you may have to investigate current business flow. Sometimes this business flow can be complex, so you may want to investigate it with an activity diagram.
So:
An activity diagram can be used to investigate a business process to
understand and discover the flow, to better discover requirements.
So:
An Activity Diagram can be used at different levels of software
development stages for different purposes.
Just like other diagrams, you can use the Activity Diagram at any time, anywhere, as soon as it can help you to ask the right question, to understand and explore any issue related to your purpose.
Here is a summary purpose of Activity Diagrams:
The purpose of the activity diagram is to model the procedural flow of
actions that are part of a larger activity. In projects in which use
cases are present, activity diagrams can model a specific use case at
a more detailed level. However, activity diagrams can be used
independently of use cases for modeling a business-level function,
such as buying a concert ticket or registering for a college class.
Activity diagrams can also be used to model system-level functions,
such as how a ticket reservation data-mart populates a corporate
sales system's data warehouse.
UML Basics : The activity diagram by by Donald Bell
To get a quick grasp of which diagrams can be used for which purposes, I advise you to check out Scott W. Ambler's mini book: The Elements of UML(TM) 2.0 Style
Activity diagram is one of the those with widest abstraction range in UML. An activity can be used for anything between a business process (very abstract, comparing with software system) and a single method algorithm (code-level, practically blue-print, meaning kind of abstraction ground level).
Use Cases on the other side are in practice very limited in their abstraction. They show the interaction between a user and the system and would be somewhere in the middle of the abstraction scale. Not as abstract as a business process, and definitelly a lot more abstract than the implementation diagram.
Software projects tend to start working on a very abstract level (business goal for example) and finish with the abstracion 0 (implemented system). During the project analysts, architects and developers work together to gradually lower this abstraction producing always less abstract artifacts/models - business processes, use cases, architecture, design, code.
After this introduction it is not hard to answer your question - any of those can be used first and that depends on type of your project and its size. SOme examples:
A large project of development an ERP system. It is almost certain that in this kind of project the first thing to model is the business process. A long before even thinking of its functionality, the team must understand the business background. The best UML diagram for this is naturally the activity diagram. Some time after, when the process is clear and the high-level reqs known, the use case modelling can start.
A middle sized of relativelly small project, with no complex processes in background (for example a mobile app development) can start directly with use cases, identifying the users and their features. Later on, these can be further refined using activities.
A very small development of some interface, driver of communication gateway, highely technical, where even the user interaction is minimal, the modelling can start with the activities again, showing the concrete algorithm too be implemented. USe cases can be completelly skipped.
As a summary I would conclude that there are no unbreakable rules of this kind in software development. Each project is unique, each development methodology is unique, even each development team is special and unique. To think about "which diagram" to do first is straight and simply WRONG! Think about what kind of analysis or specification you need in a given moment - what is easiest and most usefull to be modelled. When this is clear - there are 13 UML diagrams to pick up from in order to optimally fulfill the aim.
Choice of UML diagram is the "HOW". More important than that is more often than not - the the "WHAT".
Use case diagram is for showing the functionalities and Activity diagram is for showing operations(1 functionality can have many operations).
eg. Use case diag. is Moher (can have many childrens) and
Activity diag. is like describing the child of Mother i.e. Use Case diag.
Related
I have a project and I'm required to produce the class and sequence diagram. It is a procurement website. My only problem is that I don't know how to associate the web pages (user interfaces) to these diagrams. If they are not needed what is the right way for me to include it in the diagrams because from a book I read there are "UserInterface" classes, so another question, what should be inside of these UI classes.Can someone give me an example. Thanks!
There are several levels of abstraction for UI modelling.
Use cases and state machines. These diagrams are made in human terms.
Planning on the server/page/frame level. Here UML deployment and component diagrams are useful.
Planning of the content of UI, defining elements and functonalities and connections between them WITHOUT choosing the concrete components. No standard for this, extremely important, stage. Use diagrams that you like. Class ones are usable, but in not standard reading.
Planning of the content of screen elements WITH choice of the UI components (frames, buttons and so on) and connecting functionalities to them. On this level you can use class and sequence diagrams.
Drawings of the planned screenshots. For this level there are no UML diagrams. And a common standard doesn't exist.
These levels require MANY diagrams. The lower the level, the more diagrams it needs. Putting user interfacES into one class diagram is possible for a minuscule project, but you can't say it SHOULD be done so.
In your class diagram you will normally describe/design the (data) model part of your application, while the user interface (UI) corresponds to the view part within a model-view-controller (MVC) architecture. As a UI cannot be designed with a class diagram, I cannot see any meaning for a "UserInterface" class.
However, there is a new modeling language for modeling user interfaces: the Interaction Flow Modeling Language (IFML), which has been adopted as a standard by the OMG in March 2013. If you are serious about UI modeling, then you should use that language.
Classes of UI can be modeled as ordinary UML classes. You can create stereotype "webpage" if you want of course. If it is needed to define internal structure of UI class use composition. In sequence diagram you can define interaction between instances of UI classes in common way.
Example:
I'd like to pose this question since it seems to be a point of some debate and I'd like to know the communities thoughts on it.
To give you a bit of background to the way the team I work in operates and give this question some context, we're writing cucumbers for a RESTful API at a session called 'Three Amigos'. Three Amigos basically means there will be a Tech Lead, Developer (one or more) and BA (one or more) involved in fleshing out the acceptance criteria for a story. As part of this session the BA usually drives writing the gherkins for the cucumbers.
Here's an example to kick it off. If I have a RESTful API for getting back information about a car I may have a scenario that says:-
Scenario: Engine size should appear in the car
Given a car exists
When I request the car
Then the car should have a "1700cc" engine capacity
Or you could write it like
Scenario: Engine size should appear in the car
Given a "Mazda/ModelABC" car exists with an engine capacity
When I GET "Mazda/ModelABC"
Then the response should contain "1700cc" engine capacity
Now the first one in my eyes is easier all round to read but will not promote code re-use (is this a big deal?). The second promotes code re-use and is written from the perspective of a stakeholder i.e. a developer but a Business Analyst (BA) would not write it like this so it would make a Three Amigos session fairly pointless.
Given the two approaches which is the more highly recommended choice? I have opted for the first approach in my case but I'm interested to know what the arguments for either method are or if there are some decent articles people can back up the suggestions with that would suggest which approach should really be used.
Thanks.
You can put "IMHO" after every paragraph in this answer. This is my experience after doing BDD / Specification by example for four years.
BDD is about communication.
BDD is about understanding each other in the entire team.
Cucumber is (just) a tool that facilitates communication. The only reason to use Cucumber (and the extra abstractions it adds) is because it will make it easier to understand each other than other formats.
If we were only developers in the team we would probably be better off using code.
So, to answer your question, if your BA's and customers understand GET, POST etc then it might be appropriate to use that in the specification. But beware that you've just tied the specification to the implementation. Changes will propagate even into the Cucumber scenarios.
More likely your first example is format that your customers and BA's can relate to and understand straight off.
But, of course, it depends on the level of technical details your non-technical team members are using. Make it easy for everyone to understand.
BDD is about communication.
Here's some presentations on the subject that I've found both useful and in one case thoroughly entertaining:
BDD as you meant it
Refuctore your Cukes
Cuke Envy
Programmer Types:
Do you write extensive design documents for your programs or games?
Is using UML the standard method of diagramming your use cases?
Do you run the whole gamut of diagrams or sort of pick and choose along the way depending on the scope of your software and the number of developers on the team?
First,
If you make documentation, it should have a "clear" reason/purpose.
And this purpose is identify nature of your documentation.
Secondly:
Do not think documentation just in a "written form" or word document.
It may be in any form.Even it can be a "video" in which some guy
explain your major architecture decisons and why they choose
it[motivation]
Well, suppose that you want new team members "easily grab" what you are doing,how you are doing, and why you are doing this way.[ Be carefull all depends on your problem nature]
UML use case diagram may can give overall picture of your functional
requirements. It simply states who will use your system, and what they can
do with your system.
Short memos which state the important non-functional requirements
Short memos which states your major architecture decision and why you give this decisions
Maybe a component diagrams which shows your important components and their interfaces
If application tapology is important then may be a UML deployment diagram which shows how your system will be physically deployed.
But after all you can not document evething and you should not .You can generate whole system UML class diagram automatically with a UML tool, but how can this help a novice.
But you can put class diagrams for classes that do important and tricky
parts and draw sequence diagrams for those tricky parts which show how
they collaborate with other classes while they perform important and
tricky responsibilities.
The key for documentaion is puting yourself into your "audience" [ who
will read your doc] and ask yourself
If I was this document potantial "audience" will i read this document? [ If not why you make doc]
If I read this doc, will it help me in some way? [ it is effective]
Lastly, we do not live in "ideal word"...Sometimes you may find yourself doing doc for no real audience and no real reason just because of some "politics" and you should earn money
Well, in this situation UML will help. Draw boring, with many details [ genarally auotumatically generated] diagrams which no one read or understand but say "Oh you have extensive documentaion". In our software industry, UML is overemphasized, and many guys "buy" even bad doc if there is a UML diagrams in it.
That's all folks...
Our business is planning on building a rather large business application with about 2000 or so users.
Many objects in the system require a mildly complex series of approvals, notifications, etc.
For various reasons, our company has decided to reject formal use of BPMN or BPEL. What I am looking for is a workflow engine that I can pass these objects to as a means of facilitating, tracking, and managing the state of these objects. We are implementing this project using EJB 3.1 with a WebSphere AS.
Am I correct in my understanding of a workflow engine? Everything seems tied to BPMN or BPEL...am I just missing something here as to why most solutions seem to implement BPMN or BPEL? Some advice would be wonderful!
Workflow engines typically take an active role in an enterprise architecture. They execute a declarative process model, which is basically a directed graph consisting of nodes, which represent activities or tasks and edges, which represent the control flow between these edges. Such edges can be annotated with conditions to allow for expressing conditional branching/merging. There are several modelling languages around, like YAWL, XPDL, jPDL, BPEL and BPMN 2.0, which sit on top of these abstract concepts and some syntatic, visual and functional sugar, but only the latter are official industry standards. This is important to avoid vendor locks, make models interchangeable (at least to a certain extent), supportable by experts and different tools. During runtime, process instances are created based on a process model and are executed according to the control flow defined by the model. So the engine actively navigates from one activity to the next activity and thus "orchestrates" your business logic. The main difference between BPMN 2.0 and BPEL is that BPEL is tightly coupled to Web services, i.e. business functions to be invoked by activities are supposed to be rendered as Web service. So if you want to orchestrated WS-* services, it is still the best choice since BPMN 2.0 lacks well-defined and standardized bindings to concrete service implementations. In any case, I'd strongly recommend to use one of the standardized languages since they are both broadly accepted in industry and well supported by various vendors and open source communities.
I tried to explain that in more details because I was not entirely sure about what you mean by "facilitating, tracking, and managing the state of these objects". This sounds a little bit like you are more interested in passively monitoring an object's state change as opposed to actively controlling state changes using a workflow engine. If this assumption is right, then perhaps a abstract state machine would fit your needs better.
Take a look at jBPM5, it provides a very flexible core that allows you to build your own domain specific language on top of it. Right now the language provided is BPMN2, but you can easily add your own.
Cheers
We are building a product that has a migration path for BPMN 2.0 but does not - internally, use BPMN. We believe checklists are much easier to use in real-time workflows than flowcharts. Is still however, has rules/triggers/conditionals and more - so it's a tool that effectively models processes as "checklists on steroids":
Check it out at http://tallyfy.com
There are some Topics on Stackoverflow already related on how to model different Threads in UML, for example: Is there an inituitive UML approach to depict threads.
However I still feel, that my case has not been already discussed, even though it should be pretty common:
I am creating an iPhone Application, where I am obviously have a Main-UI-Thread and I am also using Background-Threads to perform Remote-Calls, etc. I basically have 4 different aspects that I like to display within my diagramm:
The UI that is shown to the User.
The Tasks that are being performed by the Main-UI-Thread (therefore blocking the UI)
The Tasks that are performed by Background-Threads
Updates of the UI, which are performed by the UI-Thread, but can be triggered by Background-Threads. For example: new Information loaded from Server, which needs to be displayed on the UI
Has anybody ran into a similiar issue and therefore might show me an example or give me some best practises on how to solve my problem? I am not even sure if I should use a sequence-diagram, an activity-diagram or maybe even some other type.
Well Pascal,
This is not an UML question. It is a design question.
UML just helps you
To understand hard and crtical section of your program/design and to
explore alternative solutions , while writing your code. with the power of visual modeling.
So..
First, ask yourself what kind of parallelism or concurrency exist in
your problem? To investigate this:
Draw a simple activity diagram with partions in which each partions
used to represent different operating system threads or processes.The
object nodes can be used to model the shared objects and data.Forking can be used to model the creation and parallel execution of multiple threads or processes.
Then ask yourself(using that diagram)
What are my shared data? What are my active classes? (threads)What kind of "concurency" problems" may
accour? What may go wrong? What are synronization points? etc..Based on this Explore different alternatives, designs.
The last thing you should worry is UML and its sytax(symbols).
The best UML diagrams are the one that wake up the desire of "asking question" in your mind.
At first forget about Uml. Ask core questions about your problem. If you like visual modeling and your mind like visual thinking use Uml for better understand and investigate possible design solutions.
UML can not design for you...
I found this research papers while searching for same thing
M-UML: an extension to UML for the modeling of mobile
agent-based software systems
May be it can help you