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

<channel>
	<title>MIH SWAT &#187; architecture</title>
	<atom:link href="http://www.mihswat.com/tag/architecture/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mihswat.com</link>
	<description>MIH SWAT - the official blog of MIH's Strategic Worldwide Applications and Technology Team.</description>
	<lastBuildDate>Mon, 06 Sep 2010 10:24:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Vacancies at SWAT</title>
		<link>http://www.mihswat.com/2009/11/03/vacancies-at-swat/</link>
		<comments>http://www.mihswat.com/2009/11/03/vacancies-at-swat/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 11:27:04 +0000</pubDate>
		<dc:creator>Jacques van Niekerk</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[SWAT]]></category>
		<category><![CDATA[Semantic web]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[architects]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[digital TV]]></category>
		<category><![CDATA[geeks]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[IP-TV]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Microsoft .Net]]></category>
		<category><![CDATA[oo]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Sao Paulo]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[Social Graph]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[uml]]></category>
		<category><![CDATA[VOD]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.mihswat.com/?p=977</guid>
		<description><![CDATA[Would you like to work at SWAT ? We have a few positions vacant at the moment &#8211; have a look: In Sao Paulo, Brazil &#8211; we need a junior front-end developer. You are highly skilled in front-end development, with specific skills in CSS, HTML and Javascript. You are a competent programmer, but you prefer [...]]]></description>
			<content:encoded><![CDATA[<p>Would you like to work at SWAT ?<span id="more-977"></span></p>
<p>We have a few positions vacant at the moment &#8211; have a look:</p>
<p>In Sao Paulo, Brazil &#8211; we need a<strong> junior front-end developer</strong>. You are highly skilled in front-end development, with specific skills in CSS, HTML and Javascript. You are a competent programmer, but you prefer to work on the front-end. You will be working under the guidance of an experienced and expert engineer.  You like working with bright and clever people, and you are passionate about the web. The successful candidate will speak English, and will be a paulistano, or be willing to relocate to Sao Paulo.</p>
<p>In Johannesburg &#8211; we are looking for a <strong>senior technical architect</strong>. You will have the opportunity to establish the blueprint and create the framework for truly cutting edge media delivery platforms that will change the face of media in South Africa. And that is no exaggeration. You should have outstanding technical skills, including the ability to code as and when required. You must be able to interact with a team of highly skilled professionals. You will ideally have experience of VOD, digital TV, IP-TV and related technologies. A background as a developer is essential &#8211; you will have in-depth knowledge of the Microsoft .Net platform, but also wider knowledge of open source platforms and languages. You are comfortable dealing with executives and senior managers. You&#8217;re not only an ubergeek, but also an inspirational tech leader. This is a challenging position &#8211; but it represents a massive opportunity to the right person. Detailed requirements <a href="http://www.mihswat.com/wp-content/uploads/2009/11/Lead-Architect1.pdf">here.</a></p>
<p>In Cape Town &#8211; we are looking for a <strong>junior tester</strong>, who will devote a great deal of time to ensuring that a large corporate social network meets the right quality standards. You will be part of the SWAT core team &#8211; you must be prepared to work with some of the best developers, architects, geeks and web-heads you are ever likely to meet. Can you execute tasks on your own initiative, prepare and execute test plans ? More details on the position can be found <a href="http://www.mihswat.com/wp-content/uploads/2009/11/Junior-Tester.pdf">here. </a></p>
<p>Cape Town &#8211; we are looking for someone to play the role of <strong>Internet Evangelist</strong>. This role is available to anyone who is absolutely passionate about the web, who is capable of conveying this passion to diverse audiences, who learns quickly &#8230; and who can teach others. Your role will be to evangelise the use of Web technologies (and other Internet related technologies) into the larger group &#8211; the challenge is to make people from all non-internet businesses see the Internet as an opportunity not a threat. In addition you will perform tasks as assistant community manager for the corporate social network, and you will assist the Analyst in the team with research tasks. You must be willing to travel in South Africa and abroad, as required. To apply for this job, you will have to demonstrate passion, interest and knowledge of the Web and related technologies. You are a well-spoken, confident geek, web-head and proud to be a Web addict. </p>
<p>Finally, and also in Cape Town &#8211; we want to recruit a <strong>PHP developer</strong>. You will be have outstanding technical skills, wide experience in web based development, and you will be able to hold your own amongst an elite group of developers and architects. Javascript, Zend Framework, AJAX, OO, Web 2.0, REST, SOAP and UML will be old news to you. You are passionate about the web. If you think Twitter is silly, you don&#8217;t need to apply. More information <a href="http://www.mihswat.com/wp-content/uploads/2009/11/PHP-Developer1.pdf">here.</a></p>
<p>If you are interested in any of these positions, please send your CV to <a href="mailto:mkoch@mihinternet.com">Melanie Koch</a>. We look forward to hearing from you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mihswat.com/2009/11/03/vacancies-at-swat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Journey to planet Android</title>
		<link>http://www.mihswat.com/2009/09/28/my-journey-to-planet-android/</link>
		<comments>http://www.mihswat.com/2009/09/28/my-journey-to-planet-android/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 09:11:17 +0000</pubDate>
		<dc:creator>Bradley Wells</dc:creator>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[SWAT]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.mihswat.com/?p=838</guid>
		<description><![CDATA[Coming from a Flash Developer background I have had no experience with mobile application development. From the time I saw the first phone to run Android, the G1, I have been itching to get into Android development. So when I was recently given the go-ahead to take this journey into the Android world, plus a [...]]]></description>
			<content:encoded><![CDATA[<p>Coming from a Flash Developer background I have had no experience with mobile application development. From the time I saw the first phone to run Android, the G1, I have been itching to get into Android development. So when I was recently given the go-ahead to take this journey into the <a title="Android" href="http://www.android.com/" target="_blank">Android</a> world, plus a shiny new Android phone <img src='http://www.mihswat.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  , I was both excited and nervous<span id="more-838"></span> . Why nervous? Firstly, I had never developed for a mobile device before, secondly I had never written  a Java application before and lastly because I had no idea how the Android framework actually worked . But this is what we as SWAT employees love, new territory to conquer ! If you havent seen a Android device yet, see the video below of the new HTC Hero.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="295" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/FKTDSfbcbBU&amp;hl=en&amp;fs=1&amp;rel=0&amp;color1=0xe1600f&amp;color2=0xfebd01" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="400" height="295" src="http://www.youtube.com/v/FKTDSfbcbBU&amp;hl=en&amp;fs=1&amp;rel=0&amp;color1=0xe1600f&amp;color2=0xfebd01" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Nowadays it&#8217;s almost impossible to write an article about mobile phones without mentioning the very successful<a title="iPhone" href="http://www.mihswat.com/2009/09/22/i-dont-like-the-iphone/" target="_self"> iPhone</a>. <a title="Apple" href="http://www.apple.com" target="_blank">Apple</a> had practically turned the mobile  industry upside down with its touch screen device. Some people will argue to the death about how the iPhone, or the &#8220;Jesus Phone&#8221; as some call it, is the best thing since sliced bread &#8211; and nobody can argue against how successful this device has become. But I am predicting a total onslaught of Android devices within 2 years. The Android army of phones will be everywhere you look and you will not be able to visit any cellphone store without running into at least 50 different phones running this OS. OK &#8211; maybe that is going a bit far but I think you get the message and already we are seeing signs of it. At the time of writing this article there are 16 official Android devices. How will this army of Android devices be created you ask ? Enter the Open Handset Alliance.</p>
<p>The <a title="Open Handset Alliance" href="http://en.wikipedia.org/wiki/Open_Handset_Alliance" target="_blank">Open Handset Alliance</a> was formed in 2007 and currently has 47 members. It is a consortium of technology and mobile companies all dedicated to bringing us better mobile experiences, with Android being their first project . There are some big names amongst the 47 members, including Google, Intel, Nvidia, HTC, Asus, SonyEriccson, LG, Ebay. With so many big names dedicated to Android development, it is bound to be amongst the top mobile device OS&#8217;s. You can read more about this <a title="before" href="http://www.mihswat.com/2008/10/07/why-android-will-win-or-iphone-in-the-long-run/" target="_self">argument here</a>, let me get to the Android architecture.</p>
<p>Android is a Linux based software stack. On top of the Linux kernel layer lies a layer for the system libraries such as SQLite, SSL, OpenGL, etc. This layer also houses the Android runtime, which runs the Dalvik Virtual Machine. On top of this there&#8217;s the Application Framework, housing the managers like the Activity Manager, Window Manager, etc. Then finally there is the application layer, which is the layer we are most interested in.</p>
<p><img class="alignnone size-full wp-image-844" title="system-architecture" src="http://www.mihswat.com/wp-content/uploads/2009/09/system-architecture.jpg" alt="system-architecture" width="428" height="307" /></p>
<p>Android applications can consist of different sections, namely Activities, Services, Broadcast Recievers and Content Providers. Activities form the User Interface(UI) part of the application, Services run in the background similar to RSS feed readers checking for updates. Broadcast Receivers just listen for particular system broadcasts, for example , when the battery is low. Content Providers just provide content to any asking application , for example your application asking the contact book to provide the users contacts for use within your application. We will mostly be concerned with Activities.</p>
<p>Activities were designed to be totally integrated with one another. What I mean is that Activities can call one another and pass data to one another, basically  like an event driven system, but on a system wide level. An application is thus a group of Activities passing Intents to one another. It is then possible to include , lets say, a Google Maps Activity into your application by passing a Google Maps Intent to it and waiting for a result from it. It would seem to the end user that you created a Google Maps section to your app. I think this is pretty powerful.</p>
<p>To get started with creating these applications you need the free <a title="Android SDK" href="http://developer.android.com/sdk/1.6_r1/index.html">Android SDK</a>, Apple iPhone developers need to register first($99!). Then you going to need an IDE, there is an Eclipse plugin, the <a title="Android Development Tools" href="http://dl.google.com/android/ADT-0.9.3.zip">Android Development Tools</a>(ADT) plugin that has everything including the latest stable SDK. You don&#8217;t immediately need a phone to test on as ADT comes with an Android emulator that you can debug and test with but you will eventually need a phone to properly test with. ADT is pretty awesome as it comes with many tools to tell you exactly whats happening on the phone, which threads are running,it has code completion, wizards to quickly create sub classes and much more. It took me less than 30 minutes to get a  &#8220;Hello World&#8221; application running on the Android emulator from the time I installed the ADT!</p>
<p>Since ActionScript 3 is a lot like Java I could easily jump in even though there were a few syntax differences &#8211; but after about 2 days and the help of ADT I had a basic application drawing a ball bouncing round the screen. But that was only the beginning and have rewritten sections of the game many times. Now after two weeks of lots of learning I have created the game and have it running on my phone. It is still a prototype and even though it needs weeks more spit and polish, after demonstrating the game I have gotten the thumbs up to turn it into a real game which we will be registering in the Android market.  There is still a lot to learn from this wonderful framework but the <a title="Android Groups" href="http://groups.google.com/group/android-beginners">Android groups</a> have been great help, as well as all the <a title="Android forums" href="http://www.anddev.org/" target="_blank">Android forums</a> and of course, <a title="developers guide" href="http://developer.android.com/guide/topics/graphics/2d-graphics.html">the Reference guide</a> which ships with the SDK. It has been a challenge to get to grips with this entirely new development area but it was far easier than imagined it would be. I spent about 10 times longer getting to know Flash, and that was with people available to help me.</p>
<p>What about my experience using the phone? I can honestly say I am now more connected than ever before. My email, both gmail and exchange, is pushed to the phone. My Twitter application runs in the background constantly fetching  tweets, while my Facebook application gets all my buddies&#8217; status updates to me as often as I want to see them. News and weather is updated all the time. My calendar and contacs are synchronised between my phone and my mobile. I never get lost anymore, maps are always available and my Gtalk status is always &#8220;available&#8221; and running in the background, unlike on some other phones <img src='http://www.mihswat.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Oh, and it makes phone calls as well.</p>
<p>I will follow up with another article of my findings, good and bad, this time focusing on the actual Android game development.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mihswat.com/2009/09/28/my-journey-to-planet-android/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Good software modularity. What exactly is it?</title>
		<link>http://www.mihswat.com/2008/11/27/good-software-modularity-what-exactly-is-it/</link>
		<comments>http://www.mihswat.com/2008/11/27/good-software-modularity-what-exactly-is-it/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 12:41:14 +0000</pubDate>
		<dc:creator>Otavio Ferreira</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[modularity]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.mihswat.com/?p=408</guid>
		<description><![CDATA[This post might be considered academic, but it offers a good overview of what I believe to be the guiding principles in terms of software modularity. Let’s start with a little bit of background. Sometimes the way businesses are modeled are constrained by the available technology, which may block innovation, change and even growth in [...]]]></description>
			<content:encoded><![CDATA[<p>This post might be considered academic, but it offers a good overview of what I believe to be the guiding principles in terms of software modularity.<span id="more-408"></span></p>
<p>Let’s start with a little bit of background. Sometimes the way businesses are modeled are constrained by the available technology, which may block innovation, change and even growth in the business. Instead of establishing barriers, technologists should keep pushing for the evolution of technology, and keep fighting people who are against this evolution.</p>
<p>You may be fortunate enough to live in a better world, where software is built according to real business goals, bringing real value to the company. Great! However, this is not quite enough yet. Business models keep changing quickly, which means that the software in place ought to be <strong>flexible</strong> enough to support these changes, and also <strong>expansible</strong> enough to support that always desirable growth.</p>
<p>The real problem here is the following: How can we simultaneously achieve flexibility, expansibility, and maintainability in software architecture? This is a very tough question, but the answer is rather simple: &#8220;Achieve this by using high modularity levels&#8221;. Unfortunately, this cannot be achieved by some sort of magic, but only by dint of a focused architectural effort, as described below.</p>
<p>I like thinking of a <strong>module </strong>as just a block of code &#8211; this block of code can vary from being a method to being a class, a component, and a (web) service. Now, the <strong>modularity level</strong> evaluates the usage of modules in a given software architecture, mainly when it comes to <a href="http://en.wikipedia.org/wiki/Encapsulation_(computer_science)">encapsulation</a>, <a href="http://en.wikipedia.org/wiki/Coupling_(computer_science)">coupling</a>, and <a href="http://en.wikipedia.org/wiki/Cohesion_(computer_science)">cohesion</a>. Several authors have written about modularity, but my personal choice is <a href="http://se.ethz.ch/~meyer/">Bertrand Meyer</a>. His study on Object-Oriented Software Construction presents five criteria as a guide to evaluating modularity.</p>
<ol>
<li><em>Modular Decomposability</em> – A software construction method satisfies Modular Decomposability if it helps in the task of decomposing a software problem into a small number of less complex sub-problems, connected by a simple structure, and independent enough to allow further work to proceed separately on each item.</li>
<li> <em>Modular Composability</em> – A software construction method satisfies Modular Composability if it favors the production of software elements which may then be freely combined with each other to produce new systems, possibly in an environment quite different from the one in which they were initially developed.</li>
<li> <em>Modular Understandability</em> – A software construction method satisfies Modular Understandability if it helps produce software which a human reader can understand each module without having to know the others, or, at worst, by having to examine only a few of the others.</li>
<li> <em>Modular Continuity</em> – A software construction method satisfies Modular Continuity if, in the software architectures that it yields, a small change in the problem specification will trigger a change of just one module, or a small number of modules.</li>
<li> <em>Modular Protection</em> – A software construction method satisfies Modular Protection if it yields architectures in which the effect of an abnormal condition occurring at run time in a module will remain confined to that module, or at worst will only propagate to a few neighboring modules.</li>
</ol>
<p>Mr. Meyer also presents the following six principles.</p>
<ol>
<li><em>Linguistic Modular Unit</em> – Modules must correspond to syntactic units in the language used.</li>
<li> <em>Few Interfaces</em> – Every module should communicate with as few other modules as possible.</li>
<li> <em>Small Interfaces</em> – If two modules communicate at all, then they should exchange as little information as possible.</li>
<li> <em>Explicit Interfaces</em> – When two modules communicate, this fact must be obvious.</li>
<li> <em>Information Hiding</em> – All information about a module should be private to that module unless it is specifically declared public.</li>
<li> <em>Open &amp; Closed</em> – A module should be open for small changes (with no impact on its interface), and closed in terms of readiness.</li>
</ol>
<p>Both lists are quite self-explanatory, aren’t they?</p>
<p>From my point of view, software modularity is an overused expression, and people are usually not familiar with any criteria or principles for evaluating the level of modularity, such as the ones listed above. This post aims to provide a means whereby the  often misunderstood concept of modularity is made explicit, while providing a foundation for designing truly <strong>loosely-coupled modules</strong>. I hope you find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mihswat.com/2008/11/27/good-software-modularity-what-exactly-is-it/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Dependency Inversion: Killing Gorillas and Butterflies</title>
		<link>http://www.mihswat.com/2008/10/21/dependency-inversion-killing-gorillas-and-butterflies/</link>
		<comments>http://www.mihswat.com/2008/10/21/dependency-inversion-killing-gorillas-and-butterflies/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 10:05:15 +0000</pubDate>
		<dc:creator>Otavio Ferreira</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[dependency]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[oo]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technique]]></category>

		<guid isPermaLink="false">http://www.mihswat.com/?p=309</guid>
		<description><![CDATA[In a previous post we met object orientation’s worst enemy (i.e. strong, unplanned dependencies among classes). It is now time to have a closer look at Dependency Inversion, which is one of the most efficient OOP techniques available with which to fight our adversary.Our aim with this discussion is to avoid having the already discussed [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post we met <a href="http://www.mihswat.com/2008/10/14/the-object-orientations-worst-enemy/" target="_self">object orientation’s worst enemy</a> (i.e. strong, unplanned dependencies among classes). It is now time to have a closer look at <em>Dependency Inversion</em>, which is one of the most efficient <a href="http://en.wikipedia.org/wiki/Object-oriented_programming" target="_self">OOP</a> techniques available with which to fight our adversary.<span id="more-309"></span>Our aim with this discussion is to avoid having the already discussed Domino Effect, Butterfly Effect, and Banana-Gorilla Effect. Please refer to the <a href="http://www.mihswat.com/2008/10/14/the-object-orientations-worst-enemy/" target="_self">initial article</a> if you are unfamiliar with these concepts. The following concrete example makes use of <a href="http://uml.org/" target="_self">UML</a>, and addresses a real-case scenario within the e-commerce domain.</p>
<p><a href="http://www.mihswat.com/wp-content/uploads/2008/10/diagram1.gif"><img class="alignnone size-medium wp-image-323" title="diagram1" src="http://www.mihswat.com/wp-content/uploads/2008/10/diagram1.gif" alt="" width="288" height="48" /></a></p>
<p>Obviously, the schema presented here is just part of a complete software architecture &#8211; for the purposes of this discussion we assume that all orders issued are stored in a <a href="http://en.wikipedia.org/wiki/Relational_database" target="_self">relational database</a> instance (<a href="http://www.mysql.com/" target="_self">MySQL</a> more specifically). The natural way of thinking leads the architect to model a dependency from Order to MySQL, mainly because the former class is the one responsible for deciding when database transactions begin. However, the resulting dependency leads to at least three undesirable consequences, as follows:</p>
<ul>
<li><strong>Business objects and rules start depending on purely technical matters such as database manipulation.</strong> We all know that what is cutting-edge technology at the moment, is likely to become obsolete in a few month&#8217;s time. Business concepts, on the other hand, tend towards stability &#8211; an order will always be an order, potentially keeping the same attributes in the long-run. It’s important to notice that the undesirable direction of the dependency may force the developers to change business objects whenever the database technology they are using changes.</li>
<li><strong>The architecture assumes that storage will always be handled by a specific relational database.</strong> This is a risky assumption, since the development team may decide to swap out the database provider. Moreover, alternative storage mechanisms like the file system itself may come up as a viable option in the future.</li>
<li><strong>Unit testing becomes painful.</strong> This sort of dependency makes it difficult to use the <a href="http://en.wikipedia.org/wiki/Mock_object" target="_self">mock objects</a> technique, which is quite common within <a href="http://en.wikipedia.org/wiki/Unit_testing" target="_self">unit testing</a> methods.</li>
</ul>
<p>We can address these issues by placing an interface between the classes, and therefore inverting the related dependency. As demonstrated below, we have just succeeded in decoupling storage manipulation from business objects.</p>
<p><a href="http://www.mihswat.com/wp-content/uploads/2008/10/diagram2.gif"><img class="alignnone size-medium wp-image-324" title="diagram2" src="http://www.mihswat.com/wp-content/uploads/2008/10/diagram2-300x37.gif" alt="" width="300" height="37" /></a></p>
<p>The dependency inversion technique has addressed all the problems we identified. People usually think of an interface as just a simple set of common functions, but it’s not. Instead, a strategically applied interface contributes desirable outcomes such as mobility, flexibility, reusability, and maintainability.</p>
<p>OK, but wait a minute, the business object <em>Order</em> still needs to send messages to the data access layer, doesn’t it? Yes, it does, but interfaces do not exist at runtime, only objects do. Therefore, IStorage is replaced by an object defined by a class that realizes this interface, the MySQL class in our example. It’s now clear that we could also have realizations to other database providers and storage mechanisms (<a href="http://www.oracle.com/technology/software/products/database/" target="_self">Oracle</a>, <a href="http://www.microsoft.com/sqlserver/" target="_self">MSSQL</a>, <a href="http://www.postgresql.org/" target="_self">PostgreSQL</a>, and File System).</p>
<p>Visualizing the dependency inversion is even easier when we deal with components, instead of classes. The first <a href="http://en.wikipedia.org/wiki/Component_diagram" target="_self">component diagram</a> below does <span style="text-decoration: underline;">not</span> take advantage of the technique we just learned.</p>
<p><a href="http://www.mihswat.com/wp-content/uploads/2008/10/diagram3.gif"><img class="alignnone size-medium wp-image-325" title="diagram3" src="http://www.mihswat.com/wp-content/uploads/2008/10/diagram3-300x107.gif" alt="" width="300" height="107" /></a></p>
<p>Unlikely the previous diagram, the following schema turns over the dependency between the components, making the business component independent, and enabling new data providers.</p>
<p><a href="http://www.mihswat.com/wp-content/uploads/2008/10/diagram4.gif"><img class="alignnone size-medium wp-image-326" title="diagram4" src="http://www.mihswat.com/wp-content/uploads/2008/10/diagram4-300x192.gif" alt="" width="300" height="192" /></a></p>
<p>The <a href="http://en.wikipedia.org/wiki/Black_box" target="_self">black-box notation</a> makes things even clearer:</p>
<p><a href="http://www.mihswat.com/wp-content/uploads/2008/10/diagram5.gif"><img class="alignnone size-medium wp-image-327" title="diagram5" src="http://www.mihswat.com/wp-content/uploads/2008/10/diagram5.gif" alt="" width="288" height="48" /></a></p>
<p>Again, the dependency inversion:</p>
<p><a href="http://www.mihswat.com/wp-content/uploads/2008/10/diagram6.gif"><img class="alignnone size-medium wp-image-328" title="diagram6" src="http://www.mihswat.com/wp-content/uploads/2008/10/diagram6.gif" alt="" width="288" height="56" /></a></p>
<p>Techniques such as the one presented by this post prevent the <a href="http://en.wikipedia.org/wiki/Active_record_pattern">Active Record</a> pattern from being a complete failure. Now I bet you realize how powerful dependency inversion is, right? So back to your dashboard and take your interfaces to the next level!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mihswat.com/2008/10/21/dependency-inversion-killing-gorillas-and-butterflies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Object Orientation’s Worst Enemy</title>
		<link>http://www.mihswat.com/2008/10/14/the-object-orientations-worst-enemy/</link>
		<comments>http://www.mihswat.com/2008/10/14/the-object-orientations-worst-enemy/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 14:29:10 +0000</pubDate>
		<dc:creator>Otavio Ferreira</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[dependencies]]></category>
		<category><![CDATA[interfaces]]></category>
		<category><![CDATA[object orientation]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[uml]]></category>
		<category><![CDATA[up]]></category>

		<guid isPermaLink="false">http://www.mihswat.com/?p=242</guid>
		<description><![CDATA[Strong dependencies among classes (or components) are definitely the villains within a software architecture. The opposite of strong dependencies, ie completely decoupled architectures, do not exist however, because such a utopian schema would actually result in no messages being exchanged among objects at all. Architects should focus on minimizing strong dependencies, designing only well-planned ones. [...]]]></description>
			<content:encoded><![CDATA[<p>Strong dependencies among classes (or components) are definitely the villains within a software architecture. The opposite of strong dependencies, ie completely decoupled architectures, do not exist however, because such a utopian schema would actually result in no messages being exchanged among objects at all. Architects should focus on minimizing strong dependencies, designing only well-planned ones. I refer to the latter as healthy dependencies, and they undoubtedly bring a lot of benefits to a system.<span id="more-242"></span></p>
<p>Successful development processes such as <a title="UP" href="http://en.wikipedia.org/wiki/Unified_Process" target="_self">UP</a> (<a title="Unified Process" href="http://www-01.ibm.com/software/awdtools/rup/" target="_self">Unified Process</a>) are usually defined as architecture-centric, which basically means that development iterations are guided by the evolution of the architecture,  and by architectural artifacts such as <a title="UML" href="http://en.wikipedia.org/wiki/Unified_Modeling_Language" target="_self">UML</a> (<a title="Unified Modeling Language" href="http://uml.org/" target="_self">Unified Modeling Language</a>) diagrams. Therefore, the architect is responsible for establishing a high level of modularity in order to achieve both expandibility and maintainability potentials. Nicely designed modules connected by healthy dependencies have the power to minimize three undesired, internal properties: Rigidity, Fragility, and Immobility. Let’s have a closer look at each one.</p>
<p>The Rigidity property states that maintenance in a specific point in the architecture may oblige the developer to also change directly related points, generating a maintenance chain. I like calling it the <a title="Domino Effect" href="http://en.wikipedia.org/wiki/Domino_effect" target="_self">Domino Effect</a>. If you don’t enjoy reading Wikipedia articles, you can just read the following extract: “The Domino Effect is a simple chain reaction that occurs when a small change causes a similar change nearby, which then will cause another similar change, and so on in linear sequence”. It’s pretty clear, isn’t it?</p>
<p>The Fragility property, in its turn, states that maintenance in a specific point in the architecture may force the developer to change a point indirectly related to or far from the former point. We will call the consequence of ths property the <a title="Butterfly Effect" href="http://en.wikipedia.org/wiki/Butterfly_effect" target="_self">Butterfly Effect</a>. Again, another Wikipedia snapshot: “The Butterfly Effect is a phrase that encapsulates the more technical notion of sensitive dependence on initial conditions in chaos theory. Small variations of the initial condition of a dynamical system may produce large variations in the long term behavior of the system”. I am sure the meaning is clear.</p>
<p>Finally, the Immobility property takes place when a developer tries to reuse an existing component, but then gets blocked by other component’s classes that the desired ones depend on. I usually call this the Banana-Gorilla Effect, funny huh? This is because whenever you try to get just the banana, the gorilla comes after it. There’s no way of running away from the big animal, and you suddenly lost one of the major features of the object orientation tenet, <a title="code reuse" href="http://en.wikipedia.org/wiki/Software_reuse" target="_self">code reuse</a>.</p>
<p>OK, enough talking, let’s get back to business. How can we avoid having these three bad properties? How can we design only healthy dependencies? Quick answer: Using <a title="Interfaces" href="http://en.wikipedia.org/wiki/Interface_(computer_science)" target="_self">Interfaces</a> for <a title="dependency inversion" href="http://en.wikipedia.org/wiki/Dependency_inversion_principle" target="_self">dependency inversion</a>. An Interface is a partial description of a domain concept, and is certainly an invaluable ally for any software architect. Technically speaking, it’s a bunch of method signatures that allow further specialization. <a title="Erich Gamma" href="http://en.wikipedia.org/wiki/Erich_Gamma" target="_self">Erich Gamma</a> et al wrote an entire (best-seller) <a title="book" href="http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional/dp/0201633612/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1223960343&amp;sr=1-1" target="_self">book</a> called “Design Patterns: Elements of Reusable Object-Oriented Software”, which provides a full set of solutions that address common object-oriented software problems. The solutions are divided in three categories (namely Creational, Structural, and Behavioral), and all of them take advantage of interfaces (holy thing!).</p>
<p>In the next post I’ll illustrate the discussion using a graphical, concrete example. Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mihswat.com/2008/10/14/the-object-orientations-worst-enemy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
