<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Squarespace Site Server v5.9.2 (http://www.squarespace.com/) on Fri, 12 Mar 2010 19:41:16 GMT--><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rss="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:cc="http://web.resource.org/cc/"><rss:channel rdf:about="http://abdullin.com/wiki/"><rss:title>Wiki</rss:title><rss:link>http://abdullin.com/wiki/</rss:link><rss:description></rss:description><dc:language>en-US</dc:language><dc:date>2010-03-12T19:41:16Z</dc:date><admin:generatorAgent rdf:resource="http://www.squarespace.com/">Squarespace Site Server v5.9.2 (http://www.squarespace.com/)</admin:generatorAgent><rss:items><rdf:Seq><rdf:li rdf:resource="http://abdullin.com/wiki/what-is-api.html"/><rdf:li rdf:resource="http://abdullin.com/wiki/what-is-virtual-machine-vm.html"/><rdf:li rdf:resource="http://abdullin.com/wiki/agile-software-development.html"/><rdf:li rdf:resource="http://abdullin.com/wiki/unit-testing.html"/><rdf:li rdf:resource="http://abdullin.com/wiki/version-control-system-vcs.html"/><rdf:li rdf:resource="http://abdullin.com/wiki/test-driven-development-tdd.html"/><rdf:li rdf:resource="http://abdullin.com/wiki/cloud-computing.html"/><rdf:li rdf:resource="http://abdullin.com/wiki/continuous-integration.html"/><rdf:li rdf:resource="http://abdullin.com/wiki/inversion-of-control-ioc.html"/><rdf:li rdf:resource="http://abdullin.com/wiki/component-driven-development.html"/></rdf:Seq></rss:items></rss:channel><rss:item rdf:about="http://abdullin.com/wiki/what-is-api.html"><rss:title>What is API?</rss:title><rss:link>http://abdullin.com/wiki/what-is-api.html</rss:link><dc:creator>Rinat Abdullin</dc:creator><dc:date>2009-07-24T17:06:06Z</dc:date><dc:subject></dc:subject><content:encoded><![CDATA[<p>Application Programming Interface (API) is a specification for interacting with software application or service programmatically. Usually it is exposed as a set of allowed method calls along with:</p>

<ul>
<li>defined parameters and return arguments;</li>
<li>calling conventions;</li>
<li>usage limitations.</li>
</ul>

<p>For example, here's how a piece of Twitter REST API looks like:</p>

<ul>
<li>Twitter REST API Method: <em>statuses update</em></li>
<li>URL: <em>http://twitter.com/statuses/update.format</em></li>
<li>Formats: <em>xml, json, rss, atom</em></li>
<li>HTTP Method(s): <em>POST</em></li>
<li>Requires Authentication: <em>true</em></li>
<li>API rate limited: <em>false</em></li>
<li>Parameters: ...</li>
<li>Response: ...</li>
</ul>

<p>There are a few categorizations of APIs in the software development world.</p>

<p><strong>Web APIs</strong> define interfaces for interacting with various web sites and services in the Internet. These APIs usually use Hypertext Transfer Protocol (HTTP) requests for passing around data represented in JavaScript Object Notation (JSON) or Extensible Markup Language (XML) formats.</p>

<p>Twitter REST API, mentioned above, is an example of such Web API.</p>

<p><strong>Operating System APIs</strong> represent low-level methods exposed by the operating system (OS) that could be used by software applications to integrate with it. <em>Windows API</em> (or Win32) and <em>POSIX</em> definitions are among the most known examples.</p>

<p><strong>Software APIs</strong> are usually exposed by software vendors willing to provide integration capabilities for their products.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://abdullin.com/wiki/what-is-virtual-machine-vm.html"><rss:title>What is Virtual Machine - VM?</rss:title><rss:link>http://abdullin.com/wiki/what-is-virtual-machine-vm.html</rss:link><dc:creator>Rinat Abdullin</dc:creator><dc:date>2009-07-20T08:38:23Z</dc:date><dc:subject></dc:subject><content:encoded><![CDATA[<p>In computer science a Virtual Machine (VM) is a software implementation of a hardware (or a part of it) that executes programs, applications and scripts just like the real machine would do.</p>

<p>Here's the simplest example of Virtual Machine - Windows 7 running Windows XP in a VM to provide backwards compatibility for the older applications:</p>

<p><span class="full-image-block ssNonEditable"><span><img src="http://abdullin.com/storage/uploads/2009/07/2009-07-20_virtual_machine.png" alt="Virtual Machine running Windows XP within Windows 7"/></span></span></p>

<p>Here's another example - Sun VirtualBox running Ubuntu x64 server within Windows 7:</p>

<p><span class="full-image-block ssNonEditable"><span><img src="http://abdullin.com/storage/uploads/2009/07/2009-07-20_ubuntu_vm.png" alt=""/></span></span></p>

<p>These were the examples of <em>Operating System Virtual Machines</em>. Another type of VM is <em>Application Virtual Machine</em>, that runs applications and scripts in an isolated virtual environment. Examples of that would be Java VM or .NET Framework VM.</p>

<h1>VMs and Software Development</h1>

<p><br />
Virtual Machines are getting very important and widely used these days. This happens due to the improvements in hardware and virtualization capabilities along with the numerous benefits offered by the technology. </p>

<p>Some of usage scenarios include:</p>

<ul>
<li><p>Quality Assurance teams get the ability to test applications, their deployments and upgrades more efficiently. Testers don't need to have multiple OS and installation configurations available any more. A set of VM files (that are easy to share) is a replacement for that.</p>

<p>Additionally, it is quite easy to configure <a href="http://abdullin.com/wiki/continuous-integration.html">continuous integration</a> to run actual integration tests within differet virtual machines (emulating various OS and setup configurations), thus providing a better code coverage and issue detection.</p></li>
<li><p>Software Developers could try out latest changes and various multi-server deployment configurations within <a href="http://abdullin.com/journal/2008/8/19/configuring-virtual-development-environment.html">virtual development environments</a>.</p></li>
<li><p>Cloud service providers could sell finely-grained computing capacities to customers in form of the VM slices. Customer is able to configure his Virtual Machine any way he wants.</p>

<p>Should they want to change hosting provider, they just need to move a single VM from one environment to another.</p></li>
<li><p>For complex enterprise applications (spawning multiple machines and server roles) virtual machines provide high-level separation of concerns, simplifying software evolution and maintenance.</p></li>
<li><p>It is really easy to launch multiple virtual machine clones from one VM file. This simplifies <a href="http://abdullin.com/journal/2009/6/20/cloud-bursting-scenarios-for-small-companies.html">scaling and cloud bursting scenarios for organizations</a>.</p></li>
</ul>

<p><strong>Related links:</strong></p>

<ul>
<li><a href="http://en.wikipedia.org/wiki/Virtual_machine" target="_blank" class="offsite-link-inline">Virtual Machine</a> on Wikipedia</li>
<li><a href="http://abdullin.com/journal/2008/7/31/development-server-meets-virtualization.html">Development server meets virtualization</a></li>
<li><a href="http://abdullin.com/journal/2008/8/19/configuring-virtual-development-environment.html">Configuring Virtual Development Environment</a></li>
</ul>
]]></content:encoded></rss:item><rss:item rdf:about="http://abdullin.com/wiki/agile-software-development.html"><rss:title>Agile Software Development</rss:title><rss:link>http://abdullin.com/wiki/agile-software-development.html</rss:link><dc:creator>Rinat Abdullin</dc:creator><dc:date>2009-06-13T07:50:08Z</dc:date><dc:subject></dc:subject><content:encoded><![CDATA[<p><em>Agile Software Development</em> is an <em>iterative and incremental approach</em> in software development, where <em>requirements and solutions evolve</em> through a <em>tight collaboration</em> of self-organizing cross-functional teams.</p>

