<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Andrea Baruzzo On Model-Driven Design</title>
	<atom:link href="http://baruzzo.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://baruzzo.wordpress.com</link>
	<description>Random thoughts on UML, models, and modeling in software development</description>
	<lastBuildDate>Sat, 17 Sep 2011 09:09:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='baruzzo.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Andrea Baruzzo On Model-Driven Design</title>
		<link>http://baruzzo.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://baruzzo.wordpress.com/osd.xml" title="Andrea Baruzzo On Model-Driven Design" />
	<atom:link rel='hub' href='http://baruzzo.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Can the design be automated?</title>
		<link>http://baruzzo.wordpress.com/2011/09/16/can-the-design-be-automated/</link>
		<comments>http://baruzzo.wordpress.com/2011/09/16/can-the-design-be-automated/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 14:33:47 +0000</pubDate>
		<dc:creator>Andrea Baruzzo</dc:creator>
				<category><![CDATA[Model-Driven Design]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[design_models]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[reverse-engineering]]></category>

		<guid isPermaLink="false">http://baruzzo.wordpress.com/?p=284</guid>
		<description><![CDATA[Recently I have partecipated in a discussion about the value of forward-reverse engineering of UML models. Undoubtedly generating code from models can save the developer to perform routine operations. Furthermore, the automatic synchronization of models and code can be really rewarding when the expected outcome is mainly to avoid the premature obsolescence of models with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=284&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I have partecipated in a <a title="UML" href="http://www.linkedin.com/groupItem?view=&amp;gid=143183&amp;type=member&amp;item=44425486&amp;commentID=33353397&amp;qid=1dd91b60-fc9b-42ff-a870-1516835df14a#commentID_33353397">discussion</a> about the value of forward-reverse engineering of UML models. Undoubtedly generating code from models can save the developer to perform routine operations. Furthermore, the automatic synchronization of models and code can be really rewarding when the expected outcome is mainly to avoid the premature obsolescence of models with respect to the real system (expressed concretely and precisely only in the code). However, a more in-depth investigation about modern UML tools reveals many problems that can discourage this practice. I am not saying that approaches such as <a title="Executable and Translatable UML" href="http://www.eetimes.com/design/embedded/4024510/Executable-and-Translatable-UML">Executable and Translatable UML</a> (xtUML) are bad or wrong. Simply I say that modern tools are quite far from being satisfactory, especially from the architect/designer&#8217;s point of view. In my opinion, one of the most important remarks concerning executable models is that the price to pay for having them today is an increase of detailed, low-level information in models. The immediate side effect is that models become more obscure, plenty of pseudocode, stereotypes, and (often proprietary) action language statements that hide the essence of a model: its design. Tools simply are not enough &#8220;smart&#8221; to keep this information (the graphical notation and its textual specification) in separate views, forming different layers of abstraction (Isn&#8217;t it one of the most evident promises of MDA?).</p>
<p>These critiques can be relevant or not, depending on the way and for which purpose the UML is used. UML adopters should understand in the first place why they are building models (in particular, design models). Are they interested mainly to raise the level of abstraction, moving their development environments from textual programming languages to graphical programming environments (with an obvious shift in notation)? Otherwise, are they approaching modeling in an attempt to give dignity to design artifacts like architecture, subsystems, protocols, and so on, that are usually <em>implicit</em> (hidden) in the code? Are they focusing on generating code, or they consider the goal of improving communication as a mandatory requirement?</p>
<p>Design models are artifacts to be <em>maintained</em> and <em>updated</em>. There is a lot of emphasis about automatic synchronization in the market, but (considering the state-of-the-art tools that are available nowadays) I do not believe that this is the right direction, in most cases. Simply, this type of automation it is not about design. It provides a <em>mechanistic</em> view of code. After some rounds, people continue to do all the shortcuts in the code (perhaps because they are programmer and code is their natural place to work&#8230;), and the only fact that an integrated environment is able to automatically re-align with a single click both models and code does not mean that you are doing design! Neither that you are doing GOOD design. It is exactly the opposite. It is the shortest path to bypass design!<br />
Who claims that automatic generation of UML models is the right tool to avoid the burden of synchronize code and models has in mind the main goal of speeding productivity. But it seems they are focusing only to the most easy (and useless) way of measure productivity: the percentage of LOCs automatically generated. Without taking too much into account the <em>quality of the design</em>, this attempt to improve will fail because the most important improvements in productivity come from design, not from code. In the long term, this choice is usually counter-productive. In my opinion, you have to pay a price for keeping a high level of (design) quality in a complex project. Building models and maintaining them as the backbone of the system is an important investment in communication, IP sharing inside the company, and in development.</p>
<p>If the development team really embrace a model-driven approach, modeling should not be viewed as &#8220;a way of building programs&#8221;, but as a way of <em>designing</em> solutions, a way of <em>thinking</em> to problem domains without the bias of a programming language, a way of <em>communicating</em> with people rather than with machines. Not one of these in particular, but <em>all</em> of these at the same time. Of course, we have to remember that the sole use of UML is not a guarantee of success. The value is not in the notation, but in the way the notation is exploited to guide the development process, to forge and inspire good solutions, and to better communicate with people (eventually even with ourself).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baruzzo.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baruzzo.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baruzzo.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baruzzo.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baruzzo.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baruzzo.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baruzzo.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baruzzo.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baruzzo.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baruzzo.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baruzzo.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baruzzo.wordpress.com/284/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baruzzo.wordpress.com/284/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baruzzo.wordpress.com/284/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=284&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baruzzo.wordpress.com/2011/09/16/can-the-design-be-automated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ee214ab0dbabc63bd87e451ec26ec9fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andreabaruzzo</media:title>
		</media:content>
	</item>
		<item>
		<title>Leaving untested code is stupid, shortsighted, and irresponsible (B. Beizer)</title>
		<link>http://baruzzo.wordpress.com/2011/02/04/leaving-untested-code-is-stupid-shortsighted-and-irresponsible-b-beizer/</link>
		<comments>http://baruzzo.wordpress.com/2011/02/04/leaving-untested-code-is-stupid-shortsighted-and-irresponsible-b-beizer/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 20:26:07 +0000</pubDate>
		<dc:creator>Andrea Baruzzo</dc:creator>
				<category><![CDATA[Model-Based Testing]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[complexity]]></category>
		<category><![CDATA[coverage]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[path-testing]]></category>

		<guid isPermaLink="false">http://baruzzo.wordpress.com/?p=227</guid>
		<description><![CDATA[Testing in software industry is a typical activity that everyone involved recognizes as both mandatory in theory and so often neglected in practice. Many organizations continue to develop software without a minimal testing plan. Sometimes even without a clear/detailed project specification. The classical excuse for this &#8220;lack of materials&#8221; is that there are not enough [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=227&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Testing in software industry is a typical activity that everyone involved recognizes as both mandatory in theory and so often neglected in practice. Many organizations continue to develop software without a minimal testing plan. Sometimes even without a clear/detailed project specification. The classical excuse for this &#8220;lack of materials&#8221; is that there are not enough resources (money, time, people, skills) to address them in the first place. Concerning testing, most development teams simply have no idea of how to <em>properly </em>test a system in a <em>professional </em>way. A minimum requirement for testing is the ability to debug step-by-step the code base at list once for each instruction, or to write some test code according to a <a href="http://www.agiledata.org/essays/tdd.html">Test-Driven Design</a> methodology.</p>
<p>The reality is that without a significative background on software testing techniques, even utilizing an automation tool results in a sterile activity. No tool is able to tell you what to test (first) or how to design test cases. Unfortunately, as happens for other stages in a project lifecycle which are mainly (and in my opinion erroneously) driven only by CASE tools, the idea to perform &#8220;appropriate&#8221; testing coincides with the ability to run &#8220;some&#8221; tests in NUnit until a green light reassures people that all is fine. Of course, this is not enough. Too many <em>fundamental </em>questions about testing remain unanswered using this approach. One of these questions is &#8220;how many test cases I need to properly test a particular functionality?&#8221;  Proper white-box testing requires at least some minimum <em>coverage criteria</em>. Any attempt to introduce a serious testing activity in a software project without a coverage criteria is a clear sign of an hobbist approach. Of course, a bunch of tests can provide value by itself, but this level of software quality assurance is simply insufficient and inadequate for industrial systems.</p>
<p>What I mean using the term coverage is to identify a set of tests (with respect to a module/subsystem/system) that <em>has the potential for executing every instruction and taking all branches in all directions (paths)</em> in the code. According to Boris Biezer, complete coverage is the first minimum mandatory requirement for serious testing [1]. Moreover, he also stresses the need to perform such level of testing without  taking refuge in pretexts such as the non-economical cost of testing:</p>
<blockquote><p>Any testing based on less than complete coverage requires decisions regarding what code should be left untested (which is by itself a cost). Such decisions are inevitably biased, rarely rational, and always grievous. Realistically, the practice of putting untested code into systems is common, and so are system failures. The excuse I&#8217;ve most often heard for putting in untested code is that there wasn&#8217;t enough time left or enough money left to do the testing. If there wasn&#8217;t enough time and money to test the routine, then there wasn&#8217;t enough time and money to create it in first place. For what you think is code, before it has been properly tested, is <em>not </em>code, but the mere promise of code. [...]  It is better to leave out untested code altogether than to put it in. <em>Code that does not exist cannot corrupt good code.</em> An untested function may or may not work itself (probably not), but it can make other functions fail that would otherwise work. [...] Leaving untested code in a system is stupid, shortsighted, and irresponsible. (The italics are mine.)</p></blockquote>
<p>Many years has been passed since the time Beizer wrote his book, but the situation is not changed a lot. I believe his message is very actual even nowadays. The problem is that many software developers continue to think that developing software systems is a mere act of writing code, compile it, debug it, and deploy it. This development cycle hides testing. This was probably a little concern when software systems were written by only one person and consisted of no more than a few hundred lines of code. This is a huge problem now, because more sophisticated techniques are required for testing a complex system, developed by many people, often distributed in different organizations or teams. The sole programming culture is not sufficient. Anf the role of models comes to light.</p>
<p>Considering the definition of coverage criteria provided by Beizer, which is a simple, sound metric for a (model-driven) testing activity? I believe that McCabe&#8217;s complexity metric can be useful [2]. Whereas the <a title="How testable is a software architecture?" href="http://baruzzo.wordpress.com/2009/08/22/how-testable-is-a-software-architecture/">CCD family of metrics</a> [3] helps to catch an overall indicator of the testing/maintenance burden, the McCabe&#8217;s metric provides a first hypotesis on the numer of test cases needed to test a module/subsystem/system fulfilling a coverage criteria. Indeed, McCabe&#8217;s metric is closely related to the number of circuits required to cover a graph. Due to the fact that any flowchart-like representation of the control flow structure is similar to a graph, it is straightforward to conclude that this metric has the potential to provide an indicator of the number of test case needed to test e.g. a piece of model dynamics expressed by an UML activity diagram. There are three ways to calculate such metric. The first one is a simple formula:</p>
<p><strong>M= L &#8211; N + 2P</strong>,</p>
<p>where  <strong>L</strong>= the number of links in th graph, <strong>N</strong>= the number of nodes in the graph, and <strong>P</strong>= the number of disconnected parts of the graph (e.g. a calling program and a subroutine).</p>
<p>The second method  is to calculate the number of binary decisions in a program plus one. A three-way decision must be converted in a two binary decisions, and a N-way case statement in a N-1 binary decisions. Similarly for the guard condition of a loop.</p>
<p>Finally, the third way, which is associated to the notion of a circuit in a graph, is to count the number of connected regions present in the graph&#8217;s topology.  An interesting property of the McCabe&#8217;s metric is that the complexity of several graphs (modules/subsystems/systems) considered as a group is equal to the <em>sum </em>of the individual graphs&#8217; complexity. (Of course, we focus here in the structural complexity concerning the algorithmic/dynamic representation of such modules/subsystems/systems.) Hence, as a simple test plan action, we start to build a representation of the control flow structure of a module code (using either flowcharts or UML activity diagrams). Then we transform such a representation in a graph, and finally we calculate the McCabe&#8217;s metric on it. If the number of test cases does not equal the final M value of the metric, then we have not yet satisfied the coverage criteria. In that case, there isn&#8217;t necessarily an error, but there is anyway a reason for caution, as Beizer claims:</p>
<blockquote>
<ol>
<li>You haven&#8217;t calculated the complexity correctly. Did you miss a decision?</li>
<li>The cover is not really complete. There is a link that has not been covered.</li>
<li>The cover is complete, but it can be done with a few more but simpler paths.</li>
<li>It might be possible to simplify the routine.</li>
</ol>
</blockquote>
<p>I like the McCabe&#8217;s metric because it is quite as simple as the count of LOCs (Lines Of Code) but provides a better measure of the structural complexity of a routine (method). It&#8217;s intuitively better because it takes into account the increase of complexity due to subdividing a routine (method), something that a LOC-based metric does not do. To be precise, as suggested by Beizer, the McCabe&#8217;s metric takes into account but underestimate the real impact of subdividing code because in such cases the structural complexity increases nonlinearly with respect to the number of parts in which the routine (method) is splitted into. However, it is better than nothing.</p>
<p>It is time to show how things work in practice. Consider the situation in which we want to test the main method of a simple data recorder for a hot-water healing system. We first create a flowchart (e.g. an activity diagram in UML) illustrating the control-flow logic of our recorder system. The result should be similar to that illustrated in <strong>Figure 1</strong>.</p>
<div id="attachment_275" class="wp-caption aligncenter" style="width: 480px"><a href="http://baruzzo.files.wordpress.com/2011/02/workflow-process-model.png"><img class="size-full wp-image-275" title="Workflow Process Model" src="http://baruzzo.files.wordpress.com/2011/02/workflow-process-model.png?w=588" alt=""   /></a><p class="wp-caption-text">Flowchart for a simple data recorder system</p></div>
<p>(It is not the best design for such application, but this is not the point). Then we translate this flowchart into a graph representing all possible paths. We label each node with a number and each link with a letter. (In order to facilitate the mapping with the two diagrams, I have annotated the activity diagram accordingly.) A link in the graph corresponds to either an activity (process) or a connection between nodes (e.g. a loop) in the flowchart, whereas a node represents a decision point, a junction (a point in the flowchart where two or more paths join), or a combination of both. For example, the <strong>f</strong> link describes the jump backward to the the process <strong>b</strong> (Read data from environmental sensors) that can arise at the decision point <strong>5</strong> (Any error during validation?) immediately after the execution of process <strong>c</strong> (Validate data).</p>
<div id="attachment_277" class="wp-caption aligncenter" style="width: 379px"><a href="http://baruzzo.files.wordpress.com/2011/02/workflow-graph.png"><img class="size-full wp-image-277" title="workflow graph" src="http://baruzzo.files.wordpress.com/2011/02/workflow-graph.png?w=588" alt=""   /></a><p class="wp-caption-text">Paths for the workflow model of the data recorder system</p></div>
<p>Applying the McCabe&#8217;s formula, we have that:<strong> L=7</strong>; <strong>N=6</strong>, thus <strong>M= L &#8211; N + 2= 7-6+2= 3</strong></p>
<p>The minimum number of test cases needed to test the flowchart of our data recorder system is 3. I have made an important hypotesys here: all the paths through the routine are achievable because all the predicates (statements) in the routine are uncorrelated (independent). If we have correlated data or statements, the actual possible paths are less than those provided by the McCabe&#8217;s metric.</p>
<p>Our next problem is to find these test cases. In our pretty simple example, it is quite forward to find them simply by manually inspecting the graph. The simplest path is probably <strong>abcde</strong>, which covers all the links except <strong>f</strong> and <strong>g</strong>. Now we need two other different paths to complete the coverage criteria: one satisfying <strong>f </strong>(the simplest one is <strong>abcfbcde</strong>), and the other satisfying <strong>g</strong> (again, the simplest path is <strong>abcdgcde</strong>). In conclusion, the set of test cases needed are:</p>
<ol>
<li><strong>abcde</strong></li>
<li><strong><strong>abcfbcde</strong><br />
</strong></li>
<li><strong><strong><strong>abcdgcde</strong><br />
</strong></strong></li>
</ol>
<p>Finding a set of input values that will cause the execution of each desired path (path sensitizing) gives us a reasonable level of confidance that our testing effort was sufficient (according to our basic coverage criteria) to check the recorder funtionality illustrated here.</p>
<p><strong>Bibliography</strong></p>
<p>[1] B. Beizer, &#8220;Software Testing Techniques&#8221;, Van Nostrand Reinhold, 1983  [2] T.J. McCabe, &#8220;A Complexity Measure&#8221;, IEEE Transaction on Software Engineering SE-2: 308-320 (1976)  [3] J. Lakos, &#8220;Large-Scale C++ Software Design&#8221;, Addison Wesley, 1993</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baruzzo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baruzzo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baruzzo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baruzzo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baruzzo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baruzzo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baruzzo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baruzzo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baruzzo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baruzzo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baruzzo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baruzzo.wordpress.com/227/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baruzzo.wordpress.com/227/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baruzzo.wordpress.com/227/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=227&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baruzzo.wordpress.com/2011/02/04/leaving-untested-code-is-stupid-shortsighted-and-irresponsible-b-beizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ee214ab0dbabc63bd87e451ec26ec9fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andreabaruzzo</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2011/02/workflow-process-model.png" medium="image">
			<media:title type="html">Workflow Process Model</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2011/02/workflow-graph.png" medium="image">
			<media:title type="html">workflow graph</media:title>
		</media:content>
	</item>
		<item>
		<title>2010 in review</title>
		<link>http://baruzzo.wordpress.com/2011/01/02/2010-in-review/</link>
		<comments>http://baruzzo.wordpress.com/2011/01/02/2010-in-review/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 13:58:46 +0000</pubDate>
		<dc:creator>Andrea Baruzzo</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baruzzo.wordpress.com/?p=233</guid>
		<description><![CDATA[The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here&#8217;s a high level summary of its overall blog health: The Blog-Health-o-Meter™ reads Minty-Fresh™. Crunchy numbers A Boeing 747-400 passenger jet can hold 416 passengers. This blog was viewed about 2,200 times in 2010. That&#8217;s about 5 full 747s. In [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=233&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here&#8217;s a high level summary of its overall blog health:</p>
<p><img style="border:1px solid #ddd;background:#f5f5f5;padding:20px;" src="http://s0.wp.com/i/annual-recap/meter-healthy.gif" alt="Healthy blog!" width="250" height="183" /></p>
<p>The <em>Blog-Health-o-Meter™</em> reads Minty-Fresh™.</p>
<h2>Crunchy numbers</h2>
<p><a href="http://baruzzo.files.wordpress.com/2009/06/shape-physical2.png"><img style="max-height:230px;float:right;border:1px solid #ddd;background:#fff;margin:0 0 1em 1em;padding:6px;" src="http://baruzzo.files.wordpress.com/2009/06/shape-physical2.png?w=288" alt="Featured image" /></a></p>
<p>A Boeing 747-400 passenger jet can hold 416 passengers.  This blog was viewed about <strong>2,200</strong> times in 2010.  That&#8217;s about 5 full 747s.</p>
<p>In 2010, there were <strong>3</strong> new posts, growing the total archive of this blog to 9 posts. There were <strong>3</strong> pictures uploaded, taking up a total of 93kb.</p>
<p>The busiest day of the year was November 23rd with <strong>32</strong> views. The most popular post that day was <a style="color:#08c;" href="http://baruzzo.wordpress.com/2009/07/01/physical-design-vs-logical-design-part-i/">Physical design vs. logical design (part I)</a>.</p>
<h2>Where did they come from?</h2>
<p>The top referring sites in 2010 were:</p>
<ul>
<li><strong>users.dimi.uniud.it</strong>,</li>
<li><strong>sole.dimi.uniud.it</strong>,</li>
<li><strong>lmodules.com</strong>,</li>
<li><strong>facebook.com</strong>, and</li>
<li><strong>linkedin.com</strong>.</li>
</ul>
<p>Some visitors came searching, mostly for <strong>logical design diagram</strong>, <strong>logical design vs physical design</strong>, <strong>andrea baruzzo</strong>, <strong>logical design and physical design</strong>, and <strong>difference between logical and physical design</strong>.</p>
<h2>Attractions in 2010</h2>
<p>These are the posts and pages that got the most views in 2010.</p>
<ol>
<li><a style="margin-right:10px;" href="http://baruzzo.wordpress.com/2009/07/01/physical-design-vs-logical-design-part-i/">Physical design vs. logical design (part I)</a> <span style="color:#999;font-size:8pt;">July 2009</span></li>
<li><a style="margin-right:10px;" href="http://baruzzo.wordpress.com/2009/07/11/physical-design-vs-logical-design-part-ii/">Physical design vs. logical design (part II)</a> <span style="color:#999;font-size:8pt;">July 2009</span></li>
<li><a style="margin-right:10px;" href="http://baruzzo.wordpress.com/2009/08/22/how-testable-is-a-software-architecture/">How testable is a software architecture?</a> <span style="color:#999;font-size:8pt;">August 2009</span></li>
<li><a style="margin-right:10px;" href="http://baruzzo.wordpress.com/2008/11/26/on-cardinalities-in-uml-associations/">About cardinalities and multiplicities in UML associations</a> <span style="color:#999;font-size:8pt;">November 2008</span></li>
<li><a style="margin-right:10px;" href="http://baruzzo.wordpress.com/2010/08/29/data-object-models-difference/">On the difference between data and object models</a> <span style="color:#999;font-size:8pt;">August 2010</span></li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baruzzo.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baruzzo.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baruzzo.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baruzzo.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baruzzo.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baruzzo.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baruzzo.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baruzzo.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baruzzo.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baruzzo.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baruzzo.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baruzzo.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baruzzo.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baruzzo.wordpress.com/233/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=233&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baruzzo.wordpress.com/2011/01/02/2010-in-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ee214ab0dbabc63bd87e451ec26ec9fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andreabaruzzo</media:title>
		</media:content>

		<media:content url="http://s0.wp.com/i/annual-recap/meter-healthy.gif" medium="image">
			<media:title type="html">Healthy blog!</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/06/shape-physical2.png?w=288" medium="image">
			<media:title type="html">Featured image</media:title>
		</media:content>
	</item>
		<item>
		<title>The need of measuring software quality</title>
		<link>http://baruzzo.wordpress.com/2010/11/01/the-need-of-measuring-software-quality/</link>
		<comments>http://baruzzo.wordpress.com/2010/11/01/the-need-of-measuring-software-quality/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 17:56:06 +0000</pubDate>
		<dc:creator>Andrea Baruzzo</dc:creator>
				<category><![CDATA[Design for Testability]]></category>
		<category><![CDATA[Software Quality]]></category>
		<category><![CDATA[ccd]]></category>
		<category><![CDATA[complexity]]></category>
		<category><![CDATA[design-patterns]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[software-quality]]></category>
		<category><![CDATA[testability]]></category>

		<guid isPermaLink="false">http://baruzzo.wordpress.com/?p=170</guid>
		<description><![CDATA[People spend a lot of time debating about software quality but, very often, they speak in abstract terms. They don&#8217;t measure anything. Even worst, they make early design decisions in name of non-functional requirements (especially concerning perfomance issues). Without any measurement to support decisions, our intuition can be misleading most of the time. UML models [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=170&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>People spend a lot of time debating about software quality but, very often, they speak in abstract terms. They don&#8217;t measure anything. Even worst, they make early design decisions in name of non-functional requirements (especially concerning perfomance issues). Without any measurement to support decisions, our intuition can be misleading most of the time. UML models let us to visualize large-scale structures better than the mere code, but again they are not always sufficient to fully describe the overall complexity of the system, nor they suffice to compare design alternatives. Consider, for example, the design illustrated in <strong>Figure 1</strong> (real names are replaced by letters; in any case, what is important here is the model structure, not the specific domain discussed).</p>
<div id="attachment_215" class="wp-caption aligncenter" style="width: 310px"><a href="http://baruzzo.files.wordpress.com/2010/11/model-a.png"><img class="size-medium wp-image-215" title="Model A" src="http://baruzzo.files.wordpress.com/2010/11/model-a.png?w=300&#038;h=233" alt="The structure of model A" width="300" height="233" /></a><p class="wp-caption-text">Figure 1 -  The first option to model a portion of a domain in UML</p></div>
<p>The model illustrates two aggregates, G and M, a hierarchy H and some infrastructure classes all around the aggregates (repositories, factories, and proxies). Looking at this design, the designer experimented a little bit in order to improve it. Pheraps the hierarchy merges two different dimensions, an abstraction and an implementation (H<em>j</em> and H<em>jk</em>, where <em>j </em>stands for the abstraction concern and <em>k</em> for the implementation concern, respectively). Thus, one possible refactoring strategy is to separate such dimensions, applying the <a title="The Bridge pattern" href="http://www.c2.com/cgi/wiki?BridgePattern">Bridge pattern</a> (the original hierarchy rooted at H now has been divided into two structures rooted at H1 and H2, respectively). Another improvement can be to merge the classes X and Y in order to provide a single, convenient access point to the hierarchy for the aggregates M and G (another <a title="The Proxy pattern" href="http://www.c2.com/cgi/wiki?ProxyPattern">Proxy </a>interface?). Finally, some small modifications affecting the dependencies between the infrastructure classes and their aggregates, and we obtain the design described in model <strong>Figure 2</strong>.</p>
<div id="attachment_217" class="wp-caption aligncenter" style="width: 310px"><a href="http://baruzzo.files.wordpress.com/2010/11/model-b.png"><img class="size-medium wp-image-217" title="Model B" src="http://baruzzo.files.wordpress.com/2010/11/model-b.png?w=300&#038;h=257" alt="" width="300" height="257" /></a><p class="wp-caption-text">Figure 2 - An alternative design for the original model</p></div>
<p>In his refactoring, the designer applied two well-known design patterns. This sounds good, but does he <em>really </em>improve the design? Looking at the structures of the two models, which one is better is not so evident. In general, there is no single answer. We need to understand which non-functional requirement is more important, in order to choose a suitable metric to measure it. Considering maintainability and testability, better means &#8220;simpler&#8221; in terms of complexity and coupling. We can calculate the CCD/NCCD metrics for both design alternatives in order to evaluate the dependecy structure of the two models. Despite of the fact that the second model applies some design patterns, the overall maintainability is not improved. The crude numbers are showed in <strong>Table 1</strong>:</p>
<p style="text-align:center;">&nbsp;</p>
<div id="attachment_220" class="wp-caption aligncenter" style="width: 310px"><a href="http://baruzzo.files.wordpress.com/2010/11/table1.png"><img class="size-medium wp-image-220 " title="Table1" src="http://baruzzo.files.wordpress.com/2010/11/table1.png?w=300&#038;h=64" alt="Comparison between the two designs" width="300" height="64" /></a><p class="wp-caption-text">Table 1 - Comparison between the two designs</p></div>
<p>The second design shows an increase in complexity of 9,334% according to NCCD metric despite of a reduction of the system size (-13,793%). This example illustrates several points:</p>
<ul>
<li>The simple application of design patterns does not always guarantee an improvement in quality. A pattern represents a well documented solution to a recurring problem, but it comes with costs and consequences. If we choose a pattern which do not represents a good trade-off with respect to the specific non-functional requirement we want to optimize, the result will not be optimal.</li>
<li>Changing the non-functional requirement to prioritize, the numbers may tell a completely different story. In our example, if we take into account scalability, probably the alternative model of <strong>Figure 2</strong> is better, at least considering the maintainance of the <em>evolving </em>hierarchy structure. After all, this is exactly the reason why the Bridge pattern was introduced.</li>
<li>Supported by a <em>mathematical model</em> such as that provided by the CCD/NCCD metric, we can measure one dimension of software quality <em>objectively </em>and <em>systematically</em>.</li>
<li>Without an objective evaluation, making strategic decisions (e.g. optimizations, design speculations, architectural choices, and so on) on the basis of the sole designer&#8217;s intuition can produce unexpected (unpleasant) results.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baruzzo.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baruzzo.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baruzzo.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baruzzo.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baruzzo.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baruzzo.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baruzzo.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baruzzo.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baruzzo.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baruzzo.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baruzzo.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baruzzo.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baruzzo.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baruzzo.wordpress.com/170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=170&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baruzzo.wordpress.com/2010/11/01/the-need-of-measuring-software-quality/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ee214ab0dbabc63bd87e451ec26ec9fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andreabaruzzo</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2010/11/model-a.png?w=300" medium="image">
			<media:title type="html">Model A</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2010/11/model-b.png?w=300" medium="image">
			<media:title type="html">Model B</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2010/11/table1.png?w=300" medium="image">
			<media:title type="html">Table1</media:title>
		</media:content>
	</item>
		<item>
		<title>On the difference between data and object models</title>
		<link>http://baruzzo.wordpress.com/2010/08/29/data-object-models-difference/</link>
		<comments>http://baruzzo.wordpress.com/2010/08/29/data-object-models-difference/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 13:16:42 +0000</pubDate>
		<dc:creator>Andrea Baruzzo</dc:creator>
				<category><![CDATA[Data Models]]></category>
		<category><![CDATA[data models]]></category>
		<category><![CDATA[impedance mismatch]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://baruzzo.wordpress.com/?p=146</guid>
		<description><![CDATA[A recurring challenge in the development of an object-oriented system is mapping the object model (in particular, the domain model) with a relational database. This is a well-known problem referred in literature with the &#8220;impedance mismatch&#8221; term [2,3]. It is a problem because we are trying to merge two paradigms which encourage very different programming [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=146&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A recurring challenge in the development of an object-oriented system is mapping the object model (in particular, the domain model) with a relational database. This is a well-known problem referred in literature with the &#8220;<em><a title="Object-relational impedance mismatch" href="http://en.wikipedia.org/wiki/Object-relational_impedance_mismatch">impedance </a><a title="Object-relational impedance mismatch" href="http://en.wikipedia.org/wiki/Object-relational_impedance_mismatch">mismatch</a></em>&#8221; term<strong> [2,3]</strong>. It is a problem because we are trying to merge two paradigms which encourage very different programming styles. It is not surprising to see how often the communities of data modelers and object modelers clash when they talk each others about the importance/superiority of one model with respect to the other. Usually, these discussions don&#8217;t produce much value because (more often than not) they originated by several misunderstandings. If we do not understand the very different nature of the two paradigms, we will not be able to effectively integrate them in current software development methods and applications. Hence, the idea of this post is to compare each paradigm in order to better understand how they differ. My assumption is that the two models will coexist for many years (perhaps until either object-oriented databases will became mainstream or another paradigm will outpace the object-oriented development style).</p>
<p>Obviously the space in a blog is not sufficient to provide a complete treatment. The interested reader can deepen the arguments discussed here in the books suggested at the end of this post.</p>
<p><strong>Relationships and navigability</strong></p>
<p>Of course, the most evident difference between the two paradigms concerns how they handle the relationships between entities. The relational model is based on the set theory whereas the object model is quite close to the graph theory. This fact has several implications which affect how relationships are dealt with. As described by Jimmi Nilsson <strong>[1]</strong>, <em>in the relational model, relationships are formed by duplicated values</em>. Consider, for example, the ORDER entity which has the primary key ORDER.Id: such key is duplicated as a foreign key in any children entity, letting the child rows &#8220;point&#8221; to the parents. Thus, everything in a relational model is data, even the relationships. <em>In an object-oriented model, relationships are implemented using the built-in object identifiers</em>, letting the parent have references to object identifiers of its children.</p>
<p>Navigability is also affected by the different nature of these two models. A graph <em>can </em>be oriented, so in an object model the navigation between two objects is one way. Bidirectional navigation is achieved by two separate links (relations). Conversely, in the relational model the navigation is always bidirectional. Moreover, the relational model is set-based, hence almost every operation on the database deals with sets. When we want to navigate in the relational model, we execute a query to retrieve all children that have a foreign key with the same value of the primary key of the parent. What we have in return is a set of data. Another way of navigating the relational model is to perform a joint between both the parent set and the children set. In an object model the typical way to navigate through the instances is to traverse the relationships between the objects (as in a graph). With objects, we deal always with only an object (instance) at a time.</p>
<p><strong>Data encapsulation</strong></p>
<p>This different way to implement relationships affects also the &#8220;privacy&#8221; of the data. Every data in the relational model is &#8220;global&#8221;, while in an object model we usually keep data encapsulated and protected in agglomerates called aggregates. Every aggregate should keep secret its internal state, exposing only the public services used to manipulate it.</p>
<p><strong>Static vs. dynamic nature</strong></p>
<p>Relational models concern only data, whereas object models take into account also the dynamic nature of object (objects, differently than entities, expose a behavior implemented by methods).</p>
<p><strong>Type system</strong></p>
<p>Using both a relational database and an object model, we deal with two different type systems. This is evident when we look at the physical models. Often the two types systems are located in different machines and even it is not so, they live in different address spaces. Moreover, not even the primitive types are the same. A string in .NET can have a variable length whereas in Microsoft SQL Server is typically a varchar or a text or a char. Again according to <strong>[1]</strong>, a DateTime in .NET has the precision of 100 ns, whereas in SQL Server the precision is only of 3/1000 s. Yet another example: in the object type system it is not possible to assign a primitive type to an object instance, and viceversa. Thus it is not possible to set an int to null; however, it is perfectly legal to store a null value in an int in SQL Server.</p>
<p>Clearly, these differences show us that when we are developing a complete software system we are dealing with two distinct development environments: the <em>application programming</em> environment and the <em>database programming</em> environment. In the latter the typical programming language is a declarative query language, whereas in the former the languages are usually imperative (often either procedural or object-oriented). Declarative query languages have no control constructs, nor variables, thus they are not well suited for complete application development. Hence, programmers write applications in a programming language with its own data structures, and use a query language to transfer data back and forth between the application programming environment and the database programming environment. Because these two environments adopt different paradigms (with the differences highlighted above), we deal with the impedance mismatch problem.</p>
<p>Due to their intrinsic characteristics, the object model is usually the best place for coding the business logic. The translation between the object model and the data model can be done manually (e.g. with design patterns such as <a href="http://martinfowler.com/eaaCatalog/repository.html" target="_blank">Repository </a>or <a href="http://martinfowler.com/eaaCatalog/queryObject.html" target="_self">Query Object</a>) or automatically, with an <a href="http://en.wikipedia.org/wiki/Object-relational_mapping" target="_blank">Object-Relational Mapping</a> (ORM) tool such as <a href="http://www.hibernate.org/" target="_blank">Hibernate</a> or <a href="http://cayenne.apache.org/" target="_blank">Cayenne</a>. Moving the business layer in the data model is typically an anti-pattern. We are forced to work in the database programming environment where the programming languages are not expressive enough to provide the support needed to code business rules and complex business logic. Moreover, we lack also the support of testing tools and techniques which is commonly available in the application programming environment (assertions, unit testing, integration testing, and system testing frameworks).</p>
<p><strong>Bibliography</strong></p>
<p>[1] Jimmy Nilsson, &#8220;Applying Domain-Driven Design and Patterns&#8221;, Addison Wesley, 2007</p>
<p>[2] Roderic Geoffrey Galton Cattell, &#8220;Object Data Management: Object-Oriented and Extended Relational Database Systems&#8221;, Addison Wesley, 1991</p>
<p>[3] François Bancilhon and David Maier, &#8220;Multilanguage Object-Oriented Systems: New Answers to Old Database Problems?&#8221;, in Future Generation Computer, K. Fuchi and L. Kott Eds, North-Holland, 1988</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baruzzo.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baruzzo.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baruzzo.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baruzzo.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baruzzo.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baruzzo.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baruzzo.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baruzzo.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baruzzo.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baruzzo.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baruzzo.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baruzzo.wordpress.com/146/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baruzzo.wordpress.com/146/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baruzzo.wordpress.com/146/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=146&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baruzzo.wordpress.com/2010/08/29/data-object-models-difference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ee214ab0dbabc63bd87e451ec26ec9fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andreabaruzzo</media:title>
		</media:content>
	</item>
		<item>
		<title>Why SOA is different?</title>
		<link>http://baruzzo.wordpress.com/2010/05/15/why-soa-is-different/</link>
		<comments>http://baruzzo.wordpress.com/2010/05/15/why-soa-is-different/#comments</comments>
		<pubDate>Sat, 15 May 2010 22:42:15 +0000</pubDate>
		<dc:creator>Andrea Baruzzo</dc:creator>
				<category><![CDATA[SOA]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[soa]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://baruzzo.wordpress.com/?p=152</guid>
		<description><![CDATA[The idea of reusing a functionality embedded in software modules (or components) is not new. Even considering only the last decade, the technology of remote reusable services has been well established. Both Microsoft DCOM and CORBA attempted at a distributed service model. Both models failed in some way. I have found an interesting discussion about [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=152&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The idea of reusing a functionality embedded in software modules (or components) is not new. Even considering only the last decade, the technology of remote reusable services has been well established. Both <a href="http://msdn.microsoft.com/en-us/library/ms809340.aspx">Microsoft DCOM</a> and <a href="http://www.omg.org/gettingstarted/corbafaq.htm">CORBA </a>attempted at a distributed service model. Both models failed in some way. I have found an interesting discussion about these failures in the book &#8220;<a href="http://www.amazon.com/Oracle-JDeveloper-11g-Handbook-Development/dp/0071602380/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1273961001&amp;sr=8-1">Oracle JDeveloper 11g Handbook</a>&#8220;. The authors present the SOA concept as an evolution of the earlier attempts at distributed computing such as DCOM and CORBA. From a technical point of view, they point out the following critical advantages of SOA over its predecessors:</p>
<ul>
<li><em><strong>Communication is based on hypertext protocols</strong></em>. COM and CORBA failed mainly because of the transport mechanism they use to communicate between remote servers  (i.e. the low-level TCP-IP protocol). The problem with this mechanism concerned the need to cross firewall boundaries or pass between proxy servers. SOA uses a different protocol for communication (i.e. HTTP) which works better as a transport layer and is capable of traversing firewalls and proxy servers.</li>
<li><em><strong>Through Web services, SOA has a common (and standard) lexicon</strong></em>. SOA uses both the Web Services Description Language (WSDL) and a publishing mechanism (UDDI, Universal Description Discovery and Integration) for discovering Web services, which are standard formats. CORBA is based on a standard specification, but implementors failed to provide standard implementations. DCOM achieves portability at the binary level, but it is &#8220;standard&#8221; only in the realm of the Microsoft platform. Porting DCOM outside Windows resulted in several difficulties.</li>
<li><em><strong>SOA emphasize orchestration, not just communication</strong></em>. The typical code we write with either DCOM or CORBA exploits local and remote function call. With marshaling and unmarshaling, this programming style enables a uniform invocation style, which makes local and remote calls look similar. However, that code remains at the functional level. SOA concentrates on the more abstract task of integrating at the service level. Furthermore, using the Business Process Execution Language (BPEL), this task can be reasonably achieved by a business analyst rather than by a programmer.</li>
</ul>
<p>Of course, any technology succeeds (or fails) for a variety of reasons concerning not only the technical aspects. Nonetheless, I think that the aspects discussed so far are quite interesting as key factors in the comparison between SOA and its predecessors.</p>
<p>Finally, I conclude this post with what I consider a challenge in the actual software modeling scenario. The development of SOA applications promotes the use of a declarative programming style on the top of an object layer. To this regard, it is interesting to see how modeling notations such as UML are/will-be capable of expressing these two different paradigms in a coherent, unified style.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baruzzo.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baruzzo.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baruzzo.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baruzzo.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baruzzo.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baruzzo.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baruzzo.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baruzzo.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baruzzo.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baruzzo.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baruzzo.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baruzzo.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baruzzo.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baruzzo.wordpress.com/152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=152&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baruzzo.wordpress.com/2010/05/15/why-soa-is-different/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ee214ab0dbabc63bd87e451ec26ec9fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andreabaruzzo</media:title>
		</media:content>
	</item>
		<item>
		<title>How testable is a software architecture?</title>
		<link>http://baruzzo.wordpress.com/2009/08/22/how-testable-is-a-software-architecture/</link>
		<comments>http://baruzzo.wordpress.com/2009/08/22/how-testable-is-a-software-architecture/#comments</comments>
		<pubDate>Sat, 22 Aug 2009 21:51:54 +0000</pubDate>
		<dc:creator>Andrea Baruzzo</dc:creator>
				<category><![CDATA[Design for Testability]]></category>
		<category><![CDATA[ccd]]></category>
		<category><![CDATA[component diagram]]></category>
		<category><![CDATA[hierarchical testing]]></category>
		<category><![CDATA[isolation testing]]></category>
		<category><![CDATA[john lakos]]></category>
		<category><![CDATA[levelizable system]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[physical design]]></category>
		<category><![CDATA[testability]]></category>

		<guid isPermaLink="false">http://baruzzo.wordpress.com/?p=110</guid>
		<description><![CDATA[Testability is not testing. A (software) system is testable when there is an effective test strategy that can be used to verify the conformance of a particular implementation with respect to its specifications. Vice-versa, a system is tested when a specific test suite has been executed, verifying that such implementation really conforms to its specifications. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=110&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Testability is not testing. A (software) system is <em>testable </em>when there is an effective test strategy that can be used to verify the conformance of a particular implementation with respect to its specifications. Vice-versa, a system is <em>tested </em>when a specific test suite has been executed, verifying that such implementation really conforms to its specifications. In other words, testability is a property of the design, whereas &#8220;tested&#8221; is a state the system must attain before we release it to the customers.</p>
<p>The initial question (how testable is a software architecture?) is thus a question concerning the quality of the <em>design</em>. Objectively, it is a complex question which can be tackled from several different perspectives. There is no single &#8220;good answer&#8221;, no magical tool. I try to address it considering the quality aspect from the <a title="Physical design vs. logical design (part I) " href="http://baruzzo.wordpress.com/2009/07/01/physical-design-vs-logical-design-part-i/">physical design</a> perspective, which I have discussed in previous posts. This is also a good occasion to talk about two types of testing strategies:</p>
<ul>
<li>Isolation testing;</li>
<li>Hierarchical testing.</li>
</ul>
<p>One technique useful to analyze the testability of a system is to check either if it is layered or how far it is from a layered structure. In the case it is layered, we want to analyze also both the complexity of each layer (how many components, how many dependencies, etc.) and the cumulative complexity of the entire system.  Layering is a technique to produce <em>levelizable system</em>. The idea is to identify a method for partitioning all the components constituting the system under testing into equivalence classes called <em>levels</em>. This partition is based on the physical dependencies existing between the components. Each level is then referred by a non-negative integer number, called <em>level number</em>. An example will clarify the idea.</p>
<p>Several years ago I developed a geometrical engine to solve some research problems in the field of computational geometry. This engine was intended to provide not only the geometrical algorithms, but also a predefined library of shapes upon which the programmers could build their applications. I was asked also to develop a simple shape editor implementing the most common operations concerning the shapes manipulation. Inspired by the work of Lakos, I designed the shape editor subsystem as illustrated in Figure 1 (actually, this is a simplified version of that system, but it suffices to illustrate the point). It was composed by several components which do not form any cycle in the physical dependency graph. I strove to not introducing cyclic dependencies because only a configuration of components that has a directed acyclic physical dependency graph (DAG) forms a levelizable system. In a DAG, we can always assign a unique level number to each component using the following rule. At level 0 we place all the components external to the system under test (e.g. a third-party library component, assuming that such components have already been tested). At level 1 we place components internal to the system under test with no local physical dependencies (e.g. <em>Shape</em> and <em>Utils::Node</em> components in the figure). Finally, at level N we place those components internal to the system under test which depend physically on components at level N-1, but not higher. In this way, a component has a level number one more the maximum level of the components upon which it depends.</p>
<p>The rationale in this level number assignment is that a level number counts the length of the longest path from that component through the (local) component dependency graph to the (possibly empty) set of external or compiler-supplied library components. In general, we will say that <em>any software system is levelizable if its physical dependency graph can be assigned unique level numbers</em>. A cycle is not levelizable, so we cannot assign to its components unique level numbers. In that case, the cycle must be considered as a unique component in order to assign a unique level number to it.</p>
<div id="attachment_133" class="wp-caption aligncenter" style="width: 370px"><a href="http://baruzzo.files.wordpress.com/2009/08/shapeeditor.png"><img class="size-full wp-image-133 " title="shapeEditor" src="http://baruzzo.files.wordpress.com/2009/08/shapeeditor.png?w=588" alt="Figure 1 - A UML component diagram annotated with level numbers"   /></a><p class="wp-caption-text">Figure 1 - A UML component diagram annotated with level numbers in the upper-right corner of each component</p></div>
<p>It is very simple to rearrange the components in the diagram in order to enphasize each level. The diagram in Figure 2 reflects this new disposition, appearing now as a typical layered architecture.</p>
<div id="attachment_134" class="wp-caption aligncenter" style="width: 370px"><a href="http://baruzzo.files.wordpress.com/2009/08/shapeeditor-levels.png"><img class="size-full wp-image-134 " title="shapeEditor-levels" src="http://baruzzo.files.wordpress.com/2009/08/shapeeditor-levels.png?w=588" alt="Figure 2"   /></a><p class="wp-caption-text">Figure 2 - The same component diagram rearranged according to a typical layered design</p></div>
<p>Why layering is a desirable property of a design? Why I were so carefully with cycles in the dependency graph? If we have a levelizable system and we want to test it, we can immediately identify which components are <em>testable in isolation</em>: it is sufficient to look at those components belonging to level 1. In a cycle there is no level 1! In the case of my shape editor illustrated in Figure 1, there are only two components that can be tested without linking any other component: <em>Utils::Node</em> and  <em>Shape</em>. Moreover, by starting to test at the lowest level (level 1)  and testing all the components belonging to that level before moving to the next level, we guarantee that all the components on which the current component depends have already been tested.  This criteria is referred by Lakos as <em>hierarchical testing</em>, because level numbers define a partition that can be considered as an hierarchy of component dependencies in the physical graph.</p>
<p>Layering let us quickly identify the most reusable components in the system and, if we arrange the UML diagrams as in figure 2, we will find such components looking at the top of the diagrams. However layeing alone does not reveal a direct measure of the internal complexity of each level, nor it provide a measure of the cumulative complexity of the overall architecture. To do this, we need a <em>metric </em>based on the physical properties of a system: the <em>Cumulative Component Dependency</em> (CCD). CCD is not new: it has been discussed extensively by John Lakos in his book &#8220;Large-Scale C++ Software Design&#8221;, published in 1993. Despite this metric is available long before the rise of UML, no modeling CASE tool supports it nowadays (at least to the best of my knowledge). CCD is useful because represents a good indication of the long-term maintenance cost associated to that component/system [1]. CCD is defined as follows:</p>
<blockquote><p>CCD = sum over all components C in a subsystem of the number of components needed in order to test each C incrementally.</p></blockquote>
<p>Calculate the CCD is straightforward: for each component C in the subsystem under test we count how many other components are reachable inspecting the dependency graph rooted at C. To test C incrementally we have to write a test driver for it and a single independent test driver for each component reachable from C. If there are n components reachable from C, we have to link <em>k+1</em> components to test C incrementally. This <em>k+1</em> is the linkg cost associated to C. Now we add the link cost of all the components in the subsystem under test. The total sum is the CCD value for the specific subsystem. In our example, the CCD of the <em>EditorShape</em> subsystem is 50, as shown in Figure 3. For each component in the upper-right corner I have shown now the link cost. To test incrementally the <em>Edge </em>componet, we have to link to its test driver the test drivers of <em>Point </em>and <em>Shape</em>, so the link cost is 3. If we want to test <em>Triangle</em>, we have to link also <em>Vertex</em>, <em>Utils::Node</em>, <em>Point</em>, and <em>Shape</em>, so the link costs is 5. The CCD is the sum of all link costs.</p>
<div id="attachment_210" class="wp-caption aligncenter" style="width: 386px"><a href="http://baruzzo.files.wordpress.com/2009/08/shapeeditor-ccd2.png"><img class="size-full wp-image-210" title="shapeEditor-ccd" src="http://baruzzo.files.wordpress.com/2009/08/shapeeditor-ccd2.png?w=588" alt=""   /></a><p class="wp-caption-text">Figure 3 - CCD of the Shape editor</p></div>
<p>CCD is useful because provides a numerical measure of the overall link cost associated with the incremental testing of a given system. Obviously a low CCD value identifies a design which is simpler to test, to maintain, and to understand. A low CCD combined with a levelizable design allows to study pieces of the subsystem in isoltation, to test, tune, and even replace them whithout having to involve the entire subsystem either mentally or physically [1].</p>
<p>If our subsystem is very tightly coupled, e.g. forming a cyclical graph of the same size (11 components) as illustrated in Figure 4, the CCD will be 121. Comparing the 49 CCD value of the system in Figure 3 with the CCD value of this second configuration, we have a numerical evidence that the former design is better (from the testing perspective). Indeed, in Figure 4 none of the components can be tested in isolation or reused independently of the others. There is no partition that let us to test the subsystem hierarchically. Each independent test driver will be forced to link the entire subsystem in order to test a single component, causing a quadratic link time.</p>
<div id="attachment_125" class="wp-caption aligncenter" style="width: 303px"><a href="http://baruzzo.files.wordpress.com/2009/08/ccd-cycle.png"><img class="size-full wp-image-125  " title="ccd-cycle" src="http://baruzzo.files.wordpress.com/2009/08/ccd-cycle.png?w=588" alt="Figure 2 - A cyclic subsystem of size 11"   /></a><p class="wp-caption-text">Figure 2 - A cyclic subsystem of size 11</p></div>
<p>The conclusion of this long post is summarized by the following principle:</p>
<blockquote><p><strong>Principle</strong>: Large software architectures must be levelizable if they are to be tested effectively.</p></blockquote>
<p>As Lakos remarks:</p>
<blockquote><p>CCD provides a raw measure to grasp the structural complexity of a software architecture in order to test it. Level numbers characterize the relative complexity of a component, providing also an objective strategy for testing (hierarchical testing). Cyclic physical dependencies among components inhibit understanding, reuse, and testing, hence they should be avoided or at least confined in a single package. If we design our software systems with an eye toward minimizing CCD, most cyclic dependencies would be eliminated, producing more testable architectures. Moreover, reducing the interdependencies between components as quantified by the CCD helps to keep the overall system simpler, improving both maintenability and understandability.</p></blockquote>
<p>Bibliography</p>
<p>[1] Lakos, J. &#8211; &#8220;Large-Scale C++ Software Design&#8221;, Addison Wesley, 1996</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baruzzo.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baruzzo.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baruzzo.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baruzzo.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baruzzo.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baruzzo.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baruzzo.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baruzzo.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baruzzo.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baruzzo.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baruzzo.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baruzzo.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baruzzo.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baruzzo.wordpress.com/110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=110&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baruzzo.wordpress.com/2009/08/22/how-testable-is-a-software-architecture/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ee214ab0dbabc63bd87e451ec26ec9fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andreabaruzzo</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/08/shapeeditor.png" medium="image">
			<media:title type="html">shapeEditor</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/08/shapeeditor-levels.png" medium="image">
			<media:title type="html">shapeEditor-levels</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/08/shapeeditor-ccd2.png" medium="image">
			<media:title type="html">shapeEditor-ccd</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/08/ccd-cycle.png" medium="image">
			<media:title type="html">ccd-cycle</media:title>
		</media:content>
	</item>
		<item>
		<title>Physical design vs. logical design (part II)</title>
		<link>http://baruzzo.wordpress.com/2009/07/11/physical-design-vs-logical-design-part-ii/</link>
		<comments>http://baruzzo.wordpress.com/2009/07/11/physical-design-vs-logical-design-part-ii/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 21:20:24 +0000</pubDate>
		<dc:creator>Andrea Baruzzo</dc:creator>
				<category><![CDATA[Design for Testability]]></category>
		<category><![CDATA[john lakos]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[logical design]]></category>
		<category><![CDATA[physical design]]></category>
		<category><![CDATA[testability]]></category>

		<guid isPermaLink="false">http://baruzzo.wordpress.com/?p=93</guid>
		<description><![CDATA[In the first instalment of this post, I introduced the notions of physical and logical designs. Then, I introduced three new stereotyped UML dependencies needed to express the relations between classes in terms of both interfaces and implementations. In this post I discuss how to transform a logical design  into a physical architecture that can be exploited [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=93&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the <a title="Physical design vs. logical design (part I)" href="http://baruzzo.wordpress.com/2009/07/01/physical-design-vs-logical-design-part-i/">first instalment</a> of this post, I introduced the notions of physical and logical designs. Then, I introduced three new stereotyped UML dependencies needed to express the relations between classes in terms of both interfaces and implementations. In this post I discuss how to <em>transform </em>a logical design  into a physical architecture that can be exploited in order to analyze the overall system testability.</p>
<p>To show how this transformation is obtained, consider the simple UML class diagram in <em>Figure 1</em>: it illustrates the <strong>Shape </strong>hierarchy, one of its clients (the <strong>ShapeEditor</strong> class), and a utility class (<strong>ShapeUtil</strong>). The first step to translate this diagram into a logical design diagram (according to the Lakos method) is to characterize each relation between classes in terms of generalization and the three new stereotyped dependencies «Uses-In-The-Interface», «Uses-In-The-Implementation», and «Uses-In-Name-Only» (the latter is not supported by all programming languages, as noted in the aforementioned instalment).</p>
<div id="attachment_95" class="wp-caption aligncenter" style="width: 282px"><a href="http://baruzzo.files.wordpress.com/2009/07/shape-editor1.png"><img class="size-full wp-image-95     " title="shape-editor" src="http://baruzzo.files.wordpress.com/2009/07/shape-editor1.png?w=588" alt="The shape editor"   /></a><p class="wp-caption-text">Figure 1 - The shape editor</p></div>
<p>To select the proper type of dependency, we have to check the source code, if available. Otherwise, at design-time, we can set a specific dependency type between two classes in order to force a particular property: for example, we specify that a class <em>X</em> «Uses-In-The-Implementation» a class <em>Y</em> when we want to treat <em>Y</em> as an encapsulated implementation detail of <em>X</em>, avoiding to propagate this logical dependency to any external client which uses <em>X</em>.</p>
<p>I suppose here that at design-time <strong>ShapeUtils </strong>will be coupled with every concrete shape, using them substantially in its implementation. Thus, from a logical point of view, <strong>ShapeUtils</strong> «Uses-In-The-Implementation» <strong>Triangle</strong>, <strong>Square</strong>, and <strong>Circle</strong>.</p>
<p>The same reasoning is applied for the class <strong>ShapeEditor</strong>, with one important difference: whereas <strong>ShapeUtils </strong>needs to delve directly with each concrete class, the <strong>ShapeEditor</strong> can (should) treat every shape trasparently, without knowing directly its concrete type. Hence, <strong>ShapeEditor </strong>will depend only from the (abstract) base class <strong>Shape</strong>, and the communication with concrete shapes will be realized by means of polymorphism. The resulting logical design is depicted in <em>Figure 2</em>. Note that, in order to show the transition between logical and physical design, I have specified in the diagram also the component to which every class belongs to (showing components is not mandatory in a logical design, as it is in physical design).</p>
<div id="attachment_96" class="wp-caption aligncenter" style="width: 314px"><a href="http://baruzzo.files.wordpress.com/2009/07/shape-editor-logical.png"><img class="size-full wp-image-96   " title="shape-editor-logical" src="http://baruzzo.files.wordpress.com/2009/07/shape-editor-logical.png?w=588" alt="Logical design of the shape editor"   /></a><p class="wp-caption-text">Figure 2 - Logical design of the shape editor</p></div>
<p>The last step that we have to do to complete the transformation is to map any arrow (relation) between classes in the logical design into a dependency between components in the physical design. The transformation of both generalization and dependency relations between the classes <strong>ShapeUtil</strong>, <strong>Triangle</strong>, and <strong>Shape </strong>is depicted in <em>Figure 3</em>.</p>
<div id="attachment_104" class="wp-caption aligncenter" style="width: 322px"><a href="http://baruzzo.files.wordpress.com/2009/07/shape-editor-logical-physical.png"><img class="size-full wp-image-104   " title="shape-editor-logical-physical" src="http://baruzzo.files.wordpress.com/2009/07/shape-editor-logical-physical.png?w=588" alt="shape-editor-logical-physical"   /></a><p class="wp-caption-text">Figure 3 - From logical to physical design</p></div>
<p>The final physical design corresponding to the class diagram of <em>Figure 1</em> is illustrated in <em>Figure 4</em>.</p>
<div id="attachment_98" class="wp-caption aligncenter" style="width: 303px"><a href="http://baruzzo.files.wordpress.com/2009/07/shape-editor-physical.png"><img class="size-full wp-image-98   " title="shape-editor-physical" src="http://baruzzo.files.wordpress.com/2009/07/shape-editor-physical.png?w=588" alt="Physical design of the shape editor"   /></a><p class="wp-caption-text">Figure 4 - Physical design of the shape editor</p></div>
<p>This diagram has an important property of good software design: it is layered. In other words, it is <em>levelizable</em>: it is possible to partition all the components in a system based on their physical dependencies into equivalence classes called <em>levels</em>. I will discuss levels and their implication to testability in the <a title="How testable is a software architecture?" href="http://baruzzo.wordpress.com/2009/08/22/how-testable-is-a-software-architecture/">next instalment</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baruzzo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baruzzo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baruzzo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baruzzo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baruzzo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baruzzo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baruzzo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baruzzo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baruzzo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baruzzo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baruzzo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baruzzo.wordpress.com/93/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baruzzo.wordpress.com/93/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baruzzo.wordpress.com/93/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=93&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baruzzo.wordpress.com/2009/07/11/physical-design-vs-logical-design-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ee214ab0dbabc63bd87e451ec26ec9fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andreabaruzzo</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/07/shape-editor1.png" medium="image">
			<media:title type="html">shape-editor</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/07/shape-editor-logical.png" medium="image">
			<media:title type="html">shape-editor-logical</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/07/shape-editor-logical-physical.png" medium="image">
			<media:title type="html">shape-editor-logical-physical</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/07/shape-editor-physical.png" medium="image">
			<media:title type="html">shape-editor-physical</media:title>
		</media:content>
	</item>
		<item>
		<title>Physical design vs. logical design (part I)</title>
		<link>http://baruzzo.wordpress.com/2009/07/01/physical-design-vs-logical-design-part-i/</link>
		<comments>http://baruzzo.wordpress.com/2009/07/01/physical-design-vs-logical-design-part-i/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 21:34:18 +0000</pubDate>
		<dc:creator>Andrea Baruzzo</dc:creator>
				<category><![CDATA[Design for Testability]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[john lakos]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[logical design]]></category>
		<category><![CDATA[physical design]]></category>
		<category><![CDATA[testability]]></category>

		<guid isPermaLink="false">http://baruzzo.wordpress.com/?p=48</guid>
		<description><![CDATA[The first time I met the concept of physical design was almost one decade ago, reading the book &#8220;Large-Scale C++ Software Design&#8220;, by John Lakos. The book is now quite aged, resulting in some out-of-date material (e.g. package prefixes versus C++ namespaces).Nonetheless, these elements are details with respect to the overall methodology that I continue to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=48&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The first time I met the concept of physical design was almost one decade ago, reading the book &#8220;<a title="Large-Scale C++ Software Design" href="http://www.amazon.com/Large-Scale-Software-Addison-Wesley-Professional-Computing/dp/0201633620/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1245788192&amp;sr=1-1" target="_blank">Large-Scale C++ Software Design</a>&#8220;, by John Lakos. The book is now quite aged, resulting in some out-of-date material (e.g. package prefixes versus C++ namespaces).Nonetheless, these elements are details with respect to the overall methodology that I continue to consider very important and up-to-date, also concerning current<br />
model-based development environments. Moreover, it is probably the only (C++) book that <em>seriously </em>addresses the notion of physical design in contrast to the more popular topic of logical design. Even if the physical design is not so popular as its counterpart, it is essential to build large-scale, critical software systems. According to John Lakos:</p>
<blockquote><p>The physical architecture is the skeleton of the system &#8211; if it is malformed, there is no cosmetic remedy for alleviating its unpleasant symptoms. The quality of the physical design of a large system will dictate the cost of its maintenance and the potential it has for the independent reuse of its subsystems.</p></blockquote>
<p>This claim touches several important points. First, it emphasizes the need of <em>up-front design</em> in developing complex and large software architectures. In other words, don&#8217;t believe that your architecture will &#8220;emerge&#8221; simply as a side-effect of continuous refactoring steps. Refactoring simply do not scale well to be a serious &#8220;large-scale&#8221; architectural design tool. Second, Physical design provides some interesting metrics which can be very effective in order to evaluate the maintenance cost of an architecture. Furthermore, the same metrics can also be used to compare alternative designs. Finally, working with physical design lets the architect to address many testability issues (such as testing in isolation, testing hierarchically, ensuring high-quality software <em>as it is being developed</em>). I will discuss separately each of these aspects in future posts, especially in the context of modern, model-driven development environments.</p>
<p>Before to delve into technical details, however, I briefly recap here the difference between logical and physical design. The dichotomy between these two concepts is similar to that of classes and components. <em>Logical design</em> addresses issues such as the interaction of classes and functions, the (public) interface of a class, the signature of a method, and so on. In an object-oriented system, the class is the smallest fundamental unit of logical design. <em>Physical design</em>, on the other hand, takes into account physical entities (e.g. components, files, and libraries), compile-time coupling, link-time dependencies. The component is the smallest fundamental unit of physical design. Using both physical and logical design aspects, it is possible to automatically analyze a software architecture in order to evaluate several characteristics closely tied to software quality such as understandability, maintainability, testability, and reusability.</p>
<p>In order to do this, it would be desirable to have a unique notation to talk about both logical and physical design. Furthermore, it is desirable that such notation would be supported by modern CASE tools in order to be really applicable. At the time of his writing, Lakos proposed a visual language to talk about logical and physical architectures which were based upon the Booch Notation. Unfortunately, no tool never supported this endeavour. What I propose here is an adaptation of the Lakos notation to current UML. In this way, we can approach to the same type of analysis proposed by Lakos, but applying it to UML diagrams using current state-of-the-art CASE tools, where Lakos performed his automatic analysis of (only) C++ source code using a custom analyzer, in spite of his more general, langugage-independent method).</p>
<p>To set the stage, I choose a simple example consisting of three concrete classes forming a hierarchy of shapes. If we would like to describe the logical design of this small system in UML, we would probably draw a class diagram similar to the following:</p>
<div id="attachment_53" class="wp-caption aligncenter" style="width: 196px"><a href="http://baruzzo.files.wordpress.com/2009/06/shape-logical.png"><img class="size-full wp-image-53 " title="shape-logical" src="http://baruzzo.files.wordpress.com/2009/06/shape-logical.png?w=588" alt="Logical dependences between classes"   /></a><p class="wp-caption-text">Logical dependencies between classes</p></div>
<p>Three types of shapes, <strong>Circle</strong>, <strong>Square</strong>, and <strong>Triangle</strong>, derive from the abstract class <strong>Shape</strong>. Logically, the interface of <strong>Circle</strong>, <strong>Square</strong>, and <strong>Triangle </strong>depend from the interface of <strong>Shape </strong>(this dependency is expressed by the generalization relation). This diagram represents a logical architecture because it describes logical entities (classes) and their relations. Suppose now that each class will be implemented as a single component (for example, in C++ this component consists of both a header file and an implementation file; in Java we will have a single physical .java file, and so on). In UML we can use a component diagram to describe each shape component. A dependency between classes in the logical design is then propagated to a dependency between components in the physical design, as illustrated by the figure below:</p>
<div id="attachment_58" class="wp-caption aligncenter" style="width: 251px"><a href="http://baruzzo.files.wordpress.com/2009/06/shape-physical2.png"><img class="size-full wp-image-58 " title="shape-physical" src="http://baruzzo.files.wordpress.com/2009/06/shape-physical2.png?w=588" alt="Physical dependencies between components"   /></a><p class="wp-caption-text">Physical dependencies between components</p></div>
<p>I will use extensively these types of diagrams to discuss design for testability issues. What the diagrams have in common here is the notion of <em>dependency</em>. After all, designing object-oriented system is mainly a question of managing dependencies. Not surprisingly, thus, we can rely on a very simple notation in order to reason about many aspects related to the complexity of a software architecture. More specifically, concerning the physical design, I will use classes, components, and dependencies. With these few elements, we are able to understand a lot of the overall architectural quality, especially for analysing the maintenance cost or the degree of testability (I will examine opportune metrics in a successive post). Concerning the logical design, again I adhere to the minimal notation used by Lakos for designing a logical system, based on classes and relations. More specifically, in UML I will use generalization (for hierarchies) and three types of (stereotyped) dependencies: the «Uses-In-The-Interface», the «Uses-In-The-Implementation», and the «Uses-In-Name-Only». Such dependencies replace to some extent the more specific association, aggregation, and composition relations in UML.  The semantics of these relations is quite strightforward:</p>
<ul>
<li><strong><em>«</em>Uses-In-The-Interface<em>»</em></strong>: a type <em>T</em> is <em>used-in-the-interface</em> of a component <em>C</em> if the type is used in the <em>public </em><em>interface </em>of any class defined for that component. In this case, we will say that <em>C</em> depends in its interfaces from the type <em>T</em>. If <em>T</em> is used in the interface of <em>C</em>, it can also be used in any <em>C</em> implementation. Therefore, the  «Uses-In-The-Interface» dependency subsumes the «Uses-In-The-Implementation» one, which will not be drawn in order to keep the diagrams simple.</li>
</ul>
<ul>
<li><strong><em>«</em>Uses-In-The-Implementation<em>»</em></strong>: a type <em>T</em> is <em>used-in-the-implementation </em>of a component <em>C</em> if that type is referred to by name anywhere in the <em>definition </em>of the component. In this case, the component <em>C</em> depends in its implementation from the type <em>T</em>. This dependency is <em>not</em> propagated to the interface of C. (In other words, the dependency is logically encapsulated in the implementation of <em>C</em>, thus <em>T</em> is not visible/accessible from the outside of <em>C</em>.)</li>
</ul>
<ul>
<li><strong><em>«</em>Uses-In-Name-Only<em>»</em></strong>: a component <em>C</em> uses a type <em>T</em> in name only if compiling <em>C</em> and any of the components on which <em>C</em> may depend does not require having first seen the definition of <em>T</em>. It is, for example, the case of a C++ type <em>T</em> which appear in a component <em>C</em> always only in the form of <em>T*</em> (i.e. a pointer). In that case, the compiler do not need to see the layout of <em>T</em> in order to compile <em>C</em> (it will always reserve the space for a memory address &#8211; the <em>T*</em> pointer &#8211; to represent any reference of <em>T</em> in <em>C</em>).</li>
</ul>
<p>In the second part of this post, I will provide further examples which clarify the use of such dependencies. Before to conclude, I have to address a question that can arise: why we have to &#8220;re-invent&#8221; new relations by means of stereotyped dependencies when they are similar to the association-aggregation-composition relations already present in UML? The answer is simple: the traditional UML relations used in class diagrams do not differentiate between the interface and the implementation of a class. This is natural, because class diagrams are typically concerned with logical issues. From a logical point of view, what is and what is not used in the implementation of a component is unimportant because it is an encapsulated detail. Vice-versa, from a physical point of view, such usage can imply physical dependencies on other components. It is these physical dependencies that will affect maintainability, reusability, and testability in large systems.  Good design requires that the developer understands the issues involved in both logical and physical design. Thus, we need more expressive dependencies.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baruzzo.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baruzzo.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baruzzo.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baruzzo.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baruzzo.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baruzzo.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baruzzo.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baruzzo.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baruzzo.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baruzzo.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baruzzo.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baruzzo.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baruzzo.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baruzzo.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=48&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baruzzo.wordpress.com/2009/07/01/physical-design-vs-logical-design-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ee214ab0dbabc63bd87e451ec26ec9fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andreabaruzzo</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/06/shape-logical.png" medium="image">
			<media:title type="html">shape-logical</media:title>
		</media:content>

		<media:content url="http://baruzzo.files.wordpress.com/2009/06/shape-physical2.png" medium="image">
			<media:title type="html">shape-physical</media:title>
		</media:content>
	</item>
		<item>
		<title>Design for testability and UML models</title>
		<link>http://baruzzo.wordpress.com/2009/06/08/design-for-testability-uml/</link>
		<comments>http://baruzzo.wordpress.com/2009/06/08/design-for-testability-uml/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 21:12:36 +0000</pubDate>
		<dc:creator>Andrea Baruzzo</dc:creator>
				<category><![CDATA[Design for Testability]]></category>
		<category><![CDATA[linkedin]]></category>

		<guid isPermaLink="false">http://baruzzo.wordpress.com/?p=40</guid>
		<description><![CDATA[There are several books available either in the market or in the Web addressing the fundamentals of object-oriented design using UML. More or less, almost all of them provide to the reader important concepts and principles on software design, a basic notation for learning the most used part of UML, some examples, and perhaps some [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=40&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are several books available either in the market or in the Web addressing the fundamentals of object-oriented design using UML. More or less, almost all of them provide to the reader important concepts and principles on software design, a basic notation for learning the most used part of UML, some examples, and perhaps some complete case study. But finding a book on advanced topics concerning object-oriented design with UML is totally a different story. Obviously, what is the meaning of &#8220;advanced&#8221; depends by the context. In my experience, one of such advanced topics is  the technique of <a title="Design for Testability" href="http://en.wikipedia.org/wiki/Design_For_Test">Design for Testability</a> (or DFT). This technique is very common in the integrated circuit industry and is aimed at adding certain testability features to a microelectronic hardware product design. The premise of the added features is that they make it easier to develop tests for the designed hardware. Nowadays, DFT is a standard in the microelectronic industry. By comparison, the complexity of modern large software systems can be orders of magnitude higher than that found in hardware systems. Nonetheless, surprisingly there are often no testability plans in software projects. Admitedly, DFT is not without any costs. Moreover, it addresses issues that are very relevant especially for complex, critical, and very large software systems. And, of course, it is not necessarily a &#8220;simple&#8221; technique to learn and to apply effectively. These are probably the reasons why there are few articles or books on the subject, especially in the context of model-driven development. I believe that this is both an &#8220;advanced&#8221; and an interesting software engineering topic to cover in this blog, so stay tuned.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baruzzo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baruzzo.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baruzzo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baruzzo.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baruzzo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baruzzo.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baruzzo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baruzzo.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baruzzo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baruzzo.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baruzzo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baruzzo.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baruzzo.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baruzzo.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baruzzo.wordpress.com&amp;blog=5506092&amp;post=40&amp;subd=baruzzo&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baruzzo.wordpress.com/2009/06/08/design-for-testability-uml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ee214ab0dbabc63bd87e451ec26ec9fb?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andreabaruzzo</media:title>
		</media:content>
	</item>
	</channel>
</rss>
