<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5516952211035950466</id><updated>2012-02-16T00:11:55.722-08:00</updated><category term='child'/><category term='Visual Studio'/><category term='Project management'/><category term='Integer'/><category term='BCS'/><category term='state machine'/><category term='DBC'/><category term='Google is ready to go'/><category term='development'/><category term='seperation of concerns'/><category term='VS 2010'/><category term='gang of four'/><category term='agility'/><category term='loose coupling'/><category term='try catch'/><category term='c#'/><category term='irobot'/><category term='c# enum'/><category term='data source'/><category term='TDD'/><category term='long thing'/><category term='British Computer Society'/><category term='pattern and practise'/><category term='windows azure'/><category term='.net'/><category term='developer'/><category term='green software development'/><category term='LINQ'/><category term='enpoints'/><category term='wrapper'/><category term='Behavioural Driven Developement'/><category term='webservices'/><category term='Command Pattern'/><category term='patterns and practices'/><category term='hate'/><category term='struct'/><category term='un-boxing'/><category term='cloud'/><category term='salako'/><category term='UK IT'/><category term='interpreter'/><category term='process improvement'/><category term='wcf facade'/><category term='software'/><category term='OOP'/><category term='design by contract'/><category term='proxy pattern'/><category term='professional membership'/><category term='CMM'/><category term='interceptors'/><category term='YAGNI'/><category term='workflow'/><category term='SPICE'/><category term='ISO'/><category term='PSP'/><category term='green it'/><category term='Rosairo'/><category term='.NET wrapper'/><category term='SPI'/><category term='reflection emit'/><category term='creativity'/><category term='design pattern'/><category term='green'/><category term='Exception'/><category term='address'/><category term='.net 4.0'/><category term='Google Go'/><category term='BDD'/><category term='proactive'/><category term='agile development'/><category term='fire and forget'/><category term='TSP'/><category term='object serialization'/><category term='dnd'/><category term='boxing'/><category term='invention'/><category term='green computing'/><category term='asp.net drag and drop'/><category term='.NET exception'/><category term='ahmed salako'/><category term='javascript drag and drop'/><category term='Go'/><category term='dependency injection'/><category term='enum'/><category term='cloud computing'/><category term='Throwable'/><category term='REST'/><category term='publisher and subscriber'/><category term='united kingdom'/><category term='object oriented programming'/><category term='pragmatic'/><category term='WCF'/><category term='microsoft'/><category term='Chartered Me'/><category term='salako ahmed'/><category term='value types'/><category term='CMMI'/><title type='text'>Ahmed Salako's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>35</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-3492849536149858438</id><published>2011-05-15T00:10:00.000-07:00</published><updated>2011-05-15T03:56:22.111-07:00</updated><title type='text'>Separation of concerns: The proper use of technologies</title><content type='html'>Have you ever written or programmed in such a way of convoluting functionality with business rules, data transfer objects, Domain driven Design &lt;span style="font-weight:bold;"&gt;(DDD)&lt;/span&gt;, ORM standards etc into one single partition of your enterprise level application.&lt;div&gt;&lt;ol&gt;&lt;li&gt;Do you at all, think of your system as a piece of components with its own concerning functionality?&lt;/li&gt;&lt;li&gt;How often do you do pure object orientation? (How often do you &lt;span class="Apple-style-span" style="font-family: Arial; font-weight: bold; "&gt;conceptualize&lt;/span&gt; your application as real world artifacts)&lt;/li&gt;&lt;li&gt;Do you just code to solve business problems, or do you engineer code to be used to solve business problems?&lt;/li&gt;&lt;li&gt;Do you have overlapping functionalities frequently in your projects?&lt;/li&gt;&lt;li&gt;How do you integrate your system with legacies or third party? (Do you just integrate or add a layer of integration).&lt;/li&gt;&lt;li&gt;Do you examine the commonalities and/or variabilities of your system before re-inventing the wheel.&lt;/li&gt;&lt;li&gt;Do you know the paradigm: &lt;b&gt;System of Systems&lt;/b&gt;&lt;/li&gt;&lt;li&gt;What about aspect oriented programming? (how do you keep cross cutting concerns at bay?)&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;I can go on and on, but I'd thought i should take it from simple facts, so that upcoming software engineers/developers are inculcated. The success factor of an enterprise application development, is the domain knowledge, how often do you review and conceptualize your domain?&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Domain engineering (Now called product engineering) is a systematic way of conceptualizing application components into families of systems to be later reused to solve problems within the domain. Although the concept of domain engineering is a different topic for another day, most software development &lt;b&gt;IDE's&lt;/b&gt; are beginning to integrate this concepts into their systems.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Again: What is separation of concern&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Separation of concern is a computer programming paradigm that stressed out the abilities to  modularize , conceptualize , hides external impediments , follow &lt;b&gt;LOD&lt;/b&gt; (law of Demeter or principle of least knowledge). &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Although technologies had helped improve software development from 10 folds into higher number of folds in recent times, still, most development lack the knowledge of bringing this technologies together, rather they create an over complicated system which undermine the intentions of  advancing technologies. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Are new technologies really new?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;New technologies are not really new, they a proven approaches/standards blueprints which had been adopted by wider communities in the past before it became a technology. I would say, make a research on a new technology to understand its root and to understand what the drive and multivations are in the first place.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Latest .NET most misunderstood technologie&lt;/b&gt;s&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;ASP.NET MVC. Try to understand what the real MVC paradigm means. MVC is not a technology but a methodology.&lt;/li&gt;&lt;li&gt;&lt;b&gt;WCF&lt;/b&gt; is not &lt;b&gt;RPC&lt;/b&gt; (Remote procedure call). The contract first development is not actually contract first, its Interface/Code contract first because this will still auto generate the &lt;b&gt;WSDL&lt;/b&gt; , xml schema's etc. try to manually create wsdls and schema when integrating with different languages or platforms. Or understand how this work and how you can leverage message based achitecture instead.&lt;/li&gt;&lt;li&gt;Entity Framework: Is not an holy grail nor a silver bullet. ORM's has their strengths and weaknesses, use patterns with ORM's or avoid most pitfalls when using ORM's.&lt;/li&gt;&lt;li&gt;&lt;b&gt;AJAX&lt;/b&gt;: Do you understand&lt;b&gt; XMLHttpRequest&lt;/b&gt; and Response? have a look into the root of all AJAX evils, its a must understand.&lt;/li&gt;&lt;li&gt;&lt;b&gt;WWF&lt;/b&gt;: Why the sudden changes in .NET 4. When to use and how to reduce its noise.&lt;/li&gt;&lt;li&gt;MEF: managed extensibility framework. very nice, but it is not a replacement for dependency injection framework.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;This list goes on and on, but for now, i will stop here and let us have a think. Microsoft did invest alot on these technologies and upcoming technologies for us to have our concerns separated. &lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-3492849536149858438?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/3492849536149858438/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=3492849536149858438' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3492849536149858438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3492849536149858438'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2011/05/separation-of-concerns-proper-use-of.html' title='Separation of concerns: The proper use of technologies'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-4791078187555045699</id><published>2011-01-14T16:01:00.000-08:00</published><updated>2011-01-15T05:23:33.818-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salako ahmed'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='javascript drag and drop'/><category scheme='http://www.blogger.com/atom/ns#' term='dnd'/><category scheme='http://www.blogger.com/atom/ns#' term='asp.net drag and drop'/><title type='text'>Demystifying Drag and Drop in  ASP.NET (Part 1)</title><content type='html'>This is not particularly and fully related to ASP.NET but the main project which I extracted this concept from is an asp.net project, so I have decided to present an asp.net example.&lt;br /&gt;&lt;br /&gt;As a requirement for one of my pet projects, I am required to create drag and drop event handler on an scheduler/events calendar. This threw me into the dark side of javascripting, ASP.NET ICallBackEvent interface, post back/viewstate dodging.&lt;br /&gt;&lt;br /&gt;I searched the web for an existing solutions that will enable me drag events memo from a date to another date using JavaScript. Most of the approaches that I encountered are either too complex  or overly complicated for the simple scenario&lt;br /&gt;&lt;br /&gt;Then I stumbled on this particular script at &lt;a href="http://www.webtoolkit.info/javascript-drag-and-drop.html" target="_blank"&gt;Web Tool kit&lt;/a&gt;  which blew my mind away, this JavaScript particularly simplifies the cross browsers headache  when trying to handle mouse events across browsers. And its simple object oriented approach to handling and delegating event for drag and drop is just fantastic.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Then something happened&lt;/span&gt;&lt;br /&gt;I was looking for a solution that will enable me to drag an event from one data point to another. The solution i am talking about above though perfect but it has not fulfilled the entire drag and drop functionality. I can drag and drop, but when droping, the element being dragged should be attached to the object in the drop zones.&lt;br /&gt;&lt;br /&gt;For clarity, try the drag drop sample below. Please note that the two drop zones can allow drag gable elements to be dropped upon them, and that you cannot drop items outside of the drop zones. To give a  clear comparison then try the example given in the original script, located &lt;a href="http://www.webtoolkit.info/javascript-drag-and-drop.html"&gt;here&lt;/a&gt; , then you can understand the concepts of drop zones and drop targeting.&lt;br /&gt;&lt;div class="table-no-break"&gt;&lt;br /&gt;&lt;table id="main" border="1" cellpadding="1" cellspacing="1"&gt;&lt;br /&gt;&lt;thead&gt;&lt;br /&gt;    &lt;tr class="style1"&gt;&lt;br /&gt;            &lt;td class="style1" valign="top"&gt; Drop Zone 1 &lt;/td&gt;&lt;br /&gt;            &lt;td class="style1" valign="top"&gt; Drop Zone 2 &lt;/td&gt;&lt;br /&gt;            &lt;td class="style1" valign="top"&gt; Collection Area &lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;&lt;/thead&gt;&lt;br /&gt;&lt;tbody&gt;&lt;br /&gt;    &lt;tr&gt;&lt;br /&gt;            &lt;td class="zone"&gt;&lt;br /&gt;            &lt;/td&gt;&lt;br /&gt;            &lt;td class="zone"&gt;                &lt;br /&gt;            &lt;/td&gt;&lt;br /&gt;            &lt;td class="zone"&gt;                   &lt;br /&gt;                &lt;div id="dragable1" class="element-class"&gt;&lt;br /&gt;                    &lt;h3 class="box-head"&gt;Draggable 1 &lt;/h3&gt;&lt;br /&gt;                &lt;/div&gt;&lt;br /&gt;                &lt;div id="dragable2" class="element-class"&gt;&lt;br /&gt;                    &lt;h3 class="box-head"&gt;Draggable 2 &lt;/h3&gt;&lt;br /&gt;                &lt;/div&gt;                           &lt;br /&gt;            &lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The above drag and drop simulates the drop zone functionality which allows drag able elements to be dropped into the zones without hassles.&lt;br /&gt;&lt;br /&gt;The missing points in original JavaScript, is the fact that drop zones are not recognized. I will take you bit by bit into how I have improved and added new functionality to the original code :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Identifying the container&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The container element for this page example is a table with id = 'main'. A container is an HTML element which will contain the drop zones, note, any html which can contain other elements (p, div, table li etc.)element within the body section of an HTML document can be used as a container. This example makes use of a table as the container.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;   &amp;lt;table id="main" cellpadding="6" cellspacing="6" border="1"&amp;gt;&lt;br /&gt;           &amp;lt;thead&amp;gt;&lt;br /&gt;               &amp;lt;tr class="style1"&amp;gt;&lt;br /&gt;                       &amp;lt;th class="style1" valign="top"&amp;gt; Drop Zone 1 &amp;lt;/th&amp;gt;&lt;br /&gt;                       &amp;lt;th class="style1" valign="top"&amp;gt; Drop Zone 2 &amp;lt;/th&amp;gt;&lt;br /&gt;                       &amp;lt;th class="style1" valign="top"&amp;gt; Collection Area &amp;lt;/th&amp;gt;&lt;br /&gt;               &amp;lt;/tr&amp;gt;           &lt;br /&gt;           &amp;lt;/thead&amp;gt;&lt;br /&gt;           &amp;lt;tbody&amp;gt;&lt;br /&gt;               &amp;lt;tr&amp;gt;&lt;br /&gt;                       &amp;lt;td class="zone"&amp;gt;&lt;br /&gt;                  &lt;br /&gt;                       &amp;lt;/td&amp;gt;&lt;br /&gt;                       &amp;lt;td class="zone"&amp;gt;&lt;br /&gt;                  &lt;br /&gt;                  &lt;br /&gt;                       &amp;lt;/td&amp;gt;&lt;br /&gt;                       &amp;lt;td class="zone"&amp;gt;&lt;br /&gt;                           &amp;lt;div id="dragable1" class="element-class"&amp;gt;&lt;br /&gt;                               &amp;lt;h3 class="box-head"&amp;gt;Draggable 1 &amp;lt;/h3&amp;gt;&lt;br /&gt;                           &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;                           &amp;lt;div id="dragable2" class="element-class"&amp;gt;&lt;br /&gt;                               &amp;lt;h3 class="box-head"&amp;gt;Draggable 2 &amp;lt;/h3&amp;gt;&lt;br /&gt;                           &amp;lt;/div&amp;gt;                               &lt;br /&gt;                           &amp;lt;span id="writtable"&amp;gt;&lt;br /&gt;  &lt;br /&gt;                           &amp;lt;/span&amp;gt;                                       &lt;br /&gt;                       &amp;lt;/td&amp;gt;&lt;br /&gt;               &amp;lt;/tr&amp;gt;           &lt;br /&gt;           &amp;lt;/tbody&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;/table&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Some table cells within the table main's table row have the class name &lt;span style="font-weight: bold;"&gt;zone&lt;/span&gt; identifying them as the drop zones. Any element with the class name = "zone" can contain draggables.&lt;br /&gt;&lt;br /&gt;Any element can also be dragged (except td, th etc. ), so far they are registered using the following javascript snippet.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode" style="height: 30px;"&gt;&lt;br /&gt; DragHandler.attach(document.getElementById('dragable element'));&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Registering/Preparing the Container and Drag able objects&lt;/span&gt;&lt;br /&gt;We needed to look up the DOM and hook events on the drag gable's and retain drop zones into a Position object created below.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;   var zonesArray = new Array();&lt;br /&gt;   var index = 0;&lt;br /&gt;&lt;br /&gt;    window.onload = function () {&lt;br /&gt;&lt;br /&gt;        var dragable1 = DragHandler.attach(document.getElementById('dragable1'));&lt;br /&gt;        var dragable2 = DragHandler.attach(document.getElementById('dragable2'));&lt;br /&gt;&lt;br /&gt;        var main = document.getElementById('main');&lt;br /&gt;&lt;br /&gt;        for (var j = 0; j &lt; main.childNodes.length; j++) {&lt;br /&gt;&lt;br /&gt;            PrepareDropZones(main.childNodes[j], zonesArray, "zone");&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    function Position(element) {&lt;br /&gt;        this.X = findPosX(element);&lt;br /&gt;        this.Y = findPosY(element);&lt;br /&gt;        this.Element = element;&lt;br /&gt;        this.Width = (this.X + element.offsetWidth);&lt;br /&gt;        this.Height = (this.Y + element.offsetHeight);&lt;br /&gt;&lt;br /&gt;        this.IsInCordinate = function (XCord, YCord) {&lt;br /&gt;            if (XCord &amp;gt; this.X &amp;&amp; XCord &amp;lt; (this.Width) &amp;&amp; YCord &amp;gt; this.Y &amp;&amp; YCord &amp;lt; (this.Height)) {&lt;br /&gt;                return true;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The above code is the missing point in the original code, and the part where elements are dropped. As soon as an element is dropped, the mouse coordinates &lt;span style="font-weight: bold;"&gt;X&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;Y&lt;/span&gt; are checked against the drop zones &lt;span style="font-weight: bold;"&gt;X + width&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;Y + height&lt;/span&gt; , if the mouse is within coordinate, then the element is dropped. Shown below is the code for checking drop zones when an element is dropped.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;        // private method. Stop drag process.&lt;br /&gt;        _dragEnd: function (e) {&lt;br /&gt;            var oElem = DragHandler._oElem;&lt;br /&gt;&lt;br /&gt;            var x = parseInt(oElem.style.left);&lt;br /&gt;            var y = parseInt(oElem.style.top);&lt;br /&gt;&lt;br /&gt;            oElem.dragEnd(oElem, x, y);&lt;br /&gt;&lt;br /&gt;            var evt = e || window.event;&lt;br /&gt;            var evtTarget = evt.target || evt.srcElement;&lt;br /&gt;&lt;br /&gt;            for (var i = 0; i &lt; zonesArray.length; i++) {&lt;br /&gt;&lt;br /&gt;                var dZone = zonesArray[i];&lt;br /&gt;                var cursor = getMousePosition(e);&lt;br /&gt;&lt;br /&gt;                if (dZone.IsInCordinate(cursor.x, cursor.y)) {&lt;br /&gt;                    dZone.Element.appendChild(oElem);&lt;br /&gt;                    oElem.style.left = 0;&lt;br /&gt;                    oElem.style.top = 0;&lt;br /&gt;                    break;&lt;br /&gt;                }&lt;br /&gt;                else {&lt;br /&gt;                    oElem.style.left = DragHandler._beginX;&lt;br /&gt;                    oElem.style.top = DragHandler._beginY;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            document.onmousemove = null;&lt;br /&gt;            document.onmouseup = null;&lt;br /&gt;            DragHandler._oElem = null;&lt;br /&gt;            oElem = null;&lt;br /&gt;        }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="https://docs.google.com/uc?id=0B33TYqzFmlF_YjE2ZGRiOWItNWY3Zi00MTI4LTg2NjYtMjg0NTM0ODliZmQ1&amp;export=download&amp;authkey=COvN_ssB&amp;hl=en"&gt;Download the source code (VS 2010)&lt;/a&gt;:&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-4791078187555045699?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/4791078187555045699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=4791078187555045699' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/4791078187555045699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/4791078187555045699'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2011/01/demystifying-drag-and-drop-in-aspnet.html' title='Demystifying Drag and Drop in  ASP.NET (Part 1)'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-594062063905934417</id><published>2010-08-04T14:32:00.000-07:00</published><updated>2010-08-05T01:11:14.858-07:00</updated><title type='text'>SOA : The golden bullet of our time</title><content type='html'>The hype in todays enterprise development world is &lt;strong&gt;SOA&lt;/strong&gt; (Service Oriented Architecture), as enterprises are becoming conversant with this buzz, so as medium and smaller companies are considering joining the band wagon of this development strategies that is gaining momentum in todays enterprise computing.&lt;br /&gt;&lt;br /&gt;SOA as the name suggest is a development strategies that tries to put decoupling in mind from ground up by using the notion of services. Although decoupling is un-avoidable when we engineer software/component but to a degree of efforts, SOA allows you to take advantage of seperation of concerns service orchestration, Service Choreography, REST Architecture and Service reusability. Decoupling is bad to some extent because this business of ours is all about integrating stuffs (coupling), there are types of coupling that make sense and there are coupling that makes no sense at all. The following are sample of types of coupling :&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Business Coupling :&lt;/strong&gt; In the real world where we make money and apply both theorical and practical knowledge to software engineering, we cannot avoid integrating systems with legacies and new applications. Business coupling makes sense because we tend to apply rules of data interchange between disparate systems why we avoid any form of tight coupling to reduce the dependencies amongst participants. This is an exact coupling that SOA would allow, the business logic codes are exposed as a service and there are no dependencies between services and consumers. Although business coupling could lead to plumbing if developers do not take into account the tenets of Service Architecture.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Plumbing Coupling :&lt;/strong&gt; This type of coupling is what most developers that are just finding their ways into true software engineering processes do. This coupling is bad and does not add any value to your assets and infrastructure. In my years of experience, i have encouraged developers and have educate developers to move away from this development practices because as long as you continue to plumb couple, your system will die naturaly without any cause. Plumbing is a sin that we all must have committed one way or the other and the only ways to cleanse ourselves from this sins is to embrace SOA and try to pay back our technical debt by constanly reviewing and refactoring our code.&lt;br /&gt;&lt;br /&gt;Having understood the two most common coupling, we should now know where SOA fits in software engineering. SOA allows us to expose business functionalities without exposing the underlying code by enforcing a data-interchage driven by SOAP (Simple Object Application Protocol) by encouraging metadata interchange. SOA is client/devices/platform independent so far we follow the W3C semantics of SOAP and the WS-* specifications.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The Tenets of SOA&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Explicit Boundary :&lt;/strong&gt; Service should communicate with themselves in a true and loose coupled manner using agreed messaging construct (SOA encourages SOAP Envelopes). As long as there is no rigourous dependencies amongs services, services should be able to send and recieve messages between themselves without the knowledge of where they are located. Services are platform angnostic by default and should use this effectively. A service boundary starts from the service contract, all communication agreements should should be based on contract.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Services can be autonomous:&lt;/strong&gt; This encourages us all to build services that are independent of other services, and since we cannot achieve one hundred percent service autonomous, we can still strive to build services that are cleanly seperated from dependants, an example of such service is a service which serves as a router or facade for other services. Services can be autonomous: This encourages us all to build services that are independent of other services, and since we cannot achieve one hundred percent service autonomy, we can still strive to build services that are cleanly seperated from dependants, an example of such service is a service which serves as a router or facade for other services. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Shared Contract:&lt;/strong&gt; Service clients talk to services using a published contract. The contract is an interface where service clients communicate with the service. The service client is not required to know the intricacies of the service because the contract sits between the client and the service. Most dependencies are on the contract and not the actual implementations of the service.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;To be continued ...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-594062063905934417?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/594062063905934417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=594062063905934417' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/594062063905934417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/594062063905934417'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2010/08/soa-golden-bullet-of-our-time.html' title='SOA : The golden bullet of our time'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-7441890157063663964</id><published>2010-04-29T01:31:00.000-07:00</published><updated>2010-06-01T11:23:59.553-07:00</updated><title type='text'>Hit Your Deadlines and Incur Technical debts</title><content type='html'>We all owe our developments more time to do it right. Software developers are humans too, we can make mistakes, take short cuts , hack , hack , hack and &lt;b&gt;wala!&lt;/b&gt; we think we are done , we think we have produced the most changeable solution, the most elegant code, we think we have added value to the business because it works (Hey it works). Well wait until business changes mind, wait until your company buy in a new solution to enhance its business, this is when it will occur to you that you have produced the most crappy software of the year.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Sorry Guys, do not judge me by my writings. I have been in many situations in the past, instead of learning from it i fall into the same pot hole again and again. All in all, software architecture plays a dominant role when building enterprise applications and since i wasn't the architect, i fell into the same pit again.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;What is Technical debts&lt;/b&gt;&lt;/div&gt;&lt;div&gt;The metaphor &lt;b&gt;"Technical debts"&lt;/b&gt; was  developed by Ward Cunningham (The man behind wiki) It means design / code / architectural debts that we owe our developments , since we are humans and we want to meet our targets we can bypass some development strategies to make a shortcut, so that we meet the deadlines. Meeting the deadlines doesn't mean we would not re-pay our technical debts (This is one problem that most people/organisations make). We need to go back to the drawing board and re-sharp , this will enable us to learn more on the product and this will strengthen our knowledge of the entire system.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Knowing when to re-pay your debts&lt;/b&gt;&lt;/div&gt;&lt;div&gt;You can choose to continue incurring more debts (This will tie you down to the system), or if you are smart enough or at least someone in your team is an anti-hacking developer (A design pattern loyalist) , then you can choose to refactor mercilessly. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Nobody ever said it was going to be easy, but at least you are making the first move to improve your system. Re-paying technical debts is a culture that all software professionals should imbibe. A development team should aggressively encourage this practice , or else none of the team members would come in terms with their weakness or forgotten errors.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I know its good to go faster to the market, but at-least let us look back and re-pay those debts that might come back to hunt us.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What do you think i am doing right now, of course &lt;b&gt;"I am re-paying my debts"&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-7441890157063663964?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/7441890157063663964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=7441890157063663964' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/7441890157063663964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/7441890157063663964'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2010/04/hit-your-deadlines-and-incur-technical.html' title='Hit Your Deadlines and Incur Technical debts'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-5862780838765902249</id><published>2010-03-16T09:28:00.000-07:00</published><updated>2010-03-16T09:48:47.094-07:00</updated><title type='text'>They are here! April 12 2010</title><content type='html'>If you read my last post about the long awaited &lt;a href="http://salakoahmed.blogspot.com/2009/03/democratizing-software-development.html"&gt;Rosairo&lt;/a&gt; , you will understand fully well, the richness of what the future hold in stock for all of us.&lt;br /&gt;&lt;br /&gt;Come This April 12, the .NET community will experience a change in software development while leveraging the .NET 4.0 and new enhanced WWF (Windows Workflow Foundation), Advanced and Rapid WCF (Windows Communication Foundation) . This will mark the true begining of us all in the .NET Land.&lt;br /&gt;&lt;br /&gt;In my experience with developers, catching up with technologies is very difficult because of the rate at which technologies changes in the .NET front. This might leave some developers obsolette because some have'nt tried their hands on LINQ , Extension method , anonymous type e.t.c This isnt nobodys fault but some justifications while this new futures are there. I recently interviewed a C# developer remotely about his abilities on the .NET framework, he said ! ".NET stopped bieign .NET since 3.0/3.5, he went on saying that .NET 2.0 is the best of all."&lt;br /&gt;&lt;br /&gt;Everybody is entitled to his/her own opinion, if a new feature appeals to you, use it, if else then throw it away. Visual studio .NET IDE now allows you to switch frameworks, so you can go back to previous framework version.&lt;br /&gt;&lt;br /&gt;Never the less, new changes are driven by Customer requirements , bug fixes , industry defined and endorsed patterns. So not to worry, because &lt;span style="font-weight: bold;"&gt;They are here already!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I cant wait no more ,&lt;a href="http://www.microsoft.com/visualstudio/en-us/"&gt; click here to try it out&lt;br /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-5862780838765902249?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/5862780838765902249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=5862780838765902249' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/5862780838765902249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/5862780838765902249'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2010/03/they-are-here-april-12-2010.html' title='They are here! April 12 2010'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-6664286727744551362</id><published>2010-01-29T02:15:00.000-08:00</published><updated>2010-06-21T03:38:59.775-07:00</updated><title type='text'>Software Development Should evolve and not desolve</title><content type='html'>I have written several titles , i have made a big leap in software development strategies. I have utilized domain engineering culture towards developing software. I am against &lt;a href="http://salakoahmed.blogspot.com/2010/01/reactive-software-developement-lazy-man.html"&gt;&lt;span style="font-weight: bold;"&gt;reactive software&lt;/span&gt;&lt;/a&gt; development. I talked about &lt;a href="http://salakoahmed.blogspot.com/2009/05/going-to-clouds-with-windows-azure.html"&gt;&lt;span style="font-weight: bold;"&gt;AZURE&lt;/span&gt;&lt;/a&gt; , about &lt;a href="http://salakoahmed.blogspot.com/2009/11/google-is-ready-to-go.html"&gt;&lt;span style="font-weight: bold;"&gt;Google ready to GO&lt;/span&gt;&lt;/a&gt; , I took you down to the&lt;span style="font-weight: bold;"&gt; &lt;a href="http://salakoahmed.blogspot.com/2009/11/story-of-spider-web-software-part-1.html"&gt;Spider Web Land&lt;/a&gt;&lt;/span&gt; &lt;a href="http://salakoahmed.blogspot.com/2009/05/wii-in-software-development.html"&gt;&lt;/a&gt;while telling how we can be &lt;a href="http://salakoahmed.blogspot.com/2009/09/software-development-can-be-green-too.html"&gt;&lt;span style="font-weight: bold;"&gt;Green too&lt;/span&gt;&lt;/a&gt;. These are very good articles that reflects the happenings in todays agility driven software world.  For this flow to continue, todays topic is how we grow our development process with emerging technologies.&lt;br /&gt;&lt;br /&gt;All problems and solutions in software land revolves around how we allow our software development process to evolve. How do we grow our process of development? what can we do to ensure our processes are check listed.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Why should software development evolve?&lt;/span&gt;&lt;br /&gt;Enterprises needs solutions that fits in properly into their businesses. They require an extensible software packages that makes for quicker responsiveness in changes. They want to say hey&lt;span style="font-weight: bold;"&gt; "Lets GO"&lt;/span&gt;  and we are all moving. But wait a minute, &lt;span style="font-weight: bold;"&gt;we are all moving ?&lt;/span&gt; should we all be moving? As part of movements, we shouldn't move too fast nor too slow, we should allow development to grow from an infant into a more mature development process.&lt;span style="font-weight: bold;"&gt; "Lets GO"&lt;/span&gt; though sound more like carry along, but in most contexts &lt;span style="font-weight: bold;"&gt;"Lets Go" &lt;/span&gt; is used by people who does not know how the software will be build (Imagine a plumber fixing your telephone), so i take the word&lt;span style="font-weight: bold;"&gt; "Lets Go"&lt;/span&gt; as being too reactive.&lt;br /&gt;&lt;br /&gt;Software development should be allowed to evolve because its a culture driven activities that we must all conform to, there is no island of knowledge, developers should share knowledge. Strategies/standards/patterns are not paper works, sweet tongues, and big grammars. They are meant to be observed and not to be written down or praised. They are critical to business success and they should evolve as the software evolves.&lt;br /&gt;&lt;br /&gt;To complement and supplement evolution of software development, developers should be allowed to use their creativity, software process should have a process too, that means the development strategies should always have its own parent strategies to checklist.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Can we be smart with SMART ?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-weight: bold;"&gt;SEI&lt;/span&gt; (&lt;span style="font-weight: bold;"&gt;Software Engineering Institute&lt;/span&gt;) , developed a migration technique called SMART (Service Migration and Reuse Technique), this enable teams of professionals to actualize reuse &lt;span style="font-weight: bold;"&gt;SOA&lt;/span&gt; (Service Oriented Architecture) pattern properly and deliver what a client wants rather than polluting the entire solution with noise.&lt;br /&gt;&lt;br /&gt;Migrating legacy systems are becoming problematic because, if proper planning is not observed, we might end up migrating problems we are trying to avoid.&lt;br /&gt;&lt;br /&gt;The SMART initiative allows professionals to engage with customers/end users and document their needs, according to their needs, SMART can be strength ed to cater for it. It allows organizations to identify problem areas before software is reused. There are now several versions of SMART which addresses different problem areas.  The following have been developed after the initial SMART Methodology :&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;SMART-MP (migration pilot)&lt;/li&gt;&lt;li&gt; SMART-SMF (service migration feasibility)&lt;/li&gt;&lt;li&gt;SMART-ENV (environment),&lt;/li&gt;&lt;li&gt;SMART-ESP (enterprise service portfolio)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;SMART-SYS (system)&lt;/li&gt;&lt;/ol&gt;All of these are designed and tailored to needs of the customers. This is how flexible we should allow development strategies to evolve.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-6664286727744551362?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/6664286727744551362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=6664286727744551362' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6664286727744551362'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6664286727744551362'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2010/01/software-development-should-evolve-and.html' title='Software Development Should evolve and not desolve'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-6719400048269544522</id><published>2010-01-15T03:46:00.000-08:00</published><updated>2010-01-18T03:25:30.051-08:00</updated><title type='text'>Reactive Software Developement ( A Lazy Man Engineering ).</title><content type='html'>What is Reactive Engineering?&lt;br /&gt;&lt;br /&gt;Reactive engineering is a principle that most software organizations tend to follow when they fix and sell. Reactive is reacting to problems that could have been resolved if a proactive means is followed using the following : development trends, processes improvements (SPI) , &lt;span style="font-weight: bold;"&gt;common sense&lt;/span&gt; and having smart people take the lead. Reactive can make organizations believe they are closer to the deadline dates, while it makes them believe so, it become tragic when such reactively built software fails, and cost your company millions , or that reactive solutions is not precise enough and cost lives.&lt;br /&gt;&lt;br /&gt;Reactive is not only a problem of software engineering, but a problem for the world, we are not fully prepared for worst cases. This article will only point at reactiveness towards software engineering.&lt;br /&gt;&lt;br /&gt;When ever a problem occurs during the development or testing of a solution, reactive tends to fix the problem alone, this is more error prone, because what you think you just fixed may introduce another bug latter on.&lt;br /&gt;&lt;br /&gt;For software developers, &lt;span style="font-weight: bold;"&gt;Continuous Integration&lt;/span&gt; can make your unit testing strategies proactive, when you make a simple changes, you will need to run all unit tests to see what breaks and what does not.&lt;br /&gt;&lt;br /&gt;Development front has improved over the years. We have experienced the leap from assembly languages, procedural, object and object oriented languages. In this modern day of software engineering where domain principles are adopted to further solve  development strategies pertaining to its domain area, software is adopted as part of a necessity for todays businesses to survive and for tomorrows businesses to emerge.  This means, many businesses large and small all relies on software for their businesses to run smoothly.  But what are we software developers/engineers/architects doing to ensure softwares are built in a proactive manner using agile domain engineering principles as opposed to reactive software development.&lt;br /&gt;&lt;br /&gt;Scenario One&lt;br /&gt;&lt;br /&gt;Ping Pong (Canonical Naming) softwares are aeronautical software development agency based in Asia, Ping Pong develops software that enable an aircraft  control systems.  Ping Pong in the early years does not have a clearly defined engineering principles that guide the production of its software (This is counter dangerous because Ping Pong are releasing softwares that does not follow regulations and principles) . This software company is endangering the lives of its users and passengers.  Ping Pong, in the other hand are very reactive to software changes and bug resolution.&lt;br /&gt;&lt;br /&gt;Although Ping Pong are very reactive, they have not met the standards of software engineering principles because they have refused to follow the ethics and professional obligations to the general public.&lt;br /&gt;&lt;br /&gt;In real life there is no such company as Ping Pong, this is just an illustration and an example to show how we may be risking life, billions of monies because we bought a software that hasn't followed due diligence. We do not want reactive software engineering but domain engineering, which will keep you proactive and will make your software resilient to future changes.&lt;br /&gt;&lt;br /&gt;Scenario Two&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Know All software systems&lt;/span&gt; is based somewhere in Europe, know All softwares cannot see beyond itself, it does not recognize the fact that software development has evolves, and there are patterns that enable developers to do it right as opposed to do it any how.&lt;br /&gt;&lt;br /&gt;Since &lt;span style="font-weight: bold;"&gt;Know All&lt;/span&gt;  seems to know it all alone, they do not realize that tools have emerged and processes have changed and the world is moving forward and not backwards. This organization is the father of all reactive technologist, because they hire people that are good in fire fighting, and people who will hide most software problems under a simple fix called hacking (Again Hackers brothers i do not intend to cross the line).  Software development is not an industry of patching, there should be no heroic patching, all stakeholders should follow the same patterns of domain engineering so that people speak the same domain vocabularies.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I will always follow a proactive development practice, it saves time and money and it help prevents the image of the software organizations.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-6719400048269544522?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/6719400048269544522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=6719400048269544522' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6719400048269544522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6719400048269544522'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2010/01/reactive-software-developement-lazy-man.html' title='Reactive Software Developement ( A Lazy Man Engineering ).'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-2691120084255425338</id><published>2009-12-15T02:26:00.000-08:00</published><updated>2010-06-14T13:05:35.297-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='wcf facade'/><category scheme='http://www.blogger.com/atom/ns#' term='REST'/><category scheme='http://www.blogger.com/atom/ns#' term='object serialization'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>Consume RestFul Service as Object using WCF.</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_XwziUoKLz60/Syds-SpO1fI/AAAAAAAAADo/vGpg0Xih1pk/s1600-h/Resfproblem.png"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 420px; height: 200px;" src="http://1.bp.blogspot.com/_XwziUoKLz60/Syds-SpO1fI/AAAAAAAAADo/vGpg0Xih1pk/s320/Resfproblem.png" alt="" id="BLOGGER_PHOTO_ID_5415416894348776946" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;As an enterprise software engineer, i deal with disparate systems. I deal with several impedance mismatches between these systems, i built several integration components to glue these systems together. Many of these systems have its domain semantics (They speak different languages ), my daily work life activities is to build abstractions over semantics of different and disparate systems.  I am one of those software engineers that believe in domain engineering paradigm , separation of concerns (A dog is a dog not a dogcat) , inversion of control e.t.c I enjoy spending time on a solution to see how it could be done better.My daily work is so challenging that bringing systems together from multiple domain is my strength and i have used aspect orientation to my advantage.&lt;br /&gt;&lt;br /&gt;Recently, i entered a problem, we have an application that exposes objects as pure xml , the application supports &lt;span style="font-weight: bold;"&gt;soap 11&lt;/span&gt; . The soap envelope does not have an action (Simply put in  in WCF terms, it does not have an &lt;span style="font-weight: bold;"&gt;OperationContract&lt;/span&gt; , so when you consume this service, there is no web service operations to call on it ), This application only accepts pure XML as request and returns xml as response.&lt;br /&gt;&lt;br /&gt;This is chaos, i know some hackers would say there is no biggy here, just construct an string as xml, send it over to the &lt;span style="font-weight: bold;"&gt;REST&lt;/span&gt; service and get the response as string and use linq or manually tranverse the string and construct an object from it. &lt;b&gt;Wao&lt;/b&gt;! this indeeed is a hacky packy solution (Forgive me hackers brothers, i do not intend to cross the line). We are now in the world of objects, things have changed, newer platforms have emerged.&lt;br /&gt;&lt;br /&gt;The diagram above speaks more of my scenarios, XML input and XML output using the good old REST Service approach. How am i suppose to translate these XML returned as string into object , how does WCF Channel Factories come into play with these. Keep focus, i will explain how i did the magic ...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;First :&lt;/span&gt; Call the service from web browser , or get the schema of all the objects returned by the service. I chose the first option for my scenario as there was no schema, so what did i do, i called the web service from a browser , saved it as &lt;span style="font-weight: bold;"&gt;anything.xml&lt;/span&gt; , then i opened visual studio command prompt , ran the &lt;span style="font-weight: bold;"&gt;XSD.EXE&lt;/span&gt; command using the following parameters :&lt;br /&gt;&lt;br /&gt;                             &lt;span style="font-weight: bold;"&gt; xsd anything.xml /outputdir:mydir&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_XwziUoKLz60/SydwXYuUl0I/AAAAAAAAADw/J0XN0dcLseM/s1600-h/xsdcommand.PNG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 623px; height: 161px;" src="http://3.bp.blogspot.com/_XwziUoKLz60/SydwXYuUl0I/AAAAAAAAADw/J0XN0dcLseM/s320/xsdcommand.PNG" alt="" id="BLOGGER_PHOTO_ID_5415420624012351298" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The command above, generates the schema from the xml which i saved from the browser called anything.xml. Now that i have my .xsd file handy, i can generate a .net class using the same xsd.exe command but with different parameters. Thats the price to pay.&lt;br /&gt;&lt;br /&gt;Now i have anything.xsd in my output directory , i would like to generate .net classes using the follwoing command :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;                                                                                        xsd /c anything.xsd &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This generates C# classes for me. Now i am equiped with the object representations of the XML that the REST service sends to my consuming applications.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Second : How do i send request and recieve response from the REST Service ? &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To do this, you would need to understand how to use low level WCF communication classes to send soap messages back and fort. First i want to have a mechanism that will enable me to serialize and de-serialize my soap messages Request messages : The following is an example request object :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Sample XML Request&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&amp;lt;hellorest&amp;gt;&lt;br /&gt;&amp;lt;message&amp;gt;Get Hello world  &amp;lt;/message&amp;gt;&lt;br /&gt;&amp;lt;/hellorest&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Now that we have carefully reviewed the generated c-sharp class we can proceed to creating the request object. Since we have the request xml above, we will have to hand code this as a c-sharp class. Using the good old &lt;span style="font-weight: bold;"&gt;System.Xml.Serialization&lt;/span&gt; namespace, we would decorate our request class with xml attributes for pure serialization. Here is our sample request object and a Serialization method :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;[XmlRoot( "hellorest" )]&lt;br /&gt;public class RESTWebRequest&lt;br /&gt;{&lt;br /&gt;    [XmlElement( "Message" )]&lt;br /&gt;    public string Message&lt;br /&gt;    {&lt;br /&gt;        get;&lt;br /&gt;        set;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public RESTWebRequest( )&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public XmlElement SoapSerialization( )&lt;br /&gt;    {&lt;br /&gt;        XmlSerializer serializer = new XmlSerializer( typeof( RESTWebRequest ) );&lt;br /&gt;        StringWriter writer = new StringWriter( );&lt;br /&gt;&lt;br /&gt;        serializer.Serialize( writer , this );&lt;br /&gt;&lt;br /&gt;        XmlDocument xmlDocument = new XmlDocument( );&lt;br /&gt;        xmlDocument.Load( new StringReader( writer.ToString( ) ) );&lt;br /&gt;&lt;br /&gt;        return xmlDocument.DocumentElement;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Having done that, we are ready to use the communication classes within WCF from the lower level to send our request object and receive our response as object too. To do this, we need to understand the following classes with the System.ServiceModel namespace :&lt;br /&gt;&lt;br /&gt;1. Message : Wraps the request/response in a soap envelope.&lt;br /&gt;2. BasicHttpBinding  : Communication ensured via HTTP .&lt;br /&gt;3. IRequestChannel&lt;br /&gt;4. IChannelFactory&lt;br /&gt;&lt;br /&gt;The listed interfaces and classes would be used to send and recieve , serialize and de-serialize soap messages. Now the long awaited class, the RestAgent which will be used to send and recieve messages is defined below :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;internal class RESTAgent : IDisposable&lt;br /&gt;{&lt;br /&gt;    IChannelFactory&lt;irequestchannel&gt; channel;&lt;br /&gt;&lt;br /&gt;    internal string EndPoint { get; set; }&lt;br /&gt;&lt;br /&gt;    internal RESTAgent( string EndPoint )&lt;br /&gt;    {&lt;br /&gt;        BasicHttpBinding basicHttpBinding = new BasicHttpBinding( );&lt;br /&gt;        basicHttpBinding.MaxReceivedMessageSize = 1000;&lt;br /&gt;        this.EndPoint = EndPoint;&lt;br /&gt;&lt;br /&gt;        channel = basicHttpBinding.BuildChannelFactory&lt;irequestchannel&gt;&lt;br /&gt;                                                                (&lt;br /&gt;                                                                    new BindingParameterCollection( )&lt;br /&gt;                                                                );&lt;br /&gt;&lt;br /&gt;        channel.Open( );&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    internal GeneratedFromXSD GetResponset( RESTWebRequest webRequest )&lt;br /&gt;    {&lt;br /&gt;        Message requestMessage = CreateIncomingMessage( webRequest );&lt;br /&gt;        IRequestChannel requestChannel = GetRequestChannel( );&lt;br /&gt;&lt;br /&gt;        requestChannel.Open( );&lt;br /&gt;&lt;br /&gt;        //Hey. time out here is ugly.&lt;br /&gt;        Message responseMessage = requestChannel.Request( requestMessage , new TimeSpan( 1 , 20 , 00 ) ); //1 hour&lt;br /&gt;&lt;br /&gt;        requestMessage.Close( );&lt;br /&gt;&lt;br /&gt;        GeneratedFromXSD anything = DeserializeXMLStream( GetMessageContent( responseMessage ) );&lt;br /&gt;&lt;br /&gt;        responseMessage.Close( );&lt;br /&gt;&lt;br /&gt;        return anything;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private GeneratedFromXSD DeserializeXMLStream( string xmlStream )&lt;br /&gt;    {&lt;br /&gt;        XmlSerializer serializer = new XmlSerializer( typeof( GeneratedFromXSD ) );&lt;br /&gt;&lt;br /&gt;        return ( GeneratedFromXSD ) serializer.Deserialize( new StringReader( xmlStream ) );&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private string GetMessageContent( Message message )&lt;br /&gt;    {&lt;br /&gt;        XmlDictionaryReader xmlReader = message.GetReaderAtBodyContents( );&lt;br /&gt;&lt;br /&gt;        return xmlReader.ReadInnerXml( );&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private System.ServiceModel.Channels.Message CreateIncomingMessage( RESTWebRequest request )&lt;br /&gt;    {&lt;br /&gt;        XmlNodeReader reader = new XmlNodeReader( request.SoapSerialization( ) );&lt;br /&gt;        return Message.CreateMessage( MessageVersion.Soap11 , "" , reader ); //Give us the real thing. Wrap up with soap envelope without a specific action = ""&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private IRequestChannel GetRequestChannel()&lt;br /&gt;    {&lt;br /&gt;        return channel.CreateChannel( new EndpointAddress( EndPoint ) );&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void Dispose( )&lt;br /&gt;    {&lt;br /&gt;        channel.Close( );&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/irequestchannel&gt;&lt;/irequestchannel&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You can use the RESTAgent class to send and recieve soap message from our Restful service by using the follwoing :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;RESTWebRequest request = new RESTWebRequest();&lt;br /&gt;request.Message = "Hello world";&lt;br /&gt;&lt;br /&gt;RESTAgent agent = new RESTAgent( "http://localhost/restapi" );   //Parameter is the endpoint address&lt;br /&gt;&lt;br /&gt;GeneratedFromXSD anything = agent. GetResponset( request  );&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-2691120084255425338?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/2691120084255425338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=2691120084255425338' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/2691120084255425338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/2691120084255425338'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/12/consume-restful-service-as-object-using.html' title='Consume RestFul Service as Object using WCF.'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_XwziUoKLz60/Syds-SpO1fI/AAAAAAAAADo/vGpg0Xih1pk/s72-c/Resfproblem.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-5514930763480436791</id><published>2009-11-17T01:24:00.000-08:00</published><updated>2009-12-13T02:57:12.844-08:00</updated><title type='text'>The Story of the Spider Web Software (Part 1)</title><content type='html'>This article is a long story line of software projects, practices and cultures that contributed to the failure aspect of software development. &lt;span style="font-weight: bold;"&gt;The story of the Spider Web Software&lt;/span&gt;  is all about how you and I have turned software engineering institution into a chaotic industry. This is not Blame, nor one of those cries,  because you and I needs to accept the fact that we are not following due-diligence.&lt;br /&gt;&lt;br /&gt;Not anymore do people , engineers , end-users and business owners whose daily interactions with software have diminished could say a good thing about that new solution. People are loosing their confidence, end-users are sticking to their manual processes instead of living with crappy solutions that we once persuaded them to use (Dictatorship, you must use it to be compliant with the world =&gt; this is a big lie).&lt;br /&gt;&lt;br /&gt;Software industry is experiencing a vote of no confidence from all angles of the industry, just because of what ? because we built what we are asked to build =&gt; &lt;span style="font-weight: bold;"&gt;"The Spider Web Software"&lt;/span&gt; . If you do not build it their way, you are an enemy of state with all eyes on you, the only way out is to join the Open source community. From a disciplined industry into a free for all industry, Software industry will continue to suffer these pathetic problems mutilating the profession. I am ashamed to call myself a software enthusiast , i cry inside for several failed projects which could have been avoided at the initial stage.&lt;br /&gt;&lt;br /&gt;Not every software is a piece of crap, not every pragmatic development is wasted; not every solution meets the users need. But at least, in the &lt;span style="font-weight: bold;"&gt;systems development&lt;/span&gt; front, there have been more successful software stories and many software  have experienced growth from  its initial version 0.0.0.1 to 0.0.x.2, at least a quantum leap. Get ready for the story, close your eyes, open them, close it again .... wala :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;In the land of Spidery&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Once upon a time (time - time), in the ancient town of spidery in faraway land, there lived a the very strong people of the land blessed with shelter, shields (anti-virus), clothing's and a massive web which connects and support the foundation of the land. For 1000 years, the people of this land have lived and conquered their challenges, all have worked in a team spirit fashion to the successful of their legacies.&lt;br /&gt;&lt;br /&gt;Happy, these people were, until modernization came into the lime light, the stories of how cities were emerging reached the land of Spidery. The king summoned his cabinets, and they decided to follow the trends rather than taking the step at a time, they wanted to dive into modernization straight away.&lt;br /&gt;&lt;br /&gt;It was a good idea says one cabinet member, at least in one day we will have trains (Bakerloo , waterloo), sky scrappers, parks and standard environment, that would make life easy. Do not get me wrong, the Spidery kingdom is very rich (Milk and honey flows on the land). The cabinets and the king all agreed, that it was time they change the kingdom in one day. News of the changes had reached the entire world. Even the Spidery Kingdom have a way of celebrating their successes even before the success. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, when the integration starts, many loop holes where discovered, and instead of going back to the drawing board to re-design the architecture of the new modern spidery land, they insist on going on. At a point the people of the kingdom saw the  direction where modernization is taking them, they realized that everything that is glued together can easily fall apart if one of it fails, it was too late to change the designs to separation of concerns , the train line , city centers shops , bars , buses , electricity , houses , airports are all linked together with a very tightly coupled manner , that if one fails others would not run. Its was a bad moment for the people of spidery, the preferred to be in their olden and conservative lifestyles rather than leaping into modernization in one  day , it was a day that they will never forget.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-5514930763480436791?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/5514930763480436791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=5514930763480436791' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/5514930763480436791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/5514930763480436791'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/11/story-of-spider-web-software-part-1.html' title='The Story of the Spider Web Software (Part 1)'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-4567237051891618780</id><published>2009-11-11T11:26:00.000-08:00</published><updated>2009-11-12T01:53:27.242-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='salako ahmed'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='Google is ready to go'/><category scheme='http://www.blogger.com/atom/ns#' term='Google Go'/><category scheme='http://www.blogger.com/atom/ns#' term='Go'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented programming'/><title type='text'>Google is Ready to "GO"</title><content type='html'>&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;There is a new addition to the Object Object Oriented programming platform , codenamed &lt;/span&gt;GO&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; (A new addition and descendant of the &lt;/span&gt;C&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; family) by &lt;/span&gt;Google&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;. It is said to take advantages of new trends in the software versus hardware community. &lt;/span&gt;Go&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; will take advantage of dynamic languages like python,  it is said to have an efficient Garbage collection, runtime speed close to C language and full support for multi-core processor from ground up.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Go&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; is blessed with &lt;/span&gt;true closures&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; and &lt;/span&gt;reflection&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; (Programmers delight to extending the framework). The reasons behind the introduction of &lt;/span&gt;GO&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; is that the older languages have failed to include current computing trends like fast programming, expressiveness (Functional),  multi-processors, true closures . I personally love the idea of methods/functions returning multiple values. Although i struggle with the return type after the method parameter.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;Is Go the future that we all want?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;The problems claimed to be solved by &lt;/span&gt;G&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;o is already taken care of by mature object oriented programming languages. Go should not be seen as a replacement for C# or Java etc but a language introduced specifically to solve specific computing problems. C# is still in its infants and we have experienced more powerful programming concepts and constructs that Go claims to be a silver bullet for. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Dynamic language integration is already a number one citizen of todays languages, Java has the Rhino (Integrates with JavaScript), and C# 4.0 is coming with the dynamic keyword to solve Com inter op problems and integration with more dynamic language. .NET is a platform that cannot just be thrown away, because it already blends with todays problems and it is constantly being updated to support features required to develop todays application.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;What does programmers want?&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;We want a unified programming platform, we would like to see all object oriented programming languages to have very easy integration and it is not wise to introduce new language to address specific problems. If you are a system integrator and an advance developer, you would realize that bringing platforms together is more fury. We would love to see a bridge across platforms, enough of this chaos.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;Will Go Make it?&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;well, it is still experimental and we are all allowed to contribute to it because its completely free. Go still have a lot of hurdles to pass through like every other new language, it will survive most of this hurdle but if it is focused on the right direction. I personally does not see it as a replacement for any of the more matured and advanced languages.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Share your views. and Go for &lt;a href="http://golang.org/"&gt;Go here&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-4567237051891618780?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/4567237051891618780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=4567237051891618780' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/4567237051891618780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/4567237051891618780'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/11/google-is-ready-to-go.html' title='Google is Ready to &quot;GO&quot;'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-8471153090963016066</id><published>2009-09-14T04:58:00.001-07:00</published><updated>2009-12-29T06:09:14.157-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='green computing'/><category scheme='http://www.blogger.com/atom/ns#' term='green software development'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='green it'/><category scheme='http://www.blogger.com/atom/ns#' term='green'/><title type='text'>Software Development Can be Green Too. (Part 1)</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_XwziUoKLz60/Sq9w7GJhvdI/AAAAAAAAACw/rNWcHaTlVRo/s1600-h/howgreenareyou.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5381644240296197586" style="margin: 0pt 10px 10px 0pt; float: left; width: 320px; cursor: pointer; height: 90px;" alt="" src="http://3.bp.blogspot.com/_XwziUoKLz60/Sq9w7GJhvdI/AAAAAAAAACw/rNWcHaTlVRo/s320/howgreenareyou.png" border="0" /&gt;&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;T&lt;/span&gt;he new wave in our industry &lt;span style="font-weight: bold;"&gt;"GREEN IT"&lt;/span&gt; , is rapidly becoming the IT buzz of the moment. Almost anything you do in computing nowadays needs to under go the green scrutiny. In other to cut cost and save our ecosystem. Recently i went on a computer gadget parade at Soho (down town London west-end), i noticed a gadget that i loved, asked for the price, the store assistant had to check records to confirm the new price is not different from the one on the sticker. I asked why they could not use an electronic price indicator, he answered : &lt;span style="font-weight: bold;"&gt;"We want to be green"&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Most people, organization and professionals read meanings to the definition of &lt;span style="font-weight: bold;"&gt;"GREEN Computing"&lt;/span&gt; just like any other computing phrase and jargon, it can mean differently when used in different context. We need to exercise caution when we form our own theories around the &lt;span style="font-weight: bold;"&gt;"GREEN Computing"&lt;/span&gt; word, because wanting to be green should not mean you would disregard what is efficient over what is not. Because you need to be green does not mean you would not provide your customers, staffs with what will make life easier in the workplace and as a product.&lt;br /&gt;&lt;br /&gt;Nowadays, every organizations (large and small) are going into green computing foray to utilize resources and energy. The green aspect is to ensure that, there is adequate resources and that project leads/managers/technical leads/architects/business analysts proactively utilizes what is left of them in a cost effective way. Green must ensure resources are maximized and reused accordingly during project development.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What exactly is "GREEN" Computing or IT&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Green IT is a computer word that favors efficient production/use of computer resources without any dangerous impacts on our environment. It also mean cutting cost on what we can reuse (It favors Re usability over Recycle - New ). Most computing resources consume a great deal of energy and the cost run into millions to maintain yearly, if we try to be green we can save a lot on environment and cost.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Is That all. No! "GREEN IT" also means &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We change our practices, we obey our ethical responsibilities to the society at large. We need to be green before encouraging it. (For example i am green about my spending habbit).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Cloud Computing will take us to the greener pastures&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;With the Internet becoming so powerful and broadband s are becoming cheaper everyday. It is now wise to take big advantage of the next revolution of our industry, the cloud. Although i can always argue that we are already in the cloud era, right from the 50s and early 60s when the US military used Internet to boost their military operations, and since then, the skies have become the limit, we have experienced the advancing Internet revolution, and within the same era, here come the cloud.&lt;br /&gt;&lt;br /&gt;More development should be targeted at the cloud, their is a green advantage on the usage of software systems over the wire compared to conventional run from local system. This approach will reduce cost of installations, cost per head of users and of course the cost of maintaining a server will be taken of you and it will be the responsibilities of the cloud provider. In short cloud computing will take us to the greener pastures.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Now we need GREEN Software Development&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Computer hardware does not exist alone, they are produced to complement and supplement the software written by us. You may start to think, that if hardware is useless without a software, that means the software itself consumes resources from the hardware, and the more resources a software consumes the higher the rate of electricity, network packets that the hardware will be forced to use.&lt;br /&gt;&lt;br /&gt;To be greener in development, we should try to write code that can be reused across our application domain. We should try and employ domain driven engineering principles (Most organizations write the same code over again because they could not define their domain).&lt;br /&gt;&lt;br /&gt;Software as an assets, if you define your domain well, and everything you need are in place and you have a catalogs of domain artifacts assets, this mean your organization is practicing green development.&lt;br /&gt;&lt;br /&gt;Get experienced developers to influence the in-experience one, make awareness about the importance of modularizing your components. Use &lt;span style="font-weight: bold;"&gt;AOP&lt;/span&gt; (Aspect Oriented Programming) like you have never done before.&lt;br /&gt;&lt;br /&gt;We need to embrace greener coding styles, which will include more focus on software performance, the exploitation of multi threaded and parallel computing. We need to retrain and ensure that software development standards are used to build software and not just delivering crappy software. If we want to be greener in software development approaches, then we have to imbibe the culture of using standards. This will take us back to the days scarce hardware resources.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Green Coding Standards&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. If you are building large tree structure of objects which requires recursion or the visitor pattern, then you will need to cache your output to by pass the same recursion when you require the same output. A slower system makes use of resources.&lt;br /&gt;&lt;br /&gt;2. Use design patterns effortlessly. A pragmatic developer would appreciate that common and recurring problems can be solved using a library of knowledge. It is wise for software houses to document that knowledge.&lt;br /&gt;&lt;br /&gt;3. Agile developers believes that TDD (&lt;span style="font-weight: bold;"&gt;Test Driven Development)&lt;/span&gt;, when practiced to its fullest represents the full specification of a software. In fact TDD believes that tests are the documentation, I am also a strong believer of this. If you make use of scenario based &lt;span style="font-weight: bold;"&gt;TDD&lt;/span&gt;, you will understand that TDD can cover all aspects of your application. If TDD can represent your documentation, why write another bogus documentation wasting paper resources, and re-writing such documentation when something simple changes in own code.&lt;br /&gt;&lt;br /&gt;4. Make use of Code Generators, &lt;span style="font-weight: bold;"&gt;ORM&lt;/span&gt; facilities, this will bring you very close to the market place. They are an existing strategies proven to be successful, and reduces code bloat. A good one is this : &lt;a href="http://www.codeplex.com/rapidentityframework"&gt;Rapid Entity Framework.&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;5.&lt;span style="font-weight: bold;"&gt; Use Open source :&lt;/span&gt; Open source will make you greener and there is no hidden cost the software is completely free to distribute. Open source projects are delivered on time and patches are made on time.&lt;br /&gt;&lt;br /&gt;6. Ensure your program does not have bottlenecks. Ensure your code does not take long to achieve its aspect.&lt;br /&gt;&lt;br /&gt;7. Be performance aware, an application that consumes resources alot consumes electricity, and so therefore such applications are not green.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;We cannot help it, we only develop what works.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Many developers, especially those who are much more around in IT industry today, are more focused on getting faster to the market and during the process, they end up with a product that misses its deadline, a product that is fragile and breaks down every hour, an un-maintainable code base. I can hear some developers already throwing blames at their managers for not allowing them to follow industry standards before software is delivered. Well some managers do not understand (Make them understand and let them know its importance), some managers do understand but their superiors do not understand. These are the problems that IT is facing today.&lt;br /&gt;&lt;br /&gt;If we keep focusing on hardware alone in other to be green, then we are half way in reaching the greener pastures. Software development can be green too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-8471153090963016066?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/8471153090963016066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=8471153090963016066' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/8471153090963016066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/8471153090963016066'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/09/software-development-can-be-green-too.html' title='Software Development Can be Green Too. (Part 1)'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_XwziUoKLz60/Sq9w7GJhvdI/AAAAAAAAACw/rNWcHaTlVRo/s72-c/howgreenareyou.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-3404593367319382787</id><published>2009-07-30T01:22:00.000-07:00</published><updated>2009-08-11T09:56:25.388-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='reflection emit'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='design pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='proxy pattern'/><title type='text'>Generating PROXY from interfaces (Using Reflect Emit) : The flexible way to reduce code</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Whats is a Proxy&lt;/span&gt;&lt;br /&gt;A proxy is a class object, that acts as the original class type. Lets assume we have an interface &lt;span style="font-weight: bold;"&gt;ICustomer&lt;/span&gt;  and we need to get implementations of this interface from different datasources (XML, flat file, soap object). Before we could assign data to the instance of this interface, we need a concrete type that implements the interface i.e &lt;span style="font-weight: bold;"&gt;XMLCustomer&lt;/span&gt; implements &lt;span style="font-weight: bold;"&gt;ICustomer&lt;/span&gt; . If what we need is to represents what is defined in the ICustomer interface, then we do not need the extra type &lt;span style="font-weight: bold;"&gt;XMLCustomer&lt;/span&gt; instead we will make a proxy from the interface, i can hear you say why, well, read on .....&lt;br /&gt;&lt;br /&gt;I have been doing a lot of code reduction lately, in fact  all my years as a software engineer, i have been seeking ways to make development a happy hour for myself and my peers. Tell you what, domain driven development is the future of wring software components that is fail prove, it is also the future that will bring us closer to the market place.&lt;br /&gt;&lt;br /&gt;Interface is a very powerful programming construct which reduces dependencies between applications and components. With interface, your code is not far away from TDD (Test Driven Development) and you can test first before writing any code. So if we want to write a code that is targeted at the future, we need to focus on interface.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Much blabbing, how do i generate proxy from interface&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here, i will be revealing some powers of the Reflection.Emit namespace of the .NET framework. Using components/classes of this namespace, will allow you to programmatically examine types and creating code at runtime, what we are going to do in this section is runtime code injection and code generation.&lt;br /&gt;&lt;br /&gt;Now back to our &lt;span style="font-weight: bold;"&gt;ICustomer&lt;/span&gt; interface, let us assume the class definition is as follows :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public interface ICustomer&lt;br /&gt;{&lt;br /&gt;  string FirstName {get; set;}&lt;br /&gt;  string LastName {get; set;}&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Yep, the example above is very simple, we will use this in our PROXY generation pattern. Did i just here you say where is the class that will implement this interface, nope is the answer, there is none for today because we are trying to avoid more code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Now The PROXY Maker&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We would like to do something like the following :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;  ICustomer customer = PROXY.CreateProxy&lt;icustomer&gt;();&lt;br /&gt;&lt;/icustomer&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;yep, this is cool, we do not have an implementation class, but our proxy maker creates one for us behind the scene while examining the structure of the interface &lt;span style="font-weight: bold;"&gt;ICustomer&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;   public class PROXY&lt;br /&gt;   {&lt;br /&gt;       internal const string VIRTUAL_ASSEMBLY_NAME = "our.proxy.us";&lt;br /&gt;       const string version = "1.0.0.0";&lt;br /&gt;&lt;br /&gt;       static AssemblyName assemblyName;&lt;br /&gt;       static ModuleBuilder moduleBuilder;&lt;br /&gt;&lt;br /&gt;       static AssemblyBuilder assembly;&lt;br /&gt;       static AppDomain curAppDomain;&lt;br /&gt;       static IDictionary&lt;string,&gt; cache;&lt;br /&gt;&lt;br /&gt;       static PROXY()&lt;br /&gt;       {&lt;br /&gt;           assemblyName = new AssemblyName(VIRTUAL_ASSEMBLY_NAME);&lt;br /&gt;           assemblyName.Version = new Version(version);&lt;br /&gt;           curAppDomain = Thread.GetDomain();&lt;br /&gt;           assembly = curAppDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);&lt;br /&gt;           moduleBuilder = assembly.DefineDynamicModule(VIRTUAL_ASSEMBLY_NAME);&lt;br /&gt;           cache = new Dictionary&lt;string,&gt;();&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       private static ModuleBuilder ModuleBuilder&lt;br /&gt;       {&lt;br /&gt;           get { return moduleBuilder; }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       public static T CreateProxy&lt;t&gt;()&lt;br /&gt;       {&lt;br /&gt;           if (!cache.ContainsKey(typeof(T).Name))&lt;br /&gt;           {&lt;br /&gt;               TypeBuilder proxy = PROXY.ModuleBuilder.DefineType(typeof(T).Name, TypeAttributes.Class | TypeAttributes.Public, typeof(Object), new[] { typeof(T) });&lt;br /&gt;               proxy = Emit&lt;t&gt;(proxy);&lt;br /&gt;               Type type = proxy.CreateType();&lt;br /&gt;               cache.Add(typeof(T).Name, type);&lt;br /&gt;&lt;br /&gt;               return (T)Activator.CreateInstance(type);&lt;br /&gt;           }&lt;br /&gt;           return (T)Activator.CreateInstance(cache[typeof(T).Name]);&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       private static TypeBuilder Emit&lt;t&gt;(TypeBuilder proxy)&lt;br /&gt;       {&lt;br /&gt;           foreach (PropertyInfo propertyInfo in typeof(T).GetProperties())&lt;br /&gt;           {&lt;br /&gt;               FieldBuilder field = proxy.DefineField(string.Concat("_", propertyInfo.Name), propertyInfo.PropertyType, FieldAttributes.Public);&lt;br /&gt;               PropertyBuilder propertyBuilder = proxy.DefineProperty(propertyInfo.Name, PropertyAttributes.HasDefault, propertyInfo.PropertyType, new[] { propertyInfo.PropertyType });&lt;br /&gt;&lt;br /&gt;               if (propertyInfo.CanWrite)&lt;br /&gt;               {&lt;br /&gt;                   MethodBuilder setMethod = proxy.DefineMethod("set_" + propertyInfo.Name, MethodAttributes.Public | MethodAttributes.Virtual, CallingConventions.HasThis, null, new[] { propertyInfo.PropertyType });&lt;br /&gt;                   GenerateSetMethodBody(field, setMethod.GetILGenerator());&lt;br /&gt;                   propertyBuilder.SetSetMethod(setMethod);&lt;br /&gt;               }&lt;br /&gt;&lt;br /&gt;               if (propertyInfo.CanRead)&lt;br /&gt;               {&lt;br /&gt;                   MethodBuilder getMethod = proxy.DefineMethod("get_" + propertyInfo.Name, MethodAttributes.Public | MethodAttributes.Virtual, CallingConventions.HasThis, propertyInfo.PropertyType, Type.EmptyTypes);&lt;br /&gt;                   GenerateGetMethodBody(field, getMethod.GetILGenerator());&lt;br /&gt;                   propertyBuilder.SetGetMethod(getMethod);&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;           return proxy;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       private static void GenerateSetMethodBody(FieldBuilder field, ILGenerator iLGenerator)&lt;br /&gt;       {&lt;br /&gt;           iLGenerator.Emit(OpCodes.Nop);&lt;br /&gt;           iLGenerator.Emit(OpCodes.Ldarg_0);&lt;br /&gt;           iLGenerator.Emit(OpCodes.Ldarg_1);&lt;br /&gt;           iLGenerator.Emit(OpCodes.Stfld, field);&lt;br /&gt;           iLGenerator.Emit(OpCodes.Ret);&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       private static void GenerateGetMethodBody(FieldBuilder field, ILGenerator iLGenerator)&lt;br /&gt;       {&lt;br /&gt;           iLGenerator.Emit(OpCodes.Nop);&lt;br /&gt;           iLGenerator.Emit(OpCodes.Ldarg_0);&lt;br /&gt;           iLGenerator.Emit(OpCodes.Ldfld, field);&lt;br /&gt;           iLGenerator.Emit(OpCodes.Ret);&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/string,&gt;&lt;/string,&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now the deed has be done. We have the proxy class above using the Reflection.Emit, to emit code at runtime for our interface properties. For each properties defined in the interface, a method body is created for it in the proxy class&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-3404593367319382787?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/3404593367319382787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=3404593367319382787' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3404593367319382787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3404593367319382787'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/07/generating-proxy-from-interfaces-using.html' title='Generating PROXY from interfaces (Using Reflect Emit) : The flexible way to reduce code'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-7649045594471013320</id><published>2009-07-26T06:33:00.000-07:00</published><updated>2009-07-26T15:50:31.284-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Chartered Me'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='British Computer Society'/><category scheme='http://www.blogger.com/atom/ns#' term='united kingdom'/><category scheme='http://www.blogger.com/atom/ns#' term='Project management'/><category scheme='http://www.blogger.com/atom/ns#' term='professional membership'/><category scheme='http://www.blogger.com/atom/ns#' term='BCS'/><category scheme='http://www.blogger.com/atom/ns#' term='agile development'/><category scheme='http://www.blogger.com/atom/ns#' term='UK IT'/><title type='text'>Chartered Me (The Hallmark of my commitment to IT)</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_XwziUoKLz60/SmxdGsyBDnI/AAAAAAAAACo/qkyFA8ftggY/s1600-h/citp-logo.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 214px;" src="http://2.bp.blogspot.com/_XwziUoKLz60/SmxdGsyBDnI/AAAAAAAAACo/qkyFA8ftggY/s320/citp-logo.jpg" alt="" id="BLOGGER_PHOTO_ID_5362763625972960882" border="0" /&gt;&lt;/a&gt;I received the &lt;span style="font-weight: bold;"&gt;Chartered IT Professional Status&lt;/span&gt; award from &lt;span style="font-weight: bold;"&gt;The British Computer Society&lt;/span&gt;.  The award is part of professional achievement that gives satisfaction in your career, and a re-assurance that you are doing the right thing and keeping yourself up-to date on current trends in your area of expertise. There are many of these awards, but the &lt;span style="font-weight: bold;"&gt;CITP&lt;/span&gt; award stand for the Gold standard for a true IT professional.&lt;br /&gt;&lt;br /&gt;A professional without a clue of where he/she will belong in years to come is wasting time and awaiting to become obsolete which will lead to their inability to keep up with the pace in technological advancements. There are gains in career developments (Learning new things), and setting achievable goals yearly. There are gains in standing out from the crowd.&lt;br /&gt;&lt;br /&gt;The IT industry have suffered  from lack of professionalism in the past, this then lead to many failures in IT projects and over budget, because  of poor project management, outdated software tools and platform, and of course,  obsolete people working on the project. In this current economic climate condition, the last thing an organization would like to face is failing and over budget projects. Some projects do fail because most people are obsolete and they have been blinded by daily routines that they cannot see the advancement in the technology world and how these advancements will help shape their businesses. Most don't even understand their business.&lt;br /&gt;&lt;br /&gt;There is now a chance for likely minded, to share their experiences and the pros and cons in using the following paradigms:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;project management,&lt;br /&gt;&lt;/li&gt;&lt;li&gt;development standards,&lt;br /&gt;&lt;/li&gt;&lt;li&gt;risk assessment,&lt;br /&gt;&lt;/li&gt;&lt;li&gt;software quality assurance,&lt;br /&gt;&lt;/li&gt;&lt;li&gt;software measurement and&lt;br /&gt;&lt;/li&gt;&lt;li&gt;agile system.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;An organization that is doing the right thing will have to bring together as a single component, the listed practices above (Although i agree that there are many more but for brevity we will mention just few).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Why Professional Membership is Good?&lt;/span&gt;&lt;br /&gt;Like Accountants, Surveyor, Engineers, professional membership and status is an achievement that tells about your competence and your interest in developing your career. The best place to get the latest information in your profession will be through the membership of your profession. There are many professional bodies out there and &lt;span style="font-weight: bold;"&gt;The British Computer Society&lt;/span&gt; is just one of them which i am proud to be a member.&lt;br /&gt;&lt;br /&gt;You have the opportunity to meet people of like minds. For example i am an Open source developer and also an advance software engineer my professional body will present me with people of like minds that we can discuss and help ourselves in emerging trends in technology. This will peer you with people around the world and you will be the first to know the latest gist in town.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Continuing Professional Development&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;(CPD)&lt;/span&gt;&lt;br /&gt;Being a member of a professional body will enable you to learn from experience. You will tailor your career progression with what new thing you have to learn. In this fast paced technological driven world continuous development should be an attribute that enable you become a respected and true IT professional. Then you can measure yourself/skill sets against an SFIA level (The Skill Framework For Information Age). This will tell you were you are at the moment and areas you have to work on to get to the next level.&lt;br /&gt;&lt;br /&gt;It will enable you and your organization to see beyond your company alone and keep you at the edge in this competitive market.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Is IT so polluted that we need a professional body?&lt;/span&gt;&lt;br /&gt;well, some section of IT is overly polluted that we need measures in our industry to stop these pollution. Just like a doctor, you cannot be a newly graduate doctor and be given a chance to perform surgery, you need to be validated in so ways (Medical schools and year of experience) before you are given a chance.&lt;br /&gt;&lt;br /&gt;In IT anybody can write a piece of program so far it works but not everybody will write a program that will conform to best practices etc.  Anybody can manage a project because they feel project management is just overseeing (This is wrong). An IT project manager should have been an enthusiast software developer that will enable such person to strike a balance between delivering quality products and conforming to standards in our industry.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-7649045594471013320?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/7649045594471013320/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=7649045594471013320' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/7649045594471013320'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/7649045594471013320'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/07/chartered-me.html' title='Chartered Me (The Hallmark of my commitment to IT)'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_XwziUoKLz60/SmxdGsyBDnI/AAAAAAAAACo/qkyFA8ftggY/s72-c/citp-logo.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-1178947017409352242</id><published>2009-06-03T21:16:00.000-07:00</published><updated>2009-06-21T00:39:22.978-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='cloud'/><category scheme='http://www.blogger.com/atom/ns#' term='windows azure'/><category scheme='http://www.blogger.com/atom/ns#' term='cloud computing'/><category scheme='http://www.blogger.com/atom/ns#' term='microsoft'/><title type='text'>Going to the Clouds with windows AZURE. (A platform for cloud computing)</title><content type='html'>Access to software, services and applications over the Internet, with/without you having an idea of the original location, such services is referred to be living in the cloud. Users need not bother about where the software is located.&lt;br /&gt;&lt;br /&gt;With cloud computing, you do not have to worry about the technologies that supports your virtual environment. You don't have to wait too hard for your service providers who have to setup/install and configure components for your server environment before using cloud computing, all the components that you require for smooth running of your cloud business, are already in the cloud.&lt;br /&gt;&lt;br /&gt;Cloud computing is mixture of other existing buzzes in the INTERNET jargon, these are :&lt;br /&gt;&lt;br /&gt;1. Iaas : Infrastructure as a service&lt;br /&gt;2. Paas : Platform as a service&lt;br /&gt;3. Saas : Software as a service&lt;br /&gt;&lt;br /&gt;These existing services are incorporated together to form what we refer to the cloud. They all are functionally Dependant on one and other to give a breath taking user experience.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Is cloud computing the new IT Jargon?&lt;/span&gt;&lt;br /&gt;In today's IT complexity driven world, reliance or dependencies on technology resources are becoming cumbersome for large and small enterprises, while maintaining large infrastructures of computing resources are becoming an cost issues to organisations, there is a newly born term (Cloud computing) to wash away our worries. Doing business on the web is not as easy as it seem when you have to worry about all the infrastructures, security, maintenance and continuous up gradation of  these infrastructures, it would be nice when several providers take charge of the technology backing and the rest is for you to leverage an existing API's/Frameworks to complement your business.&lt;br /&gt;&lt;br /&gt;The cloud buzz is already attracting bigger IT providers like Google, IBM, Sun, Microsoft. What does all these mean to us all, the future is in the cloud (with the exception of propriety based technologies).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Microsoft answered with Windows AZURE&lt;/span&gt;&lt;br /&gt;Windows Azure is Microsoft first step into the cloud computing foray. Azure is a Microsoft initiative in providing services on the cloud. This is an operating system that is used for deploying azure services on Microsoft owns data centers.&lt;br /&gt;&lt;br /&gt;In our day to day deployment/development experience, we overcome several challenges in application configurations, server prerequisites, and configurations.&lt;br /&gt;&lt;br /&gt;The windows Azure is an assurance that all these server components (MS-MQ, WCF Host, WWF host, SOAP, XML, REST, ASP.NET etc) will be available without you worrying.&lt;br /&gt;&lt;br /&gt;The good thing is that Microsoft is providing SDK's for windows azure, and there is already a Visual Studio integration. Although, Microsoft technologies will be supported (As these are core to the heart of the software giant) , windows Azure will also host non-microsofts technologies. (infact there is already an effort on codeplex for &lt;a href="http://phpazure.codeplex.com/"&gt;PHP Azure&lt;/a&gt;  .&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Azurance Provided by windows Azure&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Provisions for Binary large object (Blob) tables hosted in the cloud.&lt;/li&gt;&lt;li&gt;Full .NET Framework support.&lt;/li&gt;&lt;li&gt;Available security polices.&lt;/li&gt;&lt;li&gt;Support for other platforms languages (PHP)&lt;/li&gt;&lt;li&gt;Message queuing.&lt;/li&gt;&lt;li&gt;SDk's available everywhere&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;To azure yourself on the next IT jargon using Microsoft platforms and technologies you will need to go here http://www.microsoft.com/azure/default.mspx. Do not panic, because your development will still be the same, and you can continue to use your existing applications. Infact, your applications can be made azure compliance.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Good thing for .NET developer&lt;/span&gt;&lt;br /&gt;Microsoft is not forgetting us and we are already cloud compliant as Microsoft, already provides an SDK for integration into Visual Studio development environment. In fact, our existing developments can be converted to azure services (Its just a matter of configurations). Download the Visual Studio Tools for windows &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=11b451c4-7a7b-4537-a769-e1d157bad8c6&amp;amp;displaylang=en"&gt;Azure&lt;/a&gt;, and reassure yourself of the future of computing.&lt;br /&gt;&lt;br /&gt;If you wait on this channel, i would be providing a simple .NET application that is windows Azure compliant.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-1178947017409352242?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/1178947017409352242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=1178947017409352242' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/1178947017409352242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/1178947017409352242'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/05/going-to-clouds-with-windows-azure.html' title='Going to the Clouds with windows AZURE. (A platform for cloud computing)'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-1664794346556879759</id><published>2009-06-03T06:42:00.000-07:00</published><updated>2009-06-03T07:51:42.795-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='hate'/><category scheme='http://www.blogger.com/atom/ns#' term='seperation of concerns'/><category scheme='http://www.blogger.com/atom/ns#' term='OOP'/><category scheme='http://www.blogger.com/atom/ns#' term='try catch'/><category scheme='http://www.blogger.com/atom/ns#' term='Command Pattern'/><title type='text'>Hating Try Catch Block (Successful way of cleaning code)</title><content type='html'>The title of this post is a bit weird, it is weird in the sense that it promotes hatred for try catch blocks in our code. I am not a try and catch block hatter, but too much of it will lead to code rots and very, very buggy software.&lt;br /&gt;&lt;br /&gt;Did i just say buggy, not only will it make it difficult to maintain but very inexperienced.&lt;br /&gt;&lt;br /&gt;In our grained experience in developing object oriented components/systems, we have met with several challenges that tells us that OO (Object Orientation) is not complete and it is not a silver bullet and answer for all. Well for the OO enthusiastic, permit me to say OO has its own bad practices and so therefore it is not complete in its own rigth (No wonder we have several design patterns all over).&lt;br /&gt;&lt;br /&gt;Anyway, the purpose of this post is not about OO not beign complete particularly, but about a practices that can lead to very hard to read code, a difficult and un-maintainable codebase. The following contains short list of code demons :&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Too much &lt;span style="font-weight: bold;"&gt;IF ELSE&lt;/span&gt; statements : This is a killer code beast that if not properly used, you end up with a code that no one will understand.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Separation of concern&lt;/span&gt; : The statement &lt;span style="font-weight: bold;"&gt;'Separation of Concern'&lt;/span&gt; does not apply to components/libraries/.dlls alone. It also applies to classes, methods, properties, interfaces. Any code elements is there for a purpose (Concern). If you write a class and you have several methods within the class (even utility methods like GetDate()) , your class does not have a concern. This allows your library, componets, dlls not to conform to concerns from class levels. I will rather create a class that does one thing and do it very well, instead of creating one class that does many things. A dog is a dog and not dogcat. If your class is a dog, let it be a dog, if its a cat let it be a cat.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;The evil of all &lt;span style="font-weight: bold;"&gt;TRY CATCH BLOCKS&lt;/span&gt; : Yeap too much of this leads to code rot and it does not encourage readability of codebase. Since this is the subject of this article, i will start in a separate paragraph.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;The Problem Statement&lt;/span&gt;&lt;br /&gt;Consider the following code snippets.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public delegate void SafeMethodCall();&lt;br /&gt;&lt;br /&gt;       public void DoSomeBadThing()&lt;br /&gt;       {&lt;br /&gt;           try&lt;br /&gt;           {&lt;br /&gt;               //Do bad thing&lt;br /&gt;               Thrower();&lt;br /&gt;&lt;br /&gt;               try&lt;br /&gt;               {&lt;br /&gt;                   //Really Do some wacky thing&lt;br /&gt;                   Thrower();&lt;br /&gt;               }&lt;br /&gt;               catch (Exception ex)&lt;br /&gt;               {&lt;br /&gt;&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;           catch (Exception ex)&lt;br /&gt;           {&lt;br /&gt;&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       public void Thrower()&lt;br /&gt;       {&lt;br /&gt;           throw new InvalidOperationException("Exception message");&lt;br /&gt;       }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Some people will not see any bad in the above code, let us assume we are doing the same in several places. This will lead to very messy code base, i rather allow the application to fail and log the error than catching different exceptions in several places. The only way out of this situation is maintaining at least one try catch block at the application entry points. That is if you have a class that kick starts your entire application, or its an abstraction of a framework, this is the most suitable place to hook the try and catch.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;An efficient approach :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public delegate void SafeMethodCall();&lt;br /&gt;&lt;br /&gt;       public void Thrower()&lt;br /&gt;       {&lt;br /&gt;           throw new InvalidOperationException("Exception message");&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       public void SomethingNeat()&lt;br /&gt;       {&lt;br /&gt;           CallSafely(Thrower);&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       public void CallSafely(SafeMethodCall methodCall)&lt;br /&gt;       {&lt;br /&gt;           try&lt;br /&gt;           {&lt;br /&gt;               methodCall.Invoke();&lt;br /&gt;           }&lt;br /&gt;           catch (Exception x)&lt;br /&gt;           {&lt;br /&gt;&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The delegate can be used by several other methods to do safe call. This means your try and catch is maintained in a single location. This approach is also efficient for logging, if you are logging errors to file or different repositories.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Now, how does this approach save cleanse our code base&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Let us assume we have three different parameterless methods (because our delegate is parameterless) :&lt;br /&gt;&lt;br /&gt;public void GetName(); //Can throw string format exception&lt;br /&gt;public void GetAge(); // Can throw invalid cast exception&lt;br /&gt;public void GetCountry(); //Can throw country not in world map exception&lt;br /&gt;&lt;br /&gt;These methods have a potential of throwing these errors, how can we call these methods using the above approach, instead of defining try and catch everywhere in our code base. we will now do like so :&lt;br /&gt;&lt;br /&gt;CallSafely(GetName);&lt;br /&gt;CallSafely(GetAge);&lt;br /&gt;CallSafely(GetName);&lt;br /&gt;&lt;br /&gt;For me, the following is more cleaner, than having many try catch handlers to handle the exceptional situations.&lt;br /&gt;&lt;br /&gt;Let me know what you think.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-1664794346556879759?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/1664794346556879759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=1664794346556879759' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/1664794346556879759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/1664794346556879759'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/06/hating-try-catch-block-successful-way.html' title='Hating Try Catch Block (Successful way of cleaning code)'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-1218694525064686399</id><published>2009-04-10T07:58:00.000-07:00</published><updated>2009-06-27T02:34:09.748-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='design by contract'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='.net 4.0'/><category scheme='http://www.blogger.com/atom/ns#' term='DBC'/><title type='text'>Building quality and bug free software : Leverage Design By Contract</title><content type='html'>Since inception, the advent of Object orientation development gave birth to chains of  concepts in recent years, and all these had positive impacts on the ways we develop robust, reliable and scalable systems that passes the test of time.  One of this concept is designing software component and allowing components interaction based on contracts. These contracts are the full agreements that each components must satisfy before the system can run successfully.&lt;br /&gt;&lt;br /&gt;A simple analogy is smashing a bottle on the floor, what do we expect? of course, we'd expect the bottle to break, and scattered all over the floor. The fact that the action smashing a bottle on the floor requires a bottle (Pre-conditions) and bottle must scatter on the floor  (Post- condition). The pre-conditions and post-conditions are the contract agreement in our analogy. Now lets dig into what really is design by contract:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is Design By Contract (DBC)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Design by contract is the ability of software components to satisfy obligations that are required for the smooth running of a software systems. Was introduced into the &lt;a href="http://www.eiffel.com/"&gt;Eiffel&lt;/a&gt; programming language designed by Bertrand Meyer in 1988.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, the word design by contract is used to associate software contracts/specifications with the software development itself, by so doing, we described what the software component expects from calling component or client. This approach makes the development of software and its specification to be interwoven and changed when either changes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Again What is Design By Contract&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Design by contract is a software development standards that enforces a pre-conditions and post-conditions on the ways software components/ methods and libraries communicate with one another. An object oriented class should depict what it represents. If you have a class called &lt;span style="font-weight: bold;"&gt;AccountValidator&lt;/span&gt;, the job of that class is to validate an &lt;span style="font-weight: bold;"&gt;Account&lt;/span&gt; not to withdraw from that account, another class or service will handle the withdraw aspect.&lt;br /&gt;&lt;br /&gt;To validate an account, we will &lt;span style="font-weight: bold;"&gt;Require&lt;/span&gt; an Account Details object, and the algorithms for validating an account, and also &lt;span style="font-weight: bold;"&gt;Ensure&lt;/span&gt; that the account is valid, and there is no invalid data supplied. Note the two words &lt;span style="font-weight: bold;"&gt;Require&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;Ensure &lt;/span&gt;, these are analougous to the pre-conditions and post-conditions that we have been refering to. So if you are developing the AccountValidator class, the methods should require that parameters meets its demand and ensure that valid validation response is sent to the consumer.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Why all this, what about TDD&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;(Test Driven Development)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Yeap, &lt;span style="font-weight: bold;"&gt;TDD&lt;/span&gt; allows you to pre-verify your code against certain conditions too. And if you have been using &lt;span style="font-weight: bold;"&gt;Assert&lt;/span&gt; statements to verify outputs from your test, you are near design by contract. But DBC allows you to have the assertions into your code not outside your code. Your methods should be strict enough and only bound to its part of the contract.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;All talk and no code : Tell me more&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now lets consider the following class &lt;span style="font-weight: bold;"&gt;AccountValidator&lt;/span&gt;, and its contract obligations :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;interface IAccountValidator&lt;br /&gt;{&lt;br /&gt;   bool ValidateAccount(IAccountDetails account);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//IAccountValidator Implementation&lt;br /&gt;&lt;br /&gt;public class AccountValidator : IAccountValidator&lt;br /&gt;{&lt;br /&gt;   public bool ValidateAccount(IAccountDetails account)&lt;br /&gt;   {&lt;br /&gt;       if (ValidateAccountNumber(account.AccountNumber))&lt;br /&gt;       {&lt;br /&gt;           if (ValidateNameOnAccount(account.NameOfAccount))&lt;br /&gt;           {&lt;br /&gt;               //Now ensure that the value is in the database&lt;br /&gt;&lt;br /&gt;               if(ValueIsInDataBase(account))&lt;br /&gt;                  return true;&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       return false;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   private bool ValidateAccountNumber(string accountNumber)&lt;br /&gt;   {&lt;br /&gt;       if (string.IsNullOrEmpty(accountNumber))&lt;br /&gt;           throw new InvalidOperationException("Invalid Account Number");&lt;br /&gt;&lt;br /&gt;       if (accountNumber.Length != 8)&lt;br /&gt;           throw new InvalidOperationException("Account number must be exactly 8 characters long");&lt;br /&gt;&lt;br /&gt;       return true;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   private bool ValidateNameOnAccount(string name)&lt;br /&gt;   {&lt;br /&gt;       if (string.IsNullOrEmpty(name))&lt;br /&gt;           throw new InvalidOperationException("Invalid Account Name");&lt;br /&gt;&lt;br /&gt;       return true;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;      private bool ValueIsInDataBase(IAccountDetails account)&lt;br /&gt;      {&lt;br /&gt;          //Database calls here&lt;br /&gt;      }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The class above specifies to pre-conditions, these are valid account number and valid account name. The post-conditions of this class would have been checking that the actual data submitted is valid in the database. This class is just a simple and classic design by contract example, more advanced frameworks has been produced using aspect weaving or aspect oriented programming to solve the contract issues.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;DBC is comming in .NET 4.0&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;Code contracts will be part of the Rosairo project (VS 2010). This will allow you to have the ability of static time checking of contract violations, API documentation, improve your testability. &lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-1218694525064686399?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/1218694525064686399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=1218694525064686399' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/1218694525064686399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/1218694525064686399'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/04/building-quality-and-bug-free-software.html' title='Building quality and bug free software : Leverage Design By Contract'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-1688144013368053695</id><published>2009-03-29T03:35:00.000-07:00</published><updated>2009-03-29T08:27:58.296-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VS 2010'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='Rosairo'/><title type='text'>Democratizing Software Development (A Promise from Rosairo) .NET 4.0</title><content type='html'>Microsoft is making a big change in its .NET suites of technologies. The Visual studio development environment will experience additional functionalities that will make life a sweet one for all of us. An application server code named &lt;span style="font-weight: bold;"&gt;"Dublin"&lt;/span&gt; will be introduced to compliment IIS (Internet Information Service) . &lt;span style="font-weight: bold;"&gt;WF&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;WCF&lt;/span&gt; will experience another quantum changes, and we will all be happy.&lt;br /&gt;&lt;br /&gt;The .NET framework is not left behind, as we will see more API changes like : &lt;span style="font-weight: bold;"&gt;dynamic&lt;/span&gt; (supports for COM interop and dynamic languages), Named parameters, default parameters,  BigIntegers, covariance and contra variance of generic list : as IList string  will now be equals to IList object , also Code contracts.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Democratizing Software Development Life Cycle&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;There is now a big quantum leap from programming focused development environment to software life cycle development environment.&lt;br /&gt;&lt;br /&gt;In an Agile driven development environment, the key practices there is collaboration, software developers needs to collaborate with architects, testers, project managers and database administrators. This collaborative means ensures that products are delivered on time and risks are noted on time. The collaboration amongst team of professionals already in an agile environment leveraging the .NET platform will be a plus when the new Visual Studio 2010 finally ships.&lt;br /&gt;&lt;br /&gt;Use case, activity, architectural diagrams are other integrated features of &lt;span style="font-weight: bold;"&gt;Rosairo&lt;/span&gt;, developers, architects will enjoy new ways of architectural designs because all of this forms parts of the new change in VS 2010.&lt;br /&gt;&lt;br /&gt;Ever thought about using test data to validate the efficacy of software solution. There is an added test tool that will ensure a proper scenario based documentation which is useful to application testers.&lt;br /&gt;&lt;br /&gt;Black box testing recorder will be integrated into the Visual studio 2010, where testers  can interrogate the call stack and record debug sessions for replay later. This gives the developers to watch the replay of the black box when a bug is found.&lt;br /&gt;&lt;br /&gt;Let us fold our arms and experience the new changes to the developers number ones platform. Derio to Microsoft, Visual Studio Bomayee!!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-1688144013368053695?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/1688144013368053695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=1688144013368053695' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/1688144013368053695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/1688144013368053695'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/03/democratizing-software-development.html' title='Democratizing Software Development (A Promise from Rosairo) .NET 4.0'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-695028568382857181</id><published>2009-03-24T05:51:00.000-07:00</published><updated>2009-03-24T12:25:04.380-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BDD'/><category scheme='http://www.blogger.com/atom/ns#' term='Behavioural Driven Developement'/><category scheme='http://www.blogger.com/atom/ns#' term='YAGNI'/><category scheme='http://www.blogger.com/atom/ns#' term='TDD'/><title type='text'>Time for BDD (Behavioural Driven Development)</title><content type='html'>A deep thought over why software project really fails or was built without actual concentration on the business cases will lead to the fact that the actual requirement was not being captured well, no feasibility study of any kind was taken to check the efficacy of the business case. We understand that Business Analyst, Quality Assurance and of course developers need a collaborative efforts to building software. Do we as developer really test first before writing the code. The test first approach makes for understandability of business requirements from coding and it makes us concentrate on what our requirements really are.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How YAGNI (&lt;/span&gt;You Aren't Gonna Need It&lt;span style="font-weight: bold;"&gt;) can help developers&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;YAGNI can help us to focus on our development needs, it will allow us to focus on the business/technical cases and reduces large complicated code referred to as code bloat. You really aint gonna need that sophisticated features if its just not helping the software requirements at the moment. I know we developers likes to write the best standardize code that meets with the current practices in our industry, that's cool but are we conscious of the time spent on the sophistication, do we put in mind that business requirements comes first before satisfying our hunger for fine grained development practices.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;BDD complements TDD&lt;/span&gt;&lt;br /&gt;The current methodologies in software houses is the Agile Methodology, whether it is being practiced in a full fledged manner or it is being  tailored against your organization requirements, Agile methodologies favors incremental development over classic water fall approach.  Agile methodology was referred to as cowboy coding because of its minimal planning approach, but it has proven to be successful in today's deliverable focused environments.&lt;br /&gt;&lt;br /&gt;Agile methodologies encourages Test driven Development which in turn allows us as a programmer/developer/architect to focus more on testability of our code. At a point during the writing of large and complex systems, we loose our confidence in our code if we do not have an automated testing framework that gives us the confidence and boost our moral.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;That said and done what is BDD?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Have you ever written a complex system with several many business scenarios. The reasons why systems fails is that we do not fully test all different scenarios that the system can find it self. An agile test driven developer should understand that testing scenarios goes beyond your test and mock passed, but its that your code/system meets the full capabilities and conform to clients needs.&lt;br /&gt;&lt;br /&gt;It promotes common domain language between what the business analysts, quality assurance and the developers understand. Developers can save the technical detail when interacting with none technical people. This will enable everyone speaking the same language and everyone having common understand of the business case and where we are at.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;A simple non BDD interactions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Business Manager&lt;/span&gt; : I want the new software to support staff tracking&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Systems Analyst&lt;/span&gt;   :  It will results to us obtaining a tracking GPRS systems and API built around it.&lt;br /&gt;&lt;br /&gt;Developers : We need to use a wrapper or/and abstraction, that will be make us not tight with third party tools. Yes it seems there is already a bluethoot API in the corner.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Business Manager&lt;/span&gt;   : The goal of the system is to allow us know the time which the staff logs onto the systems, the idle time of the keyboard, and internet usage.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Systems Analyst &lt;/span&gt;       : Ok i see, the provide us with your initial thougths and we can write a behavioural code that will clearify your thoughts.&lt;br /&gt;&lt;br /&gt;The interaction above is just an example our understandibility is a neccessity in software development. You will not blame us developers for having a higher level mindsets its our job but we need to understand the business case, in other words we have to interrogate our code and simulate the business cases to get the clearer picture.&lt;br /&gt;&lt;br /&gt;Note even the business managers do not know what they fully want, but the BDD will document and give a clearer picture of what the system should do.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Hence we need a user story&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Recently i migrated a very complex business scenarios from code into WWF (Windows Workflow Foundation) . This would not have been possible if i do not know the user story. Although, i have to admit that i delt with a document which does not clearly structure the requirements in other of user stories or scenarios, all the same i picked up my own pen, and i wrote an interesting user stories from such document. Here is a simple example :&lt;br /&gt;&lt;br /&gt;As a user of the online banking system&lt;br /&gt;I want to loging with with my secure credentials&lt;br /&gt;Then check my account details to see my balance record.&lt;br /&gt;&lt;br /&gt;With This scenario, =&gt; check my account details&lt;br /&gt;Given , the logging page is active and ready to take my details&lt;br /&gt;And, suplying my real encrypted password&lt;br /&gt;And, my real user name&lt;br /&gt;when, i log in my details&lt;br /&gt;Then, i was redirected to a new bank customer account page&lt;br /&gt;And, I checked my account details.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If systems developers can write out a story out of the big and large software requirements documents, then the remaining code will be less painless because you would not be coding and asking about the story because you already know that the story line is happily ever after.&lt;br /&gt;&lt;br /&gt;Watch out for when i display my experience with various BDD frameworks like Nbehave, Dan Norths Blog site, at http://dannorth.net/whats-in-a-story.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-695028568382857181?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/695028568382857181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=695028568382857181' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/695028568382857181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/695028568382857181'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/03/time-for-bdd.html' title='Time for BDD (Behavioural Driven Development)'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-6030144588538403522</id><published>2009-03-20T07:49:00.000-07:00</published><updated>2009-03-20T08:49:37.684-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='dependency injection'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='seperation of concerns'/><category scheme='http://www.blogger.com/atom/ns#' term='loose coupling'/><title type='text'>Simple dependency Injector class</title><content type='html'>It is apparent in todays application development that complexity starts from when we typed the first line of code. Code complexity is one of the code horrors mutilating todays application development. To ensure that we work around these developments show stoppers, many design patterns and software development standards have been built to help come over this poor development approach.&lt;br /&gt;&lt;br /&gt;Today we develop software with components in mind, we develop so that we can easily decouple our systems and make it a pluggable system.&lt;br /&gt;&lt;br /&gt;Systems are very difficult to decouple when we do not use a strategic and standardized ways of separating component concerns. Over the years, the development and Object Oriented community  have realized that there was a need to separate application concerns because of changing business cases and requirements.&lt;br /&gt;&lt;br /&gt;As a software developer i have made it a culture to think of software as several functional modules that are independent from one and other but dependent on one and other via a plugable means.&lt;br /&gt;&lt;br /&gt;The following code shows an example of code coupling :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;  public class Person&lt;br /&gt;  {&lt;br /&gt;      public string FirstName { get; set; }&lt;br /&gt;      public string LastName { get; set; }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  Person person = new Person();&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;There is nothing wrong with the code above really for a simple application. But for a very complex application, we tend to tight couple the Person class with the calling application. Let us assume the person class was imported from a web service proxy, that means our application is relying on the web service proxy for the Person Implementation. What then happens when we are not interested in web service proxy again but in another .dll that has its own Person implementation but with some extra fields and properties, do we start to refactor our code to comply with the new Person class? I bet that is not the easiest way ever.&lt;br /&gt;&lt;br /&gt;Let us assume that person class now implements an interface IPerson. The following code depicts the kind of defination :&lt;br /&gt;&lt;br /&gt;&lt;div class="myclass"&gt;&lt;br /&gt;  interface IPerson&lt;br /&gt;  {&lt;br /&gt;      string FirstName { get; set; }&lt;br /&gt;      string LastName { get; set; }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public class Person : IPerson&lt;br /&gt;  {&lt;br /&gt;      public string FirstName { get; set; }&lt;br /&gt;      public string LastName { get; set; }&lt;br /&gt;  }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Hmm, now that person have implemented an interface IPerson, then we could refer to IPerson all over our code, this is fairly decoupled until the very point where we really initialised the Person class, like the following :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;IPerson person = new Person();&lt;br /&gt;&lt;br /&gt;person.FirstName = "Ahmed";&lt;br /&gt;person.LastName = "Salako";&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;now although we ahve succesfully initialised the Person class and because it implements the IPerson interface, we can assign it to the IPerson interface. Our code is still exposed to the point where we did new Person.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;A simple Dependency Injector class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The following class will serve as a repository that knows about dependencies of our application :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;   public static class ModelFactory&lt;br /&gt;   {&lt;br /&gt;       private static IDictionary &amp;ltType, Type&amp;gt repos = new Dictionary &amp;ltType, Type&amp;gt();&lt;br /&gt;&lt;br /&gt;       static ModelFactory()&lt;br /&gt;       {&lt;br /&gt;           repos.Add(typeof(IPerson), typeof(Person));&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       public static T CreateInstance &amp;lt T&amp;gt()&lt;br /&gt;       {&lt;br /&gt;           Type value = repos[typeof(T)] as Type;&lt;br /&gt;           return (T)Activator.CreateInstance(value);&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       public static T AsInterface &amp;lt T&amp;gt(Type type)&lt;br /&gt;       {&lt;br /&gt;           Type value = repos.Where(t =&gt; t.Value == type).FirstOrDefault().Key;&lt;br /&gt;&lt;br /&gt;           return (T)Activator.CreateInstance(value);&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;So with the class above, we have successfully created a dependency repository class that knows about an interface and its implementations. Here is how to use the simple dependency repository class :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;IPerson person = ModelFactory.CreateInstance &amp;lt IPerson&amp;gt();&lt;br /&gt;person.FirstName = "Ahmed";&lt;br /&gt;person.LastName = "Salako";&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This leaves us very happy and with code decoupling.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-6030144588538403522?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/6030144588538403522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=6030144588538403522' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6030144588538403522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6030144588538403522'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/03/simple-dependency-injector-class.html' title='Simple dependency Injector class'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-2023128420081687809</id><published>2009-01-06T06:37:00.000-08:00</published><updated>2009-01-06T07:33:41.435-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='data source'/><category scheme='http://www.blogger.com/atom/ns#' term='pattern and practise'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='interpreter'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><category scheme='http://www.blogger.com/atom/ns#' term='gang of four'/><title type='text'>LINQ And Interpreter Pattern : A tale of datasources</title><content type='html'>In a service oriented (SOA) environment, larger systems communicate/handshake with one and other with different varieties of data and formats.&lt;br /&gt;&lt;br /&gt;These systems leverage different Data formats, contracts and pure XML (The RESTFULL way) hosted in a multi - platform environment.&lt;br /&gt;&lt;br /&gt;Recently, in the real life, i came across a situation that i needed to fetch information from different data sources. The consuming application(s) does not want to know where these data's are being imported from and the producing application does not want to let go of the secret of the source to data. All it is concerned about is that the format must be consistent wherever it may be coming from.&lt;br /&gt;&lt;br /&gt;I am supposed to fetch data from the following sources :&lt;br /&gt;&lt;br /&gt;1. XML stored in a file system.&lt;br /&gt;2. DataSet from another WebService&lt;br /&gt;3. Service contracts from another service.&lt;br /&gt;&lt;br /&gt;At first, this seems to be a mundane tasks, because you may have to create different code for different datasources and different translation for those datasources because an xml data is not the same as object data until we have a translator, we would not get anywhere near what we want to achieve.&lt;br /&gt;&lt;br /&gt;First thing that comes to my mind was to leverage the Linq API and architecture to archive the above problem, how do i program my WCF service so that it will be extensible to other datasources, how do i ensure that the translation is not ambiguous (hence finding a better approach and framework that is consistent enough to do the job of translating data coming from different sources.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Proposed architecture&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I dig my hands into the dirty chests of patterns, i traveled from Gang of four to Microsoft pattern, i moved from different community, but there seem not to be a proper way of ensuring a consistent data translation strategy. After sometime, of digging, i eventually choose to use the interpreter pattern (Since it is used to interpret sentences in language elements). The reason for this choice is because i need a consistent language lexical structure that i can use for different data sources (as explained above) and Interpreter pattern seem to be the best choice to define my language grammar.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In this example,  we want to interpret a Customer detail data structure coming from different sources, here is the C# structure of our Customer Poco class.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public class Customer&lt;br /&gt;{&lt;br /&gt;public string FirstName { get; set; }&lt;br /&gt;public string LastName { get; set; }&lt;br /&gt;public string Address { get; set; }&lt;br /&gt;public int Age { get; set; }&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;We want to be able to translate several data sources to the Customer class defined above. This example will focus on the following data sources :&lt;br /&gt;&lt;br /&gt;1. XML&lt;br /&gt;2. Database&lt;br /&gt;3. DataSet&lt;br /&gt;4. object&lt;br /&gt;&lt;br /&gt;If we are familiar with the Linq API, we would know that it supports for language elements across the named data sources above.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Interpreter Pattern Structure&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;The base interpreter is the interface to which we will use to interpret our language elements, because we need not know about the child classes or how they do their interpretations. The code snippet below is our base Interpreter.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public abstract class CustomerExpression&lt;br /&gt;{&lt;br /&gt;  public Customer Customer { get; set; }&lt;br /&gt;  public abstract void Interpret();&lt;br /&gt;}&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;The code above defines the Customer&lt;/span&gt;&lt;span&gt;Expression class and this class will define the structure of its child classes, the following child classes will be created :&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;CustomerXMLExpression&lt;/li&gt;&lt;li&gt;CustomerSQLExpression&lt;/li&gt;&lt;li&gt;CustomerDataSetExpression&lt;/li&gt;&lt;li&gt;CustomerObject&lt;span&gt;Expression&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;I will be discussing the first one only which is the CustomerXML&lt;span&gt;Expression. The code below is the snippet for the CustomerXMLExpression :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public class CustomerXMLExpression : CustomerExpression&lt;br /&gt;{&lt;br /&gt;   public override void Interpret()&lt;br /&gt;   {&lt;br /&gt;       Customer = TranslateCustomer();&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   private Customer TranslateCustomer()&lt;br /&gt;   {&lt;br /&gt;       StringBuilder customerXML = new StringBuilder("XML Data");&lt;br /&gt;       XDocument customers = XDocument.Parse(customerXML.ToString());&lt;br /&gt;&lt;br /&gt;       return (from customer in customers.Descendants("Customers")&lt;br /&gt;                                     select new Customer&lt;br /&gt;                                     {&lt;br /&gt;                                         FirstName = customer.Element("FirstName").Value,&lt;br /&gt;                                         LastName = customer.Element("LastName").Value,&lt;br /&gt;                                         Age = (int) int.Parse(customer.Element("Age").Value),&lt;br /&gt;                                         Address = customer.Element("Address").Value,&lt;br /&gt;                                     }).FirstOrDefault();&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;We can use the same idea for the rest of the remaining data sources, for example we can search each data sources as follows :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;CustomerExpression expression = new CustomerXMLExpression();&lt;br /&gt;Customer customer = expression.Interpret();&lt;br /&gt;&lt;br /&gt;&lt;span&gt;CustomerExpression expression = new &lt;/span&gt;CustomerSQLExpression();&lt;br /&gt;Customer customer = expression.Interpret();&lt;br /&gt;&lt;br /&gt;&lt;span&gt;CustomerExpression expression = new &lt;/span&gt;CustomerDataSetExpression();&lt;br /&gt;Customer customer = expression.Interpret();&lt;br /&gt;&lt;br /&gt;&lt;span&gt;CustomerExpression expression = new &lt;/span&gt;CustomerObjectExpression();&lt;br /&gt;Customer customer = expression.Interpret();&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;There is a long way you can go with this practise because it makes you to centralise your code and hides several dirty works away from developers.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-2023128420081687809?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/2023128420081687809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=2023128420081687809' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/2023128420081687809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/2023128420081687809'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2009/01/linq-tale-of-three-datasources.html' title='LINQ And Interpreter Pattern : A tale of datasources'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-6511544370745407913</id><published>2008-11-27T02:54:00.000-08:00</published><updated>2009-01-06T07:32:04.357-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='enum'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='c# enum'/><title type='text'>Enum can now have method</title><content type='html'>Thanks to Extension method.&lt;br /&gt;&lt;br /&gt;Have you ever programmed against enum in the .NEt framework. Have you realized that the .NEt enum is not as efficient as other enum living in other platforms like the Java Land. Still the .NET enum is suffering from advance ways of using constants. An .NET enum cannot even have a method (Thats how bad it is) this is referred to constants specific method in Java.&lt;br /&gt;&lt;br /&gt;But with the method extension in the .NET framework 3.5, we can pro grammatically extend an enum with methods that makes us think that they are actually defined within the enum scope.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public enum MyEnum&lt;br /&gt;{&lt;br /&gt;Name,&lt;br /&gt;Age,&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static string RealName(this enum myEnum)&lt;br /&gt;{&lt;br /&gt;return Enum.GetName(typeof(MyName), myEnum);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;MyEnum enn = MyEnum.Name,&lt;br /&gt;&lt;br /&gt;enn.RealName();&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-6511544370745407913?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/6511544370745407913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=6511544370745407913' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6511544370745407913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6511544370745407913'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/11/enum-can-now-have-method.html' title='Enum can now have method'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-3761052826810412053</id><published>2008-11-26T02:13:00.000-08:00</published><updated>2008-11-28T03:35:01.825-08:00</updated><title type='text'>Pragmatic Approach To development. (Developing for Today and Tomorrow)</title><content type='html'>Recently i have been engrossed in a project that will contribute to the way we develop system rapidly. This project is an ORM framework that maps the impedance mismatch between the relational world and the object oriented world. I must confess its one of those projects that does not have a finished date, its a project that will continuously apply the current trend in our no destination journey of system development. What i meant by no destination is that software evolves overtime and there is no promise land, is either we re-invent the wheel and make it a better wheel or we introduce a new form of practices or complexity.&lt;br /&gt;&lt;br /&gt;I started on this project out of frustration because designing data access frameworks per the project isn't a good development practice this can lead to inconsistent development methodologies and framework will be prone to errors. In my software development lifetime i have worked on several real world projects in their hundreds, and i understand fully well what fits well in what area. Dont get me wrong, i do mistakes too, but i accept these mistakes immediately and i make it my strength. So, over the years, i have struggled to find a long lasting solutions to poor and repeated programming approach.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Develop For Tomorrow&lt;/span&gt;&lt;br /&gt;One of the greatest software practice i have learn't is not letting requirement to control the software but letting the software development process think ahead of what the requirement maybe in the nearer future. This is a proactive approach to developing a scalable and reliable applications that will cut across different environment and requirements.&lt;br /&gt;&lt;br /&gt;Most of us, developers allow software requirements to drive and predict the architecture of our software for us, so when requirement changes, we need to change heavy chunk of our code. To me thats a very bad approach and it could be very costly to organisations that are practicing such approach. Where is separation of concern, where is pragmatic development.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Requirement Volatility does not mean software volatility&lt;/span&gt;&lt;br /&gt;Feasibility checks should be done on requirements before the changes can be made. Even without full requirement, software should be built with adaptability and reconfigurability in mind, this will ensure that the volatility nature of requirements does not affect system development.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Separate as many concern as you like&lt;/span&gt;&lt;br /&gt;Recently, in Microsoft  &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/06c75ee6-14b3-4436-aa3f-cddf5629d4bc/"&gt;(MSDN) Forum&lt;/a&gt;, somebody asked a question about separating the a UI framework or layer from a data layer, many suggestions where given to this question, some say use DTO (Data transport Object) some say use interface, the bottom line is use something that wont have adverse effect on your codebase even when the underlying structure changes, be very pragmatic and scrutinize the kind of changes that are anti pattern, we are not in the procedural programming ERA, we are developing in the world of Objects (Think in objects).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Beware of hard-coding&lt;/span&gt;&lt;br /&gt;One of the major setback of good programming practices is hard coding. When developers hard code, it shows how vulnerable our codes can be, and how it is difficult to maitain and sustain. I wonder why we will leave a pragmatic approach to development (Even if it takes time, lets do it right). So never hard code, instead create constant file or xml or use enum.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-3761052826810412053?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/3761052826810412053/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=3761052826810412053' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3761052826810412053'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3761052826810412053'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/11/pragmatic-approach-to-development.html' title='Pragmatic Approach To development. (Developing for Today and Tomorrow)'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-6034450295060453616</id><published>2008-10-21T04:56:00.000-07:00</published><updated>2008-10-22T12:12:51.474-07:00</updated><title type='text'>Rapid Entity Framework: A new persistent framework</title><content type='html'>The Object Oriented Paradigm is shifting massively because coupling relational semantics into our fine grained object oriented programming designs is becoming unpopular in todays enterprise needs and domain engineering. Because of this reasons and many more, object oriented platforms is already taking a big quantum leap since the impedance mismatches between OOP and Relational has made programming against relational database an Herculean task for most development efforts.&lt;br /&gt;&lt;br /&gt;The industry is filled with many framework's that contribute to this change, and "Rapid Entity Framework" is one out of many that will solve most of the mismatches that we face in the persistence industry today. Rapid Entity Framework is an open source framework that was discovered by a motivation to really solve the divide problem between relational DB and object oriented concepts.&lt;br /&gt;&lt;br /&gt;With rapid entity framework, you can think about your business domain rather than columns and rows. Its a wise design efforts to really segregate applications according to their duties, "what they do", this segregation methodologies applied by industry today, should be applied to database and object (Because they are different concept). A database is data centric, and should only contain data and any data manipulation semantics. While on the other hand, an object oriented architecture see object as real life artifacts.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.codeplex.com/rapidentityframework/"&gt;Visit Rapid Entity Here &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-6034450295060453616?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/6034450295060453616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=6034450295060453616' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6034450295060453616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6034450295060453616'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/10/rapid-entity-framework-new-persistent.html' title='Rapid Entity Framework: A new persistent framework'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-3715894493418446317</id><published>2008-10-10T02:08:00.000-07:00</published><updated>2009-08-22T15:12:27.230-07:00</updated><title type='text'>How to do the laziest loading in C# and SQL Server (Part 1)</title><content type='html'>Mapping POCO (Plain Old CLR Object) to relational database could be a bit messy and a degradation of our application performance in terms of relational loading. There are several types of relationships in the database which we try to simulate with the object oriented language, these relationships are as follows :&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;One - To - One       (one row to one row)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;One - To Many       (one row to many rows)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Many - To -One      (many rows to one row. Inverse of the One - To Many)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Many - To - Many  (Many rows to Many rows).&lt;/li&gt;&lt;/ol&gt;When we use the above in OOP, we come up with Aggregation, inheritance, composition, containment etc. But the way the relational data is structured and stored is different from the way data is stored in the OOP world. Data are stored on the disk in the relational world while data are stored on the stack/and heap in the CLR (Common Runtime Language).&lt;br /&gt;&lt;br /&gt;So, to maximize the usage of data when we are mapping relational to object oriented, we need to use a pattern called &lt;span style="font-weight: bold;"&gt;"Lazy Loading"&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is Lazy Loading.&lt;/span&gt;&lt;br /&gt;Simply, lazy loading can be described as an approach for loading objects or data when we need them. This helps to save &lt;span style="font-weight: bold;"&gt;CPU&lt;/span&gt; cycles because we do not intend to load what we do not need, thereby we free our heap from unessary usage, and the almighty deallocator, the Gargbage collector can go to sleep. Simple lazy loading example can be described as follows :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public IList Customers&lt;br /&gt;{&lt;br /&gt;get{&lt;br /&gt;if(null == customer)&lt;br /&gt;customers = LoadCustomers();&lt;br /&gt;&lt;br /&gt;return customers;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;From the above code snippet, we are checking for null values and if lists of customers is not null, we load the already loaded lists of customers; else we load new ones. This is a classic lazy loading feature. This kind of lazy loading will still load all customers, except a stub that refers to the list that contains the data is returned. But in the case of the classic lazy-loading, we are loading everything and returning everything. (Thats Bad, isn't it).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Concept of Laziest Loading&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Let us assume the following relationships between two objects, &lt;span style="font-weight: bold;"&gt;Customer&lt;/span&gt; has many &lt;span style="font-weight: bold;"&gt;Orders&lt;/span&gt; . The relationships that we described above is a &lt;span style="font-weight: bold;"&gt;One - To - Many&lt;/span&gt; scenairo, One customer to many orders, the following class diagram and code depicts the relationship :&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_XwziUoKLz60/SO8leTG5ndI/AAAAAAAAACU/xtiO2Wjadx8/s1600-h/onetomanyrelation.PNG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_XwziUoKLz60/SO8leTG5ndI/AAAAAAAAACU/xtiO2Wjadx8/s320/onetomanyrelation.PNG" alt="" id="BLOGGER_PHOTO_ID_5255460492620176850" border="0" /&gt;&lt;/a&gt;The relationships in the diagram says one instance on a customer class will have multiple instances of an order in its relationship bag. And one instance of an order, will have one instance of a customer class. Thats it.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Perfect Solution &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the classic lazy loading scenario, we are loading everything once it is required, even if we do not intend to use everything in the list, we end up fetching objects into the list which they will all be allocated memory space on the heap. unwanted objects made its way to the CLR heap, thats not what we bargained for.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;What if we create our own special list and a class that implements IEnumerator for a special case of doing the laziest loading. The following diagram depicts our new concepts of laziest loading of data structure using our custom built list (implements from IList) and custom iterator, inplements IEnumerator : The diagram below represents the concept of the laziest loading and relational to object transformation, using datareader and our custom enumerator class.&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_XwziUoKLz60/SO8wsrQPxYI/AAAAAAAAACc/3r5nn1yNa60/s1600-h/iteratorlazyloadingpattern.PNG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 490px; height: 211px;" src="http://3.bp.blogspot.com/_XwziUoKLz60/SO8wsrQPxYI/AAAAAAAAACc/3r5nn1yNa60/s320/iteratorlazyloadingpattern.PNG" alt="" id="BLOGGER_PHOTO_ID_5255472834247902594" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;Looking at the diagram, we will realize that there are three sections, the Custom enumeration section, the Data Reader, and the the relationship sections.  This sections mapped to themselves properly to achieve the laziest loading i have been talking about.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Datareader mapping with Custom Enumerator&lt;/span&gt;&lt;br /&gt;When you create a custom enumerator, you will implement the IEnumerator interface, which will give you various method and properties to override, but in this article, i will be talking about three methods that are very useful in our lazy loading scenario. The idea is to lazily load objects from the database when they are iterated instead of when the whole list is called. For that to happen, we need an open data reader that we need to read when the GetEnumerator method of the list that use's this Enumerator is called.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Enumerator MoveNext Mapped to DataReader Read&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When there is a call to our List (Probably you need to create a custom list that implements IList, and returns our custom Enumerator). When in a froeach loop, an iterator can know if it has data to iterate with the call to movenext method. And since we are fetching from the database, we need to call the Read method of our DataReader here, this will ensure that our dataReader moves it cursor to the next row in the list. This can also return false to indicate that there is no more row to read.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;      public bool  MoveNext()&lt;br /&gt;      {&lt;br /&gt;           return dataReader.Read();&lt;br /&gt;      }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Current and DataReader Get[Type]&lt;/span&gt;&lt;br /&gt;Enumerator Current property used to translate DataReader Get[DataType] to our domain or entity object. For example, let us look at the code snippet below :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;      public object  Current&lt;br /&gt;      {&lt;br /&gt;          get&lt;br /&gt;          {&lt;br /&gt;              ProductOrder order = new ProductOrder();&lt;br /&gt;              order.OrderDate = Convert.ToDateTime(dataReader[1]);&lt;br /&gt;              order.OrderName = Convert.ToString(dataReader[2]);&lt;br /&gt;&lt;br /&gt;              return order;&lt;br /&gt;          }&lt;br /&gt;      }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Enumerator Dispose Method (If you implement IDisposable)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The disposed method is fired when you exit the foreach loop, or you read the list to the end, or you break from the list. It is a wise idea to close the datareader in the dispose section, and before you close the datareader, it is wise to keep moving the datareader till it gets to its last (In case the loop was exited with break statement). The connection shouldnt be close here, because you may be using it for other database operations (Especially if you are using MARS (Multiple Active Result Sets) new feature in &lt;span style="font-weight: bold;"&gt;"SQL 2005 YUKON"&lt;/span&gt;. The following code snippet, depicts the kind of stuffs that you can do with the dispose method :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;       public void  Dispose()&lt;br /&gt;       {&lt;br /&gt;        while(dataReader.Read())&lt;br /&gt;          {&lt;br /&gt;              //Do not do anything again here. This is called when you exit the loop&lt;br /&gt;              //By end of loop or break statement.&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;          dataReader.Close();&lt;br /&gt;       }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This is just the beginning, so watch out for part two when we create lazy loading handlers delegates and when i introduce you all to Ghosting or Dynamic Proxy in C# using IL (Intermediate Language).  Thanks.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://salakoahmed.blogspot.com/2009/07/generating-proxy-from-interfaces-using.html"&gt;You can now find the Dynamic Proxy Part 1 here &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-3715894493418446317?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/3715894493418446317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=3715894493418446317' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3715894493418446317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3715894493418446317'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/10/how-to-do-laziest-loading-in-c-and-sql.html' title='How to do the laziest loading in C# and SQL Server (Part 1)'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_XwziUoKLz60/SO8leTG5ndI/AAAAAAAAACU/xtiO2Wjadx8/s72-c/onetomanyrelation.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-6261857724391276109</id><published>2008-10-06T02:42:00.000-07:00</published><updated>2010-06-10T02:25:24.931-07:00</updated><title type='text'>Validating Domain Objects</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introducing Domain Engineering :&lt;/span&gt;&lt;br /&gt;All OOP Languages allow users to create reusable components that cut across different domains in any business context. These components becomes an reusable asset to the practicing organization. It is called cross cutting concerns and  also referred to the art of grouping objects/data's into families of system (Domain Engineering). The system families are distributed across application domains (With common variabilities and commonalities) within the same organization and/or entire world. The paradigm shift from application engineering to domain engineering gives us the gains of building reusable families of systems.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What are family of system's?&lt;/span&gt;&lt;br /&gt;A system family is a library of components that are easily configured with other systems. In .NET a system family could be an .NET assemblies, and in JAVA it is the jar files which contains domain artifacts. When building domain objects we need to ensure that they represent what they are so as not to over engineer a system that will later on back-fire on our investments.&lt;br /&gt;&lt;br /&gt;Let us assume the following scenario of a banking system : We have Customer, Account, Statements etc.&lt;br /&gt;&lt;br /&gt;If we need to implement the above banking domain issues in C#, we will be modeling them each as C# POCO (Plain Old CLR Object) objects. The following diagrams forms what we would be implementing as our domain artifacts :&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_XwziUoKLz60/SOoxIr4djZI/AAAAAAAAACM/FWVuCU5T8W8/s1600-h/bankingrelations.PNG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://4.bp.blogspot.com/_XwziUoKLz60/SOoxIr4djZI/AAAAAAAAACM/FWVuCU5T8W8/s320/bankingrelations.PNG" alt="" id="BLOGGER_PHOTO_ID_5254065940569361810" border="0" /&gt;&lt;/a&gt;You can see the relationships that these object holds to themselves. An Customer object has many account. An customer object also have many statements to one account. This is a simple design of a banking domain system. If we are to create these classes, and add them in a single assembly (JAR file in Java), then, they become reusable across application domains and interfaces.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Mapping domain objects to relational database&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;The advent of the Object Oriented Relational Mapping has finally come, when the bigger guys in the OOP language community already have the framework interwoven with their runtime systmes. The two main OOP player of today are the .NET framework and the Java Runtime. The .NET framework has introduced the Entity Framework, while the Java people introduced java persistent framework (JPA). The mismatch between relational database and object orientation will soon be over.&lt;br /&gt;&lt;br /&gt;When we map components or domain object to a relational database table, we are abstracting the relational semantics away from our code, which is a better thing to do. The following is the &lt;span style="font-weight: bold;"&gt;Customer&lt;/span&gt; code of the banking domain object in the above diagram.&lt;br /&gt;&lt;br /&gt;Note the Customer class in the code below inherits from the BaseModel class, which is an abstract class that marks that our domain object can be validated. Note in your implementation, you can use an interface.&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public abstract class BaseModel&lt;br /&gt;{&lt;br /&gt;public abstract bool CanValidate { get;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class Customer : BaseModel&lt;br /&gt;{&lt;br /&gt;private List &lt;&gt; statements = new List&lt;statements&gt;();&lt;br /&gt;&lt;br /&gt;public List &lt;&gt; Statements&lt;br /&gt;{&lt;br /&gt;get { return statements; }&lt;br /&gt;set { statements = value; }&lt;br /&gt;}&lt;br /&gt;private List &lt;&gt; accounts = new List&lt;account&gt;();&lt;br /&gt;&lt;br /&gt;public List &lt;&gt; Accounts&lt;br /&gt;{&lt;br /&gt;get { return accounts; }&lt;br /&gt;set { accounts = value; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/account&gt;&lt;/statements&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Domain Validation Rule Class&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;Since our domain objects are our relational table representation, we need to ensure that there is a valid object oriented validation before the state of our domain object hits the back end. What is a validation rule. In this example, domain rules are created as .NET attributes, and they will be used on properties of domain objects. For example of some domain rule, here are two types of rules :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Max Length Rule&lt;/span&gt;    This rules checks the maximum length of a data in a property of a domain object. It inherits from the CustomValidationAttribute abstract class, which will be used to validate any domain object that inherits from the BaseModel&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;class MaxLengthRule : CustomValidationAttribute&lt;br /&gt;{&lt;br /&gt;private int min;&lt;br /&gt;&lt;br /&gt;public int Min&lt;br /&gt;{&lt;br /&gt; get { return min; }&lt;br /&gt; set { min = value; }&lt;br /&gt;}&lt;br /&gt;private int max;&lt;br /&gt;&lt;br /&gt;public int Max&lt;br /&gt;{&lt;br /&gt; get { return max; }&lt;br /&gt; set { max = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;internal override bool IsValid&lt;t&gt;(T value)&lt;br /&gt;{&lt;br /&gt; if (null == value)&lt;br /&gt;     return false;&lt;br /&gt;&lt;br /&gt; string text = value.ToString();&lt;br /&gt;&lt;br /&gt; return (text.Length &gt;= min &amp;amp;&amp;amp; text.Length &lt;= max);         }     } &lt;/t&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NotNull rule&lt;/span&gt;  : This rule checks if a property is null.&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;internal class NotNullRule : CustomValidationAttribute&lt;br /&gt;{&lt;br /&gt;private object value;&lt;br /&gt;&lt;br /&gt;public object Value&lt;br /&gt;{&lt;br /&gt; get { return this.value; }&lt;br /&gt; set { this.value = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;internal override bool IsValid&lt;t&gt;(T value)&lt;br /&gt;{&lt;br /&gt; return (null != value);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/t&gt;&lt;/div&gt;&lt;br /&gt;Let us now decorate our POCO Customer class with our validation rules. The code below show how we will decorate our domain object with attributes of our validation rule :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public class Customer : BaseModel&lt;br /&gt;{&lt;br /&gt;private List &lt;&gt; statements = new List&lt;statements&gt;();&lt;br /&gt;&lt;br /&gt;[NotNullRule]&lt;br /&gt;public List &lt;&gt; Statements&lt;br /&gt;{&lt;br /&gt;get { return statements; }&lt;br /&gt;set { statements = value; }&lt;br /&gt;}&lt;br /&gt;private List &lt;&gt; accounts = new List&lt;account&gt;();&lt;br /&gt;&lt;br /&gt;[NotNullRule]&lt;br /&gt;public List &lt;&gt; Accounts&lt;br /&gt;{&lt;br /&gt;get { return accounts; }&lt;br /&gt;set { accounts = value; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/account&gt;&lt;/statements&gt;&lt;/div&gt;&lt;br /&gt;Note that we have decorated our customer class with our &lt;span style="font-weight: bold;"&gt;NotNull &lt;/span&gt;&lt;span&gt;Validation&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span&gt;rule&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;This rule ensures that the value of the properties is not null&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;.&lt;br /&gt;&lt;br /&gt;Creating the The CustomValidationAttribute class&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;This class is the base class of all the validation rules that are used in this example, and it holds the entry points to the Validate method which takes the model as parameter. The following code snippet is the full code definition of the CustomValidationAttribute.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;[AttributeUsage(AttributeTargets.Property)]&lt;br /&gt;abstract class CustomValidationAttribute : Attribute&lt;br /&gt;{&lt;br /&gt;   abstract internal  bool IsValid&lt;t&gt;(T value);&lt;br /&gt;&lt;br /&gt;   internal static bool Validate&lt;t&gt;(T model) where T : BaseModel&lt;br /&gt;   {&lt;br /&gt;       Type modelType = GetModelType(model);&lt;br /&gt;       List&lt;bool&gt; validities = new List&lt;bool&gt;();&lt;br /&gt;&lt;br /&gt;       foreach (PropertyInfo propertyInfo in modelType.GetProperties())&lt;br /&gt;       {&lt;br /&gt;           object[] customAttributes = propertyInfo&lt;br /&gt;               .GetCustomAttributes(typeof(CustomValidationAttribute), true);&lt;br /&gt;&lt;br /&gt;           object value = FindValueByRule(propertyInfo, model);&lt;br /&gt;           foreach (CustomValidationAttribute attribute in customAttributes)&lt;br /&gt;           {               &lt;br /&gt;               validities.Add(attribute.IsValid(value));&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       return validities.TrueForAll(el =&gt; el == true);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   private static Type GetModelType(object instance)&lt;br /&gt;   {&lt;br /&gt;       return instance.GetType();&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   private static object FindValueByRule(PropertyInfo propertyInfo, object model)&lt;br /&gt;   {&lt;br /&gt;       return propertyInfo.GetValue(model, null);&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;/bool&gt;&lt;/bool&gt;&lt;/t&gt;&lt;/t&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The code above is the full defination of the base validator class. And to use the validation strategy which i have been explaining, we need to make the following simple call which returns a boolean flag that tells us if our Domain model is valid or not .&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;Customer customer = new Customer();&lt;br /&gt;&lt;br /&gt;bool isValid = CustomValidationAttribute.Validate(customer);&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The code above returns a boolean that indicates if the validation operation is valid or not. Happy domain validation.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-6261857724391276109?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/6261857724391276109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=6261857724391276109' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6261857724391276109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/6261857724391276109'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/10/validating-domain-objects.html' title='Validating Domain Objects'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_XwziUoKLz60/SOoxIr4djZI/AAAAAAAAACM/FWVuCU5T8W8/s72-c/bankingrelations.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-2205033440622910637</id><published>2008-09-26T01:32:00.001-07:00</published><updated>2008-09-27T09:01:30.871-07:00</updated><title type='text'>Unifying Object Oriented Platforms</title><content type='html'>The Object Oriented Programming ERA is a never ending story. New platforms are being created every day. Older platforms are considered outdated, but we see them struggling for supremacy over newer and innovative ones. When Java formerly known as OAK technology joined the OOP party in the 90's, its aim was to support consumer electronics such as remote control, PDA's etc. But unfortunately, Sun microsystems lost's the bid for the consumer electronics project, which was the motive behind java. Yet, the JAVA technology quickly moved into the internet platform, seeing that java is promising in the internet era gave birth to the Java applets (an application that can run within a web browser). Java became the talk of the development industry, little did we know that some people somewhere in Redmond street are planning to revolutionise the way we write software using OOP.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;The promises that Java made&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Java promised to be the platform indepent OOP that will run on any operating system, mobile phones, wrist watches etc. This promise was meet with the different types of JRE (Java Runtime) that handles the native interpretation's of the Java's Bytecode into the native language. Java did not stop there but made its way through to the enterprise and server-side programming language. When J2EE was firnally introduced into the enterprise market, java became the popular platform amongst industries. Although java's cross platform features suffers performance problems over native languages because the JVM ( Java Virtual Machine ) had to be responsible for the lower level work that would have been done by the OS if it were to be a native language like C. But JAVA loyalist did not relent on the bitter side of the java technology, they concentrate more on the better side, which have seen java as the champion from inception.&lt;br /&gt;&lt;br /&gt;But java seems to be losing out, because C# as an Object oriented Programming language is moving as fast as possible to solve the problems of software development using OOP. Still both JAVA and C# are learning from one and other.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;And there was .NET&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Java solves the problem of multiple platforms, but not that of multiple languages. In this our industry that is full of several programming languages, standards and patterns. There is no silver bullet that will unify these platforms. People writing java should be able to exchange components with people writing c#. These components should interoperate without any native tweaks or call.&lt;br /&gt;&lt;br /&gt;Microsoft understands these trouble's very well, and that is why the .NET approach is to unify programming languages that targets the .NET platform. Now at last we can all invest in any kind of languages while we still use our older systems because they integrate very well with the newer ones.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;But did .NET solve the problem?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;.NET is not really platform independent, because .NEt was built for the windows operating systems. But there is a MONO &gt;&gt; &lt;a href="http://www.mono-project.com/Main_Page"&gt;http://www.mono-project.com/Main_Page&lt;/a&gt; project concentrating on making .NET runtime on the Linux, Solaris, Mac OS and even windows operating system. The news is Mono sponsored by Novell is an open source project and it is based on ECMA/ISO standards, the same standard for C#.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Bringing all platforms together&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Time as come for us all to stop tying our developments efforts with platforms and or runtimes, time has come for us to stop using the re-inventing the wheel approach, because we can all leverage our existing systems even if we are to move from one platform to the other.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;IS Mono the answer?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Mono can run .net languages as well as java, phython, Boo, PHP, javascript and many more &lt;a href="http://www.mono-project.com/Languages"&gt;http://www.mono-project.com/Languages&lt;/a&gt; . This is the long awaited universe for the software development community. A unified approach that targets different platforms and natives. Can you imagine yourselves speaking french without learning french, thats the MONO approach. We have waited so long for some thing to bring us all together, and here MONO presents itself as an opportunity.&lt;br /&gt;&lt;br /&gt;MONO is not really the answer. I my experience of software developments and use of various technologies to solve problems, the real problem we are facing is complexity. I am very sure there is some kinds of complexity behind the use of MONO. What about learning curve, should we throw away our over the years experience in other platforms for another platform. Do we really need an interpreter for all languages? Do we need a language converter instead?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-2205033440622910637?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/2205033440622910637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=2205033440622910637' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/2205033440622910637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/2205033440622910637'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/09/unifying-object-oriented-platforms.html' title='Unifying Object Oriented Platforms'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-3174974813089139080</id><published>2008-09-08T08:00:00.000-07:00</published><updated>2008-09-10T03:55:02.089-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='enpoints'/><category scheme='http://www.blogger.com/atom/ns#' term='address'/><category scheme='http://www.blogger.com/atom/ns#' term='webservices'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><category scheme='http://www.blogger.com/atom/ns#' term='interceptors'/><title type='text'>How to implement a generic WCF message interceptor:</title><content type='html'>In a changing business environment and business processes; changes affects not only the entire work force, cooperate partners, the way businesses are done and of course our tools that makes our work life better. We are left with the choice of ensuring that our legacy or existing system inter-operate well into our new ways of life and they deliver the expected result that yields expected ROI. Because for today's business to survive, we need to carry along with us our efforts of yesterday, we need to have decoupling in mind when we are integrating services for a wider business sector. These were the thoughts in Microsoft when it first launched the framework (WCF) that shook the whole distributed computing industry.&lt;br /&gt;&lt;br /&gt;Windows Communication Foundation is a Microsoft initiative of building Service Oriented Applications that leverages yesterdays and todays technologies, in fact it complements existing distributed technologies. The WCF (Windows Communication Foundation) infrastructure is built into .NET 3.0/3.5 and can be leveraged for different kinds of communication types/endpoint, that ranges from Message Queue, TCP communication, standard webservices, service based webservices. The most commonly used approach is the Service based where you can host it as .asmx or .svc.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;In a typical WCF implementation, we have the following :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Datacontract&lt;/span&gt;. Represents the data that will be wired from one endpoint to the other. Any CLR compliant type marked as datacontract can be serialized and wired over the communication protocol.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Message Contract :&lt;/span&gt; Think of messages as envelopes, that wraps up our data/data contracts over the wire. Our message have a body and header section. It is analogous to SOAP envelope, in-fact it is converted to a SOAP envelope when the message serialization begins at runtime.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Service Contract :&lt;/span&gt; Here is the interface that is marked [ServiceContract] which can be called remotely by clients of the service. In our service, we will implement this interface and provide business functionalities that clients will consume and call remotely. Services can expose one - To - Many endpoints (Listener point), and more than one service operations can be exposed by an endpoint.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Service Endpoint :&lt;/span&gt; Think of an endpoint as message gateways for services that are hosted. A service can be configured to listen for request in different endpoints. A service Endpoint has an Address, a Binding, and a Contract.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ol style="text-align: left;"&gt;&lt;li&gt; An  address that describes the location where messages can be sent.&lt;/li&gt;&lt;li&gt;A Binding specifies the type of communication that an endpoint can make using protocols such as HTTP, TCP, MSMQ and security requirements such as SSL, WS-Security etc.&lt;/li&gt;&lt;li&gt;Contract : The binding contract are sets of messages that defines sets of operations that can be accessed by the service clients.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Message Oriented Concept In WCF&lt;/span&gt;&lt;br /&gt;I mentioned above that the service contract defines operations that are used to send request and response messages over the transport layer defined by the service endpoint. In a simple client/server architecture, messages can be coupled between sending interface and the receiving end. That is there is a stub and skeleton relationship between the service and the consumers. Although, there is noting wrong in the stub and skeleton approach, that is a client\consumer keeps a stub or proxy of the services that it can talk to. This means when a service changes the client is regenerated using svcutil.exe tool for re-generation of the service stubs.&lt;br /&gt;&lt;br /&gt;In an ever changing world of buisiness, we need to build services with simplycity in mind, conformance to changes. How do we allow a generic communication between our service and the rest of the world. Thinking about generic-ability of our services, we need to create an interceptor service that sits in between our clients and services, although the contract binding will be between our client and service, but the address binding will be between our client and the interceptor.&lt;br /&gt;&lt;br /&gt;Having understood the basics of the WCF fundamentals, we need to now understand how to pass messages in a generic context.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Interceptor Pattern&lt;br /&gt;&lt;/span&gt;&lt;span&gt;This&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span&gt;pattern came into mind when i fell deeply into a WCF scenario that requires changing of service messages or re-delegating a service request to other service other than the requested one.  Also you can use this pattern to achieve load-balancing amongst services.&lt;br /&gt;&lt;br /&gt;One of the reason's why you might want to use an interceptor pattern is the following :&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Expose a single entry to the entire world with the interceptor/facade.&lt;/li&gt;&lt;li&gt;Do load - balancing with the interceptor.&lt;/li&gt;&lt;li&gt;Expose a REST (Representational State Transfer) to the world while your back - end service supports WCF semantics, so you need an interceptor to bridge the gap between the pure xml and soap messages required by the WCF services.&lt;/li&gt;&lt;li&gt;Manipulating/ validation on the facade/interceptor end before delegating to the actual service.&lt;/li&gt;&lt;li&gt;A form of clean architecture design pattern&lt;/li&gt;&lt;li&gt;Securability as single entry is used as the entry point. Security is focused on that single entry instead of all&lt;br /&gt;&lt;/li&gt;&lt;li&gt;etc&lt;/li&gt;&lt;/ul&gt;The list above goes on and on without end, and there isnt a limit to what our services mediator can achieve. So how do we do the coding (Good Question) : so lets start with defining our service contract :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;[ServiceContract(SessionMode = SessionMode.Allowed)]&lt;br /&gt;public interface IRequestDispatcher&lt;br /&gt;{&lt;br /&gt;  [OperationContract(IsOneWay = false, Action = "*", ReplyAction = "*")]&lt;br /&gt;  System.ServiceModel.Channels.Message ProcessMessage(System.ServiceModel.Channels.Message message);&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Note the ProcessMessage operation in our IRequestDispatcher contract, this operation accepts and return a Message from the System.ServiceModel.Channels namespaces and it is the only operation that we need to generically or intercept message calls from client and server.&lt;br /&gt;&lt;br /&gt;You will also note that the ProcessMessage method is decorated with [OperationContract(IsOneWay = false, Action = "*", ReplyAction = "*")]. This is to tell our service that our method (ProcessMessage) can process any operation call from different client, by marking it Action = "*" and ReplyAction = "*" . This is the basic of our interceptor strategy.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Big Picture&lt;/span&gt;&lt;br /&gt;Lets have a simple picture of what we want to achieve. We have two WCF services one accepts a string and returns a string, the other accepts an object and returns a string. This services are our back office operations that is open to services that are within our domain. Assuming we want to expose this services to the entire world, we will end up exposing two services. So, if any of the services changes, that means the entire world will have to change with it, this is quite burden some. So, instead of exposing the two services, we have to expose only one service that is generic to all other services, and this service communicates in REST - FUL manner (pure XML and no soap messaging).&lt;br /&gt;&lt;br /&gt;Lets define the big picture of&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-3174974813089139080?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/3174974813089139080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=3174974813089139080' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3174974813089139080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3174974813089139080'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/09/how-to-implement-generic-wcf-message.html' title='How to implement a generic WCF message interceptor:'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-3262057835826009241</id><published>2008-09-03T06:42:00.000-07:00</published><updated>2009-09-24T03:45:14.771-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='fire and forget'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='publisher and subscriber'/><category scheme='http://www.blogger.com/atom/ns#' term='state machine'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Asynchronous State Machine Pattern. (The C# Way)</title><content type='html'>Experienced Software developers/programmers and architects enjoys separation of concern approach when building reusable components using the domain engineering practice.&lt;br /&gt;We all understand that as part of separating application concerns, we need to ensure that our applications are purely decoupled away from dependencies and we need to ensure we properly inject those dependencies without coupling.&lt;br /&gt;&lt;br /&gt;As we mature in decoupling our applications and components, we also must understand that, as part of dependency injection, we need to understand the underlying theories behind the publisher and subscriber pattern (Popularly known as fire and forget). Experience have  shown that writing application without decoupling in mind is a way of creating problems for the nearer future, this approach is referred to conventional based application engineering. Most developers win and rush to market by launching an application that is very difficult to debug, an application that is overly designed , an application that is very tightly coupled and does not give room to changing and demanding business cases.&lt;br /&gt;&lt;br /&gt;We can imagine two processes that handles heavy jobs (like handling about 50,000 calls in a day) coded in a more tightly coupled manner, these processes, by all standards, can handle their concerns differently without one waiting for the other to finish executing. In a service oriented architecture, where business processes are shipped/designed as web services/windows services, we need to carefully understand when to use an asynchronous call and a synchronous call, because of the load involved in processing a request.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Scenario 1&lt;/span&gt;&lt;br /&gt;Let us all look at this simple analogy: We have a Business Process Services that handles our business processes like our internal/ and external business concerns. Our business process services comprises of the following functionality :&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Register new customer&lt;/li&gt;&lt;li&gt;Register with payment gateway&lt;/li&gt;&lt;li&gt;Send notifications&lt;/li&gt;&lt;li&gt;make periodical payment&lt;/li&gt;&lt;li&gt;Calculate due payment&lt;/li&gt;&lt;li&gt;Daily status monitoring.&lt;/li&gt;&lt;/ol&gt;Before i go ahead talking more about our area of concern, i would like to introduce a simple architectural diagram of our case study, so that you can catch a glimpse of what big picture i have got in my mind. Here we go, architecture :&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_XwziUoKLz60/SL6e3cAlCaI/AAAAAAAAAAk/4x0yX9HWf84/s1600-h/architecture.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 337px; height: 316px;" src="http://3.bp.blogspot.com/_XwziUoKLz60/SL6e3cAlCaI/AAAAAAAAAAk/4x0yX9HWf84/s320/architecture.jpg" alt="" id="BLOGGER_PHOTO_ID_5241801691554449826" border="0" /&gt;&lt;/a&gt;The architecture digram above, shows that our business process handles several business functionalities, so it wont be wise to do a synchronous call on our business service's. One of the scenario that we may need to use the separation of concern strategy i have been talking about is when we happen to be in the following scenario :&lt;br /&gt;&lt;br /&gt;The daily processor runs.&lt;br /&gt;The status functionality Begins.&lt;br /&gt;The payment is calculated.&lt;br /&gt;Notification is sent. (Based on status).&lt;br /&gt;&lt;br /&gt;At the end of each business cycle processing, i mean,  our business logic processing, the end task is to send a notification (email). If we have more than 40, 000 status checks, which in turn leads to thousands of business criteria to meet. I mean if we call the method in our service (CheckStatus()) 40, 000 times, a single call will invoke several operations, several operations will launch other legacy stuffs, other legacy stuffs will have their own custom built operations as well, we can see that for a single operations, the load on the Business service is very high, what about for 40, 000 operations. As we must remember, the process calling our business service is also tide with our service until the notifications is sent.&lt;br /&gt;&lt;br /&gt;It would be very nice to tell our business process that a customer needs status checks, and thats all, we do not need to wait for our business process to tell us yes or no. All we are satisfied with is that we handled the call to business process. Then asynchronously, our business process will handle all the dirty work without locking its caller. So we now understand where to use asynchronous communication, let us diggit with code :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;First of all we need to create the event argument that is raised when a status has been meet. Note* i wont be writing full code here, as readers are assumed to be an experienced developer.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;public class StatuChangeEventArgs : EventArgs&lt;br /&gt;{&lt;br /&gt;CustomerState CustomerState{get; set;}&lt;br /&gt;&lt;br /&gt;public StatuChangeEventArgs(Customer customer){ //Initialize here. }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public enum CustomerState&lt;br /&gt;{&lt;br /&gt; Stateless = 0,&lt;br /&gt; CreditCardDetailsExpired = 100,&lt;br /&gt; PaymentNotice = 200,&lt;br /&gt; PaymentFailure = 300,&lt;br /&gt; CanCalculateFirstPayment = 600,&lt;br /&gt; PaymentChangeNotified = 1000,&lt;br /&gt; DefaultState = Stateless,&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The code above is the kinds of state that our customer can fall into, in our scenario. No let us see the State engine implementation : First how to we fire an event to our state handlers that need to consume the events and do other processing based on these event/state that was raised. We need a delegate at first :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;public delegate void CustomerStateUpdate(object source, StatusChangeEventArgs eventArgs);&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now we have successfully defined our delegate that serve as the template of our event handler. Remember, we are handling different customer state asynchronously, that is, the application or service that send us the customer object will not know about our processing and it wont wait for results.&lt;br /&gt;&lt;br /&gt;Now we need to implement the state Publisher, that is the class that scan a customer object, fire the CustomerStateChangeEvent, and also registers interested subscribers to the state event. Here is a simple structure :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;public class CustomerStatePublisher&lt;br /&gt;{&lt;br /&gt; public event CustomerStateUpdate CustomerStateEvent;&lt;br /&gt; StatuChangeEventArgs eventArgs;&lt;br /&gt; Customer customer;&lt;br /&gt;&lt;br /&gt; public CustomerStatePublisher(Customer customer, StatusChangeEventArgs eventArgs)&lt;br /&gt; {&lt;br /&gt;    this.eventArgs = eventArgs;&lt;br /&gt;    this.customer = customer;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void AddSubscriber(CustomerStateUpdate subscriber)&lt;br /&gt; {&lt;br /&gt;    CustomerStateEvent += subscriber;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void RemoveSubscriber(CustomerStateUpdate subscriber)&lt;br /&gt; {&lt;br /&gt;    CustomerStateEvent -= subscriber;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void OnCustomerStateChanged(CustomerState customerState)&lt;br /&gt; {&lt;br /&gt;     //We are not processing stateless customer&lt;br /&gt;     if (customerState == CustomerState.Stateless)&lt;br /&gt;         return;&lt;br /&gt;&lt;br /&gt;     if (null != CustomerStateEvent)&lt;br /&gt;     {&lt;br /&gt;         eventArgs.CustomerState = customerState;&lt;br /&gt;  &lt;br /&gt;         //CustomerStateEvent(this.customer, eventArgs);&lt;br /&gt;  &lt;br /&gt;         Delegate[] customerStateHandlers = CustomerStateEvent.GetInvocationList();&lt;br /&gt;&lt;br /&gt;         foreach (Delegate handler in subscriptionStateHandlers)&lt;br /&gt;         {&lt;br /&gt;             CustomerStateUpdate eventHandler = (CustomerStateUpdate)handler;&lt;br /&gt;             eventHandler.BeginInvoke(this, eventArgs, new AsyncCallback(AsyncReturn), eventHandler);&lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; private void AsyncReturn(IAsyncResult result)&lt;br /&gt; {&lt;br /&gt;     CustomerStateUpdate eventHandler =&lt;br /&gt;         (CustomerStateUpdate)result.AsyncState;&lt;br /&gt;&lt;br /&gt;     eventHandler.EndInvoke(result);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void ProcessCustomerState()&lt;br /&gt; {&lt;br /&gt;     RaiseStateChangedEvent(customer.CanCalculateFirstPayment());&lt;br /&gt;     RaiseStateChangedEvent(customer.CanCreatePendingPayment());&lt;br /&gt;     RaiseStateChangedEvent(customer.CheckCreditCardState());&lt;br /&gt;     RaiseStateChangedEvent(customer.OweMoney());&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public void RaiseStateChangedEvent(CustomerState customerState)&lt;br /&gt; {&lt;br /&gt;     if (customerState != customerState.Stateless)&lt;br /&gt;         OnCustomerStateChanged(customerState);&lt;br /&gt; }         &lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The class structure above is very simple to understand, so i will just point out where the asynchronous functionality is our code. The &lt;span style="font-weight: bold;"&gt;OnCustomerStateChanged&lt;/span&gt; method of this class calls all the registered subscriber to this event asynchronously, by getting the invocation list from the CustomerStateEvent (CustomerStateEvent.GetInvocationList();) iterating through it and call the BeginInvoke asynchronously, at this point, in our real world implementation of this, we should just detach from our caller service, and allow the asynchronously operations to run.&lt;br /&gt;&lt;br /&gt;Now, since we have fully defined our CustomerStatePublisher class, we need to fully understand how we are going to register subscribers, and how we will begin, processing of our asynchronous state machine. The following code describe how we will register a subscriber to the CustomerStatePublisher, and how we will begin state processing :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;          //&lt;b&gt;Create an instance of the Customer StateChangeEvent&lt;/b&gt;&lt;br /&gt;         CustomerChangeEventArgs eventArgs = new CustomerChangeEventArgs();&lt;br /&gt;     &lt;br /&gt;          //&lt;b&gt;Create an instance of the customer state publisher&lt;/b&gt;&lt;br /&gt;         CustomerStatePublisher publisher = new CustomerStatePublisher(customer, eventArgs);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;          publisher.AddStateObserver(new CustomerStateUpdate(StateHandler.CalculateFirstPayment));&lt;br /&gt;          publisher.AddStateObserver(new CustomerStateUpdate(StateHandler.PendingPaymentChanged));&lt;br /&gt;          publisher.AddStateObserver(new CustomerStateUpdate(StateHandler.CreatePendingPayment));&lt;br /&gt;          publisher.AddStateObserver(new CustomerStateUpdate(StateHandler.TrialWillExpireNotification));&lt;br /&gt;          publisher.AddStateObserver(new CustomerStateUpdate(StateHandler.CreditCardExpiryNotification));&lt;br /&gt;          publisher.AddStateObserver(new CustomerStateUpdate(StateHandler.FreeServiceNotice));&lt;br /&gt;&lt;br /&gt;          publisher.ProcessState();&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The rest of the code is to define the subscribers, that is the StateHandlers that handles the state based on the state it can handle. A simple example is an implementation of one of the state handler.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;br /&gt;      public void CustomerCreditCardExpire(object source, CustomerChangeEventArgs eventArgs)&lt;br /&gt;      {&lt;br /&gt;          if (eventArgs.CustomerState != CustomerState.CreditCardDetailsExpired)&lt;br /&gt;              return;&lt;br /&gt;&lt;br /&gt;          //Execute statebased functionality here.&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Having done the following, when control hits the publisher.ProcessState(); method, the whole state processing begins and a befitted state handler is found, the publisher now delegate the handler to handle the state. I would require more suggestions from you all. Thanks.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-3262057835826009241?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/3262057835826009241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=3262057835826009241' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3262057835826009241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/3262057835826009241'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/09/publisher-subscriber-pattern-c-way.html' title='Asynchronous State Machine Pattern. (The C# Way)'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_XwziUoKLz60/SL6e3cAlCaI/AAAAAAAAAAk/4x0yX9HWf84/s72-c/architecture.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-5480144829971128971</id><published>2008-09-03T01:50:00.000-07:00</published><updated>2008-09-03T06:25:23.364-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='process improvement'/><category scheme='http://www.blogger.com/atom/ns#' term='SPICE'/><category scheme='http://www.blogger.com/atom/ns#' term='salako ahmed'/><category scheme='http://www.blogger.com/atom/ns#' term='CMMI'/><category scheme='http://www.blogger.com/atom/ns#' term='TSP'/><category scheme='http://www.blogger.com/atom/ns#' term='SPI'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='PSP'/><category scheme='http://www.blogger.com/atom/ns#' term='CMM'/><category scheme='http://www.blogger.com/atom/ns#' term='ISO'/><title type='text'>Progress and Obstacles of software process improvement (SPI) models</title><content type='html'>This document critically evaluates the progress and obstacles of software process improvements since 1996. It addresses the shift in the SPI initiatives from “what” to “how”, the new integrated process improvements frameworks and the assessment model that can be used by a customer to assess different organizations using different process models. The evaluation is based on what process improvement frameworks used to be before 1996 and what it was after 1996 focusing on the Software Engineering Institute (SEI) and the International Organization for standardization (ISO) models.&lt;br /&gt;&lt;br /&gt;This paper discusses the usage of current process improvement models like PSP, TSP, SW-CMM, CMMI, ISO – 15004 (SPICE) and their challenges. Also the possible SPI failures were identified and this includes: Management Commitment, Misconception of SPI, SPI being too expensive etc.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;Software has become an integrated part of human nature such that it’s contribution into the way we live have risen tremendously because it is embedded in our home appliances, mobile phones, cars etc. Software complements and supplements the hardware industry, making the two a dependant of each other. Hardly will you see hardware without software, because hardware is driven by software.&lt;br /&gt;&lt;br /&gt;There was a need for a defined, structured and continuous engineering process that guides the production of quality software product. In the software industry, to produce reliable and high quality software, a software organization must adopt a process framework that not only cater for the life cycle implementation of the software but also allows for continuous changes and the integration of other process models. Quality software is not composed of discrete processes; instead, it is composed of continual processes that guide the development activity (CRSIP 1999).&lt;br /&gt;In other words, Process improvements are detailed blueprints for software organizations to meet current demand and complexity in the software market. Process helps an organization's workforce meet business objectives by helping them work smarter, not harder, and with improved consistency (Chrissis M.B et al. 2003). A process allows an organization to structure its software development activities, and a continuous process improvement,&lt;br /&gt;allows an organization to improve on these activities. SPI methods are the instruments used for guiding and managing improvement activities in practice (Sirvio 2004).&lt;br /&gt;&lt;br /&gt;Process improvement as a framework is constantly changing to meet the challenging software requirements that were faced by the software community at large. In the last decade, software process improvements have undergone several challenges and progress, these progresses introduces new standards of process models that address project management and project lifecycle to processes that encompass managerial activities, development process and people, software engineering and system engineering etc. Progress was identified and lessons learnt introduce new methods, tools and models.&lt;br /&gt;&lt;br /&gt;The current trend in the SPI literature is the combination of SPI frameworks to achieve better improvements results. This paper will address the new ideas of compound process improvement framework that integrates software engineering with system engineering. Also, this paper will address the progress that have been made in the SPI discipline since 1996, focusing on the Software Engineering Institutes (SEI) the International Organization for standardization (ISO) models. It also critically evaluates these process models and the symptoms of process improvement failure giving the authors judgments.&lt;br /&gt;&lt;br /&gt;The progresses discussed in this paper are:&lt;br /&gt;organized as follows; what went wrong, shifting from “what” to “how”, the chaining of process models, the assessment model that fits various process improvement models.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CMM: What went wrong?&lt;/span&gt;&lt;br /&gt;The Capability Maturity Model (CMM) or the Capability Maturity Model for software (SW-CMM) developed by the Software Engineering Institute (SEI) and its Version 1.1 published on February 1993, is a five level (Initial, Repeatable, Defined, Managed and Optimizing) based assessment model for measuring the capabilities of software organizations to producing quality software from ad hoc to mature software process. It is used to appraise organizations maturity as they progress in software development. It was originally modeled for the US Department of Defense (DoD) contractors.&lt;br /&gt;Although the Capability Maturity Model® (CMM®) provides a powerful improvement framework, its focus is necessarily on “what” organizations should do and not “how” they should do it. (Humphrey 1999).&lt;br /&gt;According to Sommerville (2001), the CMM should not be taken as a definitive capability model for all software processes. The model was developed to assess the capabilities of companies developing defense software.&lt;br /&gt;CMM does not focus on technology used in development; this exempts the technicalities of the product development from the process. This in turn does not give room for product and quality measurement. Very few of the Key Process Areas (KPA) address the evolving results (i.e., the software product) and associated engineering artifacts (use-case models, design models, source code, or executable code) that capture the real target product (Royce 2002, p2).&lt;br /&gt;It excludes risk analysis and resolution as a key process technology (Bollinger and McGowan 1991 cited in Summerville). The inculcation of risk assessment into process improvement was missing in CMM.&lt;br /&gt;Software engineers are protective of their creativity and what works for them, thereby using a framework that tells them what to do, may not align with their software development passion.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Personal Software process (PSP)&lt;/span&gt;&lt;br /&gt;Software process improvement community has identified the need to allow software engineers define a process framework for themselves having successfully tried the CMM, it was realized that a process model that shows software engineers how to do things was needed. PSP can be likened to CMM level 4 and 5 processes for a single software engineer. It’s a level based framework, which progresses from PSP0 to PSP3 for software engineers to measure there performance. PSP initiative is as a result of the identified bureaucracy in SPI processes that tell software engineers what to do instead of how to do it. Software engineer’s according to Humphrey (1999) are understandably skeptical about changes to their work habits; although they maybe willing to make a few minor changes, they will generally stick fairly closely to what has worked for them in the past until they are convinced a new method will be more effective.&lt;br /&gt;Improvement requires change, and changing the behavior of software engineers is a nontrivial problem. The reasons for this explain why process improvement is difficult and illustrate the logic behind the Personal Software ProcessSM (PSPSM) (Humphrey, 1999). Organizations using PSP have reported significantly improved size and time-estimating accuracy, as well as reductions of 60–75% or more in the number of defects injected during development or found during unit test (Bill Thomas n.d).&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_XwziUoKLz60/SL5Q9HFB_oI/AAAAAAAAAAU/SCkm4JiHUvQ/s1600-h/clip_image002.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://2.bp.blogspot.com/_XwziUoKLz60/SL5Q9HFB_oI/AAAAAAAAAAU/SCkm4JiHUvQ/s320/clip_image002.jpg" alt="" id="BLOGGER_PHOTO_ID_5241716027108228738" border="0" /&gt;&lt;/a&gt;Figure 1. Schedule estimating error&lt;br /&gt; (Humphrey, 1999, p.6)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Challenges of PSP&lt;/span&gt;&lt;br /&gt;Software engineers adopt what works for them; this is a problem because some engineers may change and others may decide not to change inline with the introduction of the PSP. Without proper management attention, many engineers gradually slip back into their old habits Watts S. (Humphrey 1999).&lt;br /&gt;PSP can only be adopted by small software organizations.&lt;br /&gt;Too much independent is given to software engineers. The Personal Software Process caters for individual software engineers rather than a collective team of engineers. This allows engineers working according to their own process which does not give room for comparing their work because their works are done in isolation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Team Software Process (TSP)&lt;/span&gt;&lt;br /&gt;When a team of engineers are all PSP trained and properly supported, they still have to figure out how to combine their personal processes into an overall team process (Humphrey 1999).&lt;br /&gt;&lt;br /&gt;TSP was developed to integrate team capabilities into PSP; it leverages the power of PSP and CMM with the inclusion of team management. PSP is a prerequisite for TSP. TSP is a high-maturity project management process with many of the features of CMM‚ maturity levels 4 and 5 (Steve and Ellen 2004).&lt;br /&gt;&lt;br /&gt;The Team Software Process (TSP) extends and refines the CMM and PSP methods to guide engineers in their work on development and maintenance teams. (Humphrey 1999)&lt;br /&gt;&lt;br /&gt;TSP shows engineers how to perform as a team and how management should be committed to the team building activities in other to get an environment with successful team. TSP teaches engineers the process of managing their work and the power to champion their process, decision is team based. TSP integration with PSP and CMM takes the project management activities of CMM and the self measurement process of PSP coupled with team building process.&lt;br /&gt;&lt;br /&gt;TSP was observed in Microsoft® and it was said to be successful. During TSP training, Microsoft developers reduced unit-test defects dramatically from more than&lt;br /&gt;25 defects/KLOC to about 7 defects/KLOC (Kelly 2004).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Barriers of Team Software Process&lt;/span&gt;&lt;br /&gt;TSP relies on CMM maturity levels, a level 1-2 organization cannot use TSP successfully, and this is as a result of PSP/TSP carried out on Boeing.&lt;br /&gt;TSP relies more on management support to function well.&lt;br /&gt;PSP is a prerequisite for TSP, this means before an organization can adopt TSP successfully; all its engineers must be PSP certified.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;A chain of three process models: the Integrated Initiatives&lt;/span&gt;&lt;br /&gt;Organizations that were not typically software companies—such as financial institutions, car manufacturers, airplane manufacturers, and insurance companies—find that much of their business relies on software. Software is often what differentiates them from their competitors. The problems these organizations address today involve both software and systems engineering (Chrissis M.B et al. 2003).&lt;br /&gt;&lt;br /&gt;Different process models answers different business areas, the bulkiness and the disintegration of process documents that addresses different part of an organization process was identified by the Software Engineering Institute (SEI). This lead to the creation of the Capability Maturity Model Integration (CMMI) with its version 1.02 published December 2000.&lt;br /&gt;The SEI introduced the CMMI® as an integrated model for software engineering, system engineering and integrated product and process development. There was a need for these various models working together. The use of multiple models has been problematic (Chrissis M.B et al. 2003). The overhead of using different models to address different process areas was identified and this brought about the CMMI. Most available improvement approaches focus on a specific part of the business and do not take a systemic approach to the problems that most organizations are facing (Chrissis M.B et al. 2003).&lt;br /&gt;CMMI addresses the product lifecycle from the beginning to the end, and at the same time bridging the gap between procedure, people, methods and tools. The following models were integrated into the CMMI framework:&lt;br /&gt;Capability Maturity Model for Software (SW-CMM) v2.0 draft C.&lt;br /&gt;Electronic Industries Alliance Interim Standard (EIA/IS) 731, System Engineering Capability Model (SECM).&lt;br /&gt;Integrated Product Development Capability Maturity Model (IPD-CMM)&lt;br /&gt;v0.98.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Why the Integration Approach&lt;/span&gt;&lt;br /&gt;It is becoming impossible to separate software from hardware, because the two industries complements and supplements themselves.&lt;br /&gt;&lt;br /&gt;There was a high demand for software intensive system in the market.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Benefits of CMMI&lt;/span&gt;&lt;br /&gt;Linking management objects with software and systems engineering models.&lt;br /&gt;&lt;br /&gt;Leveraging from additional areas of best practice (e.g., measurement, risk management, and supplier management) (Ferguson, 2003).&lt;br /&gt;&lt;br /&gt;Visibility into additional organizational functions critical to their products and services (Ferguson, 2003).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Challenges of CMMI&lt;/span&gt;&lt;br /&gt;CMMI is not a focused framework; in that it is composed of different SEI’s process improvement models that address the areas of Project management, engineering, and support and process management, this leave the models documentation bulky.&lt;br /&gt;&lt;br /&gt;“What is the basis for using CMMI as a model, has it been proven to improve businesses?”.  (Rold and Fleisher).&lt;br /&gt;&lt;br /&gt;What are the relationships of the many process models adopted by CMMI?&lt;br /&gt;&lt;br /&gt;CMMI inherits all the activities of the CMM; this means the model is still a reference to the staged representation of CMM, but is there any part of CMMI that helps organizations that was in a level in CMM to continue in the same level in CMMI?&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;One Assessment model now fits all&lt;/span&gt;&lt;br /&gt;With the introduction of the ISO/IEC 15004 (SPICE), organization does not need to change their process models to conform to assessment standards, because the ISO\IEC 15004 caters for an integrated assessment and capability determination for the wide ranges of process models. ISO 15004 can assess software organizations with different software models i.e. software organizations with SW-CMM can be assessed against a software organization with Bootstrap.&lt;br /&gt;&lt;br /&gt;SPICE is a world class collaborative effort by International Organization for standardization (ISO), International Electrotechnical Commission, Joint technical committee etc for assessing software process improvement initiatives.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Obstacles of process Improvements&lt;/span&gt;&lt;br /&gt;The industry focus is more on the level based rating, rather than the continuous process improvements. Impression is “pass the test”, get the rating and be done with&lt;br /&gt;this initiative (Rold and Fleisher, n.d).&lt;br /&gt;What are the evidence that process improvements leads to high Return On Investment (ROI)? According to Rold and Fleisher, conflicts over “what is the basis for using CMMI as a model, has it been proven to improve businesses?”. You cannot prove ROI unless you start the journey and begin measuring performance.&lt;br /&gt;Process improvement adoption is becoming expensive with the rapid introduction of newer version of SPI models; does the customer pay for the product and also the improved processes too?&lt;br /&gt;What are the testimonies that organizations in the same CMMI level rating will produce the same quality software? Does adopting CMMI as a benchmark really means success and high capability in engineering software.&lt;br /&gt;Process Improvement methodologies explosion. Different SPI best practices defined by different bodies, we have the US SPI standards, we also have the European SPI standards, there is no standard unification. All standard should speak the same language.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Possible SPI failures&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; Lack of Commitment to SPI&lt;/span&gt;&lt;br /&gt;The Lack of commitment to software process improvement will lead to process immaturity, inconsistent process activities, missing productivity measurement and improper planning because when commitment is missing there will be no Proper documentation, planning and maintenance of process. Effective software process Improvement will not start until management insists that product development work be Planned and properly managed (Humphrey 1998).&lt;br /&gt;&lt;br /&gt;“Process improvement for its own sake will soon die. It must address strategic organizational imperatives if it is to be successful.” (Waina n.d).&lt;br /&gt;&lt;br /&gt;Management may be too scared to commit resources and time to software process, the shorter route to software process improvements was to rush and adopt methodologies like CMM – CMMI – ISO900-3 that may not directly provide answers to their problems because problems and culture are different across processes and they shouldn’t be built around the SPI models. Software development policies should reflect current organizational commitments rather than "CMM-compliance. (Pat O’Toole, 2002).&lt;br /&gt;Process improvement for its own sake will soon die. It must address strategic organizational imperatives if it is to be successful (Waina n.d). Organizations need to address what should be improved and how it should be improved because of the deficiency in their commitment and absence of measurable goals. It its more talk than practices but when problems arises at the end management wait too late to address issues that could have been avoided if proper process documentation were carried out “The most common approach for process improvement we have seen during the last 10 years is to document all processes.( Sarkry M and Potter N, 2000). The following are problem areas when management’s commitment is too low; poor software quality measurement, poor defects identification, software is not reliable, risk assessment is not observed, and no proper feedback is given. The goal of commitment to process improvements includes better time management, quality product, risk reduction and well documented process. Organizations cannot mature in process when there are no benchmarks to follow because an undocumented process is a barrier. The process may be superb, but it is an ad-hoc process, not a defined process (Tyrrell  n.d).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Overhead in process improvements: &lt;/span&gt;&lt;br /&gt;There are times when deliverables are expected within a given time constraint, to meet customer deadline. During this period, management may consider process or its improvements as a time killer activities that will only disrupt development time and targets.&lt;br /&gt;&lt;br /&gt;CMM is not a religion. You should use it as a guide to help you focus your improvement energies where they will likely pay off, rather than simply racing up the maturity scale as fast as you can. (Wiegers n.d)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Misinterpretation of industry endorsed process models: &lt;/span&gt;&lt;br /&gt;CMM – CMMI – ISO9003 – Six Sigma etc are process benchmarks not a total solution for all organizations process improvements; there may be a misconception about the use of these methodologies to improve the organization processes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Learning curve is high &lt;/span&gt;&lt;br /&gt;They will react against things because they fear the learning curve linked with the introduction of new things (in software engineering and also everywhere else). But if we do not learn new things and try to improve ourselves and the way we work, we would not have nice cars, mobile phones, great software to support our business, etc (Global Knowledge source for software development professionals, 2002)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;The SPI part of software engineering is still evolving, as far as software evolves, the development methods, software patterns and practices and process improvements also will. There is no final destination of the software engineering process improvement, because it has to address the current issues observed in the industry today, this makes process improvement dependants on the current practices in software engineering.&lt;br /&gt;We have seen the lessons learnt in the history of CMM and how these have lead to several other process improvement frameworks in Software Engineering Institute. Progress was introduced after the several feedbacks from the users of CMM and these lead to the adoption of PSP/TSP, the SW-CMM and also the CMMI.&lt;br /&gt;After examining the different approaches discussed in the main body of this paper, a question comes to mind, does integrating different processes really solves the problem of an organization, especially smaller organizations that does nothing but software, how will an organization that does only software invest a lot into a framework like CMMI without the need for system engineering? Are these frameworks really addressing current issues of making software engineering a discipline?&lt;br /&gt;We are experiencing the shift in the way processes Improvements were done, but we have several improvement methodologies defined by different bodies, although the SPICE assessment model can be leveraged to assess different organizations with different SPI models, but for software engineering to retain its consistent engineering approaches, there should be an SPI model that can be used to assess all software engineering organizations both home and abroad no matter what the processes used.&lt;br /&gt;The more critical software are developed today, the more process Improvement are introduced. There was an impression that progress in process improvement is higher than the development tool. Organizations are now getting to know that, the process that are used in building software, is as important as the software.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;References&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1.    Chrissis M.B et el, (2003). Introduction to CMMI. [Online]. Available from: http://www.informit.com/articles/printerfriendly.asp?p=98146&amp;amp;rl=1. [Cited Dec 2006].&lt;br /&gt;2.    Computer Resources Support Improvement Program (CRSIP) Revision 3.0 March 31, (1999). A Gentle Introduction to Software Engineering [Online]. Available from: http://www.stsc.hill.af.mil/resources/tech_docs/GISE.DOC.&lt;br /&gt;3.    Ferguson J.R, (2003). CMMI Overview [Online]. Available from: http://www.ndia-tvc.org/SESEC/Presentations/SE2%20Conference%20PDFs/DAY_1/D1_Session_1/S1B3_Ferguson.pdf. [Cited Dec 2006].&lt;br /&gt;4.    Global Knowledge source for software development professionals (2002).  Methods and Tools [Online]. Available from: http://www.methodsandtools.com/PDF/dmt0302.pdf. [Cited Dec 2006].&lt;br /&gt;5.    Humphrey W.S. (1998). Three dimensions of process Improvement – Part 1: Process maturity [Online]. Available from: http://www.stsc.hill.af.mil/crosstalk/1998/02/processimp.asp.&lt;br /&gt;6.    Humphrey W.S. (1999). Pathways to process Maturity: The Personal Software Process and Team Software Process [Online]. SEI Interactive. Available from: http://www.sei.cmu.edu/news-at-sei/features/1999/jun/Background.jun99.pdf. [Cited Nov 2006]&lt;br /&gt;7.    Jainiszewski S and George E, (2004). Integrating PSP, TSP, and Six Sigma [Online]. Available from: http://www.asq.org/pub/sqp/past/vol6_issue4/sqpv6i4janiszewski.pdf. [Cited Nov 2006].&lt;br /&gt;8.    Kimberland, K. (2004). Microsoft’s Pilot of TSP Yields Dramatic Results. [Online]. Available from : http://www.sei.cmu.edu/news-at-sei/features/2004/2/pdf/feature-1-2004-2.pdf. [Cited Nov 2006].&lt;br /&gt;9.    Leeson P, (2005). Use CMMI correctly and the business benefits. [Online]. Available from &lt;a href="http://www.bcs.org/server.php?show=ConWebDoc.3051"&gt;http://www.bcs.org/server.php?show=ConWebDoc.3051&lt;/a&gt;. [Cited Nov 2006].&lt;br /&gt;10.    Pat O’Toole, 2002. Pat O’Tooles’s Dos and Don’ts of Process Improvements: Do Establish Organization Policies, Not CMM Policies [Online]. Available from: &lt;a href="http://www.informit.com/articles/article.asp?p=27124&amp;amp;rl=1"&gt;http://www.informit.com/articles/article.asp?p=27124&amp;amp;rl=1 &lt;/a&gt;[Cited Nov 2006].&lt;br /&gt;11.    Rold J and Fleisher N. CMMI as a Process Improvement Tool [Online]. Available from: &lt;a href="http://proceedings.ndia.org/587J/rold.pdf"&gt;http://proceedings.ndia.org/587J/rold.pdf&lt;/a&gt;. [Cited Dec 2006].&lt;br /&gt;12.    Royce W, (2002). CMM vs. CMMI: From Conventional to Modern Software Management [Online]. Available from: &lt;a href="http://www-128.ibm.com/developerworks/rational/library/content/RationalEdge/feb02/ConventionalToModernFeb02.pdf"&gt;http://www-128.ibm.com/developerworks/rational/library/content/RationalEdge/feb02/ConventionalToModernFeb02.pdf&lt;/a&gt;. [Cited Dec 2006].&lt;br /&gt;13.    Sarkry M and Potter N, (2000). Goal-Problem Approach for Scoping an Improvement Program [Online]. Available from:&lt;a href="http://www.stsc.hill.af.mil/crossTalk/2000/05/sakry.html"&gt; http://www.stsc.hill.af.mil/crossTalk/2000/05/sakry.html&lt;/a&gt;. [Cited Dec 2006].&lt;br /&gt;14.    Sirvio S.K. (2004). Development and Evaluation of Software Process Improvement Methods [Online]. Available from:&lt;a href="http://virtual.vtt.fi/inf/pdf/publications/2004/P535.pdf"&gt; http://virtual.vtt.fi/inf/pdf/publications/2004/P535.pdf&lt;/a&gt;.&lt;br /&gt;15.    Sommerville I, (2001). Software Engineering Sixth Edition. Ch 25.&lt;br /&gt;16.    Thomas B. Delivering on the Promise of Process improvements [Online]. Available from: &lt;a href="http://www.sei.cmu.edu/news-at-sei/features/1999/jun/Spotlight.jun99.pdf"&gt;http://www.sei.cmu.edu/news-at-sei/features/1999/jun/Spotlight.jun99.pdf&lt;/a&gt;. [Cited Nov 2006].&lt;br /&gt;17.    Tyrrell S,. The many dimensions of the software Process [Online]. Available from: &lt;a href="http://www.acm.org/crossroads/xrds6-4/software.htm"&gt;http://www.acm.org/crossroads/xrds6-4/software.htm&lt;/a&gt;l. [Cited Nov 2006].&lt;br /&gt;18.    Wania R.B. Five Critical Question in Process Improvement [Online]. Available from: &lt;a href="http://www.chips.navy.mil/archives/01_summer/five_critical_questions_in_proce.htm"&gt;http://www.chips.navy.mil/archives/01_summer/five_critical_questions_in_proce.htm&lt;/a&gt;. [Cited Dec 2006].&lt;br /&gt;19.    Wiegers K.E. Misconception of the Capability Maturity Model [Online]. Available from:  &lt;a href="http://www.processimpact.com/articles/miscon.html"&gt;http://www.processimpact.com/articles/miscon.html&lt;/a&gt;. [Cited Dec 2006].&lt;br /&gt;20.    Wilson H, (2003). Capability Maturity Model Integration [Online]. Available from: &lt;a href="http://www.dtic.mil/ndia/2003technical/wilson.ppt"&gt;http://www.dtic.mil/ndia/2003technical/wilson.ppt&lt;/a&gt;. [Cited Dec 2006].&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-5480144829971128971?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/5480144829971128971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=5480144829971128971' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/5480144829971128971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/5480144829971128971'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/09/progress-and-obstacles-of-software.html' title='Progress and Obstacles of software process improvement (SPI) models'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_XwziUoKLz60/SL5Q9HFB_oI/AAAAAAAAAAU/SCkm4JiHUvQ/s72-c/clip_image002.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-5261952651027196525</id><published>2008-09-01T03:45:00.000-07:00</published><updated>2008-11-19T01:52:48.908-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='Throwable'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET exception'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><category scheme='http://www.blogger.com/atom/ns#' term='Exception'/><title type='text'>Introducing .NET Throwable Pattern (The Exception By Contract Class).</title><content type='html'>If you are a Java developer, do not expect that i am referring to the Java Throwable class, which is the ultimate superclass for all errors and exceptions thrown by the JVM (Java Virtual Machine). I must confess that i love this name, and thats why i am sticking to it in .Net.&lt;br /&gt;&lt;br /&gt;Most .NET application developers, architects, programmers etc understand fully well the use of the throw keyword. The throw keyword can be used to throw new exception in a catch block, it can also be used to throw the actual exception while still retaining the stack trace.  I may need to explain with code :&lt;br /&gt;&lt;br /&gt;Here is an example of the throw keyword :&lt;br /&gt;&lt;br /&gt;1. Throw new Exception :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;try&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;catch&lt;/span&gt;(Exception x)&lt;br /&gt;{&lt;br /&gt;throw x; or&lt;br /&gt;        &lt;span style="color: rgb(0, 0, 0);"&gt;throw&lt;/span&gt; new IamLovingItException("I am loving it", x);&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The code above makes use of the throw keyword to throw a new exception different from the originally raised exception. This ignores the stack trace and creates a new exception to be thrown to the caller.&lt;br /&gt;&lt;br /&gt;2. Just Throw.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;catch(Exception ex)&lt;br /&gt;{&lt;br /&gt;    throw;&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The code above throws the same exception including the stack trace that was raised in the try ... catch block. Whatever situation you find yourself, using option one and two is good but not better, when we are dealing with a business focused application that makes use of throwing and handling of exception to communicate changes or business constraints to the caller application. An example of this will be AccountBlockedException, ZeroBalanceException, TransactionRolledBackException : There is no end to the ways we will be using custom exception handling.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;A typical Scenairo. (Scenario One)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You have created a payment webservice (Lets say a WCF service) that serves as an abstraction layer over any kind of third party credit card vendors like PayPal, WorldPay, Nochex etc Our Payment webservice can be configured to use any type of payment gateway because it is very generic and open to extensibility.&lt;br /&gt;&lt;br /&gt;Now, any thing can go wrong while processing payment or registring our card details via the Payment service abstraction layer. Lets assume we are trying to process £100 , and along the way, the real payment server shuts down, what do we do in this scenario :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Option 1:&lt;/span&gt; we throw the same exception that was thrown by the payment gateway&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Option 2:&lt;/span&gt; we re-brand that exception and bake a new one from it.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Option 3:&lt;/span&gt; we handle that exception in our custom Payment service, and return status (As Enum), to our clients.&lt;br /&gt;&lt;br /&gt;Think for a minute, which approach is best in our scenario. Even if the payment gateway did not throw an error, but return a status like Payment Failed to our custom Payment service, do we act upon that status and throw a new exception from there, but how do we act upon the status, the best bet may be to do :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;if(paymentGateWayStatus == Status.PaymentFailed)&lt;br /&gt;{&lt;br /&gt;throw new PaymentFailedException("Failed");&lt;br /&gt;}&lt;br /&gt;else if(paymentGateWayStatus == Status.ServerShutDown)&lt;br /&gt;{&lt;br /&gt;throw new PaymentServerShutDownException("Shut Down");&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;There, we can go on and on until we have a very messy if statement with many throw exception block, we can even have this statements in almost all the methods implemented by our Payment service abstraction, if not all. What do we need to do in this case to reduce the amount of redundant code that we have?&lt;br /&gt;&lt;br /&gt;I have got an excellent Idea. Why not let us create a pattern for this scenario, at least we are trying to avoid repeatability, we need to slve it with a pattern. To create a pattern, you must have been doing one thing for along time, before you realize that it is time consuming, and you would want to make it re-usable in code wide, applicatuion wide etc.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The New Throwable Pattern.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;in our case, we need to create like a factory class called Throwable, this class has the abilities to check a boolean statement and decide on wether to throw an exception or not. This class can navigate through a switch statement to see which status matches the given status, and throw an exception from there. To go strat to the point, the throwable class is defined as follows :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;public static class Throwable&lt;br /&gt;{&lt;br /&gt;public delegate bool Is();&lt;br /&gt;private static void Throw(Exception exception)&lt;br /&gt;{&lt;br /&gt;    throw exception;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void CauseThrow&lt;t&gt;(T exception)&lt;br /&gt;{&lt;br /&gt;    throw exception as Exception;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void ThrowWhenIsNull&lt;t&gt;(object instance,string message)&lt;br /&gt;{&lt;br /&gt;    if(null == instance)&lt;br /&gt;        throw Activator.CreateInstance(typeof(T), message) as Exception;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void CauseThrowOnTrue&lt;t&gt;(Is anonymous, string details)&lt;br /&gt;{&lt;br /&gt;    if (anonymous.Invoke())&lt;br /&gt;        throw Activator.CreateInstance(typeof(T), details) as Exception;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void CauseThrowOnTrue&lt;t&gt;(bool status, string details)&lt;br /&gt;{&lt;br /&gt;    if(status)&lt;br /&gt;        throw Activator.CreateInstance(typeof(T), details) as Exception;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void CauseThrowOnFalse&lt;t&gt;(bool status, string details)&lt;br /&gt;{&lt;br /&gt;    if (!status)&lt;br /&gt;        throw Activator.CreateInstance(typeof(T), details) as Exception;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void CauseThrowOnFalse&lt;t&gt;(Is anonymous, string details)&lt;br /&gt;{&lt;br /&gt;    if (!anonymous.Invoke())&lt;br /&gt;        throw Activator.CreateInstance(typeof(T), details) as Exception;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static void CauseThrow(ResponseStatus status, string details)&lt;br /&gt;{&lt;br /&gt;    switch (status)&lt;br /&gt;    {&lt;br /&gt;        case Status.ERROR:&lt;br /&gt;            Throw(new PaymentServerErrorException(details));&lt;br /&gt;            break;&lt;br /&gt;        case Status.INVALID:&lt;br /&gt;            Throw(new InvalidPaymentErrorException(details));&lt;br /&gt;            break;&lt;br /&gt;        case Status.MALFORMED:&lt;br /&gt;            Throw(new MalformedPaymentException(details));&lt;br /&gt;            break;&lt;br /&gt;        case Status.NOTAUTHED:&lt;br /&gt;            Throw(new AuthenticationException(details));&lt;br /&gt;            break;&lt;br /&gt;        case Status.REJECTED:&lt;br /&gt;            Throw(new PaymentServerErrorException(details));&lt;br /&gt;            break;&lt;br /&gt;        default:&lt;br /&gt;            return;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/t&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The above code is our Throwable class, and we can call the Throwable in our code as the following :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;Throwable.CauseThrow&lt;cardagreementexception&gt;(new CardException("Card is not valid"));&lt;br /&gt;&lt;br /&gt;Throwable.CauseThrowOnFalse&lt;authexception&gt;((status == Status.AUTHENTICATED), "Not AUTH");&lt;br /&gt;&lt;br /&gt;Throwable.ThrowWhenIsNull&lt;invalidcreditcardexception&gt;(creditCard,"Invalid credit card");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Throwable.CauseThrow(status, "Testing");&lt;br /&gt;&lt;/invalidcreditcardexception&gt;&lt;/authexception&gt;&lt;/cardagreementexception&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;We can see that the Throwable approach is more cleaner and reusable across. You can contribute more to the implementation because this is just a simple prototype .&lt;br /&gt;&lt;br /&gt;Cheers and enjoy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-5261952651027196525?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/5261952651027196525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=5261952651027196525' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/5261952651027196525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/5261952651027196525'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/09/introducing-net-throwable-pattern.html' title='Introducing .NET Throwable Pattern (The Exception By Contract Class).'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-4647640511720249645</id><published>2008-08-29T03:44:00.000-07:00</published><updated>2008-12-01T02:07:20.081-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wrapper'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET wrapper'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='boxing'/><category scheme='http://www.blogger.com/atom/ns#' term='value types'/><category scheme='http://www.blogger.com/atom/ns#' term='struct'/><category scheme='http://www.blogger.com/atom/ns#' term='un-boxing'/><category scheme='http://www.blogger.com/atom/ns#' term='Integer'/><title type='text'>.NET Primitive Wrapper Classes Where are thou?</title><content type='html'>In my day-to-day experience with code, forum users, other developers, i have been asked this question (Wrapper classes for primitive type) a thousand times before and now. Most developers especially the one's coming from Java Land (Like me, i am a Java Lander and still i am) seems to bring with them the Jar of Java coffee, and when they successfully arrive &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;NLand&lt;/span&gt;, they realize its a different ball game here, because &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;NPeople&lt;/span&gt; are not coffee drinkers, they are business men. Lets cut the story of N and J short, because the similarity and the dissimilarity of both lands is what makes them different.&lt;br /&gt;&lt;br /&gt;We will not argue about the two lands today, but try to work around a simple primitive Wrapper for int, lets call our wrapper &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;BigInteger&lt;/span&gt; or Integer (I will choose Integer or something like &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;IntegerWrapper&lt;/span&gt; since .NET people may want to include Integer class as part of the base class libraries in the upcoming and not so far future. In Java, int is mutable because you are allowed to change the value of int anywhere in your code.&lt;br /&gt;&lt;br /&gt;In Java we have several Wrapper classes which i will like to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;metion&lt;/span&gt; below, they wrap-up primitive data - types and have an object representation of it. The following class are some of the primitive  wrapper classes in Java.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;BigDecimal&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;BigInteger&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Byte&lt;/li&gt;&lt;li&gt;Double&lt;/li&gt;&lt;li&gt;Float&lt;/li&gt;&lt;li&gt;Long&lt;/li&gt;&lt;li&gt;Integer&lt;/li&gt;&lt;li&gt;Short&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;All of these wrapper classes described above inherit from an abstract class called &lt;span style="font-weight: bold; color: rgb(255, 153, 0);"&gt;Number&lt;/span&gt; (You can sense some intuitiveness of java here). So in java, a primitive integer type can be used as follows :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;int value = 200;&lt;br /&gt;Integer bigInt = value;&lt;br /&gt;value = bigInt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Although wrapping and un-wrapping or autoboxing and unboxing (NLand calls it Boxing and UN-Boxing. But to object) primitive data types has a performance implications, but there are some situations that we cannot do without them. So how to we bring this type of functionality to .NET, how do we ensure that our primitive types can be treated as a reference type. First let me point out some few facts about what we have in the .NET API (Application Programming Interface).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Boxing and UNBoxing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Well, with the little approach we described above, we can fully understand that in .NET we have the term boxing and unboxing. This allows us to use an value type as an object and re-casting the value type from an object to its primitive state : The following is valid :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;object value = 200; //Store an integer&lt;br /&gt;int intValue = (int) value; //returns the value 200 to an int via type casting. It&lt;br /&gt;is not automatic casting.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The above snippets shows how we can do boxing and unboxing in .NET, but where is the performance implications in this? of cos there is,  when you cast a primitive type to object in .NET, an reference is allocated in the garbage-collected heap, that means an object memory is allocated for it. Let us take another simple approach :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;object value = 200;&lt;br /&gt;object value2 = value;&lt;br /&gt;&lt;br /&gt;value2 = 500;&lt;br /&gt;value still remains 200.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The code above retains the content of value and creates a new object in the memory heap when we assigned value to value2. We would have thought that the two objects would have a reference to a single object in memory, but the data is duplicated. So we need to be carefull when dealing with boxing amd unboxing this way.&lt;br /&gt;&lt;br /&gt;Also we can use the System.ValueType class, which is the base class for all .NET value types, still this approach does not guarantee type safety and and it encourages more type casting and also incur the performance implications as the boxing and un-boxing approach.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;So what are we going to do?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;we are going to create a custom Integer Wrapper for .Net, and we will ensure that it is used like its java counterpart. So here our code goes :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt; public class Integer&lt;br /&gt;{&lt;br /&gt;    int value = 0;&lt;br /&gt;&lt;br /&gt;    public Integer(int value)&lt;br /&gt;    {&lt;br /&gt;        this.value = value;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static implicit operator Integer(int value)&lt;br /&gt;    {&lt;br /&gt;        return new Integer(value);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static implicit operator int(Integer integer)&lt;br /&gt;    {&lt;br /&gt;        return integer.value;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static int operator +(Integer one, Integer two)&lt;br /&gt;    {&lt;br /&gt;        return one.value + two.value;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static Integer operator +(int one, Integer two)&lt;br /&gt;    {&lt;br /&gt;        return new Integer(one + two);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static int operator -(Integer one, Integer two)&lt;br /&gt;    {&lt;br /&gt;        return one.value - two.value;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static Integer operator -(int one, Integer two)&lt;br /&gt;    {&lt;br /&gt;        return new Integer(one - two);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The code above is a representation of the Integer wrapper class in java in .NET. So, having created our class above, we need to see how we can utilize it. Below is how we can make use of it.&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;       Integer integer = 345;&lt;br /&gt;&lt;br /&gt;       integer = 10 * 11;&lt;br /&gt;&lt;br /&gt;       int value = integer;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now we have our a reference type for integer type in .NET. Note, you can overload other operators to make sure your reference type can be used with other operators. Enjoy your Wrapper.&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-4647640511720249645?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/4647640511720249645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=4647640511720249645' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/4647640511720249645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/4647640511720249645'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/08/net-primitive-wrapper-classes-where-are.html' title='.NET Primitive Wrapper Classes Where are thou?'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-30200585082603547</id><published>2008-08-28T09:13:00.000-07:00</published><updated>2008-09-02T03:47:23.247-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='design pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='patterns and practices'/><category scheme='http://www.blogger.com/atom/ns#' term='workflow'/><category scheme='http://www.blogger.com/atom/ns#' term='Command Pattern'/><title type='text'>Command Pattern as Workflow Pattern</title><content type='html'>In &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;today's&lt;/span&gt; development efforts, we need to ensure that we write better code that really meet our demands, code that can be executed independent of another, code that are separated by what they do (Concerns), a pragmatic code that is very safe to execute (Reliability). An efficient code that handles all error proactively.&lt;br /&gt;&lt;br /&gt;To write this kind of code, you need to start dwelling into design patterns or practices that will make life better for all of us. One of this pattern is what i will be discussing today (The Command Pattern). The command pattern as its name implies, is a practice of encapsulating chunks/subsets of operation/&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;workflow&lt;/span&gt; into a reusable format that can be used independent of the environment it was called.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.dofactory.com/Patterns/Diagrams/command.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px;" src="http://www.dofactory.com/Patterns/Diagrams/command.gif" alt="" border="0" /&gt;&lt;/a&gt;                                                                     &lt;span style="font-weight: bold;"&gt;Command Pattern From &lt;a href="http://www.dofactory.com/Patterns/PatternCommand.aspx"&gt;Do Factory Website&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A typical scenario is this : You are writing a &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;webservices&lt;/span&gt; that want to execute the following dependent operations as an atomic operation :&lt;br /&gt;&lt;br /&gt;Get details of products/services&lt;br /&gt;Calculate The Payment due.&lt;br /&gt;Make Payment. By calling external &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;webservice&lt;/span&gt; (Like payment Gateways).&lt;br /&gt;Update Your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Lagacy&lt;/span&gt; application.&lt;br /&gt;&lt;br /&gt;A good look at the cases above should tell us that these operations will be executed within the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;CallContext&lt;/span&gt; of a method. You can imagine how bulky and &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_6"&gt;spaghetti&lt;/span&gt; the underlying code will be, and i can see many if statements, many try catch blocks, many many code horrors. Anyway, let us take another look and approach on the problem on ground, what if we make the processes that we discussed above as a single unit that depends on the statuses of one and other.&lt;br /&gt;As a single Unit we can have the following :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;ProductServiceCommand&lt;/span&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;CalculatePaymentCommand&lt;/span&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;MakePaymentCommand&lt;/span&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;UpdateLegacyCommand&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The following commands can be written in separate classes, that means that they can stand alone. Before i continue &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_11"&gt;further&lt;/span&gt; with this design practices, i will now introduce the Command pattern by introducing the base class below:&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt; abstract public class BaseCommand&lt;br /&gt; {&lt;br /&gt;     CommandReciever commandReciever;&lt;br /&gt;&lt;br /&gt;     public BaseCommand(CommandReciever commandReciever)&lt;br /&gt;     {&lt;br /&gt;         this.commandReciever = commandReciever;&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     protected CommandReciever CommandReciever&lt;br /&gt;     {&lt;br /&gt;         get { return commandReciever; }&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     abstract public void Execute();&lt;br /&gt; }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The class above marks the structure/template of our commands, all commands will inherit from this class, and they will override the abstract Execute method. All command will share one instance of a status object or Reciever object (In our context, it is &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;CommandReciever&lt;/span&gt;). This object will be used to share information among commands. For example, we may want to check the status of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;CalculatePaymentCommand&lt;/span&gt; before we execute the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;MakePaymentCommand&lt;/span&gt;. If the calculate payment command fails, instead of returning/throwing an exception, we can simply return a status that the other commands can consume. Let us assume that our status is as follows :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt; public class CommandReciever&lt;br /&gt; {&lt;br /&gt;     public CommandStatus ProductStatus{get; set;};&lt;br /&gt;     public CommandStatus MakePaymentStatus{get; set;};&lt;br /&gt;     public CommandStatus PaymentStatus{get; set;};&lt;br /&gt;     public double Amount{get; set;};&lt;br /&gt;&lt;br /&gt;     public CommandReciever()&lt;br /&gt;     {&lt;br /&gt;         productStatus = CommandStatus.NOTSET;&lt;br /&gt;         makePaymentStatus = CommandStatus.NOTSET;&lt;br /&gt;         paymentStatus = CommandStatus.NOTSET;&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; public enum CommandStatus : int&lt;br /&gt; {&lt;br /&gt;       NOTSET = 0,&lt;br /&gt;       OK = 1,&lt;br /&gt;       FAILED = 2,&lt;br /&gt;       PAYMENT_SUCCESSFUL = 3,&lt;br /&gt;       PAYMENT_SERVER_ERROR = 4,&lt;br /&gt;       PRODUCT_UPDATED = 5,&lt;br /&gt;       UNSUCCESSFUL_PAYMENT = 6,&lt;br /&gt;       MAY_CONTINUE = OK,&lt;br /&gt;       MUST_DISCONTINUE = FAILED,&lt;br /&gt; }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The commandReciever above will be shared amoung commands, so that state information of other comman can be seen across through the commandReciever object. Now let us delve into implementing our Commands : The following code blocks is the structure of our commands, in our case, i will be describing only one for space and readability on this post:&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt; public delegate void StatusChangedEventHandler(object source, EventArgs e);&lt;br /&gt; public class PaymentCommand : BaseCommand&lt;br /&gt; {&lt;br /&gt;&lt;br /&gt;     public event StatusChangedEventHandler paymentStatusChanged;&lt;br /&gt;&lt;br /&gt;     public PendingPaymentCommand&lt;br /&gt;         (CommandReciever commandReciever): base(commandReciever)&lt;br /&gt;     {&lt;br /&gt;&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     public override void Execute()&lt;br /&gt;     {&lt;br /&gt;            if(commandReciever.ProductStatus.OK)&lt;br /&gt;            {&lt;br /&gt;                 //Execute Payment Command Here.&lt;br /&gt;            }&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The class above is a simple template of how the class structure of our commands will be implemented, so let us assume that all other commands inherit from BaseCommand and all commands have a constructor that takes an instance of commandReciever as argument. Also our assumptions is that, they all implement the Execute method.&lt;br /&gt;&lt;br /&gt;Now that we are clear about how our four Commands will be implemented, then we will do the calling as follows :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;CommandReciever commandReciever = new CommandReciever();&lt;br /&gt;ProductServiceCommand productCommand = new ProductServiceCommand(commandReciever);&lt;br /&gt;CalculatePaymentCommand paymentCommand = new CalculatePaymentCommand(commandReciever);&lt;br /&gt;MakePaymentCommand makePaymentCommand = new MakePaymentCommand(commandReciever);&lt;br /&gt;UpdateLegacyCommand updateLegacyCommand = new UpdateLegacyCommand(commandReciever);&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The initialization code above can be used as follows :&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;productCommand.Execute();&lt;br /&gt;paymentCommand.Execute();&lt;br /&gt;makePaymentCommand.Execute();&lt;br /&gt;updateLegacyCommand.Execute();&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;At last we have successfully separated each command as workflows that can be executed independently or as a unit of operation. Since commands share statues, a command will check if its other commands have executed successfully before it executes. Commands can also register events on one and other, so we can have some command registering themselves as a listener to a command for status change event notification. There are many usages of the command patterns, this is just one i have explained (Command pattern used as Workflow pattern.( Enjoy patternising).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-30200585082603547?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/30200585082603547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=30200585082603547' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/30200585082603547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/30200585082603547'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/08/command-pattern-as-workflow-patter.html' title='Command Pattern as Workflow Pattern'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-4689976776088665757</id><published>2008-08-21T07:15:00.000-07:00</published><updated>2008-08-29T04:10:13.296-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='agility'/><category scheme='http://www.blogger.com/atom/ns#' term='developer'/><category scheme='http://www.blogger.com/atom/ns#' term='pragmatic'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='salako'/><category scheme='http://www.blogger.com/atom/ns#' term='long thing'/><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='proactive'/><title type='text'>NO LONG THING</title><content type='html'>&lt;span style="font-weight: bold;"&gt;The&lt;/span&gt; real meaning of &lt;span style="color: rgb(255, 153, 0); font-weight: bold;"&gt;"No Long Thing"&lt;/span&gt; is "No stress, no problems, no worries, no story". As we must understand that there are many &lt;span style="color: rgb(255, 153, 0); font-weight: bold;"&gt;Long Things&lt;/span&gt; in software development industry today, because we have different kinds of heads sticking themselves or portraying themselves as pragmatic developers. The real voice of software development evangelists are not heard, because the so called un-pragmatic developers (I will say the level zero developers) filled the air. They can use their mouth to make a rocket.&lt;br /&gt;&lt;br /&gt;We are not making it easier for the whole world to believe in software anymore, because we are not practicing our software religion as it used to be in the better old days. Software development has a religion is becoming &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;un&lt;/span&gt;-practiced by most developers, and this has lead to the numbers of incompetent analysts, developers, architects, engineers in the industry. Software development is not meant for people who are not pragmatic. It is not a piece of cake neither is it yam.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Recently&lt;/span&gt; i have been lazying around with many stuffs. I normally set targets for myself and i see myself through the targets. That means that i am very proactive and hard working and a very religious software developer. Recently i have been a bit lazy, which is very unusual in my daily practice,. I think i have been allowing &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;myself&lt;/span&gt; to indulge in many lazy activities.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;First&lt;/span&gt; of all, the following will help software developers to be more positive minded about their daily &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;activities&lt;/span&gt; :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1]&lt;/span&gt; Be a pragmatic developer. Always keep up with current trend in your area of interest.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2]&lt;/span&gt; Contribute to technical forums. No man is an island of knowledge, so share and learn.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3]&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;API&lt;/span&gt; are becoming too complex, keep learning there is no end to learning.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;4]&lt;/span&gt; Experience is the best teacher. Go after it.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;5]&lt;/span&gt; &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_4"&gt;Don't&lt;/span&gt; be a talker, be a doer.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;6]&lt;/span&gt; Never be negative about &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;deliverables&lt;/span&gt;.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;7]&lt;/span&gt; &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_13"&gt;Criticize&lt;/span&gt; the code not the developer .&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;8]&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;Dont&lt;/span&gt; &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_7"&gt;panic&lt;/span&gt;.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;9]&lt;/span&gt; Discover your &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_8"&gt;unconscious&lt;/span&gt; knowledge (Knowledge we dont know we have).&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;10]&lt;/span&gt; Keep a &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_9"&gt;blog post&lt;/span&gt; for &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_10"&gt;yourself (Such as this one).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;11]&lt;/span&gt; Contribute to open source projects.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;12]&lt;/span&gt; Ask the Why? What? When? and How? questions all the time. (Cos you are not a loser).&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;13]&lt;/span&gt; Communicate techs stuffs to non techs.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;14]&lt;/span&gt; Be proactive and a good team player. (I mean &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_11"&gt;participate&lt;/span&gt; to achieve end result not delay the result).&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;15]&lt;/span&gt; Be a &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_12"&gt;ego less&lt;/span&gt; programmer. (You are not your code).&lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_13"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;16]&lt;/span&gt; Never get lazy. Software development has no end.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The&lt;/span&gt; list above is a short form of the original list of practices, if you do not want &lt;span style="color: rgb(255, 153, 102); font-weight: bold;"&gt;Long Things&lt;/span&gt; in your daily life as a software developer. A dedicated software developer see beyond what others can see. They are the ones that knows about memory heap, the ones that likes programming in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;ILAsm&lt;/span&gt; or/and very low level. They are the ones to innovate a new concept/ideas into the industry, they are passionate about technology, they are the evangelists.&lt;br /&gt;&lt;br /&gt;They contribute to open source, they are very religious and are confident about the part they have chosen. They leave a mark on every project they take part.&lt;br /&gt;&lt;br /&gt;To be a very religious software developer/ analyst etc. You need to start considering the above list for a start.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-4689976776088665757?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/4689976776088665757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=4689976776088665757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/4689976776088665757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/4689976776088665757'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/08/no-long-thing.html' title='NO LONG THING'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-5314870486755913554</id><published>2008-08-15T08:08:00.000-07:00</published><updated>2008-08-29T08:18:41.085-07:00</updated><title type='text'>Persistent Ignorance. Is that another acronym</title><content type='html'>&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;Gone&lt;/span&gt; are the days that we couple our data access&lt;span style="font-weight: bold;"&gt; code &lt;/span&gt;within our business layers/logics., the days of manually writing SQL scripts is over and stored procedures are becoming un-popular in Object Oriented Programming because the paradigmn is shifting from data cetricness to object focuseness. We write code in the modern day using modern tools and languages like C#, Java, Smalltalk, C++ etc These platforms or languages follow common design structure which is termed as object orientation. &lt;span&gt;With the fact that we use OOP, we always want to use the OOP semantics in our coding culture, analysis, and software designing. &lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;br /&gt;In other to separate data from OOP,&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span&gt;we have seen&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span&gt;the birth of many ORM frameworks (Object Relational Mapping) and code generations &lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;and yet there are still many on born frameworks&lt;/span&gt;&lt;span&gt; comming into play very soon.&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span&gt;Soon we will feel the quantum leep from data centeredness to object orientation.&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span&gt;As part of the shift in paradigmn, we saw the birth of AOP (Aspect Oriented Programming) yet many are coming.&lt;br /&gt;&lt;br /&gt;Our focus today will be about Persistent Framework and how the industry have tried to make them persistent ignorance. For those who dont understand, persistent ignorance is the ability of our domain model to be ignorant of our persistent framework. The following code is not persistent ignorant :&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: left;"&gt;&lt;span&gt;                             public class Foo : IPersistable;&lt;br /&gt;&lt;br /&gt;The class Foo above, is a domain entity class, but it is forced to implement IPersistable because its a requirement by the underlying persistent framework. If you want to change persistent farmeowork then the problem comes, you will change so many code to make your class compliant to the new persistent farmework. &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;M&lt;/span&gt;ost Persistent Frameworks are not &lt;span style="font-weight: bold; color: rgb(255, 102, 0);"&gt;Persistent Ignorant&lt;/span&gt;, how do we plan for cross ORM frameworks, when we decorate our entities with attributes, we must implement IBigBoss, we are forced to make our POCO or POJO abstract, we use mapping xml file that are embedded into our assemblies (The XML approach is the father of couping because It goes with our transparent POCO'S as embedded resource. This does not allow for Refactoring with the range of refactoring tools we have today).&lt;br /&gt;&lt;br /&gt;As we proceed,with the chaotic nature of our industry, we realize there is no silver bullet, even though we longed and waited for the miracles to happen, some of us have realized that we cannot wait forever, something need to be done, that is where Open Source framework comes into play, and different types of AOP (Aspect Oriented Programming) framework's filled the whole programming community.&lt;br /&gt;&lt;br /&gt;Recently, i am searching for a Persistent Ignorant ORM Framework, and i realiazed that there is none, even if there is any, the framework will be descriptive [Meaning that you must obey the do's and dont's].&lt;br /&gt;&lt;br /&gt;There have been several long debates going on in the Object Persistent Industry, but there havent been a silver bullet, and there wont be any. Relational is not Object period. So we still need a way to tell the Persistent Engine how the transformation will be done. If Microsoft claims to give us such functionality without the use of Visual Studio to hide the intricacies of the mapping,  we are ready to sing the "oh happy day".&lt;br /&gt;&lt;br /&gt;Most of us (The developers, Analyst, Architects etc) are the root causes to what is happening to software engineering today, we always want a rocket scince, something that cannot be done without plumbing, but have we forgotten that even the JVM's OR CLR's of today is hiding somethings away from us if not, why cant we all start programming in Bytecode or IL or ILasm. Even OOP have its own semantic's which we must follow, if we must use the language. So i wonder why we cannot live by the semantics of ORM mapping and yet we ask too much of the framework.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-5314870486755913554?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/5314870486755913554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=5314870486755913554' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/5314870486755913554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/5314870486755913554'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/08/persistent-ignorance-is-that-another.html' title='Persistent Ignorance. Is that another acronym'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5516952211035950466.post-2919986232503896032</id><published>2008-08-15T07:25:00.000-07:00</published><updated>2008-08-29T06:47:19.228-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='creativity'/><category scheme='http://www.blogger.com/atom/ns#' term='ahmed salako'/><category scheme='http://www.blogger.com/atom/ns#' term='development'/><category scheme='http://www.blogger.com/atom/ns#' term='software'/><category scheme='http://www.blogger.com/atom/ns#' term='irobot'/><category scheme='http://www.blogger.com/atom/ns#' term='invention'/><category scheme='http://www.blogger.com/atom/ns#' term='child'/><title type='text'>Software Development: Creativitity Comes First.</title><content type='html'>&lt;span style="font-weight: bold;"&gt;W&lt;/span&gt;hen i was a little boy, i used to create robots that are made out of Pen, These robot's were created by joining parts of Bic pen together, forming an iRobot look alike. I used to work my head out since i was small and overly agile (My moral was so high, i do not have anything to worry about), i will sit down for longer hours and think about my inventions or i will improve my latest break through, but its a pity no one had the idea of how far my creativity have gone, even though i was discouraged, the more i tried to stop, the more creative i became (I could'nt help it, its parts and parcel of my entire life, and its the reason why i am here). I cannot imagine my life without analysis, architecting, problem solving, inventions, creativity. Life to me without out those things that i mentioned, will be very boring.&lt;br /&gt;&lt;br /&gt;The image below is the prototype look of the iRobot that i used to create when i was very little boy and very inventful.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_XwziUoKLz60/SK1ApeGzA7I/AAAAAAAAAAM/2soROrZZ8xQ/s1600-h/iRobot.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_XwziUoKLz60/SK1ApeGzA7I/AAAAAAAAAAM/2soROrZZ8xQ/s320/iRobot.jpg" alt="" id="BLOGGER_PHOTO_ID_5236913022902141874" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;I&lt;/span&gt; became a software developer today not by chance but by what was ordained onto me since i was a little boy, i could remember my first experiment when i was in my mother's womb (he, he, he) reality. Inventions had always been my number one interest since i was a little boy because my mind is filled with curiosity [I always want to know how stuff works] and the fact that i always want to know every bit of functionality in electronic gadgets, game console, TV, wrist watches e.t.c had put me into lot of troubles, because it is either, i was too destructive or too inventive, this attitude actually gave me a name among my peers and also showed me the real side of me and what is coming in the not so far future.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What i did with toys&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;I&lt;/span&gt; remembered Lego toys (The brick toys) and how i would construct different structures with it, i loved playing with my Lego's even when i was older. I also remembered electronic cars and how i will open up their components and remove the rotor (The engine that makes it movable) . I will use that rotor to invent my own version of car, i guess the one from the toy shop wasn't good enough. I remembered trying to create an toy helicopter for 1 good year, i was able to make my helicopter fly and eventually it collapsed by hitting a brick wall (That was the last time i saw it, atleast mission accomplished). I remembered the urge for me to create my own computer games, because of my special interests for games (Since the software inside game is not an electronic, it was difficult to identify the underlying technology, but still i made an attempt using physical elements like my Bic pen and computerised wrist watches. I will explain how i invented that one :&lt;br /&gt;&lt;br /&gt;Inventing a Game of Boxing&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;M&lt;/span&gt;y curiosity led me into creating a game that i will never forget (The Boxing Game). This game can be played by two players, using the iRobot creatures that i described above, i created two oponents with movable hands that is controlled by players, all sensitive regions of the body (Face, stomach) is connected to one timer. So if you are able to hit your opponent in any sensitive part of the body, you will get a point. The second part of this blog will describe my other escapades during the journey of becoming a software engineer that i am today.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;I&lt;/span&gt;f you share the same thing with me, you can post a comment. Or if you have anthing to say, you can post a comment too. All comments are welcome : Cheers .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5516952211035950466-2919986232503896032?l=salakoahmed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salakoahmed.blogspot.com/feeds/2919986232503896032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5516952211035950466&amp;postID=2919986232503896032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/2919986232503896032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5516952211035950466/posts/default/2919986232503896032'/><link rel='alternate' type='text/html' href='http://salakoahmed.blogspot.com/2008/08/software-development-creativitity-comes.html' title='Software Development: Creativitity Comes First.'/><author><name>Ahmed Salako</name><uri>http://www.blogger.com/profile/01839254478028869212</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_XwziUoKLz60/SK1ApeGzA7I/AAAAAAAAAAM/2soROrZZ8xQ/s72-c/iRobot.jpg' height='72' width='72'/><thr:total>0</thr:total></entry></feed>