<p>Simply put, Agile Software Development is a <em>group of software development methodologies</em> that work quite well when:</p>

<ul>
<li>projects are not mission-critical;</li>
<li>business requirements change extremely fast;</li>
<li>there are great developers available;</li>
<li>development teams are small;</li>
<li>development culture and mentality favors self-organization and self-learning.</li>
</ul>

<p>In other words, Agile works quite well in situations when some <strong>unique software project has to be delivered really fast</strong> in order to seize the market opportunity. This works because Agile software methodologies allow development teams to <em>adapt quickly to the rapidly changing business requirements</em>. This happens because of:</p>

<ul>
<li><strong>short development iterations</strong> allowing to start getting feedback early in the project's life-cycle and incorporate it into the product fast by delivering working software repeatedly and in a timely manner;</li>
<li><strong><a href="http://abdullin.com/wiki/continuous-integration.html">continuous integration</a></strong> helping to reduce development friction and improve quality of a rapidly developing project in self-organizing environment;</li>
<li><strong>feature-driven development</strong> focusing development on delivering features (functionality) bringing real business value to the client (and the project);</li>
<li><strong>lean software development</strong> laying out common principles for efficient software development process;</li>
<li><strong>eXtreme Programming</strong> pushing lightweight software development methodologies to the extreme.</li>
</ul>

<p>Long-term planning (along with some other formalities of a totally controlled project management process) is mostly sacrificed in favor of the flexibility, fast delivery and self-organization. In such a situation we still have to maintain high quality of the project deliverables (while reducing the resource consumption). This is achieved with the help from:</p>

<ul>
<li><a href="http://abdullin.com/wiki/test-driven-development-tdd.html"><strong>test-driven development</strong></a> - provides foundation for the <em>Continuous Integration</em> and facilitates change while maintaining stability of the software project;</li>
<li><strong>pair programming</strong> - improves code quality and allows to have more efficient knowledge sharing.</li>
</ul>

<p><strong>Related Links:</strong></p>

<ul>
<li><a href="http://en.wikipedia.org/wiki/Agile_software_development" target="_blank" class="offsite-link-inline">Agile Software Development</a> on Wikipedia</li>
<li><a href="http://en.wikipedia.org/wiki/Lean_software_development" target="_blank" class="offsite-link-inline">Lean Software Development</a> on Wikipedia</li>
<li><a href="http://en.wikipedia.org/wiki/Scrum_(development)" target="_blank" class="offsite-link-inline">Scrum</a> on Wikipedia</li>
<li><a href="http://en.wikipedia.org/wiki/Planning_poker" target="_blank" class="offsite-link-inline">Planning poker</a> on Wikipedia</li>
<li><a href="http://www.extremeprogramming.org/what.html" target="_blank" class="offsite-link-inline">eXtreme Programming</a> on ExtremeProgramming.com</li>
</ul>

<p><em>This article is a part of <a href="http://abdullin.com/software-development-bok/">Software Development Body of Knowledge ABC</a> series. You can <a href="http://feeds.abdullin.com/RinatAbdullin"><strong>subscribe to RSS feed to stay updated</strong></a></em>.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://abdullin.com/wiki/unit-testing.html"><rss:title>Unit Testing</rss:title><rss:link>http://abdullin.com/wiki/unit-testing.html</rss:link><dc:creator>Rinat Abdullin</dc:creator><dc:date>2009-06-12T20:19:31Z</dc:date><dc:subject></dc:subject><content:encoded><![CDATA[<p><em>Unit Testing</em> in software development is a <strong>way to quickly verify that smallest blocks of software (units) behave as expected</strong> even as the software changes and evolves.</p>

<p>Here's how it works. </p>

<p>Any program could be logically separated into distinct units (in <em>object-oriented programming</em> the smallest unit usually being a <em>class</em>). <strong>Developers, while coding these program units, also create tests for them</strong> (code blocks containing some assertions and expectations about units). These tests could be used to rapidly verify behavior of the code being tested.</p>

<p>When some other developer introduces new units or changes something in existing units, he can run all the tests available for the program and verify that everything is still operating as expected. Usually running unit tests is a fast operation (less than 30 seconds), so developers are encouraged to do that often.</p>

<p>Here's how unit test suite looks for the Lokad Shared Libraries project (running all 176 tests for the primary assembly takes just 3 seconds):</p>

