<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tyner Blain &#187; UML Modeling</title>
	<atom:link href="http://tynerblain.com/blog/category/requirements/requirements-models/uml/feed/" rel="self" type="application/rss+xml" />
	<link>http://tynerblain.com/blog</link>
	<description>Software product success.</description>
	<lastBuildDate>Wed, 17 Mar 2010 04:31:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Uncovering Requirements With UML Class Diagrams Part 5</title>
		<link>http://tynerblain.com/blog/2008/03/19/requirements-class-diagrams-5/</link>
		<comments>http://tynerblain.com/blog/2008/03/19/requirements-class-diagrams-5/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 03:16:20 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[Requirements gathering]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[modeling requirements]]></category>
		<category><![CDATA[ooa]]></category>
		<category><![CDATA[requirements class diagram]]></category>
		<category><![CDATA[uml class diagram for analysis]]></category>
		<category><![CDATA[uml class diagrams]]></category>
		<category><![CDATA[uml requirements]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2008/03/19/requirements-class-diagrams-5/</guid>
		<description><![CDATA[
In this article, we build on our ability to represent straight forward business relationships in UML class diagrams.  These relationships describe how two objects are related to each other.  Representing relationships in class diagrams helps us to better understand the domain and helps us to uncover hidden requirements.  Occasionally, we have to [...]]]></description>
			<content:encoded><![CDATA[<p><img title="digging" alt="digging" src="http://www.smugmug.com/photos/267929036_P8Scw-L.jpg" /></p>
<p>In this article, we build on our ability to represent straight forward business relationships in UML class diagrams.  These relationships describe how two objects are related to each other.  Representing relationships in class diagrams helps us to better understand the domain and helps us to uncover hidden requirements.  Occasionally, we have to deal with more complex relationships that involve more than two objects to properly describe.  This does not happen as frequently, but when it does, our modeling efforts are more likely to uncover overlooked requirements.  In this article we learn how to describe relationships that involve more than two objects.</p>
<p><span id="more-650"></span></p>
<h2>Catching Up On UML Class Diagrams</h2>
<p>If you navigated to this page first, it is the fifth in a series introducing UML Class Diagrams for requirements elicitation.</p>
<ol>
<li><a title="Representing business concepts with uml class diagrams" href="http://tynerblain.com/blog/2008/03/06/requirements-class-diagrams-1/">Uncovering Requirements With UML Class Diagrams Part 1</a>: Discusses how to represent objects and entities from a business perspective.</li>
<li><a title="simple relationships in uml class diagrams" href="http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/">Uncovering Requirements With UML Class Diagrams Part 2</a>: Discusses simple relationships between objects or entities.</li>
<li><a title="using class diagrams for aggregation and compositing" href="http://tynerblain.com/blog/2008/03/13/requirements-class-diagrams-3/">Uncovering Requirements With UML Class Diagrams Part 3</a>: Discusses combining objects into collections and concepts.</li>
<li><a title="inheritance in class diagrams" href="http://tynerblain.com/blog/2008/03/17/requirements-class-diagrams-4/">Uncovering Requirements With UML Class Diagrams Part 4</a>: Defines generalization (inheritance) and how to use it.</li>
<li>Uncovering Requirements With UML Class Diagrams Part 5: This article</li>
</ol>
<p>Jump back to the other articles and get up to speed if you need. We’ll wait for you here. As a reminder, in this series, we’re specifically focusing on using UML class diagrams for uncovering requirements &#8211; as part of analysis, not design. We’re talking about what the business needs, not how the solution will work.</p>
<h2>Understanding Details <em>About</em> The Relationship</h2>
<p>One reason you may want to deal with more than two objects is obvious only after you change your way of thinking.  So far, you&#8217;ve been thinking about objects (classes) and relationships (associations).  Sometimes, when you need to understand the details of the relationship, you should think about the relationship <em>as an</em> object.  It is both a relationship AND an object.  And you draw this with an association class.  We&#8217;ll walk through an example that illustrates the idea clearly, then we&#8217;ll look at the steps needed to create a relationship that is also an object.</p>
<p>Consider that you are gathering requirements to support software for tracking court cases &#8211; perhaps a <a title="Definition of Mashup" href="http://en.wikipedia.org/wiki/Mashup_(web_application_hybrid)">mashup</a> site that combines the latest public record lawsuits with entries from <a title="LinkedIn" href="http://www.linkedin.com/">LinkedIn</a> (<a title="Scott Sehlhorst Profile" href="http://www.linkedin.com/in/sehlhorst">my profile</a>) and <a title="directory of companies" href="http://www.crunchbase.com/">Crunchbase</a>.</p>
<p><img title="linkedin" alt="linkedin" src="http://www.smugmug.com/photos/267958853_EhiJs-L.jpg" /></p>
<p><img title="crunchbase" alt="crunchbase" src="http://www.smugmug.com/photos/267958858_5AfiX-L.jpg" /></p>
<p>As part of your requirements gathering, you need to understand how these court cases work &#8211; so you start with a class diagram.</p>
<p>First &#8211; identify the main players in the lawsuits:</p>
<p><img title="litigants" alt="litigants" src="http://www.smugmug.com/photos/267935482_B2BHB-L.gif" /></p>
<p>Both a plaintiff and a defendant are litigants, as they are involved in lawsuits.</p>
<p><img alt="uml class diagram of suing" title="uml class diagram of suing" src="http://www.smugmug.com/photos/267935487_mMND6-L.gif" /></p>
<p>That represents a simple relationship.  A plaintiff sues one or more defendants.  When you show this diagram to one of your stakeholders, she likes that you captured that one plaintiff can sue more than one defendants.  She also likes that you can determine &#8220;who is the plaintiff suing&#8221; as well as &#8220;who is suing a given defendant.&#8221;</p>
<p>You point out one small problem &#8211; it is not clear if the plaintiff can only sue multiple defendants one-at-a-time, or if the plaintiff can sue multiple defendants in the same lawsuit.  You get the answer (multiple defendants can be sued at the same time), and as you start to scratch your head about how to represent it, your stakeholder interrupts (they do that):</p>
<p>&#8220;We need to be able to show lawsuits with a &#8220;most recent&#8221; view, and a &#8220;largest&#8221; (in dollar amount) view on the main page of the site!&#8221;  You realize that your diagram doesn&#8217;t work, and you make a note to yourself about the multiple-defendants issue.<br />
You need a way to capture information <em>about the suit</em>.  Suddenly, instead of a verb (sues), you need a noun (suit).  You need to reason <em>about</em> the relationship.  So you update your class diagram.</p>
<p><img alt="lawsuit" title="lawsuit" src="http://www.smugmug.com/photos/267935499_Uc4oJ-L.gif" /></p>
<p>Your updated diagram now shows that a single plaintiff, <em>in the context of a single suit</em>, can sue multiple defendants.  You also capture that you need to know the trial date and the dollar amount <em>of the suit</em>.  You erase that note to yourself, because your diagram now clearly indicates that one lawsuit involves multiple defendants.  You make another note to yourself that it is not clear if a plaintiff can be involved in more than one suit with the same defendants (he can).  You&#8217;ll deal with that later.</p>
<p>What you&#8217;ve drawn is something (the suit) that is both a relationship <em>and</em> an object.  In UML class diagrams, this is called an association class.</p>
<h2>Creating An Association Class in a Visio UML Class Diagram</h2>
<p>To create an association class, you use the <em>Association Class</em> shape in the Visio UML Static Structure stencil.</p>
<p><img title="association class visio shape" alt="association class visio shape" src="http://www.smugmug.com/photos/267935473_ozEC8-L.jpg" /></p>
<p>Drag the association class onto the page.</p>
<p><img title="default visio uml association class" alt="default visio uml association class" src="http://www.smugmug.com/photos/267947206_E9Bpw-L.gif" /><br />
By now, you realize that you need to suppress the <em>end names</em> in the display.  Right click on the shape and select &#8220;Shape Display Options&#8230;&#8221;:</p>
<p><img title="shape display options menu" alt="shape display options menu" src="http://www.smugmug.com/photos/264377116_QZicY-L.jpg" /></p>
<p>And disable the display of the end names:</p>
<p><img title="shape display options dialog" alt="shape display options dialog" src="http://www.smugmug.com/photos/267935492_4Q7cg-L.jpg" /></p>
<p>Now your shape will look like this:</p>
<p><img title="updated uml association class" alt="updated uml association class" src="http://www.smugmug.com/photos/267935477_ReNwJ-L.gif" /></p>
<p>You can manipulate the shape and its placement in two different ways.  You can select and drag either line end (to connect to another shape in the diagram)</p>
<p><img title="dragging line ends" alt="dragging line ends" src="http://www.smugmug.com/photos/267948569_p4gup-L.jpg" /></p>
<p>Or you can drag the &#8220;class&#8221; portion (the box) of the shape to wherever you want to place it.  [Note: When you drag the class, it <em>looks like</em> you are disconnecting the line from the shapes and messing everything up.  It is not happening.  When you release the mouse button, the class will be where you put it, and the line will still be where it was before.]  There is a dashed-line that connects the class (the box) to the association (the line).  Visio automatically updates that for you &#8211; you never have to worry about it.  In fact, if you don&#8217;t like it where it is, you can&#8217;t do anything about it either.</p>
<p>You could use the rotate-handle (the green circle on top) to rotate the box, but please don&#8217;t.  Class diagrams, by convention, are drawn with everything aligned with the page.  To get the line on top, just drag the line ends above the shape (or drag the shape below the line ends).</p>
<p>You use the same rules for showing directions with an association class that you do with a regular association.  If the business needs to think in one direction &#8211; &#8220;Who has the plaintiff sued?&#8221; then show that arrow.  If the business wants to think in the other direction &#8211; &#8220;Who has sued a particular defendant?&#8221; then show the opposite arrow too.</p>
<h2>Even More Complex Relationships</h2>
<p>The cool shape above lets you draw a three-way relationship.  It is most handy when you need to understand something about the relationship itself &#8211; treating the relationship as a noun instead of a verb.  You can create relationships in UML class diagrams that involve more than three objects.  These are called <em>N-Ary Associations</em>.  The &#8220;N-Ary&#8221; part is geek-speak for &#8220;binary, trinary, quaternary, etc&#8221; &#8211; any number is valid.</p>
<p>Earlier, we glossed over one question &#8211; &#8220;Can a single plaintiff, related to multiple defendants in the context of a single suit, also be related to those defendants by another suit?&#8221;  You can use an n-ary association to depict this.</p>
<p>In the Visio UML Static Structure stencil, select the <em>N-Ary Link</em> shape.</p>
<p><img alt="visio uml class diagram n-ary shape" title="visio uml class diagram n-ary shape" src="http://www.smugmug.com/photos/267966421_8kVwQ-L.jpg" /></p>
<p>Drag it onto the page</p>
<p><img alt="n-ary shape default" title="n-ary shape default" src="http://www.smugmug.com/photos/267965465_da3Xh-L.jpg" /></p>
<p>It looks a bit like a decision diamond from a flow chart, but with handles.  Drag it to where you want it to be in your diagram and then start connecting the line ends to the related classes.</p>
<p><img alt="connecting uml classes with an n-ary link" title="connecting uml classes with an n-ary link" src="http://www.smugmug.com/photos/267965454_ycQBB-L.jpg" /></p>
<p>After you&#8217;ve connected the ends (or before, but after is easier), double click on the shape to bring up the properties dialog.</p>
<p><img alt="visio uml n-ary link properties dialog" title="visio uml n-ary link properties dialog" src="http://www.smugmug.com/photos/267965473_5e44a-L.jpg" /></p>
<p>You&#8217;ll see three &#8220;Link Ends&#8221; &#8211; just rename them to show the multiplicity of the connections.  You will end up with a final diagram that shows:</p>
<p><img title="final lawsuit relationship" alt="final lawsuit relationship" src="http://www.smugmug.com/photos/267965460_4yVYd-L.gif" /></p>
<p>One plaintiff can sue one or more defendants in one or more suits.  You could (and I will) argue that this is even more ambiguous than the previous diagram.</p>
<ul>
<li>Who does the suing?  Is it the plaintiff, the defendant, or the suit itself?</li>
<li>Are they even suing?  Perhaps the relationship is just &#8220;they are all in the same room at the same time.&#8221;</li>
<li>When a plaintiff sues multiple defendants, is it one defendant per suit, with multiple suits?  Can it be?  Must it be?</li>
</ul>
<p>Personally, I never use an n-ary association when modeling complex relationships.  I much prefer the association class.</p>
<h2>A Simpler But Busier Alternative UML Class Diagram</h2>
<p>You never <em>have to</em> use an association class.  You can always represent the situation with three classes and two associations as the following diagram shows:</p>
<p><img title="alternate uml class diagram associations" alt="alternate uml class diagram associations" src="http://www.smugmug.com/photos/267977294_63Mxk-L.gif" /></p>
<p>Instead of an association class, you create a single class (suit) that represents the noun, and you break up the single association (suing) into two association (attacks with, defends against).  In some ways, this is more precise than using an association class.  You can tell from the diagram above that</p>
<ul>
<li>A single plaintiff attacks with one or more lawsuits.</li>
<li>One or more defendants defend against a single lawsuit.  Therefore, there could be two suits between the same plaintiff and the same defendants at the same time.</li>
</ul>
<p>What you lose is a notion that the suit <em>establishes the context of the relationship</em> between the plaintiff and the defendant(s).  Ultimately it is a judgment call about which form to use (the association class or the normal class with two associations).  If understanding the specific multiplicity data is important, you should use the two-association diagram.  If it is not, I personally feel that the association class provides clarifying context.</p>
<h2>Next Up</h2>
<p>In the first five parts of this series we’ve covered</p>
<ul>
<li>Using classes to represent business objects and entities.</li>
<li>Using simple associations (relationships) to demonstrate how objects are dependent or how they relate to one another.</li>
<li>Using composition and aggregation to show how objects are treated when grouped together.</li>
<li>Using generalization and inheritance hierarchies to show how similar, related objects can behave differently.</li>
<li>Using association classes and n-ary associations to express more complex relationships.</li>
</ul>
<p>If you understand all of these concepts, you are ready to create UML class diagrams of the business domain and concepts.  You are ready to use these tools to uncover otherwise hidden requirements.  If you want to study some of the more arcane details around UML class diagrams, you should be ready to read Scott Ambler&#8217;s articles.</p>
<ul>
<li><a title="uml class diagrams" href="http://www.agilemodeling.com/artifacts/classDiagram.htm">UML 2 Class Diagrams</a> &#8211; an explanation, in detail, of how and what and why to draw things a particular way</li>
<li><a title="styling your class diagrams" href="http://www.agilemodeling.com/style/classDiagram.htm">UML 2 Class Diagram Guidelines</a> &#8211; advice on how to make your diagrams consumable and appealing</li>
</ul>
<p>Just keep in mind that Scott jumps right into complex topics (which you are now ready for), and also includes tips and advice that are only relevant when creating class diagrams of implementation designs.  Just filter that stuff out.  Or come up with a way to leverage those details to the modeling of business ideas, and share them here.</p>
<p>Thanks for following along this far, and if you have any questions or would like to see us cover anything else about using UML class diagrams for uncovering requirements, add a comment below.</p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+Uncovering+Requirements+With+UML+Class+Diagrams+Part+5+http://bit.ly/167eF2+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2008/03/19/requirements-class-diagrams-5/&amp;t=Uncovering+Requirements+With+UML+Class+Diagrams+Part+5" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2008/03/19/requirements-class-diagrams-5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Uncovering Requirements With UML Class Diagrams Part 4</title>
		<link>http://tynerblain.com/blog/2008/03/17/requirements-class-diagrams-4/</link>
		<comments>http://tynerblain.com/blog/2008/03/17/requirements-class-diagrams-4/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 02:00:59 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[Requirements gathering]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[modeling requirements]]></category>
		<category><![CDATA[ooa]]></category>
		<category><![CDATA[requirements class diagram]]></category>
		<category><![CDATA[uml class diagram for analysis]]></category>
		<category><![CDATA[uml class diagrams]]></category>
		<category><![CDATA[uml requirements]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2008/03/17/requirements-class-diagrams-4/</guid>
		<description><![CDATA[
The hardest part of gathering requirements effectively is uncovering the requirements that people don&#8217;t immediately tell you.  You have to ask the right questions.  And one of the best ways to find the right questions to build a class diagram of the business domain.  This article continues our introduction to class diagrams.

Catching [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="dozer" title="dozer" src="http://www.smugmug.com/photos/266136527_CRPmU-L.jpg" /></p>
<p>The hardest part of gathering requirements <em>effectively</em> is uncovering the requirements that people don&#8217;t immediately tell you.  You have to ask the right questions.  And one of the best ways to find the right questions to build a class diagram of the business domain.  This article continues our introduction to class diagrams.</p>
<p><span id="more-649"></span></p>
<h2>Catching Up on UML Class Diagrams</h2>
<p>If you’ve found this article first, there are three that came before it.</p>
<ol>
<li><a title="Representing business concepts with uml class diagrams" href="http://tynerblain.com/blog/2008/03/06/requirements-class-diagrams-1/">Uncovering Requirements With UML Class Diagrams Part 1</a>: Discusses how to represent objects and entities from a business perspective.</li>
<li><a title="simple relationships in uml class diagrams" href="http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/">Uncovering Requirements With UML Class Diagrams Part 2</a>: Discusses simple relationships between objects or entities.</li>
<li><a title="using class diagrams for aggregation and compositing" href="http://tynerblain.com/blog/2008/03/13/requirements-class-diagrams-3/">Uncovering Requirements With UML Class Diagrams Part 3</a>: Discusses combining objects into collections and concepts.</li>
<li>Uncovering Requirements With UML Class Diagrams Part 4: This article.</li>
</ol>
<p>So jump back to the other articles and get up to speed. We’ll wait for you here. As a reminder, in this series, we’re specifically focusing on using UML class diagrams for uncovering requirements &#8211; as part of analysis, not design. We’re talking about what the business needs, not how the solution will work.</p>
<h2>Generalization: A Dog <em>Is A</em> Mammal</h2>
<p>We&#8217;ve looked at objects and relationships between them.  We&#8217;ve looked at the special association relationships that give us aggregation and composition.  Generalization is another form of relationship, but not one that tells us how different objects interact &#8211; one that helps us better describe objects.  We could talk about a dog, and create an object that represents a dog.  But what if we also wanted to talk about a horse?  They have some things in common, because they are both mammals.  Generalization allows us to talk about mammals too.  That&#8217;s fine, but let&#8217;s use a business example instead of a classroom example.</p>
<p>The key to this generalization relationship is to think about the phrase &#8220;is a.&#8221;  A dog <em>is a</em> mammal.  Don&#8217;t confuse this with combining objects into an aggregation.  A pack <em>has a</em> bunch of dogs in it.  A zoo <em>has a</em> bunch of mammals (and other animals) in it.  But a dog is not a specialized pack.  It is a specialized mammal.</p>
<p><strong>Remember <em>&#8220;&#8230;is a</em>&#8230;&#8221;</strong></p>
<p>This relationship carries special meaning &#8211; all things (characteristics, behaviors, etc) that are true about the general object are true about the specialized object.  But all things about the specialized object are not necessarily true about the general object.</p>
<ul>
<li>All mammals have hair, therefore all dogs have hair.</li>
<li>All mammals have live babies (they do not eggs), therefore all dogs have live babies (puppies).</li>
<li>All dogs are pack animals, but all mammals are not (elephants are, but shrews are not).</li>
</ul>
<p>Technical folks usually call this <em>inheritance</em> &#8211; the specialized object <em>inherits</em> all of the properties and behavior of the generalized object.  <em>Inherit </em>is almost as good of a word to use as <em>generalizes</em>.  Where <em>inheritance </em>really helps as a term is it allows us to think in terms of <em>parents and children</em> objects.  The mammal is a <em>parent</em> and the dog is a <em>child</em> of mammal.  The terms <em>parent</em> and <em>child </em>make it much less cumbersome to talk about generalization relationships.</p>
<h2>Understanding Insurance Policies With Generalization</h2>
<p>Consider that you&#8217;re working on a project for a life insurance company.  In your first <a title="interviewing techniques" href="http://tynerblain.com/blog/2006/01/15/how-to-interview-when-gathering-requirements/">conversation with a subject matter expert</a>, you hear five different terms for describing insurance policies.  At a convenient pause, you stop the interview, walk over to a white board, and draw <a title="drawing uml class diagram objects" href="http://tynerblain.com/blog/2008/03/06/requirements-class-diagrams-1/">class diagram objects</a> for each of the five items.</p>
<p><img title="insurance policies in disarray" alt="insurance policies in disarray" src="http://www.smugmug.com/photos/266357139_mBtpR-L.gif" /></p>
<p>You ask your expert how all these objects are related to each other.  She explains that all life insurance policies are either term policies (they last for a fixed term of time) or permanent policies (they last for as long as the premiums are paid).</p>
<p>You recognize this as a <em>generalization</em> relationship.</p>
<ul>
<li>Every Term Policy <em>is a</em> Life Insurance Policy</li>
<li>Every Permanent Policy <em>is a</em> Life Insurance Policy</li>
</ul>
<p>Your SME also informs you that permanent policies, as a form of investment, are always one of two special types &#8211; whole life policies and variable insurance policies.  Whole life policies have a fixed return for a fixed premium.  Variable policies invest your premium in market securities, and the amount of money available at the time of payment depends upon the performance of the policy.  More <em>generalization</em> relationships.</p>
<ul>
<li>Every Whole Life Policy <em>is a</em> Permanent Policy</li>
<li>Every  Variable Insurance Policy <em>is a</em> Permanent Policy*</li>
</ul>
<p>[*As far as I know.  If there is such a thing as a variable term life insurance policy, my apologies - just assume that your company does not sell one.]</p>
<p>You draw the generalization relationships on the white board, and you move forward in eliciting requirements.  This drawing is known as a <em>hierarchy</em>.</p>
<p><img alt="insurance policy hierarchy" title="insurance policy hierarchy" src="http://www.smugmug.com/photos/266357144_xfmde-L.gif" /></p>
<h2>Drawing Generalization Relationships in Visio</h2>
<p>You use the <em>generalization</em> shape in visio to create generalization (inheritance) relationships between classes in your class diagram.</p>
<p><img alt="generalization shape in static structure visio stencil" title="generalization shape in static structure visio stencil" src="http://www.smugmug.com/photos/266357130_4NdiY-L.jpg" /></p>
<p>As you drag it onto the page, it looks like the following:</p>
<p><img alt="dragging inheritance arrow onto visio page" title="dragging inheritance arrow onto visio page" src="http://www.smugmug.com/photos/266357135_xAxgF-L.jpg" /></p>
<p>The shape is an arrow with a closed (but not filled) arrowhead on one end.  You connect that arrowhead to the <em>parent</em> class &#8211; the more-general of the two.  The tail is connected to the <em>child</em> class &#8211; the more-specific of the two.</p>
<p><img alt="showing a single inheritance relationship in a uml class diagram" title="showing a single inheritance relationship in a uml class diagram" src="http://www.smugmug.com/photos/266357143_Qf4Lx-L.gif" /></p>
<p>Once you draw all the relationships, your Visio class diagram will look like the following:</p>
<p><img alt="Insurance policies in an inheritance relationship" title="Insurance policies in an inheritance relationship" src="http://www.smugmug.com/photos/266357144_xfmde-L.gif" /></p>
<p>Now you&#8217;re prepared to understand the other information your subject matter experts are sharing, in the context by which the business is describing their requirements.</p>
<p>This hierarchy makes sense, but it seems to be completely different from all the other class diagram stuff we&#8217;ve done.  How can you combine these different views?  It is the combination of them that really brings out the value.</p>
<h2>Relationships, Classes, and Inheritance</h2>
<p>The first thing to realize is that <a title="class diagram associations" href="http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/">association relationships</a>, <a title="composition and aggregation associations within uml class diagrams" href="http://tynerblain.com/blog/2008/03/13/requirements-class-diagrams-3/">composition relationships</a>, and inheritance relationships can all happily co-exist within the same UML class diagram.  In fact, much of the insight you gain into uncovering requirements only comes when you combine these different analyses within a diagram.</p>
<p>The structure we looked at above provides a good description of how a company manages the policies that they write.  What you are likely to want to document are requirements around selling those policies.  Each time a policy is sold, an <em>agreement</em> is created.  That agreement is a copy of the policy sold (at the time of selling it), with the insured person&#8217;s name filled in.  You can imagine the policy to be a form with blanks that need to be filled in.  Each time a policy is sold, someone makes a copy of the &#8220;official&#8221; policy, fills in the blanks &#8211; name of insured, policy dates, etc &#8211; and then it becomes an agreement.</p>
<p>Introducing the term <em>agreement</em> allows the business to treat the two ideas separately.  A policy defines the agreements that can be sold at any given time.  An agreement is one policy, as sold to an insured person (customer).</p>
<p><img alt="agreement small" title="agreement small" src="http://www.smugmug.com/photos/266462111_6J2c7-S.gif" /> [<a title="larger policy diagram" href="http://www.smugmug.com/photos/266462111_6J2c7-O.gif">click for larger diagram</a></p>
<p>As you can see from the diagram, we have the same hierarchy for describing insurance policies.  We've added some other objects and relationships.</p>
<p><strong>Objects</strong></p>
<ul>
<li>Agreement.  A policy written by an agent for an insured person.  The agreement is written in a specific state.</li>
<li>Agent.  An agent is someone who sells insurance policies (agreements).  The agent lives in a specific state.</li>
<li>Insured Person.  Someone who purchases an insurance policy (agreement).  The person lives in a specific state.</li>
<li>Insurance License.  An official document that allows someone to sell policies in a specific state for a period of time.</li>
<li>NASD License.  A special license from the National Association of Securities Dealers that allows someone to sell variable insurance policies.</li>
</ul>
<p><strong>Relationships</strong></p>
<ul>
<li>A life insurance policy <em>is used as a template for an</em> agreement.</li>
<li>An agreement <em>is written by an</em> agent.</li>
<li>An agreement <em>is held by </em>an insured person</li>
<li>An agent <em>holds one or more</em> insurance licenses.</li>
</ul>
<p>From the diagram, we can understand that an agent sells an agreement to an insured person.  That agreement is based on a life insurance policy.  The agent holds at least one license to sell insurance.</p>
<p>Notice the relationship between the <em>agreement </em>class and the<em> life insurance policy</em> class.  The life insurance policy is at the top of an inheritance hierarchy.  Each other type of insurance policy (term, whole life, etc) is just a specialization of life insurance policy.  The diagram depicts that the agreement can be one of any of the different types of insurance policy.  And therefore, an agent can sell any of the types, and an insured person can hold an agreement of any of the types of insurance policy.</p>
<p>When reviewing these relationships, you discover that this is an <em>overly</em> simplified representation.  You capture the additional information and update your diagram.</p>
<h2>More Complex Class Diagram</h2>
<p>As part of reviewing the diagram, you discover that <em>variable</em> insurance policies are treated very differently than other insurance policies.</p>
<ul>
<li>An agent must have a different type of license (an NASD) license to sell variable insurance.  Because of this, the business treats these agents as being special - they are called "Broker / Agents" and are subject to many different internal policies and procedures.  Some of those policies represent enforcement of legal regulations, and others are internal policies.</li>
<li>A broker / agent can sell both variable and fixed (non-variable) insurance policies.</li>
<li>A variable policy is a combination of a fixed policy and an investment.  As such, the business thinks about those customers as <em>investors</em>, and not just <em>insured people</em>.  This distinction is really only relevant to sales people and marketing - who will use different approaches to sell to people who want investments.</li>
</ul>
<p>You update your class diagram to look like the following:</p>
<p><img title="variable insurance small" alt="variable insurance small" src="http://www.smugmug.com/photos/266480800_DJPsu-S.gif" /> [<a title="larger complex diagram" href="http://www.smugmug.com/photos/266480800_DJPsu-O.gif">click for larger diagram</a>]</p>
<p>This diagram is much more complicated.</p>
<ul>
<li>We enhanced the hierarchy for insurance licenses to reflect that broker/agents need a different type of license (NASD license) to sell insurance.</li>
<li>An <em>insured person</em> holds a fixed agreement, where an <em>investor</em> holds a variable agreement.</li>
<li>An agent can only write a fixed agreement, where a broker/agent can write any type of agreement (fixed or variable).</li>
</ul>
<p>The diagram is  <em>almost</em> too complex to absorb within a UML tutorial.  If you were writing these requirements, and did not create a similar diagram, you would be in trouble.  In the best case, you would end up with an implementation that met all the requirements, but did not use a good implementation design (due to lack of context).  It is more likely that either you would miss some requirements, or your implementation or test team would miss some.</p>
<p>The diagrams that have had the most impact, in our experience, are diagrams that have a similar level of complexity.</p>
<h2>Next Up</h2>
<p>In the first four parts of this series we&#8217;ve covered</p>
<ul>
<li>Using classes to represent business objects and entities.</li>
<li>Using simple associations (relationships) to demonstrate how objects are dependent or how they relate to one another.</li>
<li>Using composition and aggregation to show how objects are treated when grouped together.</li>
<li>Using generalization and inheritance hierarchies to show how similar, related objects can behave differently.</li>
</ul>
<p>All of the tools you&#8217;ve learned so far deal with <em>binary</em> associations &#8211; an agent sells a policy, a book club reviews books.  In the next article, we will look at relationships that involve more than two classes.</p>
<p><a title="uml class diagram association classes and n-ary associations" href="http://tynerblain.com/blog/2008/03/19/requirements-class-diagrams-5/">Uncovering Requirements With UML Class Diagrams Part 5: Complex Relationships</a></p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+Uncovering+Requirements+With+UML+Class+Diagrams+Part+4+http://bit.ly/2VYFXp+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2008/03/17/requirements-class-diagrams-4/&amp;t=Uncovering+Requirements+With+UML+Class+Diagrams+Part+4" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2008/03/17/requirements-class-diagrams-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Uncovering Requirements With UML Class Diagrams Part 3</title>
		<link>http://tynerblain.com/blog/2008/03/13/requirements-class-diagrams-3/</link>
		<comments>http://tynerblain.com/blog/2008/03/13/requirements-class-diagrams-3/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 03:40:47 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[Requirements gathering]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[modeling requirements]]></category>
		<category><![CDATA[ooa]]></category>
		<category><![CDATA[requirements class diagram]]></category>
		<category><![CDATA[uml class diagram for analysis]]></category>
		<category><![CDATA[uml class diagrams]]></category>
		<category><![CDATA[uml requirements]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2008/03/13/requirements-class-diagrams-3/</guid>
		<description><![CDATA[
UML Class Diagrams are very effective at uncovering requirements.  They give us insight into how the business thinks about objects and their relationships.  And from that understanding, we think to ask questions we might otherwise overlook.  In this part of our series, we look at how to represent when one object is [...]]]></description>
			<content:encoded><![CDATA[<p><img title="digging" alt="digging" src="http://www.smugmug.com/photos/265493886_dXET4-L.jpg" /></p>
<p>UML Class Diagrams are very effective at uncovering requirements.  They give us insight into how the business thinks about objects and their relationships.  And from that understanding, we think to ask questions we might otherwise overlook.  In this part of our series, we look at how to represent when one object is made up of other objects.  The two types of relationships we explore are composition and aggregation.</p>
<p><span id="more-647"></span></p>
<h2>Catching Up on UML Class Diagrams</h2>
<p>If you&#8217;ve found this article first, there are two that came before it.</p>
<ol>
<li><a title="Representing business concepts with uml class diagrams" href="http://tynerblain.com/blog/2008/03/06/requirements-class-diagrams-1/">Uncovering Requirements With UML Class Diagrams Part 1</a>: Discusses how to represent objects and entities from a business perspective.</li>
<li><a title="simple relationships in uml class diagrams" href="http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/">Uncovering Requirements With UML Class Diagrams Part 2</a>: Discusses simple relationships between objects or entities.</li>
<li>Uncovering Requirements With UML Class Diagrams Part 3: This article.</li>
</ol>
<p>So jump back to the other articles and get up to speed.  We&#8217;ll wait for you here.  As a reminder, in this series, we&#8217;re specifically focusing on using UML class diagrams for uncovering requirements &#8211; as part of analysis, not design.  We&#8217;re talking about what the business needs, not how the solution will work.  UML class diagrams can be used for both, and most tutorials are written for<a title="scott ambler's technical tutorial" href="http://www.agilemodeling.com/artifacts/classDiagram.htm"> programmers doing design work</a>.  This one is written for people who work with requirements.</p>
<h2>Relationships of Combination</h2>
<p>When a collection of bananas are combined, we call them a bunch.  Crows exist in a murder, and lions in a pride.  Teams are made up of players.  It is a deck of cards.  An order is a collection of line items.  We have always had the notions of both individual items (or people) and combinations existing as an interesting entity.  Sometimes we treat them the same &#8211; you can eat a banana or a bunch.  You can feed a lion or a pride.  Sometimes, we deal with the combined entity.  You shuffle a deck, you fulfill an order.</p>
<p>Understanding this type of relationship can be very important to understanding what your customer (aka &#8220;the business&#8221;) needs.  You are describing the <em>mental model</em> of the business.  Business people think about fulfilling an order, not &#8220;fulfilling all of the items on the order.&#8221;  A user may want to archive the history (all the previous versions) of a file, or she may just want to keep the most recent version.  Thinking about these concepts helps you uncover the requirements.</p>
<p>There are two <a title="funny jargon video" href="http://tynerblain.com/blog/2006/02/15/jargon-gone-amuck/"><em>jargon</em></a> terms &#8211; aggregation and composition &#8211; that apply when we talk about multiple things as one combined thing.  They have precise meanings.</p>
<ul>
<li>Composition &#8211; when one item is <em>part of</em> another item, the relationship is composition.</li>
<li>Aggregation &#8211; when one item <em>can be included in</em> another item, the relationship is aggregation.</li>
</ul>
<p>If that doesn&#8217;t make sense, this &#8220;formal&#8221; distinction will really mess you up:</p>
<blockquote><p>Composition is a stronger form of aggregation where the whole and parts have coincident lifetimes, and it is very common for the whole to manage the lifecycle of its parts.</p>
<p><cite>Scott Ambler</cite></p></blockquote>
<p>Here are some examples that may simplify things:</p>
<h2>Composition</h2>
<ul>
<li>A building is composed of one or more rooms (a room is part of a building)</li>
<li>A plane is composed of a fuselage, one or more engines, and one or more wings (a wing is part of a plane)</li>
<li>An order is composed of one or more line items (a line item is part of an order)</li>
</ul>
<h2>Aggregation</h2>
<ul>
<li>A team includes more than one players</li>
<li>A library includes more than one books</li>
<li>A market includes one or more customers</li>
</ul>
<p>Ambler&#8217;s definition makes sense, when you think about these examples.  You could shut down a library without destroying the books &#8211; likewise, you could kick one of the players off a team and the team would still exist.  That&#8217;s what he means by <em>coincident lifetimes</em>.</p>
<h2>Drawing a Composition Relationship With Visio</h2>
<p>To draw a composition relationship in Visio, you use the <em>composition</em> shape from the UML Static Structure stencil.</p>
<p><img title="composition shape" alt="composition shape" src="http://www.smugmug.com/photos/265492984_eKQ9V-L.jpg" /></p>
<p>When you first drop this shape on the page to connect two classes, it looks like the following:</p>
<p><img title="an order is made up of line items" alt="an order is made up of line items" src="http://www.smugmug.com/photos/265492992_yKHGd-L.gif" /></p>
<p>There is a solid black diamond on one end (the first end) and nothing on the other end.  In UML, this is stating that an order is <em>composed of</em> line items.  By default, Visio shows the &#8220;end names&#8221; as it did with the association shape.  You can fix it the same way we did before.  Right click on the line and select <em>shape display options</em>.</p>
<p><img title="shape display options context menu item" alt="shape display options context menu item" src="http://www.smugmug.com/photos/264377116_QZicY-L.jpg" /></p>
<p>Then make the same modification we did before, to show the shape name and suppress the display of the &#8220;end names.&#8221;</p>
<p><img title="shape display options dialog" alt="shape display options dialog" src="http://www.smugmug.com/photos/264377118_7UN7a-L.jpg" /></p>
<p>Now you have the kind of display you want.  Note the check marks at the bottom of the dialog &#8211; you only have to make this change once per class diagram.  Unfortunately, Visio does not remember this change, so you have to do it once for every diagram (every new file, and every new tab within the same file).  Annoying.<br />
<img title="order to line item composition" alt="order to line item composition" src="http://www.smugmug.com/photos/265492996_dEy7k-L.gif" /></p>
<p>Double click on the line to update the information about <em>this</em> composition relationship.</p>
<p><img title="visio uml class diagram composition properties dialog" alt="visio uml class diagram composition properties dialog" src="http://www.smugmug.com/photos/265492980_2zGKm-L.jpg" /></p>
<p>You will end up with the following (we re-arranged it to make it easier to read):</p>
<p><img title="completed composition diagram" alt="completed composition diagram" src="http://www.smugmug.com/photos/265492999_YaJFT-L.gif" /></p>
<h2>Drawing an Aggregation Relationship With Visio</h2>
<p>Drawing an aggregation relationship is almost the same as a composition relationship with Visio &#8211; it just requires an additional step.</p>
<p><img title="book club" alt="book club" src="http://www.smugmug.com/photos/265492967_QbH5q-L.gif" /></p>
<p>In this example, a book club reviews books.  You want to show that the book club <em>includes</em> members.  Note &#8211; members can come and go without causing the book club to be disbanded.  You can think of aggregation as <em>membership</em> in a combined entity.</p>
<p>First, use the composition shape again (the same as above), and update the properties as we just did.  You will see</p>
<p><img title="composition as aggregation" alt="composition as aggregation" src="http://www.smugmug.com/photos/265492976_D5MHN-L.gif" /></p>
<p>The Visio stencil does not include a special <em>aggregation</em> shape, so we will cheat by changing the formatting of the <em>composition</em> shape.  Select (in the menu at the top of the window) format > line&#8230;</p>
<p><img title="format line menu item" alt="format line menu item" src="http://www.smugmug.com/photos/265492988_24LVC-L.jpg" /></p>
<p>And in the dialog, you will change the display of the &#8220;Begin&#8221; end-point.</p>
<p><img title="aggregation" alt="aggregation" src="http://www.smugmug.com/photos/265492981_qTAMs-L.jpg" /></p>
<p>Aggregation is represented in UML Class Diagrams with the same diamond-shape as composition.  The difference is that the shape is &#8220;empty&#8221; instead of being a solid black diamond.  Click &#8220;Apply&#8221; and &#8220;OK&#8221; and you end up with what you want:</p>
<p><img title="aggregation relationship for members in a book club" alt="aggregation relationship for members in a book club" src="http://www.smugmug.com/photos/265515915_CRatX-L.gif" /></p>
<p>Note: If you change the format of the composition line first, and then change the properties (&#8220;Joins&#8221; etc), Visio will reset the line end to be a solid diamond again.  It resets.  Annoying.  If you copy an aggregation line, the copy reverts to the solid diamond again too.  Very annoying.</p>
<h2>Next Up</h2>
<p>Up to this point, you&#8217;ve learned how to define classes (and attributes), simple relationships (A book club reviews books, and a member reads books), and combinations of items as compositions and aggregations (an order is composed of line items, and a book club aggregates members).</p>
<p>Next, we will cover hierarchies, usually thought of as &#8220;Is a&#8221; relationships.  A Sales Rep is an employee, and an employee is a person.</p>
<p><a title="inheritance in class diagrams" href="http://tynerblain.com/blog/2008/03/17/requirements-class-diagrams-4/">Uncovering Requirements With UML Class Diagrams Part 4</a>: Generalization (inheritance) and how to use it.</p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+Uncovering+Requirements+With+UML+Class+Diagrams+Part+3+http://bit.ly/41Djpk+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2008/03/13/requirements-class-diagrams-3/&amp;t=Uncovering+Requirements+With+UML+Class+Diagrams+Part+3" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2008/03/13/requirements-class-diagrams-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Uncovering Requirements With UML Class Diagrams Part 2</title>
		<link>http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/</link>
		<comments>http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 04:26:32 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[Requirements gathering]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[modeling requirements]]></category>
		<category><![CDATA[ooa]]></category>
		<category><![CDATA[requirements class diagram]]></category>
		<category><![CDATA[uml class diagram for analysis]]></category>
		<category><![CDATA[uml class diagrams]]></category>
		<category><![CDATA[uml requirements]]></category>
		<category><![CDATA[visio]]></category>
		<category><![CDATA[visio uml]]></category>
		<category><![CDATA[visio uml stencil]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/</guid>
		<description><![CDATA[
We continue our exploration of UML Class Diagrams with this article that explores how to represent basic business relationships in a class diagram.  Drawing these relationships can dramatically clarify requirements documents.  Using a class diagram to supplement other requirements documents provides for a centralized reference that enables a shared understanding of the problem [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="front loader" title="front loader" src="http://sehlhorst.smugmug.com/photos/264358008_sQVyu-L-0.jpg" /></p>
<p>We continue our exploration of UML Class Diagrams with this article that explores how to represent basic business relationships in a class diagram.  Drawing these relationships can dramatically clarify requirements documents.  Using a class diagram to supplement <a title="requirements documents" href="http://tynerblain.com/blog/2006/01/20/document-proliferation/">other requirements documents</a> provides for a centralized reference that enables a <em>shared understanding</em> of the problem domain.  That <a title="writing unambiguous requirements" href="http://tynerblain.com/blog/2006/06/12/writing-unambiguous-requirements/">understanding prevents mistakes</a> in interpreting requirements.</p>
<p><span id="more-646"></span></p>
<h2>Getting Up To Speed</h2>
<p>We started this <a title="Class diagrams" href="http://tynerblain.com/blog/2008/03/06/requirements-class-diagrams-1/">discussion of class diagrams</a> last week.  In it, we presented the notion of a class.  When <a title="stakeholder goals" href="http://tynerblain.com/blog/2007/10/11/stakeholder-goals/">a stakeholder cares about</a> a concept, idea, or thing, we represent it as a class.</p>
<p><img alt="customer class" title="customer class" src="http://www.smugmug.com/photos/262849856_uMzVU-L.gif" /></p>
<p>The business cares about customers.  And customers have addresses and credit ratings.</p>
<h2>Classes and Attributes</h2>
<p>How do you know when something should be an attribute, and not another class?  In our example above, think about <em>Customer</em> and <em>Address</em> and <em>Credit Rating</em>.  One way to make a distinction is to say that if an attribute has other attributes, it should be a class.  A credit rating is just a number.  But an address is a compound object made up of multiple attributes.</p>
<p><img alt="customer address 1" title="customer address 1" src="http://www.smugmug.com/photos/264377102_ZH2j7-L.gif" /></p>
<p>An address can have multiple lines of street address information, as well as city, state, zip code and country information.  That is a good indicator that it is <em>likely to be</em> a class of its own.  If we were to represent an address as attributes of a customer, we would have to include each of the &#8220;sub attributes&#8221; as a separate attribute of customer.  That feels bad, from a design standpoint.</p>
<p>The distinction is one of design, but generally speaking, if the concept stands on its own, it should be its own class.  An address is <em>related to</em> the customer.  A credit rating is <em>a property of</em> a customer.</p>
<h2>Simple Relationships</h2>
<p>How do we show a relationship between a customer and an address?</p>
<p><img alt="customer lives at address" title="customer lives at address" src="http://www.smugmug.com/photos/264377128_e6uKa-L.gif" /></p>
<p>The customer receives bills at an address.  That is the relationship between the customer and the address.  The business wants to know where to send bills for the customer.  We&#8217;ll talk more about relationships in a bit.  First, we&#8217;ll cover the steps in visio for creating the relationship shown above.</p>
<h2>Showing Relationships With Visio&#8217;s UML Stencil</h2>
<p>The relationship shown above is called a <em>binary association</em>, because it shows the association between two classes.  There is an object (Visio calls it a &#8220;master shape&#8221;) in the Static Structure template for creating these, aptly named <em>binary association</em>.</p>
<p><img title="binary association master shape" alt="binary association master shape" src="http://www.smugmug.com/photos/264377105_RzEd8-L.jpg" /></p>
<p>Drag that onto the page, and connect the two classes for which you wish to show a relationship.</p>
<p><img title="binary association with end names" alt="binary association with end names" src="http://www.smugmug.com/photos/264377114_Nwh78-L.gif" /></p>
<p>The default display properties for the <em>binary association</em> shape cause the shape to display some weird information &#8211; called the &#8220;end names&#8221; of the relationship.  The shape also does not give us the arrowhead, or the name of the relationship, <em>Receives Bills At</em>.  Right click on the line and select &#8220;Shape Display Options&#8230;&#8221;</p>
<p><img title="shape display options context menu" alt="shape display options context menu" src="http://www.smugmug.com/photos/264377116_QZicY-L.jpg" /></p>
<p>Remember this, you will use the dialog that pops up a lot.</p>
<p><img title="uml shape display options dialog" alt="uml shape display options dialog" src="http://www.smugmug.com/photos/264377118_7UN7a-L.jpg" /></p>
<p>We want to do three things for now:</p>
<ol>
<li>Check &#8220;Name&#8221; so that the name of the relationship (Receives Bills At) will show up.</li>
<li>Un-check &#8220;First end name&#8221; so that it is hidden.</li>
<li>Un-check &#8220;Second end name&#8221; so that it is hidden too.</li>
</ol>
<p>Click OK, and the shape will have updated to look like the following:</p>
<p><img title="unnamed association" alt="unnamed association" src="http://www.smugmug.com/photos/264377121_YoYt9-L.gif" /></p>
<p>The name is defaulted (to &#8220;Association1&#8243;), and no arrowheads are showing up.  We also have two asterisks, an no &#8220;1.&#8221;  We need to update the shape&#8217;s properties (not <em>display</em> properties) to include that information.  Double click on the line and you will see the following dialog (Fill it out to match):</p>
<p><img title="shape properties" alt="shape properties" src="http://www.smugmug.com/photos/264377126_AYaEt-S.jpg" /> [<a title="full size association properties dialog" href="http://www.smugmug.com/photos/264377126_AYaEt-L.jpg">click for full size view</a>]</p>
<ul>
<li><strong>Name</strong>: Enter &#8220;Receives Bills At.&#8221; for the name.  Note &#8211; some people prefer mixed case or lower-case.  Any approach is fine, just <a title="writing requirements consistently" href="http://tynerblain.com/blog/2006/06/09/big-ten-rules-writing-consistent-requirements/">be consistent</a>. The name is the name <em>of the relationship</em> and it indicates the meaning of the relationship.</li>
<li><strong>Name Reading Direction</strong>: forward and backward will confuse you.  It confused me for years.  This is what determines where the small solid triangle shows up to indicate the direction of reading.  <em>Customer</em> Receives Bills At <em>Address</em>, instead of <em>Address </em>Receives Bills At <em>Customer</em>.  One day, I realized that this field only controls if the triangle shows up before or after the text.  With up-down relationships, I still get confused.  Use the standard of top-to-down is the same as left-to-right, and you&#8217;ll eventually get used to it.</li>
<li><strong>Association Ends</strong>:  This section shows the two ends as rows in a table &#8211; with five columns describing each end.  For now, we will only focus on the last two columns.  This is another area for confusion &#8211; the first row represents the top-left end of the line (when you drag it onto the page) and the second row represents the bottom-right end of the line.  You can move the ends of the line around after you place it on the page, and the rows in this table will maintain their original associations.  Try not to get frustrated when you get these backwards.  I still make that mistake all the time, after creating a few hundred diagrams over the course of a decade.  Think of the top-left end of the line as the &#8220;first&#8221; end, and the bottom-right as the &#8220;second.&#8221;  Then when you move it around, you might remember which is which.  If you get in the habit of attaching the line first to the &#8220;from&#8221; class, and then to the &#8220;to&#8221; class, you will start to get the hang of it.</li>
<li><strong>Multiplicity</strong>:  Multiplicity allows you to specify how many objects can be on either end of the relationship.  In our example, a customer can receive bills at only one address, but multiple customers could share the same address.  My stepdaughter and I each have iTunes accounts.  We are two separate customers, but we have the same address.  Since I attached the &#8220;first&#8221; end to the <em>Customer</em> class, there is an asterisk in the first row, and a &#8220;1&#8243; in the second row. [*See below for explanations]</li>
<li><strong>IsNavigable</strong>:  Either the UI designers for Visio expected all of their users to be Java programmers, or they ran out of space.  &#8220;IsNavigable&#8221; can be translated into &#8220;Should the arrow be shown on this end of the line?&#8221;  Since, as a business, we care about the address at which a customer receives bills, we show the arrow for the &#8220;second&#8221; end.  But we don&#8217;t anticipate (commonly) needing to determine all of the customers that receive bills at a particular address &#8211; so we don&#8217;t show the arrow in the opposite direction.</li>
</ul>
<h2>Types of Multiplicity</h2>
<p>There are a few different concepts that can be displayed for multiplicity.  Your developer co-workers and math geeks will call this cardinality.  That&#8217;s probably even the <em>better</em> term to use.  But since Visio chose <em>multiplicity</em>, so will we, at least for this article.<br />
<img alt="multiplicity" title="multiplicity" src="http://www.smugmug.com/photos/264401798_kq7X2-L.jpg" /></p>
<ul>
<li>1: Exactly one object of this type is involved in the relationship.  A customer has one billing address.</li>
<li>*: Any number of objects (or none at all) are involved in the relationship.  Any number of customers can receive bills at a given address.</li>
<li>0..1: Zero or one objects are involved in the relationship.  A driver may or may not have a drivers license.</li>
<li>0..*: Same as &#8220;*&#8221;</li>
<li>1..1: Same as &#8220;1&#8243;</li>
<li>1..*: Any number of objects (as long as there is at least one) may be involved in the relationship.  A shipment can include any number of items, and it must include at least one item.</li>
</ul>
<p>This brings us back to our original relationship example.</p>
<p><img title="customer billing address relationship" alt="customer billing address relationship" src="http://www.smugmug.com/photos/264377128_e6uKa-L.gif" /></p>
<p>The small class diagram above represents the following:</p>
<ul>
<li>A customer has a credit rating.</li>
<li>An address includes three fields for &#8220;street information&#8221;, city, state/province/county, zip or postal code, and country fields.</li>
<li>A customer receives bills at <strong>exactly one</strong> address.</li>
<li>Any number of customers (or none at all) can receive bills at any one address.</li>
</ul>
<h2>Simple Relationships Revisited</h2>
<p>With the mechanics of using Visio out of the way, we can show some examples of some other simple relationships.</p>
<p><img alt="sales rep and customer" title="sales rep and customer" src="http://www.smugmug.com/photos/264426683_VYTbZ-L.gif" /></p>
<ul>
<li>A sales rep sells products to any number of customers.</li>
<li>Any number of customers purchase products from a sales rep.</li>
</ul>
<p>Both examples above depict the same relationship, and either is acceptable.  What would be bad would be to use the passive voice and say &#8220;any number of customers are sold products by a sales rep.&#8221;  This is the same advice that applies <a title="writing good use case names" href="http://tynerblain.com/blog/2007/01/22/how-to-write-good-use-case-names/">when writing use case names &#8211; don&#8217;t use passive voice</a>.</p>
<p>There are opportunities to misread requirements when relying <em>solely</em> on UML.  Imagine we had a requirement that any customer always make purchases from a single sales rep.  The goal is to provide a sense of <em>relationship</em> for that customer.  Both of the diagrams above <em>technically</em> express that requirement.  If a customer could have more than one sales rep, we would show &#8220;1..*&#8221; instead of &#8220;1&#8243; for the multiplicity on the sales rep side of the relationship.</p>
<p>Someone reading the examples above could <em>reasonably</em> be unsure about the intended requirement.  Is there a single sales rep for a given transaction?  Is there a single sales rep for a given customer, regardless of the number of transactions?  Only the latter interpretation is <em>technically</em> accurate &#8211; but either is a <em>reasonable</em> interpretation.  <a title="daniel berry's home page" href="http://se.uwaterloo.ca/~dberry/">Professor Daniel Berry</a>, author of <a title="the ambiguity handbook" href="http://se.uwaterloo.ca/~dberry/handbook/ambiguityHandbook.pdf"><em>The Ambiguity Handbook</em></a> [The actual title is <em>From Contract Drafting to Software Specification: Linguistic Sources of Ambiguity, A Handbook</em>], explained in a lecture last year at the <a title="2007 ibrf" href="http://tynerblain.com/blog/2007/09/06/10th-ibrf/">2007 IBRF</a> that UML stands for <em>Undefined</em> Modeling Language.  This is a good example of that.</p>
<p>By including the diagram within, or as a reference from, a requirements document, you provide both the context and the graphical clarity needed to understand the intent.  Don&#8217;t rely solely on the diagram!</p>
<p><img title="a product has a price" alt="a product has a price" src="http://www.smugmug.com/photos/264426726_jJbE8-L.gif" /></p>
<p>A product has a price.  One product has one price.  This relationship is almost too simple, making it difficult to come up with a good name for the relationship.  &#8220;A product has a price of price&#8221; is awkward.</p>
<p><img title="product will be sold for price" alt="product will be sold for price" src="http://www.smugmug.com/photos/264435630_tY9Ws-L.gif" /></p>
<p>&#8220;A product will be sold for a price&#8221; is better.  If we were limited to &#8220;has a&#8221;, we could make an argument that the price should be an attribute.  But the price may have properties (like currency used), or may be calculated dynamically based on coupons or contracts.</p>
<p>Using <em>action verbs</em> will help with both understanding and elicitation.  If you are reviewing the diagram above with a stakeholder, you are not likely to get any discussion from &#8220;product has a price&#8221; &#8211; of course it does.  But if you show &#8220;product will be sold for a price&#8221; you will immediately trigger responses.  Especially if you ask &#8220;how do you know what price to sell the product for?&#8221;  Use active verbs with explicit meanings instead of &#8220;weasel words&#8221; like &#8220;has a.&#8221;</p>
<p><img title="multiple addresses" alt="multiple addresses" src="http://www.smugmug.com/photos/264426677_ecG4B-L.gif" /></p>
<p>This is a very clear way to indicate that from a business perspective, the customer has a billing address <em>and</em> a shipping address, and no reason to expect them to be the same.  If you have to worry about export compliance, you may add an &#8220;end use&#8221; address &#8211; the location where the product will ultimately be used.  Imagine how messy that would be if we had used attributes instead of classes!</p>
<p>As messy as that would be, this highlights why we use classes.  Think about some other business relationships we have not drawn.  Credit card authorization uses the billing address.  Taxes may be* calculated based upon the billing address or the shipping address.  Shipping charges would be based upon the shipping address. [*I believe that for physical goods, the shipping address is used, and for electronic downloads, the billing address is used.]<br />
There is no limit to the number of entities and relationships that can be represented in a class diagram.  As a guideline, <a title="target your writing for your audience" href="http://tynerblain.com/blog/2006/10/04/writing-for-the-purpose-of-reading/">think about usability</a>.  Are you producing class diagrams as part of exploring specific areas of the business?  Are you making sure that a complex set of relationships do not get oversimplified?  Are you &#8220;boiling the ocean&#8221; with a giant encyclopedia of the business domain?  If you are &#8211; why?</p>
<h2>Summary So Far</h2>
<p>So far, we have discussed classes as a means to represent entities from a business perspective.  We&#8217;ve also introduced some simple relationships.  Those relationships show how pairs of entities interact or inter-relate.  We&#8217;ve shown how to make the relationships directional and bidirectional &#8211; depending on which way(s) the business needs to look at things.  And we&#8217;ve covered multiplicity &#8211; how many of each type of object are involved in the relationship.</p>
<p>There is still a fair amount of ground to cover between here and Scott Ambler&#8217;s comprehensive reference.  If any of the concepts so far are unclear, or if there&#8217;s something you want to make sure we cover &#8211; add a comment!</p>
<h2>Next Up</h2>
<p>In our next article on using UML Class Diagrams for unearthing requirements, we will look at more complex relationships.</p>
<p><a title="using class diagrams for aggregation and compositing" href="http://tynerblain.com/blog/2008/03/13/requirements-class-diagrams-3/">Uncovering Requirements With UML Class Diagrams Part 3</a>: Combining objects into collections and concepts.</p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+Uncovering+Requirements+With+UML+Class+Diagrams+Part+2+http://bit.ly/lK0CC+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/&amp;t=Uncovering+Requirements+With+UML+Class+Diagrams+Part+2" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Uncovering Requirements With UML Class Diagrams Part 1</title>
		<link>http://tynerblain.com/blog/2008/03/06/requirements-class-diagrams-1/</link>
		<comments>http://tynerblain.com/blog/2008/03/06/requirements-class-diagrams-1/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 04:23:41 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[Requirements gathering]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[modeling requirements]]></category>
		<category><![CDATA[ooa]]></category>
		<category><![CDATA[requirements class diagram]]></category>
		<category><![CDATA[uml class diagram for analysis]]></category>
		<category><![CDATA[uml class diagrams]]></category>
		<category><![CDATA[uml requirements]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2008/03/06/requirements-class-diagrams-1/</guid>
		<description><![CDATA[
UML Class Diagrams can be used not only for documenting software design, but for documenting software requirements.  One of the challenges in writing clear, unambiguous requirements is being precise about what a particular word means.  This is especially true with symbolic terms like &#8220;quote&#8221; or &#8220;customer&#8221; &#8211; where everyone knows what they mean [...]]]></description>
			<content:encoded><![CDATA[<p><img title="digger" alt="digger" src="http://sehlhorst.smugmug.com/photos/262810530_eFAkk-L.jpg" /></p>
<p>UML Class Diagrams can be used not only for documenting software design, but for documenting software requirements.  One of the challenges in writing clear, unambiguous requirements is being precise about what a particular word means.  This is especially true with <a title="symbolism and communication" href="http://tynerblain.com/blog/2006/02/12/symbolism-and-communication/"><em>symbolic</em> terms</a> like &#8220;quote&#8221; or &#8220;customer&#8221; &#8211; where everyone <em>knows</em> what they mean &#8211; but they mean different things to different people.</p>
<p><span id="more-644"></span></p>
<h2>Why Create UML Class Diagrams for Requirements?</h2>
<p>One of the first articles we wrote in 2005 provides <a title="diagrams simplify requirements" href="http://tynerblain.com/blog/2005/12/09/a-picture-is-worth-a-thousand-requirements/">a very simple class diagram example</a>, and an explanation of why you should use class diagrams to clarify your documents.</p>
<blockquote><p><img style="width: 396px; height: 213px" src="http://sehlhorst.smugmug.com/photos/47711990-M.png" /></p>
<p>In prose, we could also capture the same information as follows:</p>
<ol>
<li>The      system shall include a representation of customer orders.</li>
<li>Each order will have a single associated customer, and each customer can have multiple orders. Note that a customer is not required to have any orders.</li>
<li>Each order will have at least one, and possibly multiple line items. Each line item is uniquely associated with a single order.</li>
<li>Each line item represents a single product. Note that a product is not required to be represented in a line item. A product can be represented in multiple line items (even within the same quote).</li>
</ol>
<p><strong>OOA is compellingly powerful as a descriptive tool</strong> – it took less time to draw the diagram, and it <em>can be</em> easier to read than the prose.</p>
<p><cite><a title="using class diagrams" href="http://tynerblain.com/blog/2005/12/09/a-picture-is-worth-a-thousand-requirements/">A Picture is Worth A Thousand Requirements</a></cite></p></blockquote>
<p>UML class diagrams, in addition to being potent for communication, can also help with requirements discovery.  They provide a clarity and explicitness of understanding that helps you gain insight into the topics being explored.</p>
<h2>Getting Started or Getting Refreshed</h2>
<p>If you already know UML, or generally know how to draw UML 2 Class Diagrams, you can &#8220;test out&#8221; of this article, and go to the best, most thorough explanations we know of, courtesy of Scott Ambler.</p>
<ul>
<li><a title="uml class diagrams" href="http://www.agilemodeling.com/artifacts/classDiagram.htm">UML 2 Class Diagrams</a> &#8211; an explanation, in detail, of how and what and why to draw things a particular way</li>
<li><a title="styling your class diagrams" href="http://www.agilemodeling.com/style/classDiagram.htm">UML 2 Class Diagram Guidelines</a> &#8211; advice on how to make your diagrams consumable and appealing</li>
</ul>
<p>If your eyes glazed over, that&#8217;s ok.  There is a lot to absorb.  There are a lot of advanced concepts that can be represented in class diagrams, and Scott provides explanations and examples of how to do most of them.  If you are new to modeling with UML, or are only interested in what you need to know to document <em>requirements</em>, those articles may be too advanced for now.  We&#8217;ll try and close the gap.  Keep those links handy, both for reference, and for deeper explanations than we cover here.  If Ambler&#8217;s articles are written to help you be a master craftsman, we want to help you become a journeyman first.</p>
<p>Class diagrams are incredibly powerful tools for anyone doing requirements work.  I never wrote about them before, because Ambler already did.  And he didn&#8217;t leave me wanting more, so I never knew what to write.  After a recent conversation with someone new to modeling, I discovered that he did leave a gap.  There&#8217;s a fair amount of learning you need to do before you can really get the value from his articles. Ambler also addresses both the analysis and design uses of class diagrams.</p>
<p>We will focus exclusively on using UML class diagrams for analysis.  So if you are a business analyst or requirements analyst, this will help.  If you are a developer, this will help you read the diagrams that analysts create.  If you are a product manager, this will help too, but I think you&#8217;ll need to do this less frequently than a business analyst would.</p>
<p>We do assume that you are already comfortable using Microsoft Visio, but have not used it for creating class diagrams.  You don&#8217;t have to use Visio, but the tools in Visio are good ones for creating class diagrams.</p>
<h2>Visio Template for UML Class Diagrams</h2>
<p>The easiest way to get started is with the default drawing type already available in Visio.</p>
<p><img title="new visio file" alt="new visio file" src="http://sehlhorst.smugmug.com/photos/262810541_NDfPN-L.jpg" /></p>
<p>Create a new file, and select the Software category, then scroll down and select &#8220;UML Model Diagram&#8221; in either US or Metric units.  When you do, a number of stencils will automatically load for you.  You want to use the UML Static Structure stencil.</p>
<p><img title="static structure stencil" alt="static structure stencil" src="http://sehlhorst.smugmug.com/photos/262810538_c8hY9-L.jpg" /></p>
<p>These are the shapes that you use to represent objects in a class diagram.  You can safely ignore all of the other stuff that Visio provides in the other templates.</p>
<h2>The Class</h2>
<p><img alt="empty class" title="empty class" src="http://www.smugmug.com/photos/262839662_rnBFu-L.gif" /></p>
<p>When you drag the &#8220;Class&#8221; shape onto the page, you get the empty looking box on the left.  Visio automatically names it for you as &#8220;Class1.&#8221;  The class represents a concept, entity, item, or object.  It is important for analysts to remember that what you are drawing is &#8220;how the business thinks about these objects&#8221; &#8211; <em>not</em> &#8220;how developers will implement a representation of the objects.&#8221;</p>
<p>There are three areas in each &#8220;class&#8221; shape.  The shape on the right shows that the top area is where the name of the class appears (in bold), the middle section represents attributes, and the lower section captures operations that can be performed by the shape.  This feels like describing an implementation or design.  The terms <em>attribute</em> and <em>operation</em> certainly sound like programming.  UML Class Diagrams may have initially been created to help developers design solutions, that would certainly explain the names.  There is still a lot of power to be unleashed &#8211; so take it on faith for now &#8211; we&#8217;ll present some examples that demonstrate the value of class diagrams for analysis.</p>
<p><img alt="lamp class" title="lamp class" src="http://www.smugmug.com/photos/262839667_A4gjs-L.gif" /></p>
<p>Imagine that you are thinking about a lamp.  Perhaps you are designing an emergency battery backup system, and one of the things you need to think about is how much wattage a lamp requires to operate.  The wattage of the lamp, in English, is a <em>characteristic</em> of the lamp.  Programmers call it an attribute.  For our purposes, the terms are interchangeable.</p>
<p>A lamp can be turned on.  That is pretty intuitive.  We imagine ourselves turning on a lamp.  Actually, all we do is turn a dial (or flip a switch).  When we turn the dial, <em>the lamp turns itself on</em>.  If we were really playing with language, we might say &#8220;When the user requests illumination, the lamp turns on.&#8221;  We would never use that phrasing for a concept as simple as a lamp, but you get the idea.  The <em>operation</em> is something that the object can do.  Dogs bark, cats meow, lamps turn on.</p>
<p>When we are creating class diagrams for requirements discovery, we will <em>always</em> use class names, <em>almost always</em> use attributes, and <em>almost never</em> use operations.</p>
<p><img title="customer" alt="customer" src="http://www.smugmug.com/photos/262849856_uMzVU-L.gif" /></p>
<p>A customer, in the diagram element above has an address.  The customer also has a credit rating.</p>
<p><img title="product" alt="product" src="http://www.smugmug.com/photos/262849859_5qqyh-L.gif" /></p>
<p>The two elements above represent the same information.  A product has both price and weight.  We also find, during our requirements exploration, that we need to know if a product is available.  Perhaps our users need to know if a product is available right now before suggesting it as an <em>up-sell</em> item to a customer.  If that is our requirement, we realize that we need to know the availability of the product.  You can either include the question &#8220;Is it available?&#8221; or a single name for the attibute &#8211; &#8220;Availability.&#8221;</p>
<p>It is better to use the word &#8220;Availability&#8221; for two reasons.  First, it is consistent to say &#8220;price, weight and availability.&#8221;   You could achieve consistency with all questions &#8211; &#8220;What is the price?&#8221; &#8220;How much does it weigh?&#8221; and &#8220;Is it available?&#8221;  But that becomes overly wordy.  The second reason for using a single word is to <a title="separate rules from requirements" href="http://tynerblain.com/blog/2007/09/11/why-separate-rules-from-requirements/">avoid embedding rules in your requirements</a>.</p>
<p><img title="customer again" alt="customer again" src="http://www.smugmug.com/photos/262849856_uMzVU-L.gif" /></p>
<p>Consider the &#8220;Credit Rating&#8221; attribute for the Customer object.  What we really want to know is if the customer&#8217;s credit is good.  The definition of &#8220;good&#8221; will change over time, or may become complex.  &#8220;Good enough for small purchases&#8221;, &#8220;Good when putting 20% down&#8221; are examples of the definition of &#8220;good&#8221; becoming complex.  Or maybe you&#8217;re loaning money, and you can improve your profits with notions of &#8220;pretty good&#8221; and &#8220;really good.&#8221;  You will <a title="business rules and business requirements" href="http://tynerblain.com/blog/2006/10/18/business-rules-and-requirements/">create business rules</a> to define what you mean by good.  You happen to know that those rules will reason about the customer&#8217;s <em>credit rating</em>, so you should capture that value.</p>
<p>You <em>could</em> but <em>should not</em> represent the notion of &#8220;Is Credit Good?&#8221; with an operation:</p>
<p><img title="credit operation" alt="credit operation" src="http://www.smugmug.com/photos/262852476_iV2ma-L.gif" /></p>
<p>You end up specifying design here &#8211; however unintentionally.  Depending on how you interpret this, you are either saying &#8220;Customers are responsible for determining if their credit is good&#8221; or &#8220;The credit worthiness of a customer is determined without considering anything other than the customer.&#8221;  While precise for programmers doing design, this is a pretty ambiguous thing to document in an analysis.  By adding this operation, you are not providing unambiguous insight into how the business thinks about customers.  <strong>So don&#8217;t do it</strong>.</p>
<h2>Next Up</h2>
<p>In our next article on <a title="class diagrams and requirements relationships" href="http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/">UML Class Diagrams for analysis, we&#8217;ll look at relationships between classes</a>.</p>
<p>If there&#8217;s something in particular you&#8217;d like to see explained, add a comment below and we&#8217;ll either fold it into the series or answer in the comments.  And remember &#8211; you can subscribe to the comments for any article, just click the link.</p>
<p><a title="simple relationships in uml class diagrams" href="http://tynerblain.com/blog/2008/03/10/requirements-class-diagrams-2/">Uncovering Requirements With UML Class Diagrams Part 2</a>: Simple relationships between objects or entities.</p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+Uncovering+Requirements+With+UML+Class+Diagrams+Part+1+http://bit.ly/461efs+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2008/03/06/requirements-class-diagrams-1/&amp;t=Uncovering+Requirements+With+UML+Class+Diagrams+Part+1" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2008/03/06/requirements-class-diagrams-1/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>How To Draw an Asynchronous Process</title>
		<link>http://tynerblain.com/blog/2007/11/19/asynchronous-processes/</link>
		<comments>http://tynerblain.com/blog/2007/11/19/asynchronous-processes/#comments</comments>
		<pubDate>Tue, 20 Nov 2007 03:28:45 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Business Analysis]]></category>
		<category><![CDATA[Process Flow]]></category>
		<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[asynchronous process]]></category>
		<category><![CDATA[asynchronous sequence diagram]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[process flows]]></category>
		<category><![CDATA[uml sequence diagrams]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2007/11/19/asynchronous-processes/</guid>
		<description><![CDATA[
Documenting processes is something most business analysts have to do.  The goal of documenting the process is to communicate requirements.  By establishing a shared understanding of the process, you can establish the context for the requirements.  Easy processes are easy to draw and understand.  When documenting a more complex process, you [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="drawing" title="drawing" src="http://www.smugmug.com/photos/223396990-M.jpg" /></p>
<p>Documenting processes is something most business analysts have to do.  The goal of documenting the process is to communicate requirements.  By establishing a shared understanding of the process, you can establish the context for the requirements.  Easy processes are easy to draw and understand.  When documenting a more complex process, you need to provide the same clarity and consistency.  In this article we show how to document asynchronous process steps to maximize the clarity of the documentation.</p>
<p><span id="more-602"></span></p>
<h2>Speak in Your Reader&#8217;s Language</h2>
<p>The diagrams you choose to use represent a graphical language for communication.  It is really no different than choosing a language in which to write your textual requirements.  You need to choose a graphical language that the consumers of your document understand.</p>
<p>You can <a title="intro to bpmn" href="http://tynerblain.com/blog/2006/07/18/foundation-series-business-process-modeling/">use BPMN (business process modeling notation) to document your processes</a>, and be quite precise in your description of the process.  However, if the team you are communicating with does not know BPMN, it may not be the most effective way to communicate.  You are faced with a trade-off.  You have to either use a language (process flow charts) that is easily understood but hard to extend, or use a language that is precise in interpretation &#8211; but only to people who know the language.</p>
<p>Here&#8217;s a solution that uses diagrams that are better known than BPMN, leveraging process flow charts and UML sequence diagrams.</p>
<h2>Asynchronous Process Definition</h2>
<p>An synchronous process is one where two objects or systems talk to each other.  The first system sends a message to the second system <em>and waits for a response</em>.  An asynchronous process is one where two objects or systems talk to each other &#8211; but the first system does not wait for a response from the second.</p>
<p>Imagine making a bank deposit.  If you go to the bank, hand your money to the cashier, and wait for a deposit slip, you have just participated in a synchronous process.  You did something, and waited for the cashier before doing something else.</p>
<p>Now imagine driving through a toll booth.  You drive up to the toll booth, roll down your window, and throw your money into the collection basket.  You wait for the machine to count the money, the light turns green, and you drive on.  This is also a synchronous process.</p>
<p>Now imagine that you are in a hurry.  You roll down your window as you approach the toll booth.  You slow down, and as you drive by, you throw the money into the collection basket, and accelerate.  You don&#8217;t wait for the light to turn green &#8211; you trust that you had put enough money in the basket and you move on.  The machine still counts the money, and the light still turns green &#8211; but you didn&#8217;t wait for it.  You continued to do what you were doing &#8211; driving in a hurry.  You just participated in an asynchronous process.</p>
<h2>Drawing an Asynchronous Process</h2>
<p>Consider a simple asynchronous process &#8211; ordering a hamburger at Wendy&#8217;s.</p>
<p>Wendy&#8217;s has an interesting process for serving &#8220;made to order&#8221; burgers quickly.  They cook a small number of hamburgers in advance, and keep them warm for a short period of time.  If someone orders a burger, they take one of the already cooked burgers, and assemble it with the custom toppings.  They also put another raw burger on the grill to replace the one they just sold.  The challenge for the grill cook at Wendy&#8217;s is to have enough burgers ready that no one has to wait &#8211; while not having so many burgers precooked that any of them dry out before you order.</p>
<p><img title="asynchronous process flow" alt="asynchronous process flow" src="http://sehlhorst.smugmug.com/photos/223395905-O.jpg" /></p>
<p>The labels in the boxes above are generic, but it could be used to describe ordering a burger at Wendy&#8217;s.  The box &#8220;calling process&#8221; represents you ordering a burger.  The cashier processes the request, and then the flow splits into two parallel paths.  The grill cook immediately prepares your hamburger, and simultaneously starts cooking a new hamburger to replace the one he just used.</p>
<p>After your burger is prepared, the process returns to you &#8211; you get your burger and go eat.  You don&#8217;t wait for the new hamburger to finish cooking.</p>
<p>A process diagram doesn&#8217;t normally do a very good job of communicating that a process is asynchronous.  We&#8217;ve had good success in using a modified box &#8211; with a small clock in the lower right corner &#8211; to indicate that a process is asynchronous.  You could infer that the &#8220;delayed activity&#8221; is asynchronous because the flow moves directly from the &#8220;immediate response&#8221; to the &#8220;return&#8221; symbol.  But in a good diagram, you don&#8217;t have to infer.</p>
<p>Sometimes, it helps to create an alternate view of the same process.  This additional view can make it easier for the consumers of your diagram to understand the process.</p>
<h2>An Asynchronous Sequence Diagram</h2>
<p>Another way to diagram processes is with UML sequence diagrams.  Scott Ambler has an excellent article explaining <a title="how to read a sequence diagram" href="http://www.agilemodeling.com/artifacts/sequenceDiagram.htm">how to read a sequence diagram</a>.  The same burger ordering process could be drawn with the following sequence diagram.</p>
<p><img title="Asynchronous sequence diagram" alt="Asynchronous sequence diagram" src="http://sehlhorst.smugmug.com/photos/223395953-O.jpg" /></p>
<p>The diagram above uses the same generic labels again, but still applies to our example of ordering a hamburger at Wendy&#8217;s.  Inside the &#8220;par&#8221; bounding box, you get the immediate response (preparing your burger), and in parallel, the delayed activity (cooking a replacement hamburger).  Note that, in the diagram, you don&#8217;t have to wait for the response from the delayed process.  You get to eat your burger before the new one has completed cooking.</p>
<h2>Summary</h2>
<p>Asynchronous processes don&#8217;t come up often when learning about diagramming techniques.  But you find them all the time in the real world.  One of the easiest ways to speed up a process is to find steps that take a long time, and figure out how to do them asynchronously.  You don&#8217;t wait for paperwork to be processed when signing up for an insurance policy &#8211; the coverage is effective immediately.  You don&#8217;t wait for a loan application to be processed before driving off in your new car.  Once the loan is approved, you get the keys.  Many different software and manufacturing processes take advantage of queueing (like the Wendy&#8217;s example) to allow for faster &#8220;real time responses&#8221; to requests.</p>
<p>Being able to draw and discuss asynchronous processes is a good skill to have in your repertoire when documenting requirements in the real world.</p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+How+To+Draw+an+Asynchronous+Process+http://bit.ly/KaSnf+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2007/11/19/asynchronous-processes/&amp;t=How+To+Draw+an+Asynchronous+Process" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2007/11/19/asynchronous-processes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>APR: Updated Domain Model</title>
		<link>http://tynerblain.com/blog/2007/04/27/apr-domain-model-update1/</link>
		<comments>http://tynerblain.com/blog/2007/04/27/apr-domain-model-update1/#comments</comments>
		<pubDate>Sat, 28 Apr 2007 05:05:48 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Agile Project: Ratings]]></category>
		<category><![CDATA[Business Analysis]]></category>
		<category><![CDATA[Product Management]]></category>
		<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[agile case study]]></category>
		<category><![CDATA[agile project]]></category>
		<category><![CDATA[agile requirements management]]></category>
		<category><![CDATA[agile software development]]></category>
		<category><![CDATA[managing data]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2007/04/27/apr-domain-model-update1/</guid>
		<description><![CDATA[
More iteration in our agile project.  In this article, we make several updates to the domain model (UML class diagram) based upon discussions on all of the articles in the series.  More than a couple dozen in the last day.  Thanks to everyone who has helped with feedback and encouragement &#8211; just [...]]]></description>
			<content:encoded><![CDATA[<p><img title="model steamboat" alt="model steamboat" src="http://sehlhorst.smugmug.com/photos/147160170-M.jpg" /></p>
<p>More iteration in our <a title="open agile project " href="http://tynerblain.com/blog/2007/04/17/agile-software-development-experiment/">agile project</a>.  In this article, we make several updates to the <a title="ratings domain model" href="http://tynerblain.com/blog/2007/04/26/apr-uml-class-diagram-1/">domain model</a> (UML class diagram) based upon discussions on all of the <a title="agile ratings project category" href="http://tynerblain.com/blog/category/software-development/agile/ap-ratings/">articles in the series</a>.  More than a couple dozen in the last day.  Thanks to everyone who has helped with feedback and encouragement &#8211; just awesome!</p>
<p><span id="more-481"></span></p>
<h2>Updated domain Model</h2>
<p>Here&#8217;s the updated UML class diagram representing our domain model.</p>
<p><img title="domain model" alt="domain model" src="http://sehlhorst.smugmug.com/photos/147482720-M.jpg" /> [<a title="larger domain model" href="http://sehlhorst.smugmug.com/photos/147482753-O.png">larger</a>]</p>
<h2>Overview of Changes</h2>
<p>Rather than enumerate all of the changes to the diagram (you can compare the diagrams), I think it would be more effective to identify the concepts that have been incorporated into this iteration of the UML class diagram.</p>
<ul>
<li>Added placeholder for the mashup concept.</li>
<li>Added notion of broadcasting &#8220;events&#8221; from users, to distribution lists, about articles.</li>
<li>Updated user roles to reflect minimal classification scheme.</li>
<li>Added meta data for users, including openID support; articles.</li>
<li>Added notion of reading &#8220;events&#8221; from users, of articles, at times.  Could support &#8220;what did I read&#8221; or &#8220;been read X times&#8221;.</li>
<li>Added category/synonym idea for articles.</li>
<li>Expanded notion of &#8220;Rating&#8221; to include rating of articles, reviews, and other users.</li>
<li>Refactored ratings to be a 5 point scale like the one on this article.</li>
<li>Added notion of beginner/expert/not-sure for articles.</li>
</ul>
<h2>Questions</h2>
<p>Thoughts and questions after making this update.</p>
<ul>
<li>Do we need explicit rating of other users?  Should this supplant the admired/admirer model?  Should &#8220;people rating&#8221; be implicit based upon ratings of their reviews?  Should people know how they are rated?  Presumably not knowing who rated them.</li>
<li>Not Sure could be &#8220;conflicting or insufficient opinion&#8221;.  When filtering for &#8220;beginner&#8221; would you want &#8220;beginner only&#8221; or &#8220;beginner + not sure&#8221;?</li>
</ul>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+APR%3A+Updated+Domain+Model+http://bit.ly/19fyzx+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2007/04/27/apr-domain-model-update1/&amp;t=APR%3A+Updated+Domain+Model" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2007/04/27/apr-domain-model-update1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>APR: Domain Model &#8211; UML Class Diagram</title>
		<link>http://tynerblain.com/blog/2007/04/26/apr-uml-class-diagram-1/</link>
		<comments>http://tynerblain.com/blog/2007/04/26/apr-uml-class-diagram-1/#comments</comments>
		<pubDate>Thu, 26 Apr 2007 23:38:58 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Agile Project: Ratings]]></category>
		<category><![CDATA[Business Analysis]]></category>
		<category><![CDATA[Product Management]]></category>
		<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[agile case study]]></category>
		<category><![CDATA[agile project]]></category>
		<category><![CDATA[agile requirements management]]></category>
		<category><![CDATA[agile software development]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[object oriented analysis and design]]></category>
		<category><![CDATA[ooa]]></category>
		<category><![CDATA[ood]]></category>
		<category><![CDATA[uml 2.0]]></category>
		<category><![CDATA[uml class diagram]]></category>
		<category><![CDATA[uml static diagram]]></category>
		<category><![CDATA[uml static model]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2007/04/26/apr-uml-class-diagram-1/</guid>
		<description><![CDATA[
Along with design sketches and requirements, as part of the concurrent design and requirements development for our agile project, we have created a UML class diagram representing the domain.  This iterative process allows us to incorporate the benefits of each perspective rapidly with the others in our race to prototype a working site.
This article [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="model steamboat" title="model steamboat" src="http://sehlhorst.smugmug.com/photos/147160170-M.jpg" /></p>
<p>Along with <a title="Some Design Sketches" href="http://tynerblain.com/blog/2007/04/26/apr-design-element-sketches/">design sketches</a> and requirements, as part of the <a title="Concurrent Design and Requirements" href="http://tynerblain.com/blog/2007/04/25/apr-mixing-it-up/">concurrent design and requirements development</a> for our <a title="Agile Project" href="http://tynerblain.com/blog/2007/04/17/agile-software-development-experiment/">agile project</a>, we have created a UML class diagram representing the domain.  This iterative process allows us to incorporate the benefits of each perspective rapidly with the others in our race to prototype a working site.</p>
<p>This article reviews the domain model.</p>
<p><span id="more-478"></span></p>
<h2>UML Class Diagram Background</h2>
<p>Scott Ambler has an excellent article explaining <a title="class diagrams explained" href="http://www.agilemodeling.com/artifacts/classDiagram.htm">how to use and read UML 2.0 Class Diagrams</a> &#8211; also called <em>static diagrams</em> or <em>static models</em>.  This article does not have the typical &#8220;explain how to read it&#8221; introduction, please bear with me, or refer to Scott Ambler&#8217;s excellent tutorial as background for this.  [Note: Ambler will have a lot of articles submitted to the ratings site - he does lots of great stuff!]</p>
<h2>Ratings Project UML Class Diagram</h2>
<p>The goal of this diagram is to capture / describe our understanding of the space &#8211; an <a title="OOA as documentation artifact" href="http://tynerblain.com/blog/2005/12/09/a-picture-is-worth-a-thousand-requirements">object oriented analysis</a> step.  This diagram represents a business-perspective on the space, not an implementation-perspective.  The implementation will look very similar, and does crop up a little in the naming of attributes.  In &#8220;true agile fashion&#8221; we are trying to use the same document to represent the OOA as well as OOD artifacts.</p>
<p><img alt="ooa20070427" title="ooa20070427" src="http://sehlhorst.smugmug.com/photos/147159429-M.jpg" /> [<a title="ooa20070427 larger" href="http://sehlhorst.smugmug.com/photos/147159480-O.png">larger</a>]</p>
<p>This is the 20070424 version of the model.  It will evolve.  If you see any glaring holes or errors, please mention them in the discussion below this article.</p>
<p>[Update 20070427.  Here's the <a title="uml class diagram example" href="http://tynerblain.com/blog/2007/04/27/apr-domain-model-update1/">next version of the domain mode</a>l]</p>
<h2>Ratings Project Domain Entities</h2>
<p><strong>Article</strong></p>
<ul>
<li>articleScore.  Each article will have a score that represents the collective perception of the quality of the article.</li>
<li>articleReviews.  A list of all reviews / commentary on the article.</li>
<li>articleSubmitter.  The user who submitted the article.</li>
<li>articleTimestamp.  When the article was submitted.</li>
<li>articleRatings.  [Private].  The individual ratings of the article, used to calculate the score.</li>
<li>articleStatus.  [Private].  An article can be public, possibly private, or removed (no longer visible to users, but still in the database to prevent its re-appearance).</li>
</ul>
<p><strong>User</strong></p>
<ul>
<li>userRatings.  All of the ratings submitted by the user.</li>
<li>userArticles.  All of the articles submitted by the user.</li>
<li>userAdmiredUsers.  Possibly have a list of users who you admire.  Keeping this as a placeholder.</li>
<li>userFans.  Possibly have a list of all users who admire you.  Placeholder.</li>
<li>userRole.  [Private?]  A user can be an admin, can submit articles, and can review articles.  Most likely, anyone who can review can submit.  An admin can do both, but also has the ability to &#8220;clean house&#8221; in the system.</li>
<li>userContactRule.  [Private?]  A user may allow other users to contact her.  The site may provide an abstraction/email interface that allows contact without revealing email addresses.  And people may want to restrict who can contact them based on the fan-admired network, or allow any user to contact them.  Another placeholder for future possibilities.</li>
</ul>
<p><strong>Rating</strong></p>
<ul>
<li>ratingArticle.  The article being rated.</li>
<li>ratingUser.  The user doing the rating.</li>
<li>ratingValue.  The actual rating value assigned to the article by the user.</li>
<li>ratingTimestamp.  When the rating was created.</li>
</ul>
<p><strong>Review</strong></p>
<ul>
<li>reviewArticle.  The article being reviewed.</li>
<li>reviewUser.  The user doing the reviewing.</li>
<li>reviewTimestamp.  When the review was created.</li>
<li>reviewTitle.  Title of the review (e.g. &#8220;Best.  Article.  Ever.&#8221;)</li>
<li>reviewBody.  The content of the review.  Possibly &#8220;safe&#8221; html, analogous to comment field limitations on blogs.</li>
</ul>
<h2>Thoughts And Questions</h2>
<ul>
<li>User metadata (name, loginID, pwd, email, timestamp, etc) is missing from the domain model.  Pwd will need to be encrypted in the database [design note: probably SHA1 vs. MD5 - review details and options to determine].</li>
<li>Should user roles be private?</li>
<li>Is there a reason to have a distinction between reviewers and submitters?  What would be the reason that someone would be able to do one, but not the other?</li>
<li>Any contact rules other than &#8220;Only people I admire&#8221;, &#8220;People I admire or who admire me&#8221;, &#8220;All registered users&#8221;, and &#8220;No One?&#8221;</li>
<li>ratingValue &#8211; last night, I believe I convinced myself not to do it this way.  Will cover in more detail in the next article.</li>
<li>Should people be able to &#8220;Rate&#8221; a review?  Think of Amazon&#8217;s &#8220;Was this review helpfull?&#8221; feature.  Over time, the feedback that people give to reviewers could be used to create a notion of credibility, or be used to determine similarity of opinion between users.</li>
<li>What about threaded commenting?  Essentially reviews of reviews &#8211; not just reviews of articles.</li>
</ul>
<p>Share your thoughts and feedback below.  And thanks in advance.</p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+APR%3A+Domain+Model+%E2%80%93+UML+Class+Diagram+http://bit.ly/qKSD9+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2007/04/26/apr-uml-class-diagram-1/&amp;t=APR%3A+Domain+Model+%E2%80%93+UML+Class+Diagram" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2007/04/26/apr-uml-class-diagram-1/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>APR: Mixing It Up With Design And Requirements</title>
		<link>http://tynerblain.com/blog/2007/04/25/apr-mixing-it-up/</link>
		<comments>http://tynerblain.com/blog/2007/04/25/apr-mixing-it-up/#comments</comments>
		<pubDate>Thu, 26 Apr 2007 01:46:58 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Agile Project: Ratings]]></category>
		<category><![CDATA[Product Management]]></category>
		<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[Requirements gathering]]></category>
		<category><![CDATA[Software development]]></category>
		<category><![CDATA[Software requirements specification]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[Use Cases]]></category>
		<category><![CDATA[agile case study]]></category>
		<category><![CDATA[agile project]]></category>
		<category><![CDATA[agile requirements management]]></category>
		<category><![CDATA[agile software development]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[prototyping]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2007/04/25/apr-mixing-it-up/</guid>
		<description><![CDATA[
With a definition of the important use cases for our agile project, we can move to the logical next step &#8211; which is what exactly?
Prototyping.
Depending on which discipline is dominant in the project approach, the next step could be to define the functional requirements  (or specification) that support the use cases.  Or it [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="prototyping flow" title="prototyping flow" src="http://sehlhorst.smugmug.com/photos/146822363-M.jpg" /><br />
With a definition of the important use cases for our agile project, we can move to the logical next step &#8211; which is what exactly?</p>
<p><strong>Prototyping.</strong></p>
<p><span id="more-475"></span>Depending on which discipline is dominant in the project approach, the next step could be to define the functional requirements  (or specification) that support the use cases.  Or it could be to take  user-centric approach to prototyping interface elements.  Or it could be developing an understanding of the domain model that will drive the behavior of the site.</p>
<h2>Functional Prototyping</h2>
<p>Ruby on Rails (Rails, for short) makes rapid prototyping of the &#8220;under the hood&#8221; stuff appear to be very quick to develop.  And Rails separates the presentation from the logic with a model-view-controller approach to code structure.  From the reading I&#8217;ve done about Rails, the next step needed to get an interactive prototype is to define the representational model.</p>
<p>In the better object oriented programs I&#8217;ve worked on in the past, the underlying representation matches the user&#8217;s conceptual model as well as possible.  This will be challenging to not confuse the two and expose the implementation to the users.  I&#8217;m not sure what differences will exist between them, we&#8217;ll see when we explore this.  Creating a UML static diagram of both will help.</p>
<h2>UI Prototyping</h2>
<p>Creating some mockups of the user interface and documenting some design elements and interaction ideas will help here.  I started that process last night and have the first initial thoughts drawn on paper.  I will scan those in and post them as paper prototypes.</p>
<h2>Documenting Requirements</h2>
<p>If we were using a purely structured requirements approach, we would create an SRS at this stage. In conjunction with this prototyping approach, we will capture those same requirements.  The requirements will be defined in the context of <a title="Prioritizing Use Cases" href="http://tynerblain.com/blog/2007/04/25/apr-prioritizing-use-cases-1/">the individual use cases that we are focusing on</a> for the first release.  Don&#8217;t forget to vote on the use cases if you haven&#8217;t already.</p>
<h2>Iteration</h2>
<p><img title="Concurrency" alt="Concurrency" src="http://sehlhorst.smugmug.com/photos/146822365-M.png" /></p>
<p>This process will be iterative or concurrent.  The goal is to get enough of an understanding of the design to create an initial prototype.</p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+APR%3A+Mixing+It+Up+With+Design+And+Requirements+http://bit.ly/30bWqG+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2007/04/25/apr-mixing-it-up/&amp;t=APR%3A+Mixing+It+Up+With+Design+And+Requirements" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2007/04/25/apr-mixing-it-up/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How To Use UML Statechart Substates</title>
		<link>http://tynerblain.com/blog/2007/03/29/uml-statechart-substates/</link>
		<comments>http://tynerblain.com/blog/2007/03/29/uml-statechart-substates/#comments</comments>
		<pubDate>Fri, 30 Mar 2007 04:41:18 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[Business Rules]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[substates]]></category>
		<category><![CDATA[uml statechart]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2007/03/29/uml-statechart-substates/</guid>
		<description><![CDATA[UML Statecharts can be very effective modeling tools for describing systems and software requirements.  They provide a clear framework for identifying business rules.  The same business rules often apply to multiple states - defining a commonality for those states.  There is an element called a substate in UML statecharts that can be used to make it more obvious that a particular business rule applies to multiple states.]]></description>
			<content:encoded><![CDATA[<p><img alt="submarine" title="submarine" src="http://sehlhorst.smugmug.com/photos/139617427-M-0.jpg" /></p>
<p>UML Statecharts can be very effective modeling tools for describing systems and software requirements.  They provide a clear framework for identifying business rules.  The same business rules often apply to multiple states &#8211; defining a commonality for those states.  There is an element called a <em>substate</em> in UML statecharts that can be used to make it more obvious that a particular business rule applies to multiple states.</p>
<p><strong>A Simple UML Statechart</strong></p>
<p>We documented <a title="UML Statecharts for Business Rule documentation" href="http://tynerblain.com/blog/2007/03/22/statecharts-and-business-rules/">business rules with a UML statechart</a> in a previous article, that describes the possible states of a customer order.  Those states are <em>saved, placed, charged, shipped, delivered, </em>and <em>cancelled</em>.</p>
<p><img title="uml statechart 1" alt="uml statechart 1" src="http://sehlhorst.smugmug.com/photos/139620954-M.jpg" /><br />
We defined a series of transitions and talked about the rules associated with those transitions.  Imagine that the business rules changed, and customers were allowed to cancel orders even after they had been shipped (as long as they hadn&#8217;t been delivered).</p>
<p><strong>Commonality In UML Statechart States</strong></p>
<p>This could serve as an indication that there is a <em>relevant</em> commonality between the states: <em>placed, charged,</em> and <em>shipped</em>.  All of these states represent an order that is &#8220;in process.&#8221;  The customer has officially asked us for something, we have not delivered it yet (from the customer&#8217;s perspective), and the order has not been cancelled.</p>
<p>You can think of our states as having a hierarchy.  You can create a state called &#8220;In Process&#8221; that generalizes the three states <em>placed, charged, </em>and <em>shipped</em>.  By introducing this notion of generalization, we create &#8220;substates.&#8221;<br />
<img title="uml statechart state hierarchy" alt="uml statechart state hierarchy" src="http://sehlhorst.smugmug.com/photos/139634190-M.png" /><br />
UML Statecharts allow you to draw these substates inside of a larger <em>superstate</em>.  The superstate is drawn with a rounded-corner rectangle, like the other states &#8211; but it includes a horizontal bar at the top that allows you to easily show the name of the superstate, separated from the information describing the substates.</p>
<p><img title="UML statechart substate" alt="UML statechart substate" src="http://sehlhorst.smugmug.com/photos/139634781-M.jpg" /><br />
Notice that the transitions between the substates are the same ones that were defined when the &#8220;In Process&#8221; superstate did not exist.  You can have transitions between substates, and to and from substates to other states that are outside of the superstate.  You can also have transitions that go directly to or come directly from the superstate.</p>
<p><img title="uml statechart 2" alt="uml statechart 2" src="http://sehlhorst.smugmug.com/photos/139621064-M.jpg" /><br />
Notice the single &#8220;cancel order&#8221; transition that comes from the superstate, <em>In Process</em>.  This represents that the transition can be from <em>any</em> of the substates of <em>In Process</em>.  The &#8220;deliver order&#8221; transition can only come from the <em>Delivered</em> substate.  The transition &#8220;submit order&#8221; goes directly from the <em>Saved</em> state to the <em>Placed</em> substate.</p>
<p><strong>Summary</strong></p>
<p>The technique of using substates within UML statecharts allows for cleaner documentation when there are notions that present commonality (like business rules) that justify generalizing multiple states into a single state.  This technique allows you to reduce the number of business rules that you must maintain, and makes the diagram easier to read.</p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+How+To+Use+UML+Statechart+Substates+http://bit.ly/GUafW+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2007/03/29/uml-statechart-substates/&amp;t=How+To+Use+UML+Statechart+Substates" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2007/03/29/uml-statechart-substates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UML Statecharts and Documenting Business Rules</title>
		<link>http://tynerblain.com/blog/2007/03/22/statecharts-and-business-rules/</link>
		<comments>http://tynerblain.com/blog/2007/03/22/statecharts-and-business-rules/#comments</comments>
		<pubDate>Fri, 23 Mar 2007 04:56:38 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Business Analysis]]></category>
		<category><![CDATA[Product Management]]></category>
		<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[Requirements gathering]]></category>
		<category><![CDATA[Requirements management software]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[business requirement]]></category>
		<category><![CDATA[business requirements]]></category>
		<category><![CDATA[business rule]]></category>
		<category><![CDATA[Business Rules]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[statechart]]></category>
		<category><![CDATA[statechart diagrams]]></category>
		<category><![CDATA[statecharts]]></category>
		<category><![CDATA[uml statechart]]></category>
		<category><![CDATA[uml statecharts]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2007/03/22/statecharts-and-business-rules/</guid>
		<description><![CDATA[In yesterday's article we compared use cases and UML statecharts as tools for discovering business rules. James Taylor asked a question about how we would document those rules, and then followed up my comment response with an article about business rules and RUP. In this article we move the conversation slightly forward - recognizing that we're slowly entering the ocean of business process management.]]></description>
			<content:encoded><![CDATA[<p><img alt="turtle seeking the ocean" title="turtle seeking the ocean" src="http://sehlhorst.smugmug.com/photos/137954530-M.jpg" /></p>
<p>In yesterday&#8217;s article we <a title="use cases and uml statecharts" href="http://tynerblain.com/blog/2007/03/21/use-case-vs-statechart/">compared use cases and UML statecharts</a> as tools for <em>discovering </em>business rules.  James Taylor asked <a title="How would we document this?" href="http://www.edmblog.com/weblog/2007/03/use_cases_uml_s.html">a question about how we would document</a> those rules, and then followed up my comment response with an article about <a title="business rules" href="http://www.edmblog.com/weblog/2007/03/business_rules__3.html">business rules and RUP</a>.  In this article we move the conversation slightly forward &#8211; recognizing that we&#8217;re slowly entering the ocean of business process management.</p>
<p><strong>UML Statechart and State Transition Table Artifacts</strong></p>
<p>There are two primary artifacts that come from using a UML statechart to <em>discover</em> business rules.  The first is the statechart itself.</p>
<p><img alt="uml 2.0 statechart" title="uml 2.0 statechart" src="http://sehlhorst.smugmug.com/photos/137737585-O.png" /></p>
<p>This is a primary artifact from the perspective of <a title="Benefits of OOA" href="http://tynerblain.com/blog/2005/12/09/a-picture-is-worth-a-thousand-requirements">object oriented analysis</a> (OOA).  It provides a large amount of information in a dense, yet incredibly easy to absorb format.  It is the ease of understanding that makes this a great tool for validating your understanding of the business process with stakeholders.</p>
<p>There are three elements of information that are documented in a UML statechart.  The first is the list of possible states.  In the example above, the rounded rectangles represent the possible states for a customer-order (<em>Shipped</em>, <em>Delivered</em>, etc).  The second is the exhaustive list of all allowed state <em>transitions</em> (&#8220;Deliver Order&#8221; is the event that causes a transition from <em>Shipped </em>to <em>Delivered</em>).  The third element is the events that describe (or cause) the state transition. &#8220;Deliver Order&#8221; is one of them.</p>
<p>Note that there can be multiple events that cause transition between the two states.  If you modify the example above as follows&#8230;</p>
<p><img alt="uml statechart double transition" title="uml statechart double transition" src="http://sehlhorst.smugmug.com/photos/137958593-O.png" /></p>
<p>You can document that either the customer, or the supplier (of the products for the order) can cancel the order.</p>
<p>There are two failings of the UML statechart.  The first is the lack of support for rule discovery, and the second is that it is a poor framework for trying to <a title="Writing requirements to maximize communication effectiveness" href="http://tynerblain.com/blog/2006/10/04/writing-for-the-purpose-of-reading/">document the business rules for later consumption</a>.</p>
<p><strong>State Transition Tables</strong></p>
<p>You will have already created a state transition table as part of validating the completeness of your UML statechart.  This is how the lack of support for rule discovery was addressed.</p>
<p><img alt="state transition table" title="state transition table" src="http://sehlhorst.smugmug.com/photos/137783845-M.jpg" /></p>
<p>[<a title="larger state transition table" href="http://sehlhorst.smugmug.com/photos/137783850-M.jpg">larger image</a>]</p>
<p>In the <a title="UML state machine diagrams and use cases" href="http://tynerblain.com/blog/2007/03/21/use-case-vs-statechart/">comparison of UML statecharts with use cases</a>, we made a small reference to documentation of business rules.</p>
<blockquote><p>Each possible transition has a number &#8211; which provides a reference for defining the business rules associated with each transition. You could put the rules inside the boxes, but the numbers make the table much easier to read.</p></blockquote>
<p>In this example, #3 represents the allowed transition of the customer-order object from the state of <em>Placed </em>to the state of <em>Charged</em>.</p>
<p><strong>What You Need To Document</strong></p>
<p>To document the business rules associated with a UML statechart, there are five elements that must be documented.</p>
<ol>
<li>Defining The Object.  The definition and relevance of the object being described.</li>
<li>Listing The States.  The list of possible states that the object can be in.</li>
<li>Defining The Rules of State.<strong> </strong>The rules that in force when an object is in a single state.</li>
<li>Listing The Transitions.  The list of allowed state transitions that the object can make.</li>
<li>Defining The Transition Rules.  The rules that govern the transitions from one state to another.</li>
</ol>
<p><strong>Defining The Object</strong></p>
<p>A definition of the object is important to establish the context in which the business rules are being applied.  Remember that this is a business object (a customer-order), not an implementation detail (class CustomerOrder :: Object).  The description of the object and rules that define it will be in the language of the business, not implementation details.</p>
<p><strong>Listing The States</strong></p>
<p>You already have the list of states explicitly in the state transition table, and you could create it from the UML statechart.  If you only had to list the different states, there would not be any value to creating an additional list &#8211; just reference the table.</p>
<p><strong>Defining The Rules of State</strong></p>
<p>Each state that the object can be in has a set of business rules associated with it.  These are rules in addition to the rules that define the allowable transitions (more details below).  Here are some example business rules of state.</p>
<ul>
<li>Suppliers can view orders that are in the <em>Charged</em> or later states.</li>
<li>Suppliers can only view orders that include products that they supply.</li>
<li>Customers can edit  orders that are in the saved state.</li>
</ul>
<p><strong>Listing The Transitions</strong></p>
<p>The allowable transitions are implicitly defined in the state transition table.  Each allowable transition has a reference number (or ID) in the table.  Every transition is also displayed in the UML statechart.  If there were no rules associated with the allowable transitions, the table could have been done with yes/no boxes instead of references.</p>
<p><strong>Defining The Transition Rules</strong></p>
<p>Each allowable transition will have some rules associated with it.  What initiates the transition?  What constrains the transition?  Here are some example business rules that govern the transitions from one state to another.</p>
<ul>
<li>An order will only be shipped when it can be completely fulfilled.</li>
<li>An order will not be charged unless the customer has provided a valid shipping address.</li>
<li>Orders will only be charged when the shipping address is in the United States of America.</li>
<li>A charged order will be cancelled if it has not been shipped within ten business days.</li>
<li>A saved order will be deleted if it has not been submitted within 90 days.</li>
</ul>
<p>These business rules are important to the company.  It is important to document them.</p>
<p>Scott Ambler shows a way to <a title="showing rules within diagrams" href="http://www.agilemodeling.com/artifacts/stateMachineDiagram.htm">include this information within the UML statechart</a>.  His <em>Figure 1</em> example demonstrates how to do it for object oriented design (the implementation design) and includes references to java functions that may be called.  The concept could be applied to OOA diagrams as well.</p>
<p>We would encourage you to <strong><em>not</em></strong> include the rules within the diagram, as practicioners of Scott&#8217;s own advice &#8211; &#8220;I                          prefer to follow the AM practices <em>Depict Models                          Simply</em> and <em>Model in Small Increments</em>.&#8221;  The extra information in the diagram makes it unwieldy.  In our experience, a concise diagram with accompanying text is <a title="Effective Communication of Requirements" href="http://tynerblain.com/blog/2007/03/07/effective-communication-of-requirements/">a better communication vehicle</a> than a standalone diagram with higher information density.</p>
<p><strong>Practical Application of This Approach</strong></p>
<p>There are many systems for documenting and managing requirements and business rules.  Forrester and The Gartner Group have even changed the name of the space from &#8220;Requirements Management (RM)&#8221; to &#8220;Requirements Documentation and Management (RDM)&#8221; in their communications.  Generally, the solutions in the RDM space either use a repository to store information in a structured format, or they manage individual documents as artifacts.</p>
<p><strong>Individual Document Approach</strong></p>
<p>When your team is using individual documents to manage requirements, we suggest that you create a single text document that includes the text descriptions of states, transitions, and rules.  This document should also include the UML statechart and the state transition table.  These objects can be embedded or referenced to prevent the dual-maintenance problem of updating the text &#8220;wrapper&#8221; document whenever the underlying object changes.  When using Microsoft Office, a Word document can include both the Visio and Excel objects by reference.  HTML documentation will include the objects by reference.  There is no really &#8220;clean&#8221; way to manage individual documents, and certainly no standard way to do it.  Whatever works for you should continue to work.  The goal is to present a single document (the &#8220;wrapper&#8221;) that contains or references all of the relevant information &#8211; prose + UML statechart + state transition table.</p>
<p><strong>Requirements Repository Approach</strong></p>
<p>If you have a repository that has been customized to specifically deal with UML statecharts, transition tables, and supporting rules, you&#8217;re ahead of the game.  Please tell us about it too.  As far as we know &#8211; it doesn&#8217;t exist.</p>
<p>Most <a title="Intro to Structured Requirements" href="http://tynerblain.com/blog/2006/01/04/foundation-series-structured-requirements/">structured</a> RDM tools allow users to attach files to &#8220;requirements&#8221; objects.  They also allow for the notion of supported and supporting &#8220;requirements&#8221; &#8211; either through traceability or <a title="Decomposing requirements atomically" href="http://tynerblain.com/blog/2005/12/07/composition-in-requirements/">composition</a>.  In the rest of this explanation, the term &#8220;requirement&#8221; is a reference to whatever artifact, object, or container the particular RDM tool uses to encapsulate a discrete business requirement or rule.</p>
<p>You can create a requirement that represents the business object and includes the contextual information describing the object (customer-order in this example).  The list of states that the object can be in should be included in this requirement.</p>
<p>In support of that requirement, you should create other requirements that represent the defined business rules (#3 and #5 in the list) as separate objects.  You separate the objects so that each requirement is <a title="Atomic Requirements" href="http://tynerblain.com/blog/2006/06/14/writing-atomic-requirements/">atomic</a>.  The UML statechart and state transition table should be attached to the &#8220;wrapper&#8221; requirement as references.  The diagrams, in this approach, are providing clarifying but redundant information.  They need to be identified as such, so that in the event of misinterpretation (or requirements becoming out of sync), there is a clear &#8220;winner.&#8221;</p>
<p><strong>Summary</strong></p>
<p>There are many business rules associated with a business object that can change state.  Those rules define the interpretation and ramifaction of being <em>in</em> a state.  They also constrain and enable the transitions between states.  The list of states and possible transitions are also business rules of a sort &#8211; although they may be better <a title="Decision Services" href="http://www.ebizq.net/blogs/decision_management/2007/03/more_on_decision_services.php">described as decision services</a> than business rules.</p>
<p>Documenting these rules is important.  You shouldn&#8217;t try and cram the documentation inside the diagram or the table.  You should use accompanying prose.</p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+UML+Statecharts+and+Documenting+Business+Rules+http://bit.ly/YW9F0+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2007/03/22/statecharts-and-business-rules/&amp;t=UML+Statecharts+and+Documenting+Business+Rules" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2007/03/22/statecharts-and-business-rules/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Use Case vs. UML Statechart &#8211; Business Rules</title>
		<link>http://tynerblain.com/blog/2007/03/21/use-case-vs-statechart/</link>
		<comments>http://tynerblain.com/blog/2007/03/21/use-case-vs-statechart/#comments</comments>
		<pubDate>Thu, 22 Mar 2007 04:59:14 +0000</pubDate>
		<dc:creator>Scott Sehlhorst</dc:creator>
				<category><![CDATA[Business Analysis]]></category>
		<category><![CDATA[Product Management]]></category>
		<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Requirements Models]]></category>
		<category><![CDATA[Requirements gathering]]></category>
		<category><![CDATA[UML Modeling]]></category>
		<category><![CDATA[Use Cases]]></category>
		<category><![CDATA[business requirements]]></category>
		<category><![CDATA[Business Rules]]></category>
		<category><![CDATA[business use case]]></category>
		<category><![CDATA[managing data]]></category>
		<category><![CDATA[requirements management]]></category>
		<category><![CDATA[sample use case]]></category>
		<category><![CDATA[statecharts]]></category>
		<category><![CDATA[uml statechart]]></category>
		<category><![CDATA[use case analysis]]></category>
		<category><![CDATA[use case example]]></category>
		<category><![CDATA[use cases]]></category>

		<guid isPermaLink="false">http://tynerblain.com/blog/2007/03/21/use-case-vs-statechart/</guid>
		<description><![CDATA[What is the better requirements management model for capturing business rules? The use case, or the UML statechart? In this article, we explore how customer orders are submitted and processed, and contrast how use cases and statecharts expose and document business requirements and business rules.]]></description>
			<content:encoded><![CDATA[<p><img title="soccer trip" alt="soccer trip" src="http://sehlhorst.smugmug.com/photos/137738859-M.jpg" /></p>
<p>What is the better requirements management model for capturing business rules?  The use case, or the UML statechart?  In this article, we explore how customer orders are submitted and processed, and contrast how use cases and statecharts expose and document business requirements and business rules.</p>
<p><strong>The Scenario</strong></p>
<p>To set up the comparison between use cases and statecharts, consider a website for a company that sells products online.  Customers can create orders and submit them.  The company will process the order and ship it to the customer.  You need to define the requirements.</p>
<p>When gathering requirements, you learn the following:</p>
<ul>
<li>The company wants customers to be able to save an order and come back later (like Amazon&#8217;s shopping cart) to complete it.</li>
<li>When a customer submits an order, the company will charge the customer (credit card, paypal, etc) through an outsourced billing service provider.</li>
<li>The company doesn&#8217;t ship the order until after the charge has been made successfully.</li>
<li>The company wants customers to eventually be able to track their orders by providing them with a tracking number from the third-party shipper that they use.</li>
<li>The company also wants to be able to track their &#8220;work in progress&#8221; inventory and analyze their pipeline.  To them, that means they want to know how many orders have been saved (but not submitted), how many orders have been submitted (but not shipped), how many orders are being processed, and how many have been delivered.</li>
</ul>
<p><strong>The Use Case Example Analysis</strong></p>
<p>If you take a user-centric approach to documenting the requirements, you should start with the most important use case &#8211; <em>Customer Orders Products</em>.</p>
<blockquote><p><strong>Customer Orders Products</strong></p>
<p>Actors:</p>
<ul>
<li>The customer &#8211; user who purchases products from the company.</li>
<li>The system &#8211; the software with which the customer interacts.</li>
<li>The billing-provider &#8211; an external system that is responsible for billing transaction processing.</li>
<li>The fulfillment system &#8211; an internal system that is responsible for shipping purchased products to the customer.</li>
</ul>
<p>Use Case Steps:</p>
<ol>
<li>The customer selects products to purchase.</li>
<li>The system adds the products to the order.</li>
<li>The customer submits the order.</li>
<li>The system requests payment for the order from the customer.</li>
<li>The customer provides payment information.</li>
<li>The system requests payment for the order from the billing-provider.</li>
<li>The billing-provider acknowledges payment processing.</li>
<li>The system notifies the customer of successful payment.</li>
<li>The system submits the order to the fulfillment system (another system at the company).</li>
<li>The fulfillment system ships the order [note: this would likely be a <a title="Subordinate Use Cases" href="http://tynerblain.com/blog/2006/11/27/subordinate-use-cases/">subordinate use case</a>].</li>
<li>The fulfillment system notifies the system that the order has shipped.</li>
<li>The system notifies the customer that the order has shipped.</li>
</ol>
<p>There would also be an alternate case (<a title="Use Case Extensions (scroll down)" href="http://tynerblain.com/blog/2007/03/08/use-case-preconditions-and-triggers/">use case extensions</a>) allowing the user to save an order in-process and return to complete it later.</p></blockquote>
<p>During the review of this use case with stakeholders, you would uncover the need for customers to be able to cancel an order at any point prior to shipping the order (step 10).</p>
<p>This use case analysis gives you the framework for designing the user interface of the system, and for defining functional requirements.  Starting with a use case does not prevent you from gathering all of the business rules associated with customer ordering, but it also doesn&#8217;t help very much with some requirements.</p>
<p>Using a UML statechart provides a different view on the requirements.</p>
<p><strong>Into To UML Statecharts</strong></p>
<p><img alt="state machine controls" title="state machine controls" src="http://sehlhorst.smugmug.com/photos/137737468-M.jpg" /></p>
<p>UML 2.0 statecharts, also known as state-machine diagrams and state transition diagrams, are designed to show how an object can change its <em>state</em> of being over time.  When documenting requirements, you would create a state chart for a <em>business object</em>, in this example, a customer-order.  The UML statechart would show all of the possible states that an object can be in, and all of the possible transitions, or paths, that would allow the object to change from one state to another.</p>
<p>The following legend shows the four primary elements of a UML 2.0 state chart.</p>
<p><img title="statechart legend" alt="statechart legend" src="http://sehlhorst.smugmug.com/photos/137737563-M.png" /></p>
<p>The UML statechart starts with a solid black circle, and has a transition to the first of the possible states.  The transition is the action or event that causes an object to be created or change state.  In the legend above, the act of saving an order causes the creation of a customer-order object in the saved state.  Near the end of the diagram (the middle is removed), a &#8220;Deliver Order&#8221; transition causes the customer-order object to change to the state &#8220;Delivered.&#8221;  The end of the process is designated with a solid black circle wrapped in a thin line.</p>
<p>A much more thorough <a title="State Machine Diagrams" href="http://www.agilemodeling.com/artifacts/stateMachineDiagram.htm">introduction to UML statecharts</a> can be found at Scott Ambler&#8217;s awesome site.  Ambler&#8217;s introduction includes other statechart elements, nesting of statecharts, and more complex examples.  Good stuff.</p>
<p><strong>The UML Statechart Example Analysis</strong></p>
<p>If you had approached the requirements from a system-centric or rule-centric point of view, you might have started with the creation of a UML statechart for the customer-order object.  You could also start with <a title="Process Flow Diagram example" href="http://tynerblain.com/blog/2007/03/19/use-case-vs-process-flow-1/">a process flow diagram</a> of the customer ordering process &#8211; but that has more in common with the use case analysis.<br />
The <em>customer-order</em> object is a conceptual object that represents the order that the customer is trying to place.  While it is very likely that the implementation will be designed with a <em>customer-order</em> object too, you are not describing the implementation &#8211; you are describing the requirements.</p>
<p>Your first drawing of the UML statechart might look like the following:</p>
<p><img title="simple uml statechart example" alt="simple uml statechart example" src="http://sehlhorst.smugmug.com/photos/137737572-M.jpg" /></p>
<p>The obvious path is clearly defined in the statechart:</p>
<ol>
<li>A customer order is created in the &#8220;Saved&#8221; state when the user saves it.</li>
<li>When the customer submits the order (use case step 3), it changes state to &#8220;Submitted.&#8221;</li>
<li>When the customer is charged for the order (use case steps 4 &#8211; 8), the order changes state to &#8220;Charged.&#8221;</li>
<li>When the order has been shipped (use case step 10+11, or just 11), the order changes state to &#8220;Shipped.&#8221;</li>
<li>When the order has been delivered, the order changes state to &#8220;Delivered.&#8221;</li>
</ol>
<p>During the review of this UML statechart with stakeholders, you would uncover the need for customers to be able to cancel an order at any point prior to shipping the order.  Three additional transitions are defined, leading into a new state, &#8220;Cancelled.&#8221;  If the user deletes a saved order, or cancels an order that has been placed but not yet shipped, the order&#8217;s <em>state</em> is changed to &#8220;Cancelled.&#8221;</p>
<p>Viewing the UML statechart for the customer-order object still doesn&#8217;t help uncover more requirements.  Joe Shideler presented a great requirements model &#8211; <a title="State Transition Table" href="http://requirements.seilevel.com/blog/2005/12/requirements-model-1-state-table.html">a state transition <em>table</em></a> on Seilevel&#8217;s blog in late 2005.  The table presents a view of <em>possible</em> state transitions that gets your brain out of the linear mode that it is in in either of the above situations.</p>
<p><strong>A State Transition Table Example</strong></p>
<p>Creating and populating a state transition table for the customer-order object would look like the following:</p>
<p><img title="state transition table" alt="state transition table" src="http://sehlhorst.smugmug.com/photos/137783845-M.jpg" /></p>
<p>[<a title="state transition table example" href="http://sehlhorst.smugmug.com/photos/137783850-O.jpg">larger image</a>]</p>
<p>Each row in the table represents a <em>starting</em> state (the tail end of a transition in the diagram).  Each column represents an <em>ending</em> state (the arrowhead end of a transition in the diagram).  To read the diagram &#8211; you can see that transitions <em>from</em> the &#8220;Saved&#8221; state are possible to both the &#8220;Placed&#8221; state and the &#8220;Cancelled&#8221; state.  Transitions to the other states are <strong>not</strong> possible &#8211; indicated by the &#8220;X&#8221; and light grey shading in each cell.</p>
<p>Each possible transition has a number &#8211; which provides a reference for defining the business rules associated with each transition.  You could put the rules inside the boxes, but the numbers make the table much easier to read.</p>
<p>In some situations, it is possible for an event to cause a transition into &#8220;the same state.&#8221;  An example would be if a customer desired to split one order into two orders based on shipping lead times.  The &#8220;transition&#8221; is actually from one object to two other objects.  Ambler shows an example like this, but it doesn&#8217;t apply in this example.  The dark grey shading and bold &#8220;X&#8221; represent that an object can not &#8220;change&#8221; into the same state.</p>
<p><strong>Why State Transition Tables Help Uncover Business Rules</strong></p>
<p>The table above is already populated with the final answer &#8211; and you&#8217;ll notice that it shows some valid transitions that are not indicated in the UML statechart above.  Populating the table forces you to consider each possible transition.  As part of that consideration you are more likely to uncover &#8220;hidden&#8221; requirements than if you were only reviewing a <em>linear</em> model like a use case (or the previous statechart).</p>
<p>It is possible that an order is shipped to the wrong address, or not shipped at all.  Mistakes happen.  The company wants to be responsive to customers, and has defined specific business rules and policies for handling this situation.</p>
<p>You can update the UML statechart to show the additional transitions that must be supported:</p>
<p><img title="complete uml statechart example" alt="complete uml statechart example" src="http://sehlhorst.smugmug.com/photos/137737585-O.png" /></p>
<p><strong>Is The Statechart Better Than The Use Case?</strong></p>
<p>Yes and no.  For defining interface requirements (both the user interface and system interfaces) the use case is much more effective &#8211; it describes, by definition, the series of events that happen.  However, it is biased towards documentation of the normal flow of events.  Exceptions, errors and alternatives can all be documented with use cases, but it becomes harder to consume &#8211; because the use case triggers a linear analysis through the process.</p>
<p>When striving to <a title="Writing Complete Requirements" href="http://tynerblain.com/blog/2006/06/08/writing-complete-requirements/">achieve requirement completeness</a>, an additional perspective is required.  A statechart can provide a two-dimensional perspective of the process.  It is object focused (with actions as transitions), versus action-focused.  As this example has shown, the statechart can be presented in an equivalent form to the use case &#8211; very linear.</p>
<p>The state transition table forces you to think outside of the linear flow of the obvious course of events.  You don&#8217;t have to brainstorm about &#8220;what might go wrong&#8221; &#8211; you systematically explore all of the potential state-transitions.  Each transition is either explicitly excluded (with an &#8220;X&#8221; in the table cell) or explicitly included.  The risk of missing a transition and its associated requirements is dramatically reduced.</p>
<p>The identification of all valid transitions is the first step in defining the business rules that control each possible transition.</p>
<p>The state transition table, while very effective for analysis, falls short of the UML statechart in presenting the results.  A good practice is to update the statechart with all transitions identified in the table.</p>
<p><strong>Conclusion</strong></p>
<p>The use case and the UML statechart provide different views on the same requirements.  Using one without the other risks missing requirements.  The use case helps define interfaces with users and external systems.  The statechart helps define hidden paths (alternate flows).</p>
<p>The state transition table is the most rigorous tool I know of for explicitly defining the valid transitions.  But it is not a good communication tool.  The results from use of the state transition table should be presented in the UML statechart.  This solid set of transitions is the foundation for defining business rules and business requirements.</p>
<p align="left"><a target="_blank" rel="nofollow" class="tt" href="http://twitter.com/home/?status=By+@sehlhorst:+Use+Case+vs.+UML+Statechart+%E2%80%93+Business+Rules+http://bit.ly/WyQLV+" title="Post to Twitter"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter-big1.png" alt="Post to Twitter" /></a> <a target="_blank" rel="nofollow" class="tt" href="http://www.facebook.com/share.php?u=http://tynerblain.com/blog/2007/03/21/use-case-vs-statechart/&amp;t=Use+Case+vs.+UML+Statechart+%E2%80%93+Business+Rules" title="Post to Facebook"><img class="nothumb" src="http://tynerblain.com/blog/wp-content/plugins/tweet-this/icons/tt-facebook-big4.png" alt="Post to Facebook" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://tynerblain.com/blog/2007/03/21/use-case-vs-statechart/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
