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

<channel>
	<title>Nagarro Blog &#187; Concepts</title>
	<atom:link href="http://www.nagarro.com/blog/category/concepts/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nagarro.com/blog</link>
	<description>Nagarro blog: software development, design, architecture and usability</description>
	<lastBuildDate>Tue, 24 Aug 2010 20:57:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Conceptualizing a dynamic web service demo engine</title>
		<link>http://www.nagarro.com/blog/conceptualizing-a-dynamic-web-service-demo-engine/</link>
		<comments>http://www.nagarro.com/blog/conceptualizing-a-dynamic-web-service-demo-engine/#comments</comments>
		<pubDate>Sat, 24 Apr 2010 02:31:00 +0000</pubDate>
		<dc:creator>Ashish Dixit</dc:creator>
				<category><![CDATA[Concepts]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[dynamic rendering]]></category>
		<category><![CDATA[web services]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/conceptualizing-a-dynamic-web-service-demo-engine/</guid>
		<description><![CDATA[Introduction: Ever since the dawn of the Internet Application Service Providers have developed internet based applications for which they can charge through a subscription based business model. Earlier there was no standardization across these online service offerings, but web services emerged to create various standards for providing these online services: SOAP, UDDI, etc. Internet businesses [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction: </strong>Ever since the dawn of the Internet Application Service Providers have developed internet based applications for which they can charge through a subscription based business model. Earlier there was no standardization across these online service offerings, but web services emerged to create various standards for providing these online services: SOAP, UDDI, etc. Internet businesses adopted web services quickly and started introducing pay-to-use services on the Internet. Many companies even made publishing web services through a subscription model as their core business (weather services, financial data, etc.).</p>
<p> <span id="more-603"></span>
</p>
<p><strong>Problem: </strong>One of the challenges that you face, when you are selling web services is this: &quot;how do you showcase your product to a potential customer&quot;. The answer can be simple, make a demo web page which allows prospects to play with the web service and try it out before subscribing to it. This is indeed simple, if you are selling one or two web services. However, if you are providing anything more than a handful of services, then creating, maintaining, updating, and updating a web page for every service and its various versions that you sell can be a nightmare.</p>
<p><strong>Solution</strong>: A solution for such a scenario can be the use of an engine which can dynamically render a user interface for any given web service on demand. Let&#8217;s call this as the &#8216;web service demo engine&#8217;.</p>
</p>
<p>The advantages for such an engine are obvious:</p>
<ul>
<li>no additional effort when publishing new services </li>
<li>smaller code-base to maintain </li>
</ul>
<p>There are various challenges to as well, if such an engine is to be implemented. These include:</p>
<ul>
<li>the engine needs to be extensible to and flexible to absorb any changes to existing web services. </li>
<li>web service parameters can vary from being simple data types (such as integers) to collections, custom objects, etc. The demo engine needs to be able to interpret any data type and render its UI efficiently. </li>
<li>similarly, the web service response may contain a variety of data types (though XML) &#8211; tables, charts, images, etc. The engine should be able to interpret this data an render the output correctly. </li>
<li>the engine should render the UI to allow users to enter the input data for the web service, and should perform basic business rule validation to ensure input data makes sense. </li>
<li>the basic goal is that the engine should be completely configurable, and should not require re-coding whenever a new service is released. </li>
</ul>
<p>As can be seen, some of this information is not even present in the WSDL of the web service, so any engine that hopes to achieve all of the above needs some help other than the WSDL. A possible solution is to have a configuration file published with every new web service that carries this information. Such a configuration file would carry a number of items:</p>
<ul>
<li>business data definition </li>
<li>input controls information </li>
<li>output controls information </li>
<li>information about grouping of input and output controls </li>
<li>business rules for input validation </li>
<li>output data rendering information </li>
<li>information about the web service itself </li>
<li>mapping for input control to web service parameters </li>
</ul>
<p>This configuration file can be generated by hand, or auto-generated partially through the use of custom code attributes or custom tools when the web-service itself is being developed.&#160; Through the use of this information, an engine which renders demo pages for any given web service is conceivable.</p>
<p>How is creating a configuration file per web service better than creating individual web pages per service? There are several ways in which this is better:</p>
<ul>
<li>the configuration files generation can be largely automated. </li>
<li>the central demo engine makes it easy to have consistent UI and style when rendering. </li>
<li>you only manage one code base. Imagine if tomorrow, you wanted to add specific authentication mechanisms to provide access to the demo pages. If you had a demo engine, you only will have to make that change in one place. </li>
<li>it decouples the rendering of the UI from the web service itself &#8211; a web page per service is very tightly coupled with the service it is demonstrating. </li>
</ul>
<p>Has anyone implemented a similar solution or encountered a similar problem and provided a different solution? We would love to discuss this through the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/conceptualizing-a-dynamic-web-service-demo-engine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Case study: an application updater for application suites</title>
		<link>http://www.nagarro.com/blog/case-study-an-application-updater-for-application-suites/</link>
		<comments>http://www.nagarro.com/blog/case-study-an-application-updater-for-application-suites/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 02:11:00 +0000</pubDate>
		<dc:creator>Gaurav Arya</dc:creator>
				<category><![CDATA[Concepts]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[ClickOnce]]></category>
		<category><![CDATA[UAB]]></category>
		<category><![CDATA[Update]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/case-study-an-application-updater-for-application-suites/</guid>
		<description><![CDATA[When you are developing a windows application, it is necessary to have an updater strategy built-in. We all know that enhancements and fixes are a part of the software development process. Best practices and frameworks exist for creating application updaters services, and integrating them in your windows application. Microsoft provides ClickOnce technology which makes it [...]]]></description>
			<content:encoded><![CDATA[<p>When you are developing a windows application, it is necessary to have an updater strategy built-in. We all know that enhancements and fixes are a part of the software development process. Best practices and frameworks exist for creating application updaters services, and integrating them in your windows application. Microsoft provides ClickOnce technology which makes it very easy to package your application so that it can easily updated whenever there is an update in the application. Another approach is the Updater Application Block (UAB) which is a bit more difficult to implement, but also offers a great deal more flexibility in what you can do with it.</p>
<p> <span id="more-602"></span>
</p>
<p>One of our customers had a requirement which was slightly different from the standard update requirement. This customer offers a suite of applications (much like MS Office). There is a further twist, the business case for this customer is such that even within the same application, the end user might be able to run multiple versions of these applications side-by-side (like you can run Visual Studio 2005 and 2008 side by side). Each of these applications and the various active versions of a given application could have updates released independently of each other. One would think that all of these could be implemented as separate ClickOnce packages, but that would have been a maintenance nightmare on the update server, and also would have presented a very poor experience for the end user.</p>
<p><strong>Problem statement</strong> &#8211; Create an updater solution which uses a single application to provide automatic update notifications for multiple applications, and manages download and installation for all of these updates.</p>
</p>
<p>Our solution was to create a utility application on the client end which acts more like an Application Manager. This application keeps track of all the applications installed on the client (and those that are not installed), and manages the updates and notifications for all of them. The solution mirrors the concept presented in the Microsoft UAB. Here is what it looks like:</p>
<p><img style="border-right-width: 0px; margin: 5px auto; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.nagarro.com/blog/wp-content/uploads/2010/04/image.png" width="391" height="177" /></p>
<p>The application manager can be implemented through a variety of paradigms. It can be a service which is always running in the background. It can be implemented as an application launcher &#8211; this means that to launch any of the applications in the suite, you first have to launch the application manager. There can be other ideas on how it can be implemented.</p>
<p>The basic solution for how it works is similar to the UAB. It keeps track of the currently installed application on the client machine (perhaps through reading registry settings). It keeps track if new releases by requesting a the server for a manifest file which contains information about the various versions of the applications present in the application suite &#8211; specifically, it contains information about the latest versions of the applications present on the update server, and information about how they can be accessed. The application manager then compares this information from the manifest to the local manifest that it maintains of the installed applications. The way this differs from the UAB is that in UAB, the manifest on the server contains metadata about the releases of a single application. In our scenario, it contains the information for multiple applications.</p>
<p>The application manager can provide various services such as provide notifications when updates are available, maintain user preferences for update notifications, download updates, install selective updates, or install updates automatically (or based on a schedule). All of these, and many other rich update features can be implemented through the use of the application manager.</p>
<p>On the server side, the process is simplified because whenever any of the applications are changed, a single change has to be made to a single manifest file/data source. For all updates, only one manifest needs to be managed, which makes update management easier and less error prone. The benefit of using an Updater Service (instead of simply requesting the file directly from the server) is that the manifest information can then be kept in a database, from where the service can generate the manifest file. Or another implementation could be that the manifest file is generated from a well-defined directory structure on the server. The point is that using an interface such as a service allows you to have more flexibility on how you implement your server. Another benefit could be to build-in licensing or role-based manifest generation (to prevent access to certain applications or updates).</p>
<p>Finally, the application manager itself needs to be updated. We chose to use ClickOnce for the Application Manager itself. The reason is the ease of deployment and update for a single application using ClickOnce is still the best. So, the use case for setting up new client machines becomes very simple. First install application manager to using ClickOnce. Then the application manager downloads and installs everything else.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/case-study-an-application-updater-for-application-suites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designing Cloud Based Systems  &#8211; 3. Scalability, Performance and Software Engineering</title>
		<link>http://www.nagarro.com/blog/designing-cloud-based-systems-3-scalability-performance-and-software-engineering/</link>
		<comments>http://www.nagarro.com/blog/designing-cloud-based-systems-3-scalability-performance-and-software-engineering/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 11:26:23 +0000</pubDate>
		<dc:creator>Abhijat Vatsyayan</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/?p=525</guid>
		<description><![CDATA[Scalability and robustness
Since a very compelling business reason for using cloud computing is the ability to scale on demand and when needed, using the best practices and guidelines for designing large scale  distributed systems is a good starting point. While academia has a preference for   distributed transactions, ACID properties, and all kinds of consensus protocols, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Scalability and robustness</strong></p>
<p>Since a very compelling business reason for using cloud computing is the ability to scale on demand and when needed, using the best practices and guidelines for designing large scale  distributed systems is a good starting point. While academia has a preference for   distributed transactions, ACID properties, and all kinds of consensus protocols, you are better off with loosely coupled systems where nodes will eventually reach a consistent state (as opposed to waiting for all nodes in a very large system to  reach a consistent state before proceeding). Considering the state of existing systems, loosely coupled self healing self regulating systems should be preferred over system with exotic distributed transactional properties and consensus protocols.<span id="more-525"></span></p>
<p>Be prepared to lose computational appliances. As you already know, stateful systems are bad for scalability. Avoid storing the state in server sessions. If you are designing a client-server system from scratch, do not store client sessions on the server. For typical web applications, this means that your HTTP calls should be stateless. GWT and other rich AJAX or Flex clients let you do this relatively easily.</p>
<p>You should also try to avoid solutions that try to replicate state across multiple nodes. This almost always leads to overly complicated solutions. You are better off being prepared for  loss of data and designing with the assumption  that client application state, if at all available on the server side, may not  be synchronized across all nodes. UDP, which is often used for discovery, and negotiating other information may not even be available on many cloud platforms.</p>
<p>These are important design decisions that you must make right up front.  Retrofitting these into existing solution might be impossible.</p>
<p><strong>Software engineering</strong></p>
<p>In addition to strictly technical design and runtime issues, you also need to take into account other software engineering issues which affect you development.</p>
<p>As already discussed, you need to have a pool of engineers who understand the technologies you will be using. You may find it hard to find many engineers who have had experience with large scale, self healing, self managing systems. While one of the objectives of most cloud platforms is to take these complexities away from the developers, you will need engineers who understand these concerns.</p>
<p>You also need to find out if the platform you have selected provides good tools for development, deployment and debugging. You should ask the same questions you ask when selecting any technology.</p>
<ul>
<li>Find out if the platform integrates with the IDE you are planning to use (or if the platform comes with an IDE that will serve your development needs).  I would recommend staying away from custom IDEs. Amazon, Google and Microsoft support industry standard IDEs for their respective platforms.</li>
<li>You need to design for testability right from day one and your design should be testable on the platform.</li>
<li>If your organization has an enterprise architecture, you need to be sure that your design and tools meet the standards and approaches laid down by it. Different network topologies, moving data in and out of the cloud and integrating systems running in the cloud with the systems inside the enterprise will come with its own set of challenges. While most enterprises have already started looking into cloud as a viable means for extending their computational needs, they may not be ready for a complete adoption.</li>
<li>Security is an important aspect that you may not have full visibility into when you are running on someone else’s platform. Work with your security experts, quality assurance and compliance team to make sure everyone understands the security risks. A perceived security risk and lack of visibility could be a major problem while adopting any new technology (anyone remember trying to use Java RMI across enterprise firewalls?) and clouds are no exception. In fact the shared nature of the services makes security a bigger concern.</li>
<li>Finally, you need to design for monitoring. It is best if the platform supports automated monitoring. Otherwise you may need to design for it right from day one. Even when the platform provides some tools, you may still have to monitors aspects not supported by the platform tools.</li>
</ul>
<p>This discussing should provide you with a good starting point for creating your own best practices and guidelines. These are important design decisions that you should try to get right  up front.  Retrofitting these into existing solution might be impossible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/designing-cloud-based-systems-3-scalability-performance-and-software-engineering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designing Cloud Based Systems  &#8211; 2. System Integration and Development Considerations</title>
		<link>http://www.nagarro.com/blog/designing-cloud-based-systems-2-system-integration-and-development-considerations/</link>
		<comments>http://www.nagarro.com/blog/designing-cloud-based-systems-2-system-integration-and-development-considerations/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 19:03:06 +0000</pubDate>
		<dc:creator>Abhijat Vatsyayan</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/?p=522</guid>
		<description><![CDATA[Enterprise Application Integration
You need to consider how your system integrates with other systems in your organization. Clouds are good but one-off systems that use cloud but do not integrate with existing systems will diminish the payoffs of using a cloud.
You need to consider how your system and its data get integrated with existing data. This [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Enterprise Application Integration</strong></p>
<p>You need to consider how your system integrates with other systems in your organization. Clouds are good but one-off systems that use cloud but do not integrate with existing systems will diminish the payoffs of using a cloud.</p>
<p>You need to consider how your system and its data get integrated with existing data. This may need to be done both ways. Without access to existing data or data created and maintained by your cloud based system, you will again limit the potential of your system under design.<span id="more-522"></span></p>
<p>You may also need to integrate your application with your enterprise’s existing authentication and authorization solution.</p>
<p>Even if integration is not an immediate concern, an architectural choice can make it impossible to integrate even in future. You will need to worry about different networks and firewalls and if the protocols you will use to integrate these systems will work across these networks and firewalls.</p>
<p><strong>Development Considerations</strong></p>
<p>Once you start building the system, you will need to take into account how many engineers and support people are comfortable with the technologies you are using (in this case – something cloud based). You may need to take training and documentation time into account in your plans.</p>
<p>If you need to move large amounts of data between your internal computers and the cloud, you will need to either have sufficiently fast network connections or take the associated delays into account. This delay could play a major role in how you trouble-shoot issues, provide other kinds of support, take backup or just make the data collected by your application available to the users within your internal network.</p>
<p>Offshore development is a reality and if your application is either developed and/or maintained by a team working offshore, network speeds,  latency and round trip times will all come to play a major role. This means your choice of development and support tools and environments should work well over a bad network. VNC and Xserver-clients do not behave well, text terminals work better, light-weight HTML based clients work best. You also need to worry about moving large amounts of data in and out of the cloud from your development and support centers.</p>
<p>If you have specific regulatory compliance requirements, you need to be sure that the platform complies with the standard. For example, Amazon EC2 instances are not PCI (payment card industry) compliant so you should not plan on storing credit card information on Amazon EC2 instances. There could be regulations  regarding sending customer data out of country and when you store data in a cloud,  you (or even the provider) may have no control on where (which node) that data  could be at any given time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/designing-cloud-based-systems-2-system-integration-and-development-considerations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designing Cloud Based Systems  &#8211; 1. Introduction</title>
		<link>http://www.nagarro.com/blog/designing-cloud-based-systems-1-introduction/</link>
		<comments>http://www.nagarro.com/blog/designing-cloud-based-systems-1-introduction/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 22:22:03 +0000</pubDate>
		<dc:creator>Abhijat Vatsyayan</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/?p=519</guid>
		<description><![CDATA[Definitions and architecture
I am not a big fan of using definitions as a starting point.  In technology many useful and successful concepts have escaped definition. People still argue about what exactly is an object in an object-oriented system.  There is no scarcity of definitions for software architecture. The internet cannot be pinned down to a simple [...]]]></description>
			<content:encoded><![CDATA[<h3>Definitions and architecture</h3>
<p>I am not a big fan of using definitions as a starting point.  In technology many useful and successful concepts have escaped definition. People still argue about what exactly is an object in an object-oriented system.  There is no scarcity of definitions for software architecture. The internet cannot be pinned down to a simple definition. A definition, however, it is still useful in certain contexts.<span id="more-519"></span></p>
<p>While people might argue about the exact definition of cloud computing (which is probably a futile effort at this time), a working definition can be used to evolve a shared meaning. This is especially useful in software architecture where clear communication among stakeholders is extremely important. Software architects interact closely with business, users, developers, testers, compliance groups and others and before you move your architecture to the cloud, you should state exactly what cloud computing means  in the context of the system you are designing.</p>
<p>Definitions will differ based on whether you are a consumer of the cloud based  services or a provider and with more and more of private and hybrid clouds out there,  organizations and enterprises are fast becoming internal providers of cloud based  computing services which is blurring the line between providers and consumers of a  cloud “style” service.  Today, from a consumer’s point of view, a cloud based compute service:</p>
<ul>
<li>is implemented as a pool of servers though the consumer may not have direct access to the underlying pool.</li>
<li>is characterized by very high degree of automation typically providing both  programmatic access (for integration) and graphical or command line user interfaces.</li>
<li>provides an abstraction of compute services along with constraints that enable  the provider’s offering.</li>
<li>is priced on a pay-as-you-go basis. Consumers only pay for what they use.</li>
</ul>
<p>When you take these along with (effective) infinite scalability and pay-per-use utility model into consideration and design a system for the cloud, there are several issues that you should take  into account. I will discuss a few architectural considerations that must be taken into account while designing a cloud based system. The usual design principles and best practices for building a cloud based are not very different from what you probably already use as part of your enterprise architecture standards and/or other best practices for building large scale distributed systems; but some of these may be unique.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/designing-cloud-based-systems-1-introduction/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Case study: How a usability workshop can work wonders</title>
		<link>http://www.nagarro.com/blog/case-study-how-a-usability-workshop-can-work-wonders/</link>
		<comments>http://www.nagarro.com/blog/case-study-how-a-usability-workshop-can-work-wonders/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 11:54:22 +0000</pubDate>
		<dc:creator>Manas Fuloria</dc:creator>
				<category><![CDATA[Usability]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/?p=482</guid>
		<description><![CDATA[We have all heard the usability spiel: that technology is more or less a commodity, that ease of use – and in fact “delight of use” &#8211; should be paramount. We have also heard the horror stories of expensive enterprise and consumer applications that failed miserably because they were just too “kludgy” to use. Yet [...]]]></description>
			<content:encoded><![CDATA[<p>We have all heard the usability spiel: that technology is more or less a commodity, that ease of use – and in fact “delight of use” &#8211; should be paramount. We have also heard the horror stories of expensive enterprise and consumer applications that failed miserably because they were just too “kludgy” to use. Yet even today, for every wonderfully user-centric design (think iPhone) there are dozens of desktop or web applications that are boring at best, and simply unusable at worst.</p>
<p>Why is this so? Perhaps the problem is that when you are early in the SDLC, there are so many other challenges and moving parts that you have little time to worry about usability. You worry that bringing the “naïve” users in for design discussions will just derail the project or send it off on a tangent. On the other hand, if you wait till you are through with version 1, you have been compromised as well &#8211; it requires great courage to admit at this point that usability is poor and that major elements of the application have to be re-designed.</p>
<p>These are formidable challenges. Yet we at Nagarro recently had a very positive series of usability-related discussions with a major client, which may be useful to recount in this context.<br />
<span id="more-482"></span><br />
The client is one of the world’s leading travel-related companies. We are building a business-critical application for this company that will be used by a handful of users. The IT project management on the client side had invested a lot of intellectual muscle into the functional and algorithmic design of the application. We too put in a lot of effort to make mockups of the entire application UI and these were approved by the client – but by the IT project management, not by the users. The users did see the application from time to time, but in short bursts and they definitely did not have enough time to play with it and give their feedback.</p>
<p>Then after we had a successful development release and were reviewing progress with senior folks on both sides, we all collectively realized that the usability of the application left quite a bit to be desired. It was a depressing moment.</p>
<p>It wasn’t just a matter of aligning data elements or fiddling with the color palette.</p>
<p>It wasn’t even a matter of trying to streamline workflows to reduce the number of clicks required for each task.</p>
<p>It was the fact that the application’s UI looked like it had been designed by highly analytical engineers and scientists, which it in fact had. Would the users – who were neither engineers nor scientists &#8211; find it easy to use? Would they buy into it? Would they find all the features that they would need?</p>
<p>Luckily, the client team comprised very intelligent and wise folks. Rather than blame the team members on either side, the client’s senior VP-level executive said, “We should think of this as continuous improvement. You all did a great job, but we now see it can make it even better. Let’s see this as a positive opportunity and move forward.”</p>
<p>So, no blame game, no recriminations, no requests for “free rework”. The gentleman basically had the wisdom to see that when you are building something highly innovative, you may have to iterate to get the design just right.</p>
<p>Still, on our part, we offered the client a free usability workshop with our best consultant, a person skilled at combining “right brain” creative thinking with the “left brain” analytical thinking required for software design. The users were the star participants in the workshop, which started from first principles – what exactly is it that the users want to achieve? Our engineering team got the chance to put itself into the shoes of the users and try to come up with metaphors and overarching design principles that would work for them and, hopefully, delight them.</p>
<p>The workshop ran for two days and turned our previous thinking on its head. Yet everyone was thrilled with the insights and we agreed we’d run such workshops for each new project. The client agreed to fund a few person-months of effort to upgrade the user interface. Perhaps the cost of the overall development rose by 10%. But as a result, the chances of the application being very successful and useful in the hands of the users probably doubled or tripled.</p>
<p>And that’s always the most important metric!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/case-study-how-a-usability-workshop-can-work-wonders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>.NET Reflection: The untouchable? No, not at all.</title>
		<link>http://www.nagarro.com/blog/net-reflection-the-untouchable-no-not-at-all/</link>
		<comments>http://www.nagarro.com/blog/net-reflection-the-untouchable-no-not-at-all/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 14:08:25 +0000</pubDate>
		<dc:creator>Vikas Burman</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Concepts]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/net-reflection-the-untouchable-no-not-at-all/</guid>
		<description><![CDATA[I am a big fan of .NET reflection. However most often you will hear more of critics than praise. The biggest of all &#8220;It’s slow.&#8221; Web is full of cautions and warnings telling you not to use it. Some will go as far as saying that if you care for performance, do not even think [...]]]></description>
			<content:encoded><![CDATA[<p>I am a big fan of .NET reflection. However most often you will hear more of critics than praise. The biggest of all &#8220;<em>It’s slow.</em>&#8221; Web is full of cautions and warnings telling you not to use it. Some will go as far as saying that if you care for performance, do not even think about using reflection. If you go on and read beyond the highlight points, you will realize that a large percentage of these warnings and cautions are discussing a particular scenario where some developer failed to get what s/he was trying to achieve. And while being judgmental with the experiment a generalized statement like this comes up as an end result.<span id="more-453"></span></p>
<p>The problem of making such general rules about programming practices is that you tend to miss out the benefits by following these rules too literally in every context. Think it on the lines – Reflection or any feature for that matter, if included must have a valid reason for its presence. We should be able to see and know how and when to use it and when specifically to avoid it.</p>
<p>Reflection is slow; but the question is <em>how slow is slow?</em> One should worry about performance but this worry should not keep you away from making best use of a technology. If you look around in .NET world, you will realize that .NET framework itself uses a lot of reflection. Ability to store meta-data about your code and to be able to use it at runtime opens the door to a whole lot of possibilities limited only by your imagination.</p>
<p><!--more--></p>
<p>If you rethink it it’s just one another way of storing and working with information; difference being that this information is stored in code itself. So instead of retrieving information from some XML file or database, you are pulling it in from the code itself. Therefore your concerns towards writing optimized code while reading data from XML (e.g., load once read many times) or from database (e.g., making fewer trips to database), etc. will not be much different when using reflection. You might want to fetch type info once and hold it for future calls as well instead of fetching it every time you need it.</p>
<p>As in case of database, we know where to use joins, on which columns to create indexes and which <em><strong>where</strong></em> clauses to use to get optimized execution time; in case of reflection too there is a well defined grammar to make optimized reflective calls. For example, using <strong><em>BindingFlags</em></strong> enumeration correctly, not trying to use <strong><em>IgnoreCase</em></strong> flag, and limiting your searches to <strong><em>public</em></strong> or <strong><em>static</em></strong> or <strong><em>instance</em></strong> members as required, will definitely give you best possible results. <a href="http://msdn.microsoft.com/en-us/magazine/cc163759.aspx">Joel Pobar’s post</a> talks at length about how reflection works internally and is a good reference to understand how to avoid performance pitfalls.</p>
<p>Don’t just assume that reflection will hit the performance, but use it, test it, tweak it for performance optimization and enjoy the flexibility it provides. If you think your problem statement has a solution in reflection; don’t hesitate in going ahead just because someone says that it will be slow. If this turns out to be slow; there are ways to optimize it too. For instance <a href="http://msmvps.com/blogs/jon_skeet/archive/2008/08/09/making-reflection-fly-and-exploring-delegates.aspx">Jon Skeet’s post</a> talks about using <strong><em>Delegate.CreateDelegate</em></strong> to turn a <strong><em>MethodInfo</em></strong> into a strongly-typed delegate. This can improve performance massively in scenarios where you need to set the same properties multiple times. Essentially this means that a lot of the type checking is done once when you created the delegate, rather than on every invocation.</p>
<p>Let’s explore a scenario where reflection is no harm to use and probably the only way you can achieve the end result with.</p>
<p><strong><em>You want dynamic extensibility to your desktop application; your revenue model includes selling various groups of features separately. You do not want to build multiple deployment packages and you want to be able to provide even more features to your customers after they have started using your application.</em></strong> How would you do it?</p>
<p>You might do this by developing a plug-in model in your application.</p>
<p>You may define an <em>IMyAppPlugin</em> interface which can be implemented in each of your application’s plug-in assembly implementing a specific feature. At minimum you may have following definition:</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">interface</span> IMyAppPlugin
{
    Guid Identifier { get; }
    <span class="kwrd">string</span> Name { get; }
    <span class="kwrd">string</span> Copyright { get; }
    <span class="kwrd">bool</span> Start(IHostApp hostApp);
    <span class="kwrd">void</span> Stop();
    <span class="kwrd">bool</span> Run();
}</pre>
<p>You will not have any reference of these assemblies in your project at design time. Its only at runtime when you will try to discover these plug-in assemblies (using some mechanism such as looking in specific folder or registry, an XML file or anything else) and load it using reflection.</p>
<p>You will write code to find and create instance of the class that implements this IMyAppPlugin interface. Once you have this object you can initialize it by calling its <em>Start()</em> method passing your application’s reference as required. You may also write code to add access points (such as menu items) for this dynamic functionality to appear in your application’s user interface when this plug-in is successfully loaded.</p>
<p>A call to <em>Run()</em> method anytime after this will do what is desired.</p>
<p>So essentially what we are doing here is that we have loaded the assembly using reflection and we are calling methods dynamically again using reflection. If we just go by numbers, yes dynamically invoking a method is slow. Referring to <a href="http://www.west-wind.com/weblog/posts/351.aspx">Rick Strahl’s post</a> we can say that invoking a method dynamically is about 3.5 to 4 times slower than directly calling of a method. But again the question needs to be asked – <em>how slow is slow?</em> Here we are talking about few milliseconds extra. Unless you are making calls in a loop for a large number of times, does it really matter in the larger perspective of a typical application? Most likely – No!</p>
<p>Remember .Net Framework and especially ASP.Net uses a lot of reflection internally to provide dynamic execution of code and controls.</p>
<p>Talking again about the above scenario, if not reflection, do we have some other relevant approach of dynamically extending the application? You may talk about using COM interfaces to achieve it – but reflection or no reflection – the essence of every approach is to dynamically resolve the address of the method to be called, which is the only major difference wrt static calls where this address is readily available.</p>
<p>This is just one scenario where reflection proves to be the most effective and simplified approach to work with. There are a lot of other scenarios where reflective access to properties, fields and methods provides enormous flexibility that simply wouldn&#8217;t be there otherwise.</p>
<p>With <a href="http://msdn.microsoft.com/en-us/library/dd233052(VS.100).aspx">Dynamic Language Runtime</a> (DLR) in .NET 4.0 we are heading towards a cleaner reflection. Eventually this may replace reflection how we see it today, due to its simplified code and caching advantages. In-fact as mentioned in this <a href="http://blogs.msdn.com/hugunin/">Jim hugunin’s post</a>, it appears that DLR too internally makes good use of reflection.</p>
<p>In short, do not shy away from using reflection, just because you hear warnings about it. Always verify if these warnings apply to your project or scenario. Often they will not. As they say, “trust but verify!</p>
<p><!--.csharpcode, .csharpcode pre { 	font-size: small; 	color: black; 	font-family: consolas, "Courier New", courier, monospace; 	background-color: #ffffff; 	/*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { 	background-color: #f4f4f4; 	width: 100%; 	margin: 0em; } .csharpcode .lnum { color: #606060; } --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/net-reflection-the-untouchable-no-not-at-all/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Cloud Computing Series: Exploring the Google App Engine Java Runtime Environment</title>
		<link>http://www.nagarro.com/blog/cloud-computing-series-exploring-the-google-app-engine-java-runtime-environment/</link>
		<comments>http://www.nagarro.com/blog/cloud-computing-series-exploring-the-google-app-engine-java-runtime-environment/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 17:42:59 +0000</pubDate>
		<dc:creator>Ram Kripal Prasad</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Cloud computing]]></category>
		<category><![CDATA[GAE]]></category>
		<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[Runtime Environment]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/?p=418</guid>
		<description><![CDATA[Google recently released a Java runtime environment for their App Engine platform. As a software development organization, this offering is of special interest to Nagarro, as it offers several advantages over competing cloud hosting environments. Hosting a Java application on Google’s infrastructure provides automatic scaling and load balancing, a feature that is of interest to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-thumbnail wp-image-424" title="Various Cloud Formations" src="http://www.nagarro.com/blog/wp-content/uploads/2009/09/photo_13459_20090818-150x150.jpg" alt="Various Cloud Formations" width="78" height="78" />Google recently released a Java runtime environment for their App Engine platform. As a software development organization, this offering is of special interest to Nagarro, as it offers several advantages over competing cloud hosting environments. Hosting a Java application on Google’s infrastructure provides automatic scaling and load balancing, a feature that is of interest to a number of our software product development ISV customers. To better understand the issues and risks, we conducted an internal exercise to assess the technical effort required to port an existing application to the Google App Engine for Java (GAE-J).<span id="more-418"></span><br/><br/><strong>A Bit of Background</strong><br/><br/>GAE-J is a complete development stack that uses familiar Java technologies like JSPs, servlets and JavaScript to build and host web applications. With GAE-J we would write the application code, test it on the local machine and upload it to Google with a simple click of a button or a command line script. Once the application is uploaded to the Google infrastructure, it would host and scale the application for us. We would then, no longer need to worry about system administration, bringing up new instances of the application, clustering the database or buying new machines.<br/><br/>GAE-J provides access to many popular services from the enterprise applications world, including a scheduler, logging that can be reported from the Google Application console, mail, caching and URL fetch. It also provides elegant integration with technologies like Spring, Sitemesh, Struts etc.<br/><br/>GAE-J also makes it easy to serve static files like Images, CSS style sheets, JavaScript code, movies and Flash animations can served directly to the browser from separate servers that those that invoke servlets.<br/><br/>As you would expect from initiatives by Google, GAE-J comes with extensive online documentation &#8211; including quick start guides which I found invaluable. Also, Google provides many tools that make coding and developer testing simple and quick. GAE-J provides a local sandbox (based on Jetty) that should be used for testing before deploying into the cloud. The development web server simulates the App Engine Java runtime environment and all of its services, including the datastore. The <span style="color: blue;">Google Plugin for Eclipse </span>can run the server in the Eclipse debugger. You can also run the development server from the command line.<br/><br/><strong>Our Experience</strong><br/><br/>We found that using Google App Engine has great advantages, but it also has serious limitations. Google has implemented a tight security model on GAE-J, and you can&#8217;t write to the file system, it is read-only. You can only store data using the Google Datastore API. On first look, this seemed like a big restriction, but given the fact that the servers are clustered, it made sense in the long run.<br/><br/>In the GAE-J sandbox, the application code only runs in response to a web request or a <em>cron</em> job, and must return response data within 30 seconds in any case. A request handler cannot spawn a sub-process or execute code after the response has been sent.<br/><br/>Uploading the initial data is another challenge; however, that may be solved by providing the capability to upload data into the data store of the application itself.<br/><br/>It is also evident that GAE-J is still in its infancy and has glaring restrictions (for example: GAE-J sets a hard limit to the number of application and static files in the application; refer to <a href="http://code.google.com/appengine/docs/java/runtime.html#Quotas_and_Limits"><span style="color:blue;">The Java Servlet Environment &#8211; Quotas and Limits</span></a>.) IMO that needs to be addressed ASAP; to continue its evolution into a serious contender in the Cloud Services industry.<br/><br/>In conclusion, we found that moving an existing project to GAE-J’s infrastructure is not a trivial job, but it can be done. There are a big number of areas that differ between traditional web applications and Google’s app engine. I agree with Abhijat’s post on <a title="Cloud Computing Demystified: Part-I" href="../cloud-computing-demystified-part-i/"><span style="color:blue;">Cloud Computing Demystified: Part-I</span></a> <strong><em>#<span style="font-family:"> the real cost of using these services </span></em></strong>that identifying and reconciling all these differences would require significant work; esp. in view of the fact that in many cases it may be imperative that the changes (refactoring / re-organizations) made MUST work nicely with the traditional deployment as well. Specifically, certain areas such as the constraints from traditional relational database methodology, restrictions on the number of URLMap entries etc. may induce a re-design of the application and add to the challenges of migrating to the GAE-J cloud.<br/><br/>It would be much easier to develop a new project on GAE-J where innovative architectures for an application could be explored, rather than trying to port an existing application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/cloud-computing-series-exploring-the-google-app-engine-java-runtime-environment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A better way to test email sending functionality is to use your own SMTP Server</title>
		<link>http://www.nagarro.com/blog/a-better-way-to-test-email-sending-functionality-is-to-use-your-own-smtp-server/</link>
		<comments>http://www.nagarro.com/blog/a-better-way-to-test-email-sending-functionality-is-to-use-your-own-smtp-server/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 07:09:14 +0000</pubDate>
		<dc:creator>Vaibhav Gadodia</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools and Utilities]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[SMTP Server]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/a-better-way-to-test-email-sending-functionality-is-to-use-your-own-smtp-server/</guid>
		<description><![CDATA[A large number of applications today have some kind of a notification mechanism built-in. More often than not, an email is used to send these notifications. Typically, while developing these applications, developers use their own inbox to send notifications to. Or they setup some dummy account to send test emails to; or sometimes they might [...]]]></description>
			<content:encoded><![CDATA[<p>A large number of applications today have some kind of a notification mechanism built-in. More often than not, an email is used to send these notifications. Typically, while developing these applications, developers use their own inbox to send notifications to. Or they setup some dummy account to send test emails to; or sometimes they might send test mails to real users (it&#8217;s been known to happen).<span id="more-335"></span></p>
<p>There are many limitations to this approach:</p>
<ul>
<li>one has to deal with dummy messages arriving in the inbox, when all that you want to test is your email sending code.</li>
<li>automating the testing of the email sending code will result in a large number of emails being generated and delivered to your inbox.</li>
<li>code that is supposed to deliver large amounts of email will generate a lot of load on the Internet bandwidth (and yes that can be a problem).</li>
<li>if you are testing on a copy of a production database, you might inadvertently end up sending test emails to real users.</li>
</ul>
<p>There are other issues present as well. One solution to solving these problems is to use your own SMTP server to handle all these emails in a manner that it receives an email and doesn&#8217;t sent it forward. So, it is like a dummy SMTP server. But setting up an SMTP server is usually a hassle.</p>
<p><!--more--></p>
<p>There are plenty of options out there which make your job much easier than you think it is. In this post, I am going to list some solutions which can be used (though there are many more). The basic premise behind this approach is to run a local SMTP server (either on the developer box, or the test server, or both, or somewhere on the LAN). This local SMTP server address is what is configured as the server address in your application which is being tested. Any mail sent to such a server is kept with the server and not forwarded, thus preventing all the above listed issues.</p>
<p>Following are some of the more popular out-of-the-box programs that can be used (click on the names to go to their websites):</p>
<ul>
<li><a href="http://invalidlogic.com/papercut/"><strong>Papercut</strong></a><strong> </strong>- this is a simple windows application which will run in your System Tray and simulate an SMTP server; it receives and stores any messages it receives. It allows you to view the messages. It sits in your system tray and alerts you whenever a new message arrives.</li>
<li><a href="http://www.donovanbrown.com/post/2008/10/20/Neptune.aspx"><strong>Neptune</strong></a><strong> &#8211; </strong>this is another application which will do a similar task. It is however a little more advanced. It has an admin API interface which allows you to run custom queries to analyze the messages that it processes. It doesn&#8217;t have a UI through which you can view the received message though &#8211; but sometimes all you need to check is if the messages are being delivered. Very useful in a bulk messaging scenario.</li>
<li><a href="http://smtp4dev.codeplex.com/"><strong>smtp4dev</strong></a> &#8211; this is another option similar to Papercut, which again sits in the system tray and will let you know whenever any message arrives and will let you look at the message details.</li>
</ul>
<p>There are many more out there which can be used to do similar things with some features here and there (for example, Neptune doesn&#8217;t generate all SMTP responses). Here&#8217;s a post by Phil Haack from long ago which is also interesting: <a href="http://haacked.com/archive/2006/05/30/ATestingMailServerForUnitTestingEmailFunctionality.aspx">A testing mail server for unit testing email functionality</a>.</p>
<p>So, when you feel the need to test your email sending code the next time, it might make sense to have one of the tools (or something similar) available.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/a-better-way-to-test-email-sending-functionality-is-to-use-your-own-smtp-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using ActiveRecord for Database Setup and Migration: A How-to</title>
		<link>http://www.nagarro.com/blog/using-activerecord-for-database-setup-and-migration/</link>
		<comments>http://www.nagarro.com/blog/using-activerecord-for-database-setup-and-migration/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 15:20:08 +0000</pubDate>
		<dc:creator>Ram Kripal Prasad</dc:creator>
				<category><![CDATA[Concepts]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[LAMP]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/?p=305</guid>
		<description><![CDATA[One of the first places where the ActiveRecord pattern first appeared, was in the book Patterns of Enterprise Architecture by Martin Fowler. The ActiveRecord pattern embeds the knowledge of how to interact with the database directly into the class performing the interaction.
Per Wikipedia  
With ActiveRecord, a database table or view is wrapped into a class, thus [...]]]></description>
			<content:encoded><![CDATA[<p>One of the first places where the ActiveRecord pattern first appeared, was in the book <em>Patterns of Enterprise Architecture</em> by <em>Martin Fowler</em>. The ActiveRecord pattern embeds the knowledge of how to interact with the database directly into the class performing the interaction.<span id="more-305"></span></p>
<p>Per <em><a href="http://en.wikipedia.org/wiki/Active_record_pattern">Wikipedia</a></em>  </p>
<blockquote><p>With ActiveRecord, a database table or view is wrapped into a class, thus an object instance is tied to a single row in the table. After creation of an object, a new row is added to the table upon save. Any object loaded gets its information from the database; when an object is updated, the corresponding row in the table is also updated. The wrapper class implements accessor methods or properties for each column in the table or view.</p></blockquote>
<p>This pattern is often implemented by ORM and Object Persistence Tools like Hibernate (Java) and ActiveRecord (ruby). The implementation framework handles generating the necessary SQL appropriate for the database being used and executing them over a database connection.</p>
<p>Recently, in a couple of projects I used ActiveRecord Migrations to manage database setup and migrations.<br />
Below, I shall present a walk though the steps that I followed to get a set of ActiveRecord migrations working on my Ubuntu-9.0.4 desktop.</p>
<p>1. Check if you have ruby installed:</p>
<p>     <em>ruby -v</em></p>
<p>You&#8217;d see something like the following: <em>ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]</em></p>
<p>If not, then install ruby by executing the following from a terminal window:</p>
<p>     <em>sudo aptitude install <strong>ruby</strong></em></p>
<p>Also, install <a href="http://rake.rubyforge.org/">rake, – ruby&#8217;s build program with capabilities similar to make</a> using:</p>
<p>    <em>sudo aptitude install <strong>rake</strong></em></p>
<p>2. Install <a href="http://rubygems.org/read/book/1">rubygems</a>:</p>
<p>    <em>sudo aptitude install <strong>rubygems1.9</strong></em></p>
<p>3. Install the following ruby-gems</p>
<ul>
<li>ActiveRecord: <em>sudo gem install <strong>activerecord</strong></em></li>
<li>Database adapter: I used the MySQL database; so I needed to install the mysql gem  <em>sudo gem install <strong>mysql</strong></em><br/><br/>The above command results in the following error:<br/><br/>&nbsp;&nbsp;<em>extconf.rb:8:in `require’: no such file to load — mkmf (LoadError)</em></li>
</ul>
<p><strong>Fix:</strong> Being a Debian or Ubuntu user you’ll find that the Ruby standard distribution is split into lots of little packages in order to comply with <a href="http://www.debian.org/doc/debian-policy/">Debian packaging Guidelines</a>. Installing ruby only gives you the ruby binary and a subset of the libraries for Ruby. You’ll need to add more packages if you want to utilize more of Ruby’s standard library.</p>
<p>Hence, we need to install the ruby-dev package prior to installing the mysql gem.</p>
<p>  <em>sudo aptitude install ruby-dev</em></p>
<p>4. Create directories to hold the migration definitions:</p>
<p>  <em>mkdir ~/workspace/db_setup<br />
  mkdir ~/workspace/db_setup/migrations</em></p>
<p>That&#8217;s all on the installation side. Now it&#8217;s time to write the migrations.</p>
<p>With ActiveRecord, each change to the database is termed as a <strong>migration</strong>. Migrations derive from <em>ActiveRecord::Migration</em> and enable a developer to generate a database structure using a series of Ruby script files (each of which is an individual migration) to define database operations. It&#8217;s a <em>database-agnostic representation</em> of the database. It uses generic data types for columns, like :binary, :string, :text, :boolean, etc. to define the kind of data to be stored in a column. A sample migration would look like the following:</p>
<p><b>File:</b> <em>migrations/001_create_institutions.rb</em><br />
class CreateInstitutions &lt; ActiveRecord::Migration<br />
def self.up<br />
create_table :institutions, {:id =&gt; true} do |inst|<br />
inst.column :name, :string, :limit =&gt; 100, :null =&gt; false<br />
inst.column :url, :string, :null =&gt; false<br />
end</p>
<p>execute(&#8217;ALTER TABLE institutions ADD UNIQUE (name) &#8216;);</p>
<p>end</p>
<p>def self.down<br />
drop_table : institutions<br />
end<br />
end</p>
<ul>
<li>The file-naming convention is important here:
<ul>
<li>ActiveRecord uses the numeric prefix to determine which migrations it needs to apply. To do this, it creates a table called as <strong>SCHEMA_MIGRATIONS</strong> in the database in which the VERSION column holds the number from the last migration added. When the migrations are run without a target version specified, it will only execute the migrations that have number greater than that stored in the database, lowest numbered first.</li>
<li>The class name should correspond to a camel case representation of the migration&#8217;s file name.</li>
<li>Typically your project would have a collection of these migrations, in files with prefixes as 001_xx, 002_xx&#8230;. and so on, each defining a change desired on the database.</li>
</ul>
</li>
<li>The two methods <strong>up</strong> and <strong>down</strong> should be functional complements of each other. The <strong>up</strong> method is executed when upgrading the database while <strong>down</strong> method is executed while reverting to an earlier version.</li>
<li>You can do many things in a migration – create and delete tables, add and remove columns, set column constraints (such as nullability and column length) and also run code to initialize the data in a table.</li>
<li>As a convenience, you also have the <strong>execute</strong> method available (shown as the last statement in the <strong>up</strong> method) to run SQL / commands directly. This has many implications: it lets you execute commands that use specific database dialects, like adding database constraints. The following script allows you to execute SQL commands from an external file, say <em>create_db.sql</em>:<br/><br/>&nbsp;&nbsp;sqlCode = File.open(File.dirname(__FILE__) + &#8220;/create_db.sql&#8221;).read<br/>&nbsp;&nbsp;sqlCode.split(&#8221;;\n&#8221;).each do |stmt|<br/>&nbsp;&nbsp;&nbsp;<b>execute</b> stmt if stmt =~ /\S/<br/>&nbsp;&nbsp;end</li>
</ul>
<p>ActiveRecord can read the database configuration from a YAML config file called as database.yml (place it under ~/workspace/db_setup) that looks like:</p>
<p><em># The # character signifies a comment.<br />
#<br />
# Define db config per environment here.<br />
# yml files are formatted in a very strict way; you cannot insert spaces and tabs randomly.<br />
# Typically they use two (2) spaces to indent options.<br />
#<br />
# The space between the &#8216;:&#8217; and the configuration values is required.<br />
dev:</p>
<p>  adapter: mysql<br />
  database: devdb<br />
  username: dev_user<br />
  password: dev_pass<br />
  host:     127.0.0.1</p>
<p>qa:</p>
<p>  adapter: mysql<br />
  database: $DB_NAME<br />
  username: $USER<br />
  password: $PASSWORD<br />
  host:     $HOST<br />
</em></p>
<p>A set of ActiveRecord migrations can be executed as<br />
1. A part of a Rails application by invoking</p>
<p>  rake db:migrate RAILS_ENV=xx VERSION=yy</p>
<p>2. A standalone Ruby application: If it is not a part of a Rails application, there is no default Rakefile to use. So we&#8217;d need to create one (under ~/workspace/db_setup) with the following content:</p>
<p><em>require &#8216;rubygems&#8217;<br />
require &#8216;active_record&#8217;<br />
require &#8216;yaml&#8217;<br />
task :default => :migrate</p>
<p>desc &#8220;Migrate the database through scripts in &#8216;migrations&#8217;. Target specific version with VERSION=x&#8221;<br />
task :migrate =&gt; :environment do<br />
ActiveRecord::Migrator.migrate(&#8217;migrations&#8217;, ENV["VERSION"] ? ENV["VERSION"].to_i : nil )<br />
end</p>
<p>task :environment do<br />
RAILS_ENV = (ENV['RAILS_ENV'] ||= &#8216;dev&#8217;)<br />
dbconfig = YAML::load(File.open(&#8217;database.yml&#8217;))[RAILS_ENV]<br />
ActiveRecord::Base.establish_connection(dbconfig)</p>
<p># Enable diagnostic logging to help debugging.<br />
# Note that ActiveRecord colorizes output for viewing in a terminal.<br />
# But when viewed as a normal file, it isn&#8217;t readable. So we disable it.<br />
ActiveRecord::Base.colorize_logging = false<br />
logFile = File.open(&#8217;database.log&#8217;, &#8216;w&#8217;) # set it to &#8216;STDERR&#8217; to enable logging to Std. ERROR console<br />
ActiveRecord::Base.logger = Logger.new(logFile)<br />
end</em></p>
<p>To execute the migrations, run the following command from the directory containing the RakeFile:</p>
<p>  rake RAILS_ENV=xx VERSION=yy</p>
<p>Both the above mentioned ways lend themselves to be easily invoked from a multitude of build and CI tools, like ANT, CruiseControl, python scripts etc.</p>
<p>Thus we, saw how to configure ActiveRecord as a database agnostic mechanism of managing database setup and incremental migrations. It is relatively simple to use and highly extensible.</p>
<p>Although, some may argue that ActiveRecord leads to a high degree of coupling between application code and database structure; in many cases the issues due to this coupling is much easier to manage than to adopt an alternate complex solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/using-activerecord-for-database-setup-and-migration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Web Toolkit for Rich Internet Applications –A Java Programmer’s Experience</title>
		<link>http://www.nagarro.com/blog/google-web-toolkit-internet-applications/</link>
		<comments>http://www.nagarro.com/blog/google-web-toolkit-internet-applications/#comments</comments>
		<pubDate>Thu, 14 May 2009 17:52:42 +0000</pubDate>
		<dc:creator>Nitin Sood</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/?p=285</guid>
		<description><![CDATA[Recently, I have been working on porting a Struts and uPortal based legacy application to GWT. This work was initiated a year ago to replace an unappealing, non-responsive and slow user interface of the legacy application. Another key requirement was to make the client side technology stack lighter. Use of multiple client side technologies (Struts, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I have been working on porting a Struts and uPortal based legacy application to GWT. This work was initiated a year ago to replace an unappealing, non-responsive and slow user interface of the legacy application. Another key requirement was to make the client side technology stack lighter. Use of multiple client side technologies (Struts, uPortal, JSP, Tag libraries, Java Script, configuration files, CSS, XSLT) made it difficult to make even simple UI changes.<span id="more-285"></span></p>
<p>After initial analysis, it was clear that we needed to incorporate AJAX in multiple areas across the application. It was further decided to use one of the existing AJAX frameworks rather than writing AJAX &#8220;by hand&#8221;. After evaluating several AJAX frameworks, we selected GWT. Other AJAX frameworks like DOJO and YUI library are also good but they did not solve the above mentioned problems arising from a fat architecture and a complicated technology stack.</p>
<p>One of the primary reasons for selecting GWT was its unique approach to developing the complete application: both the client side and the server side components using Java. GUI development with GWT APIs is similar to Swing development and it is refreshing to forget JSP, JavaScript, and Struts and write everything using Java. I am very happy with experience so far and we have vastly improved presentation layer while retaining most of the service layer code.</p>
<p>With GWT, the AJAX front-end is written in Java that gets compiled into highly optimized Java Script. Developers do not need to write Java Script while end users are provided with dynamic and standards-compliant AJAX experience. JavaScript gets downloaded by the client browser at runtime where most of the client side processing is performed thus releasing the server side from handling presentation tasks.</p>
<p>I am impressed by the developer friendly features of GWT. Using Java in the presentation layer facilitates the use of design patterns and creation of reusable widget libraries. GWT’s approach to history management, internationalization, and service layer interaction is easy to understand and implement. I felt spoilt by the choice of available tools, default support for multiple browsers and ability to debug AJAX in hosted mode. I also noticed ancillary benefits like elimination of training on multiple technologies, reduced dependence on technology experts, and the overall speed of development.</p>
<p>I have heard arguments about Flex being a better RIA choice than GWT. I think this may be because some people may not be aware of other GWT widget libraries (like GWT-EXT) available today. Although GWT comes with a very good collection of useful and cool widgets but you can always use third party widget libraries which provide additional AJAX components like a special Tree or Grid component. We used <a href="http://code.google.com/p/gwt-ext/">GWT-EXT</a>, a very rich widget library to achieve the desired functionality.</p>
<p>I found a few features missing &#8211; for example, there is no inbuilt support to load client side libraries on demand. Actually GWT loads all client-side libraries in client’s browser when the end-user accesses any module of the web application for the first time. So I think GWT may be a misfit for large enterprise applications. Also I faced problems due to lack of emulators for some of the Java classes like Calendar and our application POJOs contain Calendar objects. The good thing is that there are workarounds available to solve these problems.</p>
<p>I strongly recommend GWT if you are developing a mid size web application that needs enhanced usability and a desktop like look and feel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/google-web-toolkit-internet-applications/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Application programming in the era of multicore processors</title>
		<link>http://www.nagarro.com/blog/application-programming-in-the-era-of-multicore-processors/</link>
		<comments>http://www.nagarro.com/blog/application-programming-in-the-era-of-multicore-processors/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 20:44:55 +0000</pubDate>
		<dc:creator>Abhijat Vatsyayan</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tools and Utilities]]></category>
		<category><![CDATA[Concurrent programming]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/?p=142</guid>
		<description><![CDATA[Computer chip manufacturers cannot keep on increasing the clock speed indefinitely to make their processors faster. They seem to have already reached the limit (on clock speed) and have started putting multiple independent processing cores on a single chip to increase the computational capacity. As most systems start running on processors with tens of cores (if [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><span style="color: #000000;">Computer chip manufacturers cannot keep on increasing the clock speed indefinitely to make their processors faster. They seem to have already reached the limit (on clock speed) and have started putting multiple<span id="more-142"></span> independent processing cores on a single chip to increase the computational capacity. As most systems start running on processors with tens of cores (if not hundreds right away) application programmers will need to start relying on concurrent programming to make their applications faster and responsive. This will lead to significant changes in the way we design, develop, debug and test programs. We will have new tools, APIs, compilers, languages and frameworks for supporting highly concurrent programs written by application programmers.</span></p>
<p><span style="color: #000000;">The first and most obvious change will be that programmers will start using many more threads and use current lock based approaches to synchronize access to shared data. Now detecting bugs in multithreaded programs is extremely difficult and as we write more concurrent programs, it will become increasingly important to have tools which can check our programs for correctness. Two such tools are <span style="text-decoration: underline;"><a href="http://research.microsoft.com/en-us/projects/chess/" target="_blank">CHESS</a></span> from Microsoft research and <span style="text-decoration: underline;"><a href="http://fsl.cs.uiuc.edu/index.php/JPredictor" target="_blank">jPredictor</a></span> from UIUC. Both are still research projects but are definitely worth taking a look at and playing around with.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">The transactional memory research community advocates getting rid of lock based approach for managing access to shared data. The idea comes from the database world where transactions have been around for a long time. Hardware transactional memory, hybrid transactional memory and software transactional memory, the three broad categories in which implementations are often split, are all under active research but there already are quite a few implementations out there for you to play around with. One of the core ideas behind using transactional memory for accessing shared data is to allow users to specify &#8220;what&#8221; needs to be synchronized and then let the machine take care of the &#8220;how&#8221; part (compare this to how you use locks today). This is supposed to greatly simplify the concurrent programming model but it is too early to say if it really does make the programming model simpler.</span></p>
<p style="text-align: justify;"><span style="color: #000000;">While  I cannot cover or summarize the work being done on transactional memory without making it into a small project, I can provide a few starting points that you may find interesting. Microsoft is doing very interesting work in this area and while a lot of it uses Haskel, there is a <span style="text-decoration: underline;"><a href="http://research.microsoft.com/en-us/downloads/6cfc842d-1c16-4739-afaf-edb35f544384/default.aspx" target="_blank">C-sharp API for software transactional memory</a></span> that you should look at. If you are a Java programmer, you should take a look at <span style="text-decoration: underline;"><a href="http://www.sun.com/download/products.xml?id=453fb28e" target="_blank">DSTM2</a></span>. And irrespective of what technology you use for building systems, I will recommend reading publications on transactional memory by Maurice Herlihy, Simon Peyton-Jones, Victor Luchangco and Mark Moir (there are others, I just picked up the four I see often in the literature).</span></p>
<p style="text-align: justify;"><span style="color: #000000;">Finally, we should not ignore the world of message passing. <span style="text-decoration: underline;"><a href="http://www.openmp.org/" target="_blank">OpenMP</a></span> and <span style="text-decoration: underline;"><a href="http://erlang.org/" target="_blank">Erlang</a></span> have been around for a long time and are designed for concurrent programming. OpenMP is an API you can use from C/C++ and FORTRAN to write parallel programs to take advantage of shared-memory architectures.  Erlang is a programming language in which you write processes that communicate exclusively using messages and if you write your Erlang programs correctly, you get the ability to scale to hundreds of processors for free.</span></p>
<p style="text-align: justify;"><span style="color: #000000;"><br />
</span></p>
<p style="text-align: justify;"><span style="color: #000000;"><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/application-programming-in-the-era-of-multicore-processors/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Log your exceptions to the cloud</title>
		<link>http://www.nagarro.com/blog/an-alternative-way-to-do-exception-logging/</link>
		<comments>http://www.nagarro.com/blog/an-alternative-way-to-do-exception-logging/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 07:58:04 +0000</pubDate>
		<dc:creator>Vaibhav Gadodia</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Framework]]></category>
		<category><![CDATA[Exception Logging]]></category>

		<guid isPermaLink="false">http://www.nagarro.com/blog/an-alternative-way-to-do-exception-logging/</guid>
		<description><![CDATA[Exception Logging is always an interesting problem to solve. Depending on your needs you may have a simple log statement which writes to a text file, or you may need to have a full-fledged exception management module which logs exceptions to the database, categorized them, and generates notifications. There is no single solution for how [...]]]></description>
			<content:encoded><![CDATA[<p>Exception Logging is always an interesting problem to solve. Depending on your needs you may have a simple log statement which writes to a text file, or you may need to have a full-fledged exception management module which <span id="more-108"></span>logs exceptions to the database, categorized them, and generates notifications. There is no single solution for how to log and manage your exceptions. It helps then to be aware of as many techniques and options as you can; since you never know which will come in handy in a situation.</p>
<p>One method to log exceptions is to log them in the cloud. And there exists a useful service which makes your job easier.</p>
<p> <!--more-->
<p>A service in the cloud represents a service that is hosted on the Internet, available to you through an API, so that you have no idea how it is physically implemented. This makes things simple for you since you don&#8217;t have to worry about writing implementation code for the exception logging and reporting framework. You only need to call it.</p>
<p>The service that I am discussing is called <a href="http://www.hoptoadapp.com/" target="_blank">HopToad</a>. The service offers a simple to use API which allow you to log exceptions from your application. The exceptions are stored in the cloud and are available to you from a central web-based console. All the logged exceptions are presented in easy to understand and navigable way. For example, you can see which errors are occurring most often, or which one is the latest error that came up and from where. You can look at error details and stack traces.</p>
<p>The service developed to be used from within RubyOnRails applications. However, they have an open API, and can be accessed through any technology stack. K. Robertson has made a .Net wrapper available for logging to HopToad. It&#8217;s called <a href="http://github.com/krobertson/hopsharp/tree/master" target="_blank">HopSharp</a>. It is fairly straight forward to use (just drop the DLL in your application and you are good to go). I can imagine that it would be straight forward to write a Log4Net extension for this service as well.</p>
<p><strong>When to use this?</strong></p>
<p>So, when would you use something like this. While the final decision to use this would vary from project to project and client to client, I can think of the following scenarios:</p>
<ul>
<li>The application is a work in progress and you are expected to release a number of updates. Typically, in such scenarios, a lot of testing happens while the application is in deployed state. A logging framework such as this will allow you to monitor the application as it is being used, and priorities on bugs can be assigned based on frequency and severity. </li>
<li>You have an application deployed at multiple locations and you would like to see a consolidated view of the exceptions being reported. </li>
<li>As a way to save time and effort. This is a ready made framework where you don&#8217;t need to impart any effort for implementing an exception logging and notification system. </li>
</ul>
<p>I am pretty sure that there are other such services out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/an-alternative-way-to-do-exception-logging/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ruby vs. Java</title>
		<link>http://www.nagarro.com/blog/ruby-vs-java/</link>
		<comments>http://www.nagarro.com/blog/ruby-vs-java/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 17:44:34 +0000</pubDate>
		<dc:creator>Bill Kayser</dc:creator>
				<category><![CDATA[Guest Blog: Kayser]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[radrails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blogs.nagarro.net/kayser/ruby_vs_java/</guid>
		<description><![CDATA[It&#8217;s not that we don&#8217;t have enough people offering opinions on what is a better language.  It&#8217;s just that some of us never tire of discussing it.  There are so many perspectives, so many arguments, and so many people willing to   spend time blogging about it you&#8217;d think we&#8217;d all be pretty sick of it [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s not that we don&#8217;t have enough people offering opinions on what is a better language.  It&#8217;s just that some of us never tire of discussing it.  There are so many perspectives, so many arguments, and so many people willing to  <span id="more-29"></span> spend time blogging about it you&#8217;d think we&#8217;d all be pretty sick of it by now, and I might move on to some more interesting less traveled topic, like <em>Semicolons: friend or foil to good programming?</em> or <em>Extreme Programming, Acceptance Testing, and ISO 9001: Putting it All Together</em>.</p>
<p>Yet I just can&#8217;t stay away, and neither can you if you are still reading this.  So let me jump right in with my take&#8230;</p>
<p><strong><em>Ruby Doesn&#8217;t Scale</em></strong>.  It can&#8217;t take you to the same places Java can.</p>
<p>I don&#8217;t mean performance-wise.  And I don&#8217;t necessarily believe it can&#8217;t scale complexity-wise.  I just think it won&#8217;t scale with the size of a team.  I can&#8217;t see an application equivalent to 2 million lines of Java code with 80 developers written in Ruby.  Here are some reasons why:</p>
<ul>
<li>the language and tools don&#8217;t facilitate writing APIs<img src="http://www.nagarro.com/blog/wp-content/uploads/2009/02/java_vs_ruby1.jpg" alt="Java Books vs Ruby Books" hspace="16" vspace="16" width="243" height="200" align="right" /></li>
<li>it&#8217;s too hard to protect code from the side effects of other unrelated subsystems</li>
<li>the language and tools do not support for components or version management (see my posts on OSGi)</li>
<li>one bad Ruby developer can do a lot more damage than one bad Java developer</li>
<li>there are a lot of bad Ruby developers (I am one!)</li>
<li>the tests don&#8217;t scale&#8211;no Ruby app can survive inadequate tests, and the while the amount of tests grows linearly with the size of the application, the cost of maintaining them grows exponentially.  This may be true of any tests but&#8230;</li>
<li>you need more tests with Ruby&#8211;a Java app can survive without a complete unit test suite.  In fact, some large Java app can survive without tests at all.  Call me crazy but I&#8217;ve seen it.  What did we do before JUnit, after all?  I don&#8217;t think I&#8217;d want to work on one of those apps, but the point is, test code for Ruby is as essential as an interpreter to make a decent sized Ruby app work.</li>
<li>there&#8217;s no meta-programming in Java; that&#8217;s kind of a bummer, but it also means no massive indecipherable frameworks collapsing under the weight of the author&#8217;s cleverness, frameworks which are so unfathomable they are as brittle as COBOL.</li>
</ul>
<p>There, I said it.  Now that I did, I&#8217;ll make a couple of other observations about why I love Ruby anyway:</p>
<ul>
<li>A two million line Java program probably translates to 100K lines of Ruby code</li>
<li>80 Java developers are probably as productive as 20 equivalently skilled Ruby developers</li>
<li>With only a couple of developers, I think there&#8217;s no limit to how big the application can be.  In fact, the language is much better suited for a very small team than Java because you can be so much more efficient if you know what you&#8217;re doing.</li>
<li>The tools for Ruby are way behind Java, and there&#8217;s no reason to think they won&#8217;t catch up.  When they do, it&#8217;s entirely possible the gulf between the scalability of the languages will close substantially.  I certainly hope they will.  As far as the tools for writing Ruby go, I feel like I stepped back into 2002 when I went from Java/Eclipse to Ruby/{NetBeans/RadRails/TextMate}.  rake ~ make: when was the last time I typed in make when writing Java apps?</li>
<li>The tools may be behind, but the available libraries, plugins and gems are already very rich.</li>
<li>Ruby helped me remember why I love to write programs</li>
</ul>
<p>The last point I threw in there apropos of nothing, other than to point out that while I do miss some things about writing Java apps, I&#8217;m happy to be writing in Ruby now, and hope to keep working on it for the indefinite future, or until our app gets over 100,000 lines of Ruby which should be&#8230; never.</p>
<p>P.S. Here&#8217;s my <a href="http://www.youtube.com/watch?v=PQbuyKUaKFo">favorite entry</a> in the Ruby vs. Java debate, brought to you courtesty of RailsEnvy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/ruby-vs-java/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What I Learned from Ward Cunningham</title>
		<link>http://www.nagarro.com/blog/ward-cunningham/</link>
		<comments>http://www.nagarro.com/blog/ward-cunningham/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 00:51:50 +0000</pubDate>
		<dc:creator>Bill Kayser</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Guest Blog: Kayser]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[innovation]]></category>
		<category><![CDATA[ward cunningham]]></category>
		<category><![CDATA[wiki]]></category>
		<category><![CDATA[wycash]]></category>
		<category><![CDATA[xp]]></category>

		<guid isPermaLink="false">http://blogs.nagarro.net/kayser/ward_cunningham/</guid>
		<description><![CDATA[Ward Cunningham is well known in the software engineering community and was famous in his own right for his work on WyCash and the development of CRC Cards, Extreme Programming, and Programming Patterns, even before his fame went to a new level as the inventor of the Wiki.  I first met him in 1995 and our [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Ward_Cunningham" target="_blank">Ward Cunningham</a> is well known in the software engineering community and was famous in his own right for his work on <a href="http://c2.com/doc/oopsla91.html">WyCash</a> and the development of <a href="http://c2.com/doc/oopsla89/paper.html">CRC Cards</a>, Extreme Programming, and Programming Patterns, even before his<span id="more-47"></span> fame went to a new level as the inventor of the Wiki.  I first met him in 1995 and our paths crossed several times since then, and the last few years we&#8217;ve very much traveled in the same circles among the Ruby on Rails community.  Recently I had the honor of sitting down for one of his <a href="http://www.youtube.com/view_play_list?p=740B993B09228573">Lightning Interviews</a> where he asked me about <a href="http://www.newrelic.com">New Relic</a> and traded some ideas on the career of software engineering.</p>
<p> </p>
<p style="text-align: center"><img src="http://www.nagarro.com/blog/wp-content/uploads/2009/02/ward.JPG" alt="Ward Cunningham" hspace="12" vspace="12" width="460" height="308" /></p>
<p>I feel privileged to have worked with Ward in several different contexts, and to have had a front row seat as he developed the first Wiki site and his <a href="http://c2.com/cgi/wiki?FitLibrary">Framework for Integration Testing</a> (FIT), as well as a few other fascinating smaller projects along the way.  Even though I haven&#8217;t worked closely with him over any extended period, in the long run I think I&#8217;ve developed a sense of what he&#8217;s about as an innovator, and with the publishing of this interview have some reflections on what I&#8217;ve learned from him.</p>
<p>Ward to me is a classic idea guy.  He&#8217;s always thinking, always saying &#8220;what if?&#8221;  In many of the conversations we&#8217;ve had, I&#8217;m embarrassed to say I can hardly keep up.  If I can follow half of what he&#8217;s talking about I&#8217;m fortunate since that half is usually enough to cause me to go running back to my desk and start working on some new angle in my own work.</p>
<p>Not all of his ideas see the light of day, I&#8217;m pretty sure.  But when he hits on a good one, he hits it out of the park&#8211;nobody could deny that.  The Wiki wasn&#8217;t his first great idea and it definitely wasn&#8217;t his last.</p>
<p>So that&#8217;s one thing I&#8217;ve learned.  Having great ideas isn&#8217;t like making great movies, where if you&#8217;re <a href="http://www.google.com/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fwww.imdb.com%2Fname%2Fnm0001837%2F&amp;ei=oTyGSfu-Cpm0sQOF_IG7DQ&amp;usg=AFQjCNEm7BwXt3vMLSmV5QAvR8Wu6d14Kw&amp;sig2=aY_5jRq3T4iy-ZhXkUWefg">Peter Weir</a> you do nothing for five years and then suddenly come out with some brilliant new film, then go quiet again for another five years.  You have to constantly be working on it.  You have to come up with a lot of ideas, be constantly thinking about where to go next, and keep pushing them, trying them out, until you find the one that captures the imagination and the mindset of those around you, and really takes hold.  Put another way, it&#8217;s not about the batting average&#8211;it&#8217;s about the number of at bats.</p>
<p><img src="http://blogs.nagarro.net/kayser/wp-content/uploads/2009/02/gifted.jpg" alt="Gifted" hspace="12" vspace="12" align="right" />Joel Spoelsky <a href="http://www.joelonsoftware.com/articles/fog0000000073.html" target="_blank">likes to make fun of smart people</a>, people that say things like,  &#8220;spreadsheets are really just a special case of a programming language.&#8221;  Rightly so.  Those kinds of smart people are useless.  That&#8217;s not Ward.  It&#8217;s not enough to just be an idea guy&#8211;to always be drawing connections between seemingly unrelated things, or playing with the meaning of things to try to derive new value.  If you want to make your mark the way Ward has, your ideas need to have true value, to make people&#8217;s lives easier somehow.  That&#8217;s the second thing I learned from Ward.  Great ideas need to be a path to a better way.  The Wiki, XP, and Fit&#8211;they all fit the bill in that regard.</p>
<p>Also, Ward&#8217;s ideas have a common theme, in my mind.  They are simple but with incredible leverage. He doesn&#8217;t overthink anything.  He just starts off with a simple way of looking at something differently.  He challenges conventional thinking, not very overtly, but in a kind of subtle, subversive way, innocently asking, &#8220;what if?&#8221;</p>
<p><em>What if customers wrote tests?</em>  (They can&#8217;t!)</p>
<p><em>What if programs told you how they behaved, instead of creating lots tests to ensure they behave how we expect? </em> (That won&#8217;t work!)</p>
<p><em>What if web surfers could edit the pages they view on the web?</em>  (Chaos!)</p>
<p>Ward knows the most successful systems always start out as simple concepts.  It would be easy to get carried away, to get too ambitious and over-engineer, but he always showed restraint.  The <a href="http://wiki.org/">original Wiki</a>, still going strong, is not much changed from the original implementation (although I doubt it is still served over a modem).  Instead, Ward left it to others to explore new platforms, languages, and intentions.  And thus it blossomed.</p>
<p>Which brings me to my third observation on his success.  It reminds me of something my father always used to say: &#8220;There is no limit to the amount of good you can do if you don&#8217;t care who gets the credit.&#8221;  Ward never tried to own the ideas or control them.  He puts everything into the public domain because he feels that&#8217;s where ideas can flourish and do the most good.  I believe if he tried to control his ideas with trademarks or patents (some have offered to &#8220;help&#8221; him by registering Wiki as a trademark), it would have stifled their growth, and maybe we would never have MediaWiki or Wikipedia.</p>
<p>But the best lesson I learned is something I observed when Ward was with other people.  He brings out the best in those around him.  I think he has that effect because he&#8217;s such an enjoyable person to be around.  People gravitate towards him.  Humble, unassuming, with not the slightest bit of arrogance, he disarms the cynics and brings people together, getting them to leave egos at the door and get down to the business of talking about really interesting things.  And the best example of that for me is the interview he did with me, which I thoroughly enjoyed.  View it along with the other <a href="http://www.youtube.com/view_play_list?p=740B993B09228573">lightning interviews</a> and I&#8217;m sure you&#8217;ll see what I mean.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/ward-cunningham/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Usability of Programs, Part 2 of 2</title>
		<link>http://www.nagarro.com/blog/the-usability-of-programs-part-2-of-2/</link>
		<comments>http://www.nagarro.com/blog/the-usability-of-programs-part-2-of-2/#comments</comments>
		<pubDate>Mon, 22 Oct 2007 06:32:40 +0000</pubDate>
		<dc:creator>Bill Kayser</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Guest Blog: Kayser]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blogs.nagarro.net/kayser/the-usability-of-programs-part-2-of-2/</guid>
		<description><![CDATA[Here are some other principles of UI design that apply to program design:
Reduce Cognitive Load. This guideline in UI design is about minimizing the amount of things a user has to know in order to be able to use a tool effectively. Likewise, a programmer shouldn&#8217;t have to subclass five different classes just to effect [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some other principles of UI design that apply to program design:</p>
<p><strong>Reduce Cognitive Load</strong>. This guideline in UI design is about minimizing the amount of things a user has to know in order to be able to use a tool effectively. Likewise, a programmer shouldn&#8217;t have to subclass five different classes just to effect one small change to an application. For instance, I often find that in order to add a new behavior interactive application I may have to learn the logging framework, the undo/redo mechanism, the localization framework, and the validation framework&#8211;on top of whatever complicated hierarchies exist in the model and views. Things usually reach this state when developers anticipating future needs and striving for reusability and generality in their frameworks end up sacrificing simplicity and, ultimately, usability.</p>
<p><span id="more-12"></span></p>
<p><a title="DaVinci Vman" href="http://www.nagarro.com/blog/wp-content/uploads/2007/10/davinci_vman.jpg"><img src="http://www.nagarro.com/blog/wp-content/uploads/2007/10/davinci_vman.jpg" alt="DaVinci Vman" hspace="16" vspace="12" width="213" height="250" align="right" /></a><strong>Be consistent</strong>. The brake pedal on one model of car shouldn&#8217;t serve as the accelerator on another. That would be dangerous. It can also be dangerous to mix thread safe classes with classes that aren&#8217;t thread safe, or to have methods accept null String values in some places and throw exceptions in others. If you adopt an idiom in your public interfaces, like converting exceptions thrown by delegate APIs to local exceptions, or using immutable objects as enumerated types instead of ints, then try to stick with it. Consistency fosters a perception of predictability and stability.</p>
<p><strong>&#8230;But not too consistent.</strong> Jakob Nielsen, a well known usability expert, suggested that you can take certain principles too far, and the principle of consistency is one of those. He felt that Mac interfaces went to excess in trying to maintain consistency, to the point of defying common sense. A famous example: since the operation of removing things from a desktop consisted of dragging them to the trash can, the operation for ejecting a floppy disk was to drag it from the desktop into the trash can, an operation guaranteed to unnerve a user the first time they try it. In software, programmers often step into the realm of over-engineering in an effort to enforce consistency. An action in a user interface may implement an Undoable interface, but that doesn&#8217;t mean all actions should be undoable. One might take pains to separate UI code from Domain objects, but if it means introducing intermediary classes and interfaces just to keep domain code from importing javax.swing packages then it may be better to diverge from consistency.</p>
<p><strong>Avoid modality. </strong>In many applications users are confronted with modal dialogs which force them to take action before they can proceed in other parts of the application. While a modal dialog is showing, all other parts of the interface are disabled. On the surface this may seem helpful to the user but oftentimes it&#8217;s just a convenience for the programmer who doesn&#8217;t have the inclination to design the data model so that multiple activities can be conducted concurrently (i.e., changing the properties of an Employee in a dialog while simultaneously deleting that employee in the parent window).</p>
<p>The same thing applies in program design. Sometimes when one object collaborates with another it makes assumptions about the state of that object. Its operation is only guaranteed to be correct under those assumptions. For instance in some data access object there may be operations which result in updating a database object. But these operations might assume that a transaction has been started and fail in the worst possible way if that&#8217;s not the case. Users of this class must be aware these methods can only be called in a transaction and keep track of the state of the transaction. An alternative design might encapsulate individual operations in a full transaction, or offer more support keeping track of the transaction state.</p>
<p>Avoid this kind of modality in your classes. You can&#8217;t drop all preconditions but the fewer opportunities for failure, the more robust the application.</p>
<p><img src="http://www.nagarro.com/blog/wp-content/uploads/2007/10/handle.jpg" alt="Handle" hspace="16" vspace="12" width="295" height="300" align="left" /><strong>Utilize Affordances. </strong>Affordances are properties of an object that suggest some action can be taken. A door knob &#8220;affords&#8221; opening a door. A rectangle on a screen may not afford action, but if it is raised and rounded, resembling a button, it affords being pushed. For programmers, affordances might be properties of an interface which make it&#8217;s usage more clear. In a class, abstract methods afford overriding. If a class requires several instance variables be initialized when the instance is created, then the programmer should afford that action by adding parameters to the constructor to populate those variables, rather than rely on the caller to invoke setters. Good abstractions and well factored class hierarchies can afford subclass extensions, where flat class structures with duplicate code and concrete classes may not.</p>
<p><strong>Adopt Standards. </strong>What more is there to say? Standards in User Interface design result in uniformity across user interfaces, giving the user a sense of familiarity when using an application for the first time. In programming, coding standards provide exactly the same benefit.</p>
<p><strong>Provide Feedback.</strong> Feedback in user interfaces usually means giving some indication that a user action has been detected and interpreted. If the action was accepted then give an indication to the user of success. If the action results in an error, make that error known to the user directly. This could probably be interpreted several ways in the context of programming, but the best one would probably be the principal of &#8220;Fail Fast.&#8221; This means detecting an erroneous use of a class or method early and communicating the actual offense, preferably in a runtime exception, as opposed to letting it go and waiting until the effects of the error cause secondary exceptions which may not reveal the actual API violation. An example of this would be not checking for null values in method parameters but passing the null values on to subsequent calls until a NullPointerException appears in a lower level method. I don&#8217;t think you want to check every pre-condition to an exception since it makes methods very noisy, but a lot of times there are conditions which are more likely to be violated. Play the odds and enforce those when you come across them.</p>
<p>You can really go on and on with this idea. The principles of usability apply to any system that interacts with a user, and that includes a programming model. The goal of a great programmer should be the same as the great product designers: empower and delight your users. Programmers should never forget that ultimately their users are not CPUs but other programmers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/the-usability-of-programs-part-2-of-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The Usability of Code, Part 1 of 2</title>
		<link>http://www.nagarro.com/blog/the-usability-of-programs-part-1-of-2/</link>
		<comments>http://www.nagarro.com/blog/the-usability-of-programs-part-1-of-2/#comments</comments>
		<pubDate>Fri, 12 Oct 2007 06:54:08 +0000</pubDate>
		<dc:creator>Bill Kayser</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Guest Blog: Kayser]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[api design]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[ken arnold]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://blogs.nagarro.net/kayser/the-usability-of-programs-part-1-of-2/</guid>
		<description><![CDATA[Not long ago Ken Arnold wrote an article for Queue magazine called Programmers are People Too. In it he talks about applying the principles of User Interface Design to the design of APIs. It turns out the practices of Human Factors and Usability Engineering have a lot to offer the implementors of public APIs and [...]]]></description>
			<content:encoded><![CDATA[<p>Not long ago Ken Arnold wrote an article for Queue magazine called <em><a href="http://www.acmqueue.com/modules.php?name=Content&amp;pa=printer_friendly&amp;pid=317&amp;page=3">Programmers are People Too</a></em>. In it he talks about applying the principles of User Interface Design to the design of APIs. It turns out the practices of Human Factors and Usability Engineering have a lot to offer the implementors of public APIs and frameworks. Think of an API as the &#8220;user interface&#8221; of a larger programming model. Users are application programmers and the usability of the API is judged not just by it&#8217;s richness, but on the ease of use and learnability of the API. It&#8217;s not sufficient to address usability with thorough documentation any more than it&#8217;s sufficient to compensate for a bewilderingly difficult user interface to a mobile phone with a five pound user manual.</p>
<p><span id="more-11"></span></p>
<p><img src="http://www.nagarro.com/blog/wp-content/uploads/2007/10/explorer-8300-remote-large.jpg" border="0" alt="Remote Control Interface" hspace="16" vspace="6" width="120" height="400" align="left" />The idea of applying Human Factors to API design is not far off the idea of designing programs as works of literature. In both cases your main focus is your audience, not the computer. The common principle in both is readability, but the idea of API usability takes it a little further because your audience isn&#8217;t just trying to understand what it&#8217;s looking at but actually use and extend the work.</p>
<p>I believe these principles of usability apply not just to API design, but to programs in general. Ken Arnold gives a couple of examples of UI principles applied to API design, such as the use of <strong>Progressive Disclosure</strong>. That&#8217;s the principle that says you shouldn&#8217;t overwhelm a user with more detail than they need for a common task, but rather disclose the additional detail when the need arises as they move further along in some interaction. Give the user what they need to know when they need it and only when they need it. That way they won&#8217;t be distracted or confused by superfluous information.</p>
<p>For an API, this might mean segregating the methods of a complicated class into the methods most commonly used by client applications from the less frequently used methods needed in special situations or by advanced users. For an application designer it might mean using interfaces and abstract classes to hide the distracting implementation details of a class.</p>
<p>Think about other common principles for user interface design, such those described in the <a href="http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGIntro/chapter_1_section_1.html">Apple Human Interface Guidelines</a>. How can these be applied to program design? I&#8217;ll list some more examples in the next installment of this column.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/the-usability-of-programs-part-1-of-2/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Programmers as Channel Surfers</title>
		<link>http://www.nagarro.com/blog/programmers-as-channel-surfers/</link>
		<comments>http://www.nagarro.com/blog/programmers-as-channel-surfers/#comments</comments>
		<pubDate>Tue, 02 Oct 2007 06:00:41 +0000</pubDate>
		<dc:creator>Bill Kayser</dc:creator>
				<category><![CDATA[Guest Blog: Kayser]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[literate programming]]></category>
		<category><![CDATA[program documentation standards]]></category>

		<guid isPermaLink="false">http://blogs.nagarro.net/kayser/programmers-as-channel-surfers/</guid>
		<description><![CDATA[If a program is to be a work of literature, then where does that leave object-oriented programs? In the era of functional decomposition, programs were built around algorithms and data structures. They executed in a single thread as a sequence of steps and subroutine calls, not unlike a story. Our object-oriented programs, on the other [...]]]></description>
			<content:encoded><![CDATA[<p>If a program is to be a work of literature, then where does that leave object-oriented programs? In the era of functional decomposition, programs were built around algorithms and data structures. They executed in a single thread as a sequence of steps and subroutine calls, not unlike a story. Our object-oriented programs, on the other hand, don’t have such a fixed path of execution. Whether server or client applications, they start up multiple threads and make heavy use of message passing and asynchronicity. The essence of a program is not in a sequence of steps and subroutine calls but in the subtle relationships between classes spread across many frameworks and subsystems, relationships such as inheritance, aggregation and collaboration. So how does one read a Java application like a story? The whole idea of object oriented programs seems at odds with literate programming.</p>
<p><span id="more-10"></span></p>
<p><img src="http://www.windowsusers.org/articles3/convertx/win_tv_surfing.jpg" border="1" alt="" hspace="14" vspace="6" width="180" height="151" align="left" />It may help to view your program less as a novel read in a single sitting and more like a TV show that is tuned in once a week by busy people with short attention spans. The purpose is still to engage and inform, but you need to keep in mind your audience could be jumping in to the story just about anywhere. Like a viewer flipping through channels, happening upon an interesting show, there’s a good chance that the first time a colleague comes across your code is clicking through the frames in a stack trace. They will be debugging an application trying to understand some unexpected sequence of events and will stumble upon one of your classes. Or they might drop in to use some small part of your API. Maybe they jump into your code to extend some capabilities, add a new feature, or make small changes as part of a global refactoring. They just want to know enough to get the task done and keep going. They might watch an episode but then move on.</p>
<p>There are a lot of practical implications to this approach but for this article I’ll just focus on one: give the user the information they need in the context of just “dropping in.” Think about the questions they might have looking at your code in a debugger: What is this class for? What elements are in the collection? Where did this member variable get set? Don’t make them work to find out something you could have made apparent with very little effort to begin with. Your goal is to give them enough information about each element so they won’t have to get sidetracked tracking down other references to the element just to see how it’s used . For example:</p>
<ul>
<li>Don’t make it a precondition for them to read a big design document on your intranet just to be able to understand what your GizmoClass is. Put the information as close to the artifact as possible. In the code, or at least in the same directory as the source.</li>
<li>Document all your classes and interfaces. This may seem like a no-brainer, but it’s not about spending more time writing comments. Instead, keep it as simple as possible. Avoid verbosity and forms. Just a sentence or two to explain what the class is (especially helpful if you couldn’t come up with a really good name). Maybe say what it’s used for. That’s usually about as much as someone needs to know. Refrain from a huge exposition on the overall design or the justification for the class. Save discussion of the class members for the member comments themselves. And if you can&#8217;t think of something meaningful to say, don&#8217;t say anything at all.</li>
<li>Don’t duplicate information in an Interface and a Class. If you have to pick one, document the interface. Focus on the interface for describing what something is or represents, and in the implementation, anything noteworthy about the implementation.</li>
<li>When declaring variables of collection types, if you say nothing else in the comment you should at least state the actual type of the elements of the collection.</li>
<li>Method javadocs are critical for the casual audience, but not because they will show up in the HTML documentation. Most IDEs will provide javadoc comments in a tooltip or property sheet, saving the user the step of clicking through to the declaration, or opening up the javadocs in a new window.</li>
<li>Make variable names as descriptive as possible. Not just your member or local variables. People tuning in to your code the first time will have a much easier time decrypting your for loops if instead of i or index you use names like row, month, or customerNumber.</li>
<li>Consider “Hungarian Notation” for variable names. Many developers find this convention ugly and onerous, but you can’t deny the value of immediately recognizing a variables scope without having to jump to its declaration. There’s a wide spectrum of adherence to this principle; from the old C++ practice of limiting the convention to member variables with a ‘_’ prefix on one hand, to an array of prefixes identifying the scope of every variable.</li>
</ul>
<p>The point of this is not to enumerate a list of documentation standards for your programs, but to get you to think like an author and empathize with your audience. Use your own experience learning and debugging other people’s code to determine what your audience needs from your documentation. Give them whatever they need to keep them from changing the channel before your program finishes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/programmers-as-channel-surfers/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>The Literacy of Programs</title>
		<link>http://www.nagarro.com/blog/the-literacy-of-programs/</link>
		<comments>http://www.nagarro.com/blog/the-literacy-of-programs/#comments</comments>
		<pubDate>Sun, 30 Sep 2007 09:21:36 +0000</pubDate>
		<dc:creator>Bill Kayser</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Guest Blog: Kayser]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[donald knuth]]></category>
		<category><![CDATA[literate programming]]></category>

		<guid isPermaLink="false">http://blogs.nagarro.net/kayser/the-literacy-of-programs/</guid>
		<description><![CDATA[
What is the purpose of a computer program?
Your colleagues and you all write software.  You generate software prose on a daily basis, crafting these artifacts called programs, line by line.  You utilize a common language that you all agree upon, a language which bears scant resemblance to a spoken language.  So what is it that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nagarro.com/blog/wp-content/uploads/2007/09/clip-image001.jpg"><img src="http://www.nagarro.com/blog/wp-content/uploads/2007/09/clip-image001-thumb.jpg" style="border: 0px none ; margin: 0px 10px 10px 0px" alt="Bill1" align="left" border="0" width="272" height="282" /></a></p>
<p><strong>What is the purpose of a computer program?</strong></p>
<p>Your colleagues and you all write software.  You generate software prose on a daily basis, crafting these artifacts called programs, line by line.  You utilize a common language that you all agree upon, a language which bears scant resemblance to a spoken language.  So what is it that you are creating?  What is the purpose of these lines of code?</p>
<p>You might say a program elaborates how a computer is to execute an algorithm.  It describes what the system should do and how to do it.  As programmers, we are the narrators and the computer is our audience.  That&#8217;s basically what we were taught in our very first computer class.</p>
<p><span id="more-8"></span></p>
<p><a href="http://en.wikipedia.org/wiki/Donald_Knuth">Donald Knuth</a>, Professor of the Art of Computer Programming at Stanford University, challenged this idea over twenty years ago when he first proposed the idea of “literate programming.”  Knuth felt that computer programs were first and foremost works of literature, to be read and appreciated by humans more than computers.  A programmer should take the same sort of care and attention in writing a program that an essayist takes in writing prose.  He devised a special language called “WEB” which was basically a programming language that resulted in two artifacts: one compiled into the machine language of the computer and the other compiled into a document for humans.  A program listing in WEB not only read like an article, it actually looked like one because it was based partly on <a href="http://en.wikipedia.org/wiki/TeX">Tex</a>, the typesetting language Knuth developed in the 70’s for publishing technical papers.</p>
<p>This would have been a much more challenging idea in the days before open source and tools that readily made source available and searchable, like Archie and the World Wide Web.  It wasn’t as easy to find examples of source code and even book authors were reluctant to disclose real applications in all the gory detail.  Most publications relied heavily on pseudo-code when trying to present samples for human consumption.  Before object oriented programming and the subsequent wave of class libraries and frameworks, programs had to do much more.  Real programs were just too ugly and verbose to put on display.</p>
<p>Open source has heralded in a new era of visibility for software artifacts.  The authors of Linux and Apache know that it’s not enough for their APIs to work as expected.  It’s not just how the systems behave that falls under scrutiny, but the actual source code itself.  The source of the Java Class Libraries makes itself known to most java programmers on a daily basis when they click on a stack frame in the debugger.  Successful open source contributors are very self conscious about how the source code looks.  The computer may not judge their triply nested loops but other programmers certainly will.  Their audience is first and foremost other software professionals.</p>
<p>So our program is a work of literature, then what is its purpose?  The purpose of our program is not to describe for the computer what we want it to do, but to describe for the programmer what the computer will do.  If that sounds subtle, then think about this the next time you are editing code in your IDE.  Is your &#8220;audience&#8221; really the computer?  Or is it the person in the office next to you?</p>
<p>Most conscientious programmers like to think of their code as maintainable&#8211;well documented and readable&#8211;but even the best of us may be tempted by obscure or clever shortcuts when we think nobody is looking.  Focus your work on a human audience.  If you&#8217;ve ever done pair programming, you know that having someone looking over your shoulder makes you take a bit more care with what you type in.  So imagine that someone is always looking over your shoulder, or that every line is going to be subjected to a team code review, scrutinized by your peers.  Write the code not for yourself, not for the computer, but for them.  Take pride in how your program communicates its cleverness, not just in being clever.  Choose names that not only mean something but could actually be read out loud in something that sounds like English.  Comments shouldn&#8217;t be an afterthought&#8211;your disconnected scribbled notes in the sidebar.  They should be interweaved in the source, flowing with it and filling in the prose to help the reader move effortlessly through the narration of what the computer is doing.  And remember: the best writers are avid readers.</p>
<p>Those are just a few examples of how programs should play to an audience of humans and not a computer.  I&#8217;ll be covering more in upcoming installments of this column.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nagarro.com/blog/the-literacy-of-programs/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