<p><span class="full-image-block ssNonEditable"><span><img src="http://abdullin.com/storage/uploads/2009/06/2009-06-14_UnitTesting.png?__SQUARESPACE_CACHEVERSION=1244975875863" alt="Unit test suite for Lokad Shared Libraries"/></span></span></p>

<p>If unit tests indicate that something has gone wrong, then the root of these problems could be detected rather quickly (since failing tests point directly to the misbehaving unit).</p>

<p><strong>Unit Testing is extremely important for software development</strong>, since delivering projects efficiently without unit testing is nearly impossible. There are software development practices depending on unit testing:</p>

<ul>
<li><a href="http://abdullin.com/wiki/test-driven-development-tdd.html">Test-Driven Development (TDD)</a> - software design method requiring developers to write tests before writing code (this may sound strange, but it works)</li>
<li><a href="http://abdullin.com/wiki/continuous-integration.html">Continuous Integration</a> - software development practice that allows to isolate some bugs in time by automatically running unit tests after each change to the code.</li>
</ul>

<p>There are some additional benefits of unit testing:</p>

<ul>
<li>it <strong>facilitates change</strong> - developers are encouraged to refactor and change code, since they have a way to rapidly verify that program units still behave as expected.</li>
<li>a good unit test is <strong>living documentation</strong> for the code, since it describes how the code is expected to behave;</li>
<li>unit test is a good way to communicate over issues in the code and distribute work between multiple developers.</li>
</ul>

<p>It is important to keep in mind, that unit tests only facilitate change by testing individual code units. They do not guarantee that the entire program will be free from bugs.</p>

<p>Here's the simplest unit test in C#, using <a href="http://www.nunit.org/index.php" target="_blank" class="offsite-link-inline">NUnit framework</a>:</p>

<pre><code>[TestFixture]
public class CalculatorTests
{

  [Test, ExpectedException(typeof(DivideByZeroException))]
  public void Divide_by_zero_should_throw_exception()
  {
    new Calculator().Divide(1, 0);
  }

  [Test]
  public void Adding_actually_works()
  {
    var result = new Calculator().Add(1, 15);
    Assert.AreEqual(16, result);
  }
}
</code></pre>

<p>As you can see, a unit test is simply a class that contains methods checking behavior of some <em>Calculator</em> class. This test class is sometimes also called <em>test fixture</em> or <em>test suite</em>. In this snippet above test methods are decorated with a special attributes that are used by NUnit framework to recognize them, run as needed (i.e.: within an automated build) and print results.</p>

<p>Although this unit test suite may look extremely simple, it does not have to stop there. Here are some <strong>advanced usage scenarios</strong> that simplify development of complex enterprise applications:</p>

<ul>
<li>setup a temporary database before unit tests start up and then check all data access routines against this sample database;</li>
<li>have a test suite that executes every hour against methods in your web services, verifying that they are alive and processing data properly.</li>
<li>use non-deterministic reproducible tests that verify behavior of your class in various unexpected situations, reporting back when something goes wrong;</li>
<li>use unit testing framework to write code quality tests, that check and enforce some guidelines (i.e.: every controller class should be immutable and have name ending with <em>Controller</em>).</li>
</ul>

<p><strong>Related Links:</strong></p>

<ul>
<li><a href="Continuous Integration">Continuous Integration</a></li>
<li><a href="http://abdullin.com/wiki/test-driven-development-tdd.html">Test-Driven Development</a></li>
<li><a href="http://abdullin.com/journal/2009/2/13/using-lokad-rules-to-simplify-net-unit-tests.html">Using Lokad Rules to Simplify .NET Unit Tests</a></li>
<li><a href="http://abdullin.com/journal/2008/12/5/how-to-use-systemutil-to-write-net-code-with-testable-sleep.html">How to Use SystemUtil to Write .NET Code With Testable Sleep and Time Calls</a></li>
<li><a href="http://abdullin.com/journal/2008/11/29/shortcuts-for-nunit-exception-expectations.html">Shortcuts for NUnit Exception Expectations</a></li>
<li><a href="http://en.wikipedia.org/wiki/Unit_testing" target="_blank" class="offsite-link-inline">Unit Testing</a> on Wikipedia</li>
</ul>

<p><em>This article is a part of <a href="http://abdullin.com/software-development-bok/">Software Development Body of Knowledge ABC</a> series. You can <a href="http://feeds.abdullin.com/RinatAbdullin"><strong>subscribe to RSS feed to stay updated</strong></a></em>.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://abdullin.com/wiki/version-control-system-vcs.html"><rss:title>Version Control System - VCS</rss:title><rss:link>http://abdullin.com/wiki/version-control-system-vcs.html</rss:link><dc:creator>Rinat Abdullin</dc:creator><dc:date>2009-06-12T19:21:23Z</dc:date><dc:subject></dc:subject><content:encoded><![CDATA[<p><em>Version Control System</em> (VCS) is a software that allows to manage changes of documents, programs, images and other information that is stored in form of computer files. Changes are usually identified by an incrementing number or letter code also known as <em>revision number</em> or <em>revision</em>. </p>

<p>The simplest usage of versioning is - <em>you can easily go back to the previous working version of your files</em>, should you mess something up with the latest changes.</p>

<p>Changes could range from fixing a typo in a text file up to a huge refactoring in a software project, spanning hundreds of files. Each change usually has name of the person introduced it, time of the change and an optional description message.</p>

<p><strong>Version Control Systems became an essential part of software development</strong> due to the following benefits:</p>

<ul>
<li><strong>collaboration</strong> - a team of developers (which could be distributed geographically) may be working on the same set of files at once without interrupting each other's work;</li>
<li><strong>change management</strong> - changes can be inspected, reviewed or rolled back as needed; if you need that App.config file the way it was on May 17, 2008 - no problem;</li>
<li><strong>tracking ownership</strong> - every change is associated with the name of the person, so we know whom to give kudos to or ask questions;</li>
<li><strong>tracking evolution</strong> - every change is associated with a short description, so you just need to pull a change log of some class to see how it evolved and who did what;</li>
<li><strong>branching</strong> - it is possible to create a copy (branch) of the entire project for some specific purpose (i.e.: prototyping or developing a fix for the important customer) without disrupting development workflow;</li>
<li><a href="http://abdullin.com/wiki/continuous-integration.html"><strong>continuous integration</strong></a> - ability to split evolution of a software project into incremental changes allows to run all sorts of checks and tests against each incremental change in a continuous manner.</li>
</ul>

<h1>Language</h1>

<p><strong>Common terms:</strong></p>

<ul>
<li><em>Repository</em> - database server that contains all files and their history.</li>
<li><em>Working copy</em> - local version of files on somebody's machine. It may contain local unversioned changes.</li>
<li><em>Trunk</em> - home folder for some project within the repository. It usually contains all the latest changes.</li>
<li><em>History</em> (or <em>ChangeLog</em>) - a list of changes that were done to a file or folder since it was created.</li>
<li><em>Latest</em> (or <em>Head</em>) - latest available version of some file or folder.</li>
<li><em>Revision</em> - another word that means current version of file or folder.</li>
</ul>

<p><strong>Common operations:</strong></p>

<ul>
<li><em>Check out</em> - first operation required to work with any repository. It involves creating <em>working copy</em> that mirrors some folder on the server (usually that's <em>trunk</em>).</li>
<li><em>Commit</em> (or <em>Check In</em>) - sending your local changes back to the server, so that other people can get them as well.</li>
<li><em>Update</em> - updating local <em>working copy</em> to have all the lasted changes that were committed to the server since the last time you've checked it.</li>
<li><em>Revert</em> - discard all your local changes to the <em>working copy</em>.</li>
<li><em>Diff</em> (or <em>Change</em>, <em>Delta</em>) - differences between two versions of the same file; or an operation involving actually looking up what was changed between two versions.</li>
<li><em>Create patch</em> - automatically create a file that describes all the changes that were done to the <em>working copy</em> (basically containing all <em>diffs</em>). Then these changes could be reviewed by somebody else and committed to the repository.</li>
</ul>

<p><strong>Advanced operations:</strong></p>

<ul>
<li><em>Conflict</em> - that happens when somebody else changed the file, while you were working on it locally. </li>
<li><em>Resolve</em> - to fix contradicting changes by reviewing and manually merging them (VCSs can automatically resolve majority of the conflicts).</li>
<li><em>Tag</em> - to place a human readable label on some revision (i.e.: when releasing a product); or a noun representing such a label.</li>
<li><em>Branch</em> - to start a separate line of development over some old revision (i.e.: when fixing bugs for the previously released version).</li>
<li><em>Merge</em> - bringing together changes from different sources (i.e.: when applying a bug fix from some <em>branch</em> to a <em>trunk</em>).</li>
</ul>

<h1>How it looks</h1>

<p>Here's how usage of Version Control Systems looks like.</p>

<p>Checking out the trunk of Autofac IoC project:</p>

<p><span class="full-image-block ssNonEditable"><span><img src="http://abdullin.com/storage/uploads/2009/06/2009-06-14_Version_Control_System_in_action3.png?__SQUARESPACE_CACHEVERSION=1244974613144" alt="Checking out sources of Autofac IoC Container for .NET"/></span></span></p>

<p>Browsing through the revision history:</p>

<p><span class="full-image-block ssNonEditable"><span><img src="http://abdullin.com/storage/uploads/2009/06/2009-06-14_Version_Control_System_in_action1.png?__SQUARESPACE_CACHEVERSION=1244974363275" alt="Browsing revisions with a TortoiseSVN UI for SVN Version Control System"/></span></span></p>

<p>Looking at some revision in detail:</p>

<p><span class="full-image-block ssNonEditable"><span><img src="http://abdullin.com/storage/uploads/2009/06/2009-06-14_Version_Control_System_in_action2.png?__SQUARESPACE_CACHEVERSION=1244974435065" alt="Looking at some revision in Autofac trunk with TortoiseSVN"/></span></span></p>

<p>These screen-shots show <a href="http://tortoisesvn.tigris.org/" target="_blank" class="offsite-link-inline">TortoiseSVN</a>, which is a widely-used open source software for accessing Subversion repositories. Here's the bigger picture featuring some popular Version Control Systems:</p>

<ul>
<li><a href="http://subversion.tigris.org/" target="_blank" class="offsite-link-inline">Subversion</a> - cross-platform open source VCS with great User Interface implementations (TortoiseSVN is the most known implementation for Windows shell integration).</li>
<li><a href="http://git-scm.com/" target="_blank" class="offsite-link-inline">Git</a> - open-source VCS for distributed development that does not require a central server, yet lacks a convenient UI.</li>
<li><a href="http://www.selenic.com/mercurial/wiki/" target="_blank" class="offsite-link-inline">Mercurial</a> - yet another distributed open source version control system which is less popular than Git (5 times less popular, if you trust Google).</li>
</ul>

<p><strong>Related Links:</strong></p>

<ul>
<li><a href="http://abdullin.com/wiki/Continuous%20Integration">Continuous Integration</a></li>
<li><a href="http://en.wikipedia.org/wiki/Version_control_system">Version Control System</a> on Wikipedia</li>
</ul>

<p><em>This article is a part of <a href="http://abdullin.com/software-development-bok/">Software Development Body of Knowledge ABC</a> series. You can <a href="http://feeds.abdullin.com/RinatAbdullin"><strong>subscribe to RSS feed to stay updated</strong></a></em>.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://abdullin.com/wiki/test-driven-development-tdd.html"><rss:title>Test-Driven Development - TDD</rss:title><rss:link>http://abdullin.com/wiki/test-driven-development-tdd.html</rss:link><dc:creator>Rinat Abdullin</dc:creator><dc:date>2009-06-09T20:26:11Z</dc:date><dc:subject></dc:subject><content:encoded><![CDATA[<p><em>Test-Driven Development</em> (TDD) is a software design method based on short development iterations requiring developers to <strong>create automated <a href="http://abdullin.com/wiki/unit-testing.html">unit tests</a> that define code requirements, before writing code itself</strong>. These unit tests contain multiple assertions (returning true or false) that could be used to <strong>rapidly verify correct behavior of the code</strong> being tested. </p>

<p><em>Once the produced code passes unit tests, it could be refactored and cleaned up</em>. Developer will be able to ensure code staying stable in the process, by running unit tests frequently. Next iteration could be started afterwards.</p>

<p>Writing a test before the actual code and its refactoring helps to achieve higher quality, because:</p>

<ul>
<li>it forces developer to refine code contracts before working on the implementation;</li>
<li>it forces developer to make and keep code easily testable. This requires loose coupling and a separation of <a href="http://abdullin.com/wiki/cross-cutting-concern.html">cross-cutting concerns</a>;</li>
<li>presence of unit tests gives developers more psychological freedom to experiment with the code and refactor it; managers get lower risks related to introducing high-level changes to the project.</li>
</ul>

<p>There are some limitations of the TDD:</p>

<ul>
<li>badly written or simply <em>brittle</em> tests can create a tremendous maintenance overhead and hinder any code evolution;</li>
<li>complete code coverage by unit tests creates a false perception of security and may result in less QA than needed;</li>
<li>unit tests written by the same developer tend to have similar <em>blind spots</em> that may actually require testing.</li>
</ul>

<h1>Unit Test Code Coverage</h1>

<p>One of the most important metrics in the Test-Driven Development is <em>unit test code coverage</em>. It could be calculated automatically and indicates percentage of the code that is executed while unit tests are running.</p>

<p><span class="full-image-block ssNonEditable"><span><img src="http://abdullin.com/storage/uploads/2009/06/2009-06-11_code_coverage_for_TDD.png?__SQUARESPACE_CACHEVERSION=1244748228052" alt=""/></span></span></p>

<p>Although code coverage does not indicate quality of the unit tests, it is still a good measure of code testability. It is a common practice to set a certain code coverage threshold (i.e.: 80%) and enforce it within the <a href="http://abdullin.com/wiki/continuous-integration.html">continuous integration</a> scripts. This way, if a developer commits a significant amount of code without unit tests, this is likely to break the build, forcing him to concentrate on testing his code.</p>

<p><em>Test-Driven Development</em> plays well along with <a href="http://abdullin.com/wiki/component-driven-development.html">Component-Driven Development</a>, since both of these approaches favor doing design before the actual implementation.</p>

<p><strong>Related links:</strong></p>

<ul>
<li><a href="http://abdullin.com/wiki/unit-testing.html">Unit Testing</a></li>
<li><a href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank" class="offsite-link-inline">Test-Driven Development</a> on Wikipedia</li>
<li><a href="http://abdullin.com/journal/2009/4/11/testing-mvc-controllers-with-mock-container.html">Testing MVC Controllers with Mock Containers</a></li>
<li><a href="http://abdullin.com/journal/2009/2/13/using-lokad-rules-to-simplify-net-unit-tests.html">Using Lokad Rules to Simplify .NET Unit Tests</a></li>
<li><a href="http://abdullin.com/journal/2008/12/5/how-to-use-systemutil-to-write-net-code-with-testable-sleep.html">How to Use SystemUtil to Write .NET Code With Testable Sleep and Time Calls</a></li>
<li><a href="http://abdullin.com/journal/2008/11/29/shortcuts-for-nunit-exception-expectations.html">Shortcuts for NUnit Exception Expectations</a></li>
<li><a href="http://abdullin.com/journal/2008/10/21/how-to-ensure-that-complex-methods-are-covered-with-tests.html">How to ensure that complex methods are covered with tests</a></li>
<li><a href="http://abdullin.com/journal/2008/10/14/writing-net-code-analysis-rules-as-unit-tests.html">Writing .NET code analysis rules as unit tests</a></li>
</ul>

<p><em>This article is a part of <a href="http://abdullin.com/software-development-bok/">Software Development Body of Knowledge ABC</a> series. You can <a href="http://feeds.abdullin.com/RinatAbdullin"><strong>subscribe to RSS feed to stay updated</strong></a></em>.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://abdullin.com/wiki/cloud-computing.html"><rss:title>Cloud Computing</rss:title><rss:link>http://abdullin.com/wiki/cloud-computing.html</rss:link><dc:creator>Rinat Abdullin</dc:creator><dc:date>2009-06-05T09:11:15Z</dc:date><dc:subject></dc:subject><content:encoded><![CDATA[<p><em>Cloud computing</em> is about hardware-based services (involving computing, network and storage capacities), where:</p>

<ul>
<li>Services are <strong>provided on-demand</strong>; customers can pay for them as they go, without the need to invest into a datacenter.</li>
<li>Hardware management is abstracted from the customers.</li>
<li>Infrastructure capacities are elastic and can easily scale up and down.</li>
</ul>

<p>There is a powerful economic force behind this simple model: <em>providing and consuming cloud computing services generally allows to have</em> far more <em>efficient resource utilization</em>, compared to self-hosting and data center type of hosting. </p>

<p>This is especially true for <em>bursting into cloud scenarios</em> when cloud consumers use elasticity of the cloud services to handle any spikes they might get. More information is available in article <a href="http://abdullin.com/journal/2009/4/14/why-is-cloud-computing-important-for-us.html">Why is cloud computing important for us?</a>.</p>

<p>Obviously, consuming raw hardware capacities may be too hardcore for some consumers that merely want to have a scalable storage. So it is natural that cloud computing services already got some diversity around them: </p>

<ul>
<li><p><strong>Infrastructure as a Service</strong> (IaaS), where customer gets raw hardware resources (i.e.: <a href="http://abdullin.com/wiki/what-is-virtual-machine-vm.html">virtual machines</a> with OS of choice). Examples:</p>

<ul>
<li><a href="http://en.wikipedia.org/wiki/Amazon_Elastic_Compute_Cloud" target="_blank" class="offsite-link-inline">Amazon Elastic Compute Cloud</a> - part of AWS that offers scalable Xen-based virtual machines.</li>
<li><a href="http://www.mosso.com/"  target="_blank" class="offsite-link-inline">Mosso</a> - .NET or LAMP web sites, Storage and Linux-based virtual servers. <a href="http://www.google.ru/search?client=firefox-a&amp;rlz=1R1GGGL_en-GB&amp;hs=D7K&amp;q=Mosso+sucks&amp;btnG=%D0%9F%D0%BE%D0%B8%D1%81%D0%BA&amp;aq=f&amp;oq=" target="_blank" class="offsite-link-inline">People complain</a>.</li>
</ul></li>
<li><p><strong>Platform as a Service</strong> (PaaS), where service provider builds a platform to simplify solving some technological tasks. This simplifies life for the customer, but also comes with a lock-down cost. Some providers:</p>

<ul>
<li><a href="http://www.microsoft.com/azure/default.mspx" target="_blank" class="offsite-link-inline">Microsoft Windows Azure</a> - .NET driven and Microsoft-owned cloud infrastructure, <a href="http://abdullin.com/journal/2009/4/11/cloud-computing-could-windows-azure-catch-up-with-amazon.html">which is behind Amazon in some areas</a>.</li>
<li><a href="http://aws.amazon.com/" target="_blank" class="offsite-link-inline">Amazon Web Services</a> - collection of scalable infrastructure pieces for building your cloud application.</li>
<li><a href="http://code.google.com/appengine/" target="_blank" class="offsite-link-inline">Google App Engine</a> - Python-based cloud framework.</li>
<li><a href="http://abdullin.com/journal/2009/4/11/cloud-computing-could-windows-azure-catch-up-with-amazon.html">Amazon Elastic Map Reduce</a> - <a href="http://hadoop.apache.org/core/" target="_blank" class="offsite-link-inline">Apache Hadoop</a> hosted on Amazon cloud services (EC2 and S3)</li>
</ul></li>
<li><p><strong>Software as a Service</strong> (SaaS). At this level everything is way more simple for the customers to consume, since they are provided with actual services generating business value to them. Service providers handle all the technological complexity and provide the support as needed.</p></li>
</ul>

<p>From the development perspective, cloud computing is a brand new field (which is especially true for the .NET world). So <em>there are no established patterns and pactices in the field yet</em>. However, common development guidelines tend to work quite well:</p>

<ul>
<li><a href="http://abdullin.com/wiki/component-driven-development.html">Component-Driven Development</a> with Inversion of Control Containers</li>
<li>Test-Driven Development</li>
<li><a href="http://abdullin.com/wiki/continuous-integration.html">Continuous Integration</a> for the projects</li>
<li>Separation of <a href="http://abdullin.com/wiki/cross-cutting-concern.html">Cross-Cutting Concerns</a></li>
</ul>

<p><strong>Related links:</strong>  </p>

<ul>
<li><a href="http://abdullin.com/cloud-computing-in-net">Cloud Computing article series</a></li>
<li><a href="http://abdullin.com/journal/2009/4/14/why-is-cloud-computing-important-for-us.html">Why is Cloud Computing important for us?</a></li>
<li><a href="http://blog.vermorel.com/?p=94" target="_blank" class="offsite-link-inline">Cloud computing: a personal review about Azure, Amazon, Google Engine, VMWare and the others</a> by Joannes Vermorel</li>
<li><a href="http://en.wikipedia.org/wiki/Cloud_computing">Cloud Computing</a> on Wikipedia</li>
</ul>

<p><em>This article is a part of <a href="http://abdullin.com/software-development-bok/">Software Development Body of Knowledge ABC</a> series. You can <a href="http://feeds.abdullin.com/RinatAbdullin"><strong>subscribe to RSS feed to stay updated</strong></a></em>.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://abdullin.com/wiki/continuous-integration.html"><rss:title>Continuous Integration</rss:title><rss:link>http://abdullin.com/wiki/continuous-integration.html</rss:link><dc:creator>Rinat Abdullin</dc:creator><dc:date>2009-06-03T19:07:12Z</dc:date><dc:subject></dc:subject><content:encoded><![CDATA[<p><em>Continuous Integration</em> (CI) in software development is a set of practices and principles that speed up delivery of software projects and increase quality of their deliverables.</p>

<p>Simply put, Continuous Integration takes a lot of mundane and boring things away from the process of software development, while <em>letting developers to concentrate on more enjoyable and creative tasks</em>.</p>

<p>As the name implies, Continuous Integration is about <em>integrating changes to the development project continuously and automatically</em>. These changes usually come in form of modifications and additions to the source code. When we keep them as small as possible and automatically run all checks available (starting from the compilation process and up to the full test routines), we can detect most breaking issues whenever they are introduced. Since the changes are small, it is much easier to isolate and fix the root cause.</p>

<p>Continuous integration helps to achieve this by reducing development friction involved in project integration. This is done with the help of:</p>

<ul>
<li><strong><a href="http://abdullin.com/wiki/version-control-system-vcs.html">Version Control Systems</a></strong> that allow large and distributed teams to work together on the same project, while sending their code changes (commits) to the central server. Each commit is stored on the server and could be reviewed or reverted.</li>
<li><strong>Build Automation</strong> that is basically about build tools and scripts that allow to start the complete integration build on a local machine with a single mouse-click.</li>
<li><strong>Unit Tests</strong> ensuring that code stays stable through all the changes (this normally comes with the <a href="http://abdullin.com/wiki/test-driven-development-tdd.html">Test-Driven Development practices</a>).</li>
<li><strong>Code Quality Tests</strong> that consistently enforce development guidelines accepted by the team.</li>
<li><strong>Regular Commits</strong> by developers that reduce amount of change involved in every integration.</li>
<li><strong>Integrating Every Commit</strong> (as soon as it comes) on a central server allows to detect any compilation failures or broken tests immediately. Also this is the best way to deal with "but it works on my machine" problem.</li>
<li><strong>Publishing Integration Results</strong> that get created along with the build project might simplify getting feedback from people outside of the development team. Examples of these results are: unit test results, performance metrics, install packages, code quality reports etc.</li>
</ul>

<p>From my personal experience, Continuous Integration is a must have in any single project that has a lifespan more than 200 human hours. </p>

<p>Here's the most simple example of CI benefits. When you have proper CI routine at hand, updating a customer with the latest fix (if the fix is in the desktop application, for example) is a mere matter of:</p>

<ul>
<li>write the code;</li>
<li>test the code;</li>
<li>commit the changes to the server, telling it to publish install packages along the way;</li>
<li>tell customer to install the latest version (or simply restart the application, if you have autoupdate routine in the application).</li>
</ul>

<p>Behind the scenes will happen:</p>

<ul>
<li>backing up a copy of changes;</li>
<li>running full suite of tests against the entire codebase;</li>
<li>computing code metrics and performance statistics;</li>
<li>publishing development reports for the team;</li>
<li>updating online documentation that is generated from the code;</li>
<li>building the project and creating a new version of install package;</li>
<li>creating a backup of this package (along with all the libraries and PDBs);</li>
<li>putting install package to the deployment server and updating manifest needed for auto-updates;</li>
<li>notifying all involved parties about the build and results.</li>
</ul>

<p>Ability to take all this "behind the scenes" routine for granted definitely reduces development friction a bit, allowing to concentrate on more interesting and creative things.</p>

<p><strong>Software Stack for Continuous Integration in .NET:</strong></p>

<ul>
<li><p><a href="http://abdullin.com/wiki/version-control-system-vcs.html">Version Control Systems</a></p>

<ul>
<li>Subversion (Open Source)</li>
<li>Git (Open Source)</li>
</ul></li>
<li><p>Unit Testing</p>

<ul>
<li>NUnit (Open Source)</li>
<li>MBUnit (Open Source)</li>
<li>XUnit (Open Source)</li>
</ul></li>
<li><p>Build Automation</p>

<ul>
<li>MSBuild</li>
<li>NAnt</li>
</ul></li>
<li><p>Continuous Integration Server</p>

<ul>
<li>Cruise Control .NET (Open Source)</li>
</ul></li>
<li><p>Code Quality</p>

<ul>
<li>Mono Gendarme (Open Source)</li>
<li>Microsoft FxCop</li>
</ul></li>
</ul>

<p><strong>Related Links:</strong>  </p>

<ul>
<li><a href="http://martinfowler.com/articles/continuousIntegration.html" target="_blank" class="offsite-link-inline">Continuous Integration by Martin Fowler</a> </li>
<li><a href="http://en.wikipedia.org/wiki/Continuous_Integration" target="_blank" class="offsite-link-inline">Continuous Integration on Wikipedia</a></li>
<li><a href="http://abdullin.com/journal/2008/7/30/some-integration-recipes-for-the-efficient-development.html">Some integration recipes for the efficient development</a></li>
<li><a href="http://abdullin.com/journal/2008/10/8/hunger-for-the-integration-builds.html">Hunger for the integration builds</a>.</li>
<li><a href="http://abdullin.com/journal/2008/1/3/development-software-requirements-for-the-xlim-2-solutions.html">Recommendations on software and tools for the development</a></li>
<li><a href="http://abdullin.com/journal/2008/1/12/organization-of-xlim-solutions-development-svn-and-integrati.html">Organization of xLim solutions: development, svn and integration</a></li>
<li><a href="http://abdullin.com/journal/2008/1/8/common-development-principles-for-xlim.html">Common development principles for xLim</a></li>
</ul>

<p><em>This article is a part of <a href="http://abdullin.com/software-development-bok/">Software Development Body of Knowledge ABC</a> series. You can <a href="http://feeds.abdullin.com/RinatAbdullin"><strong>subscribe to RSS feed to stay updated</strong></a></em>.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://abdullin.com/wiki/inversion-of-control-ioc.html"><rss:title>Inversion of Control - IoC</rss:title><rss:link>http://abdullin.com/wiki/inversion-of-control-ioc.html</rss:link><dc:creator>Rinat Abdullin</dc:creator><dc:date>2009-06-01T18:30:44Z</dc:date><dc:subject></dc:subject><content:encoded><![CDATA[<p><em>Inversion of Control (IoC)</em> is an approach in software development that favors removing sealed dependencies between classes in order to make code more simple and flexible. We push control of dependency creation outside of the class, while making this dependency explicit.</p>

<p>Usage of Inversion of Control generally allows to create applications that are more flexible, unit-testable, simple and maintainable in the long run.</p>

<p>Consider the sample:</p>

<pre><code>public class Car
{
  Engine _engine;

  public Car()
  {  
    _engine = new Engine();
  }
}
</code></pre>

<p>Here we have extremely strong dependency between Car and Engine. We actually, can't install any other engine inside, since Car controls instantiation of that Engine.</p>

<p>Let's open up the design a little bit:</p>

<pre><code>public class Car
{
  IEngine _engine;

  public Car(IEngine engine)
  {
    _engine = engine;
  }
}
</code></pre>

<p>Now we have moved the control over the <em>Engine</em> creation outside of the <em>Car</em> and into the code that creates it. This is called <em>Inversion of Control</em> or IoC for short.</p>

<p>Often control over the dependency creation is delegated to specialized application blocks called Inversion of Control Containers. IoC containers are really good in determining dependencies that are needed to create a specific class and injecting them automatically. This process is often called Dependency Injection.</p>

<p>Consider the following example for <a href="http://abdullin.com/autofac/">Autofac IoC Container</a> for .NET (there are many others as well):</p>

<pre><code>// configuration that happens only once.
var builder = new ContainerBuilder();
builder.Register&lt;Car&gt;();
builder.Register&lt;Engine&gt;().As&lt;IEngine&gt;();

var container = builder.Build();

// somewhere in the code
var car = container.Resolve&lt;Car&gt;();
</code></pre>

<p>Inversion of Control and Dependency Injection can do much more than that. Check the links at the end of this article for more details. </p>

<p>Here are just some hints on what could be done without changing <em>Car</em> and <em>Engine</em> classes:</p>

<ul>
<li>automatically check <em>IEngine</em> for failures when it is plugged into the <em>Car</em>;</li>
<li>write a log message every time we start the <em>IEngine</em>;</li>
<li>plug-in a spare <em>IEngine</em> whenever the original engine fails;</li>
<li>add a security check to prevent unauthorized driver from starting the <em>Car</em>.</li>
</ul>

<p><em>Engine</em> class from the example above could be called a component implementing <em>IEngine</em> service contract. Development approach that relies on separating code into composable and reusable components is called <a href="http://abdullin.com/wiki/component-driven-development.html">Component-Driven Development</a>. It brings additional benefits in conjunction with IoC. One of these benefits is about injecting <a href="http://abdullin.com/wiki/cross-cutting-concern.html">cross-cutting concerns</a> that allows to avoid complex and repeatable code in a lot of scenarios.</p>

<p><strong>Related links:</strong>  </p>

<ul>
<li><a href="http://abdullin.com/journal/2009/5/31/component-driven-development-and-ioc-containers.html">Component-driven development and IoC Containers</a></li>
<li><a href="http://abdullin.com/autofac">Autofac Inversion of Control Container for .NET</a></li>
<li><a href="http://abdullin.com/journal/2009/2/12/structuring-net-applications-with-autofac-ioc.html">Structuring .NET Applications with Autofac IoC</a> </li>
<li><a href="http://stackoverflow.com/questions/3058/what-is-inversion-of-control" target="_blank" class="offsite-link-inline">What is Inversion of Control</a>  on StackOverflow</li>
<li><a href="http://en.wikipedia.org/wiki/Inversion_of_control" target="_blank" class="offsite-link-inline">Inversion of Control</a> on Wikipedia.</li>
</ul>

<p><strong>List of popular IoC Containers for .NET:</strong></p>

<p><em>(in the order of preference)</em></p>

<ul>
<li><a href="http://abdullin.com/autofac/">Autofac</a></li>
<li><a href="http://www.castleproject.org/container/index.html" target="_blank" class="offsite-link-inline">Castle Windsor</a></li>
<li><a href="http://codeplex.com/unity" target="_blank" class="offsite-link-inline">Unity</a></li>
<li><a href="http://structuremap.sourceforge.net/" target="_blank" class="offsite-link-inline">StructureMap</a></li>
<li><a href="http://ninject.org/" target="_blank" class="offsite-link-inline">NInject</a></li>
<li><a href="http://www.springframework.net/" target="_blank" class="offsite-link-inline">Spring.NET</a></li>
</ul>

<p><em>This article is a part of <a href="http://abdullin.com/software-development-bok/">Software Development Body of Knowledge ABC</a> series. You can <a href="http://feeds.abdullin.com/RinatAbdullin"><strong>subscribe to RSS feed to stay updated</strong></a></em>.</p>
]]></content:encoded></rss:item><rss:item rdf:about="http://abdullin.com/wiki/component-driven-development.html"><rss:title>Component-Driven Development</rss:title><rss:link>http://abdullin.com/wiki/component-driven-development.html</rss:link><dc:creator>Rinat Abdullin</dc:creator><dc:date>2009-06-01T06:28:49Z</dc:date><dc:subject></dc:subject><content:encoded><![CDATA[<p><em>Component-Driven Development</em> is an approach in software development in which code is fragmented into reusable and testable components that are combined together to form application foundation for delivering business functionality. The combination and management of components is generally delegated to <a href="http://abdullin.com/wiki/inversion-of-control-ioc.html">Inversion of Control</a> Container.</p>

<p>A component itself is a class that implements some service contract and explicitly defines the dependencies that it needs in order to fulfill this contract. Actual implementation is hidden from everybody else outside the component.</p>

<p>Component-driven development really helps to deliver multiple applications and systems efficiently. It happens because:</p>

<ul>
<li>important functionality is abstracted in components;</li>
<li>components are coded and <a href="http://abdullin.com/wiki/unit-testing.html">unit-tested</a> only once;</li>
<li>it is easy to reuse component in similar situations, reducing development effort and avoiding code duplication;</li>
<li>every component has multiple use cases that provide additional feedback and help to find problems or limitations, if there are any;</li>
<li>whenever a component is fixed or improved, all its consumers would benefit from that automatically.</li>
</ul>

<p>As we go up in the complexity of the development, it becomes too cumbersome to manage components on the individual basis. That's where <a href="http://abdullin.com/journal/2009/10/21/infrastructure-shards-and-optional-components.html">infrastructure shards</a> come into the play. Infrastructure shard is a group of components used together in a similar manner to deliver certain functionality across multiple applications.</p>

<p>This scenario creates additional benefits for the component-driven development. Some synergy effects might include:</p>

<ul>
<li>Business functionality could be used to extend multiple applications. Since UI is shared, we could use shared documentation, tutorials and screenshots as well.</li>
<li>Sometimes context requires infrastructure shard to be evolved. This brings potential improvements in all existing and new applications.</li>
<li>When a group of components is developed to be used in multiple scenarios from the start, this polishes the overall design even further than <a href="http://abdullin.com/wiki/test-driven-development-tdd.html">TDD</a> or <a href="http://abdullin.com/wiki/component-driven-development.html">CDD</a> would alone.</li>
<li>Localization or UI changes across the software product line become easier, since the effort does not have to be duplicated and tested in multiple codebases.</li>
</ul>

<p><strong>Related links:</strong>  </p>

<ul>
<li><a href="http://abdullin.com/journal/2009/5/31/component-driven-development-and-ioc-containers.html">Component-Driven Development and IoC Containers</a></li>
<li><a href="http://abdullin.com/journal/2009/6/3/developing-component-driven-applications-powered-by-ioc-cont.html">Developing Component-Driven Applications powered by IoC Containers</a></li>
<li><a href="http://abdullin.com/journal/2009/10/21/infrastructure-shards-and-optional-components.html">Infrastructure Shards and Optional Components</a></li>
<li><a href="http://stackoverflow.com/questions/933723/what-is-component-driven-development" target="_blank" class="offsite-link-inline">What is Component-Driven Development on Stack Overflow</a></li>
</ul>
]]></content:encoded></rss:item></rdf:RDF>