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

<channel>
	<title>dev{shaped} &#187; Features</title>
	<atom:link href="http://devshaped.com/category/features/feed/" rel="self" type="application/rss+xml" />
	<link>http://devshaped.com</link>
	<description></description>
	<lastBuildDate>Mon, 13 Jul 2009 14:47:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<!-- podcast_generator="podPress/8.8" -->
		<copyright>&#xA9; </copyright>
		<managingEditor>derek@webradius.com ()</managingEditor>
		<webMaster>derek@webradius.com()</webMaster>
		<category></category>
		<itunes:keywords></itunes:keywords>
		<itunes:subtitle></itunes:subtitle>
		<itunes:summary></itunes:summary>
		<itunes:author></itunes:author>
		<itunes:category text="Society &amp; Culture"/>
		<itunes:owner>
			<itunes:name></itunes:name>
			<itunes:email>derek@webradius.com</itunes:email>
		</itunes:owner>
		<itunes:block>No</itunes:block>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="http://devshaped.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<image>
			<url>http://devshaped.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
			<title>dev{shaped}</title>
			<link>http://devshaped.com</link>
			<width>144</width>
			<height>144</height>
		</image>
		<item>
		<title>All I Wanted Was My Data</title>
		<link>http://devshaped.com/2009/05/all-i-wanted-was-my-data/</link>
		<comments>http://devshaped.com/2009/05/all-i-wanted-was-my-data/#comments</comments>
		<pubDate>Wed, 13 May 2009 01:00:00 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://devshaped.com/?p=181</guid>
		<description><![CDATA[by Barry Gervin
 Most .NET developers are going to need to access relational data at some point. For somebody approaching .NET for the first time, the data access story in the .NET world can be a little overwhelming to say the least. Existing .NET developers looking to update their data access techniques can face a [...]]]></description>
			<content:encoded><![CDATA[<p>by <a href="http://blogs.objectsharp.com/CS/blogs/barry/" target="_blank">Barry Gervin</a></p>
<p><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 22px 22px; display: inline; border-top: 0px; border-right: 0px" title="barrygervin" border="0" alt="barrygervin" align="right" src="http://devshaped.com/wp-content/uploads/2009/05/barrygervin.jpg" width="85" height="57" /> Most .NET developers are going to need to access relational data at some point. For somebody approaching .NET for the first time, the data access story in the .NET world can be a little overwhelming to say the least. Existing .NET developers looking to update their data access techniques can face a similar overwhelming experience. This article will help you understand the currently shipping mainstream technologies and how you can choose the one that is right for your particular needs.</p>
<p><span id="more-181"></span></p>
<p>There is a wide array of choices from Microsoft as well as from within the .NET ecosystem. There are many considerations to keep in mind when evaluating these technologies such as type safety, developer productivity, maintainability, concurrency, database agnosticism, performance, and scalability. One element that is almost universally accepted as a best (and only) practice these days is optimistic concurrency. Just about every data access technology that you&#8217;ll be interested in is going to use this concurrency model. That is where the similarities end.</p>
<div style="border-bottom: black 1px solid; text-align: left; border-left: black 1px solid; padding-bottom: 10px; background-color: #eeeeee; padding-left: 10px; padding-right: 10px; margin-left: 40px; border-top: black 1px solid; margin-right: 40px; border-right: black 1px solid; padding-top: 10px">Optimistic Concurrency is about being &quot;optimistic&quot; that we will not run into concurrent write access to records in the database. You could think of this as &quot;you probably aren&#8217;t going to update this record I&#8217;m about to give you, and even if you do, no one else is likely to update it at the same time&quot;. In practical terms, this means that I&#8217;m going to give you the record and forget I even gave it to you. When you want to update it, instead of just giving me the new values, you may want to let me know what version of the record you were editing so I can make sure somebody else hasn&#8217;t already changed it since I first gave it to you. Even more practically, this means, in addition to using the primary key in the where clause, also give me the original values of every column (or the ones you really care about). For SQL Server, you can be clever and use a single timestamp column that gets updated every time a record is touched. </div>
<h2><b>Traditional ADO.NET</b></h2>
<p>ADO.NET is a .NET brand name for all things data access from Microsoft. Typically using ADO.NET means using SqlCommand objects. Using a SqlCommand, we can pass a native T-SQL statement directly to the database. This could be a SELECT, INSERT, UPDATE, DELETE, a stored proc, or even a DDL (Data Definition Language) statement. Because ADO.NET doesn&#8217;t know too much about the database syntax, this statement is simply stored in a SqlCommand as a string and passed off directly to the database. You must use one of the Execute* methods on the SqlCommand to invoke the command. Using ExecuteNonQuery will fire the statement and assume it returns no result sets. This is useful in the Insert, Update, and Delete scenarios. To bring a result set back, we use the ExecuteReader method which will return a DataReader. A DataReader looks a little bit like a cursor which will allow us in .NET code to loop through the result set one row at a time and look at the columns. The DataReader is somewhat stupid in that it doesn&#8217;t know much about the shape or data types of the results coming back so you must use untyped access to get the columns as such in the code below:</p>
<div style="font-family: courier new; font-size: 9pt"><span style="color: blue">string</span> mySelectQuery = <span style="color: maroon">&quot;SELECT OrderID, CustomerID FROM Orders&quot;</span>;     <br />SqlConnection myConnection = <span style="color: blue">new</span> SqlConnection(myConnString);     <br />SqlCommand myCommand = <span style="color: blue">new</span> SqlCommand(mySelectQuery,myConnection);     <br />myConnection.Open();     <br />SqlDataReader myReader;     <br />myReader = myCommand.ExecuteReader();     </p>
<p><span style="color: green">// Always call Read before accessing data.</span>     <br /><span style="color: blue">while</span> (myReader.Read())     <br />{     <br />&#160; Console.WriteLine(myReader.GetInt32(<span style="color: maroon">0</span>) + <span style="color: maroon">&quot;, &quot;</span> +&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; myReader.GetString(<span style="color: maroon">1</span>));     <br />}     </p>
<p><span style="color: green">// always call Close when done reading.</span>     <br />myReader.Close();     </p>
<p><span style="color: green">// Close the connection when done with it.</span>     <br />myConnection.Close();     </div>
<p>It is also important to note that the connection to the database remains open during this looping. You may want to reduce the amount of work you do in the loop to minimize the amount of time the database connection is held open. This will make your application more scalable since database connections are a finite resource.</p>
<p>If you are only returning a single value (like a count or exactly one column from one row) you can use the ExecuteScalar method which is a bit easier to use than a DataReader.</p>
<p>SqlCommands and DataReaders in general let you be very precise about the SQL that is sent to the server and control exactly when the connection is opened and closed. You have to provide a bit more muscle in getting the data out of the SQL and coerced into .NET data types, but for performance sensitive areas of your applications, this could pay off. The other thing to be aware of is that there are a different set of objects (Commands, Connections, DataReaders) for each relational database provider. So if you need to move from SQL Server to ODBC to Oracle, you&#8217;ll need different objects. Fortunately each of these objects are based on an interface and you can program through the interface by using a DbProviderFactory class to create the concrete types based on configuration data. You will have to be sure to use ANSI compatible SQL in your attempt to be database agnostic, which may run counter to providing high speed data access which often requires developers to use native &amp; unique syntax to a particular relational database engine. Obviously your mileage might vary here.</p>
<h3>DataSets, DataTables, Data &amp; Table Adapters</h3>
<p>With DataReaders you need to be careful about how long you keep your connection open while iterating. Sometimes it is better to pull back your entire result set into memory, release your connection to the database, and then process the result set afterwards. This is where DataSets can be helpful. If you have a batch processing scenario that requires the entire result set in memory or you need to provide end user editing in a grid control, then DataSets are a good place to hold that data. </p>
<p>One of the primary benefits of a DataSet is that it not only caches the data in an efficient memory structure, but it can provide change tracking (what records were added? Deleted? Changed? What were the original values of each column, etc). DataSets work collaboratively with a SqlDataAdapter object, which is simply a composite of 4 SqlCommands (InsertCommand, SelectCommand, UpdateCommand, and DeleteCommand) mapping to the appropriate CRUD behavior (create, read, update, and delete).</p>
<p>DataSets can contain multiple result sets, each mapped into its own DataTable. Tables can be related to each other with Relations which mimic foreign keys. DataSets take care of master-detail linkages and keep everything &quot;hooked up&quot; when inserting records into parent and child tables with identity columns. Each table will require its own SqlDataAdapter. If you are doing a mix of insert, updates, and deletes and your database has referential constraints, you&#8217;ll need to orchestrate the changes, making sure parent records are inserted before children and that deletions happen in the reverse order. </p>
<p>DataSets/DataTables come in two flavors: typed and untyped. Untyped DataSets simply infer the table and column definitions after executing the SqlDataAdapter.Fill method. Accessing the columns must be done similarly to DataReaders using column names in quotes or by positional reference. Typed Datasets on the other hand use wizards and a design surface to generate a strongly typed object. The typed dataset is defined by an XSD document. The XSD is then turned into a strongly typed/named class that essentially sits on top of an untyped dataset. A table mappings collection on the SqlDataAdapter class allows you to use different names for your strongly typed object than that of your database table and column names.</p>
<p>Many people in the .NET 1.0-2.0 era used typed datasets as business entities and wrapped some additional business logic around them. Although you could map column names, you were typically tied tightly to your table design in the database. DataSets can also be converted to and from XML, including a diffgram format that retains pending change information. In many circles, DataSets have and continue to be serialized between distributed layers of an application. This makes for a pretty productive development environment, but has drawn architectural criticisms compared to properly modeled services with messages and contracts.</p>
<p>In .NET 1.0, DataAdapters and DataSets were different objects that really didn&#8217;t know about each other until you executed the DataAdapter Fill or Update method and passed the DataSet/DataTable to the respective method. It was possible for the table mappings in the SqlDataAdapter to get out of sync with the strongly typed dataset. To improve this situation, Microsoft introduced TableAdapters in .NET 2.0, which are really just DataAdapters that are strongly typed and embedded into the definition of the typed dataset. </p>
<h2><b>Object Relational Mapping</b></h2>
<p>With .NET 3.0/3.5, MS has finally released not one but two ORM toolkits. I say finally because MS previously promised an ORM toolkit to developers in the form of a project called ObjectSpaces. ObjectSpaces was never released and its demise is clouded in a series of potentially bad integrations with WinFS, Project Green, or the MS Business Framework, all of which were eventually cancelled.</p>
<p>The spark that reignited MS ambitions to produce an ORM was the Language Integrated Query (LINQ) project. LINQ&#8217;s goal as part of C# 3.0 and Visual Basic 9.0 was to provide a set based metaphor for dealing with heterogeneous data types including object collections, XML, and last but not least, relational data. For the relational component of LINQ, the language team came up with a project called LINQ to SQL and shipped it as part of .NET Framework 3.5.</p>
<p>During the same time period, the Data Programmability Group in the SQL Server team had been working on a new layer to sit over top of SQL Server&#8217;s logical data model. This new &quot;Entity Data Model&quot; (EDM) would allow developers to interact with their relational database using a more abstract conceptual model based on the ideas of Dr. Peter Chen. For this team, the promise of Language Integrated Query was what really brought the notion of the EDM to life, and so began the &quot;Entity Framework&quot; project. The Entity Framework did not ship until several months after LINQ to SQL as part of the .NET 3.5 Service Pack 1 release.</p>
<p>On the outside, LINQ to SQL and the Entity Framework ORMs appear very similar. Both tools use a graphical design tool and wizard to map a relational database into an object model. They can both use LINQ queries to project relational data into objects using composable queries. Both provide change tracking so that changes made to the objects can be persisted back to the database with a single method call. </p>
<p>Given these similarities, Microsoft has spent some considerable energy in explaining when to use each of these technologies. While these two ORMs have strong similarities in programming models, their internal architectures are quite different. These key differences are:</p>
<ul>
<li style="margin-bottom: 10px">LINQ to SQL has been locked directly to SQL Server, whereas the Entity Framework includes a provider model that allows it to work with any relational engine. As mid 2009 the list of available providers in the ecosystem included SQL Server, Oracle, Sybase, DB2, Informix, MySQL, PostgresSQL, SQLite, OpenLink Virtuoso, and Firebird. </li>
<li style="margin-bottom: 10px">LINQ to SQL does not provide a mechanism for streaming records one at a time. Using Entity SQL, the Entity Framework can provide Data Reader style access to results using the same mapping layer used for object queries. </li>
<li style="margin-bottom: 10px">LINQ to SQL provides an out of the box experience for lazy loading. Lazy loading allows the engine to automatically (by default) go out and retrieve new data as it is needed based on code that access different elements of the object graph. In the Entity Framework, you have to be explicit when you make trips to the database. Both ORMs allow you to load deep object graphs eagerly as well. </li>
<li style="margin-bottom: 10px">Perhaps the largest difference between Entity Framework and LINQ to SQL is the conceptual modeling layer that EF provides. EF provides a much richer mapping layer than LINQ to SQL, allowing you to join tables together, provide elaborate class hierarchies with abstract and concrete types, and retain many-to-many relationships in your model. Future plans will see the conceptual model being used in other MS products such as SQL Server Reporting Services and SQL Server Analysis Services. </li>
<li style="margin-bottom: 10px">Finally, expect to see significant investment in the Entity Framework ORM from Microsoft. Both ORMs are now managed by the same product team at MS and they have stated that while LINQ to SQL will continue to be supported and maintained, future innovation will be focused on the Entity Framework. </li>
</ul>
<h2><b>Other ORM Technologies</b></h2>
<p>You can&#8217;t talk about ORMs in the .NET world without mentioning NHibernate. NHibernate or &quot;NH&quot; is a mature yet free open source framework which is a port of the popular Java ORM Hibernate. Perhaps one of the biggest distinctions of NH is its support for a Domain Driven Design workflow which purports a code-first or test-first approach to building applications. Typical NH developers build their classes first and then use an XML file to map those to a database. Unlike NH, both LINQ to SQL and Entity Framework advocate a model-first approach, and one could argue a database driven approach. Both LINQ to SQL and Entity Framework designers assume you have an existing database that needs mapping to some objects that will be derived out of your model. </p>
<p>Although there are other commercial and open source ORM tools available, NHibernate, LINQ to SQL, and Entity Framework are by far the most popular technologies in use today.</p>
<h2>Enter Data Services</h2>
<p>When it comes to building distributed applications, your mileage will vary with the array of data access technologies. Dealing with serialization and concurrency issues in those environments is beyond the scope of this article. However, it is important to mention what appears to be yet another data access technology available from Microsoft called ADO.NET Data Services, formerly code-named &quot;Astoria&quot;. Astoria was made available with .NET 3.5 SP1.</p>
<p>Astoria is an HTTP service layer built on top of WCF that provides a REST-style API to your data, giving each of your elements of data a unique URI (for example, http://host/northwind.svc/Products(1) ). Out of the box, this service can be enabled for an Entity Framework model or any other IUpdateable/IQueryable data source in just a few lines of code. Data is queryable and updateable via pure HTTP verbs (PUT, POST, DELETE, and GET) using query strings and HTTP payload. Data can be serialized in either AtomPub or JSON format. The net effect is that your data model is widely interoperable with a dizzying array of potential clients and technologies. </p>
<p>Although you are free to build up complex query strings and HTTP payloads for just about any type of operation, the Astoria team has created client libraries to assist in these endeavors. Firstly, an ASP.NET Ajax library is available on CodePlex to allow JavaScript developers to easily work with Astoria Services. Secondly, as part of the core installation, there is a .NET Client Library which provides a natural query model using LINQ and projecting data into client side .NET objects for use by your .NET or Silverlight projects.</p>
<p>A new project, currently named &quot;RIA Services&quot; (code-named &quot;Alexandria&quot;), builds on top of ADO.NET Data Services by also providing rich validation and UI cues on top of your data model in a client/server model. This technology probably won&#8217;t be released until around the .NET 4.0 timeframe, but it is definitely something you should keep your eye on.</p>
<h2>Application Frameworks</h2>
<p>As you can see, the trend in Data Access is to abstract into higher and higher levels within your applications. As data access libraries are generating entity classes, the question around locating data validation logic can become a slippery slope. If a data access generated entity can validate correct data types, maybe it should also validate that postal codes and phone numbers are of the correct format. Should they also cross-validate postal codes with states/provinces? Should these error messages be managed inside of my entities? The waters can be muddied quite quickly.</p>
<p>It is therefore worthy to briefly mention a few of the more popular application frameworks that embrace a holistic view of data access in the scope of an application. </p>
<p>CSLA.NET (Component-based Scalable Logical Architecture) is a framework developed principally by author Rocky Lhotka in conjunction with his popular series of Business Objects books. When first released, CSLA was focused on Visual Basic 6, but over the years it has remained very current on the latest Microsoft technologies and is now principally maintained in C# and ported to VB. In CSLA, data is fully encapsulated by rich business objects that manage all behavior including persistence. CSLA facilitates the re-use of business objects in many possible client technologies including ASP.NET, WPF, WinForms, and Silverlight including distributed architectures using Web Services.</p>
<p>DevForce from IdeaBlade is a commercially available framework for building rich, distributed applications in Silverlight, WPF, WinForms, and ASP.NET. DevForce builds on top of the Entity Framework for its persistence layer and includes a Business Objects server for distributed architectures. DevForce is a popular application framework and has been around since 2001. </p>
<h2>But All I Wanted Was My Data</h2>
<p>If you can believe it, this article has been a <b><u>short</u></b> list of the current and popular data access technologies. I think I could safely say that the one piece of universally accepted guidance is that if the data access technology you are considering is not in the above list, then it is likely out dated or obscure and perhaps you should think twice about using it.</p>
<p>If you are comfortable with open source projects and you are a strong believer in Domain-Driven-Development, NHibernate is an obvious choice. There is a strong community to back you up on this decision.</p>
<p>If you prefer to stick with Microsoft Technologies, and you have a legacy database to start from, or prefer a model-driven or data-driven approach, then the Entity Framework is likely where you should end up. </p>
<p>If you prefer to work with a more structured and complete application framework, both CSLA and DevForce are worthy choices at this level and you will have community and paid-support available to back you up on each of these respectively.</p>
<p>The last key piece of advice to offer is that you don&#8217;t have to pick just one of these. There are pros and cons and you may have to use multiple technologies, even within the same application. If you feel the need for performance, there are no rules against dropping out of your ORM and opting for more direct access. Keep an open mind and use the best tool for the job. </p>
<p>&#8212;&#8211;</p>
<p><em>Barry Gervin is a founding Partner of ObjectSharp in Toronto, Canada. As a Principal Consultant, Barry provides technical leadership to his valued clients, staff, and the development community. Over his 19 year career in the IT industry, he has led many development teams to successfully deliver large software projects within tight schedules and budgets that consistently perform for their customers. Barry currently serves as a </em><a href="http://www.microsoft.com/rd"><em>MS Regional Director</em></a><em> in Southern Ontario and has received the </em><a href="https://mvp.support.microsoft.com/profile/Barry.Gervin"><em>Microsoft MVP Award</em></a><em> for Solutions Architecture for the past 5 years.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://devshaped.com/2009/05/all-i-wanted-was-my-data/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Remaining Valuable to Employers</title>
		<link>http://devshaped.com/2009/04/remaining-valuable-to-employers/</link>
		<comments>http://devshaped.com/2009/04/remaining-valuable-to-employers/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 09:00:00 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[skills]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://devshaped.com/2009/04/remaining-valuable-to-employers/</guid>
		<description><![CDATA[ The current economic turmoil has left many developers with uncertainties about their jobs. A big question on many people&#8217;s minds is &#34;What can I do to make sure I am the most valuable developer to my current or prospective employer?&#34;
Recently we asked 6 technology leaders to provide some advice on what developers should be [...]]]></description>
			<content:encoded><![CDATA[<p> The current economic turmoil has left many developers with uncertainties about their jobs. A big question on many people&#8217;s minds is &quot;What can I do to make sure I am the most valuable developer to my current or prospective employer?&quot;</p>
<p>Recently we asked 6 technology leaders to provide some advice on what developers should be doing to make themselves more valuable at work.</p>
<p>You might find their perspectives surprising:</p>
<p><object width="560" height="322"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=3869641&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=ff9933&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=3869641&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=ff9933&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="560" height="322"></embed></object></p>
<p><em>(There&#8217;s an embed code if you want to share this video with others on your own site.)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://devshaped.com/2009/04/remaining-valuable-to-employers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Beyond VB and C#</title>
		<link>http://devshaped.com/2009/03/beyond-vb-and-c/</link>
		<comments>http://devshaped.com/2009/03/beyond-vb-and-c/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 10:00:00 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Features]]></category>

		<guid isPermaLink="false">http://devshaped.com/?p=41</guid>
		<description><![CDATA[by Ted Neward
 Within the .NET community, a low-grade battle rages between two groups, those who use Visual Basic and those who use C#, and never has the world of Computer Science seen a more virulent and angry battle&#8230; except maybe for those who argue where the curly-braces should go in C++ and C# code. [...]]]></description>
			<content:encoded><![CDATA[<p>by <a href="http://blogs.tedneward.com/">Ted Neward</a></p>
<p><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 22px 22px; display: inline; border-top: 0px; border-right: 0px" title="ted_neward" border="0" alt="ted_neward" align="right" src="http://devshaped.com/wp-content/uploads/2009/02/ted-neward.jpg" width="85" height="57" /> Within the .NET community, a low-grade battle rages between two groups, those who use Visual Basic and those who use C#, and never has the world of Computer Science seen a more virulent and angry battle&#8230; except maybe for those who argue where the curly-braces should go in C++ and C# code. Not that there&#8217;s really anything to argue about, anyway; as any right-thinking C# developer knows, they go on the next line. But that&#8217;s not the point of this article, so we&#8217;ll move on.</p>
<p>(Besides, I&#8217;m right, anyway.)</p>
<p>The problem, of course, is that a viewpoint that limits itself to just those two languages misses out on a much larger world, one which contains a much larger set of tools than just those two languages. And while those two languages, like other object-oriented languages before them, are each genuinely useful languages, the unfortunate fact of each is that they are, at heart, just object-oriented languages. And while that may hardly seem to be a limiting factor, considering how much we&#8217;ve been able to accomplish with those languages to date, much of that viewpoint stems from the fact that most .NET developers have never seen anything else.</p>
<p>You know the old saying: When all you have is a hammer&#8230;.</p>
<p><span id="more-41"></span></p>
<p>Back in 1999 and 2000, during the incubation before Microsoft&#8217;s first .NET PDC, a curious thing took shape. Microsoft invited a number of researchers and academics to participate in a project called &quot;Project 7&quot;: as part of its efforts to ensure that the CLR was not just another proprietary technology, Microsoft wanted to see more than just its own efforts running on this new platform. The CLR was at the heart of it, certainly, but the langauges that developers used would be of far more lasting concern; while Microsoft was reasonably certain that its two lead players (an adaptation of its classic Visual Basic and the brand-new C#) would be a hit, even back then the lead architects on the CLR had a vision that encompassed a larger viewpoint.</p>
<p>Consider, for example, Microsoft&#8217;s most recent entry into the CLR family of languages, F# (a.k.a Visual F#). Like C# and VB, F# has a number of object- oriented features baked into it, but, unlike C# and VB, F# is primarily a functional language. The nomenclature here is deliberate: just as an object- oriented language drives its users to think primarily in terms of objects, a functional language drives its users to think primarily in terms of functions. This means that certain kinds of programming&#8211;such as programming that deals with mathematics or computations, like what might be seen in simulations, financial forecasting, or even game mechanics&#8211;becomes much easier than in a language where functions are almost an afterthought.</p>
<p>At this point, if you&#8217;re like most .NET developers, particularly those who &quot;grew up&quot; on a steady diet of object-oriented languages, trying to see where a functional approach would be non-detrimental, much less beneficial, is probably somewhat hard. After all, &quot;functions&quot; seems to imply &quot;global functions&quot;, and didn&#8217;t the High Priests of Good Design decry global functions almost two decades ago?</p>
<p>Here&#8217;s a <a href="http://blogs.msdn.com/chrsmith/archive/2008/09/04/simple-f-game-using-wpf.aspx" target="_blank">simple example, drawn from a blog post by Chris Smith, of the F# team</a>. In it, Chris creates a simple &quot;artillery game&quot;, in which two tanks positioned randomly on a flat plain take turns taking pot shots at one another; the challenge is in selecting the correct angle, velocity, and &quot;shot mass&quot; to reach the other tank before they get you.</p>
<p>In itself, this is a fairly simple (yet addictive) game, but the important part of the story is in its basic construction: like many (if not most) F# projects, while parts of the code are made for a functional language like F#, such as the mathematics involved in calculating the shot itself given the user&#8217;s inputs, other parts are pretty clearly not functional at all, such as the UI interaction with the Windows Presentation Foundation libraries.</p>
<p>CLR interoperability rides to the rescue. Because the F# language is a CLR-based language, it&#8217;s trivial to put the actual &quot;guts&quot; (the logic) of the artillery calculations into F# functions, then call them from C# code directly, or even indirectly via WPF data-bindings (as Chris does in his code).</p>
<p>Of course, the C# fanatic will quickly point out that C# has a number of features that make functional programming easier&#8211;anonymous methods, lambda expressions, basic delegate support, and so on. In the same vein, C# can be argued to be a dynamic language like Ruby, so long as the C# developer doesn&#8217;t mind programming via the System.Reflection APIs all the time. A vast gulf lies between what a language &quot;can&quot; support, and what a language &quot;natively encourages&quot;.</p>
<p>And herein lies the crux of the situation: every language ever designed, from ancient Lisp to modern C#, was designed with particular ideas and concepts in mind. In other words, like every kind of tool designed throughout history, every programming language has a particular usage model in mind when created, and its feature set is carefully crafted around that usage model.</p>
<p>Consider the aforementioned Lisp, for example. While sporting a syntax that only a mother (or a really dedicated programmer) could love, Lisp maintains a very powerful relationship between code and data: that, at the heart of things, code *is* data, and Lisp programs often manipulate code structures every bit as much as they manipulate user-entered data. This allows Lisp programmers to write layers of abstraction on top of abstractions, eventually creating an entirely new layer on top of the programming language itself. (It&#8217;s no accident that many of the &quot;domain-specific language&quot; advocates look at Lisp as a shining beacon of things to come.) This means, then, that the business domain can be much more closely expressed in the language, rather than trying to mold the domain into a strictly object-oriented model.</p>
<p>Fortunately, these ideas aren&#8217;t lying fallow waiting for developers to come to Lisp to pick them up and play. Thanks to the foresight of those Microsoft lead architects and developers back in the early days of the CLR&#8217;s development, a wide range of languages have appeared on top of the CLR (and even more for the CLR&#8217;s twin brother, the Java Virtual Machine, thanks to its half-decade greater age), many of which explore these ideas in depth. And because they run on top of the CLR, all of these languages can take advantage of the rich ecosystem of .NET libraries and tools, like the .NET Framework Class Library, ASP.NET, WCF, WPF, Workflow, NHibernate, and so on.</p>
<p>For example, consider the language Boo, described as a &quot;wrist-friendly language for the CLR&quot;, derived from the scripting language Python. A dynamic language, Boo ranks alongside IronPython and IronRuby as languages that make certain kinds of tasks far easier to complete because of its essentially scripted nature and lack of need for compile-time type-safety. (In other words, practically speaking, scripting languages make it easier to create higher-level code.) For that reason alone, Boo (and IronPython and IronRuby) merit investigation.</p>
<p>But Boo also provides the ability to &quot;plug in&quot; to the compiler itself, essentially offering developers the chance to extend the language in the same way that Lisp does: by having a look at the structure of the program after it has been parsed, in what compiler wonks refer to as the &quot;abstract syntax tree&quot;, or &quot;AST&quot;, but before it has been turned into IL. This gives the Boo programmer an opportunity to edit, validate and modify that AST in various ways, providing a clear &quot;meta-programming&quot; capability to the language that C# and VB both lack. In Boo, this is known as a syntactic macro.</p>
<p>For example, a simple macro that comes with the language is the ability to conditionally process certain snippets of code, depending on whether a particular string is provided during the compilation phase. In other words, this is Boo&#8217;s equivalent to the #if preprocessor directive from C/C++ or C#. (When Boo is interpreting the code in a more scripting-like fashion, the flag is assumed to be passed in to the Boo engine&#8217;s command-line.) Its usage looks pretty simple:</p>
<div style="font-family: courier new; font-size: 9pt">ifdef <span style="color: maroon">&quot;BOO&quot;</span><span style="color: blue">:</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; print <span style="color: maroon">&quot;woohoo BOO is defined&quot;</span>     </p>
<p>print <span style="color: maroon">&quot;okthxbye&quot;</span>     </div>
<p>and the definition of the &quot;ifdef&quot; macro is remarkably simple as well, considering that we&#8217;re hooking into the compilation process itself:</p>
<div style="font-family: courier new; font-size: 9pt">import System    <br />import Boo<span style="color: blue">.</span>Lang<span style="color: blue">.</span>Compiler     <br />import Boo<span style="color: blue">.</span>Lang<span style="color: blue">.</span>Compiler<span style="color: blue">.</span>Ast     </p>
<p>macro ifdef<span style="color: blue">:</span>     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">if</span> not ifdef<span style="color: blue">.</span>Arguments<span style="color: blue">[</span><span style="color: maroon">0</span><span style="color: blue">]</span> isa StringLiteralExpression<span style="color: blue">:</span>     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; raise ArgumentException<span style="color: blue">(</span><span style="color: maroon">&quot;ifdef argument must be a string literal.&quot;</span><span style="color: blue">)</span>     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">if</span> Context<span style="color: blue">.</span>Parameters<span style="color: blue">.</span>Defines<span style="color: blue">.</span>ContainsKey<span style="color: blue">(</span><span style="color: blue">(</span>ifdef<span style="color: blue">.</span>Arguments<span style="color: blue">[</span><span style="color: maroon">0</span><span style="color: blue">]</span>&#160;<span style="color: blue">as</span> StringLiteralExpression<span style="color: blue">)</span><span style="color: blue">.</span>Value<span style="color: blue">)</span><span style="color: blue">:</span>     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return <span style="color: blue">[|</span>     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $<span style="color: blue">(</span>ifdef<span style="color: blue">.</span>Block<span style="color: blue">)</span>     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">|]</span>     </div>
<p><code></code></p>
<p><code></code></p>
<p>Similar macros come predefined with the language, such as the &quot;using&quot; macro, which serves the same basic purpose as the &quot;using&quot; keyword does in C#:</p>
<div style="font-family: courier new; font-size: 9pt">import System&#160; <br />import Boo<span style="color: blue">.</span>Lang<span style="color: blue">.</span>Compiler&#160; <br />import Boo<span style="color: blue">.</span>Lang<span style="color: blue">.</span>Compiler<span style="color: blue">.</span>Ast&#160; <br />&#160;&#160;&#160;&#160;&#160; <br />macro using<span style="color: blue">:</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; expansion = using<span style="color: blue">.</span>Body&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">for</span> expression <span style="color: blue">as</span> Expression <span style="color: blue">in</span> reversed<span style="color: blue">(</span>using<span style="color: blue">.</span>Arguments<span style="color: blue">)</span><span style="color: blue">:</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; temp = ReferenceExpression<span style="color: blue">(</span><span style="color: maroon">&quot;__using${_context.AllocIndex()}__&quot;</span><span style="color: blue">)</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; assignment = <span style="color: blue">[|</span> $temp = $expression <span style="color: blue">as</span> System<span style="color: blue">.</span>IDisposable <span style="color: blue">|]</span><span style="color: blue">.</span>withLexicalInfoFrom<span style="color: blue">(</span>expression<span style="color: blue">)</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; expansion = <span style="color: blue">[|</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $assignment&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">try</span><span style="color: blue">:</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $expansion&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ensure<span style="color: blue">:</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">if</span> $temp is not <span style="color: blue">null</span><span style="color: blue">:</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $temp<span style="color: blue">.</span>Dispose<span style="color: blue">(</span><span style="color: blue">)</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $temp = <span style="color: blue">null</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color: blue">|]</span>&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; return expansion&#160; </div>
<p>This ability to extend the core language is a powerful feature, and one that shouldn&#8217;t be taken lightly &#8212; consider the pain and suffering that Visual Basic developers went through, waiting for the team at Microsoft to introduce the &quot;using&quot; keyword into their language. Had Visual Basic supported a syntactic macro system like Boo&#8217;s, developers could have added it themselves, alongside any other interesting and useful macros they&#8217;d cooked up along the way. Or, if you don&#8217;t particularly like the exact semantics of the &quot;using&quot; keyword&#8211;I personally have always wanted a diagnostic logging statement in the &quot;finally&quot; block generated by the compiler&#8211;then in a macro-based approach, the semantics can change without having to go back to Microsoft to ask for a patch.</p>
<p>The point of all this, in case you were concerned, is not that you need to give up your existing fondness for an object-oriented language; Lord knows, I&#8217;m not going to any time soon, either. C# and Visual Basic are both languages that serve a useful purpose, and nobody should be telling you to give up something that serves a useful purpose. (Though you&#8217;ll never get me to admit it, Perl probably does, too, but let&#8217;s keep that a secret between us, OK?) In fact, the point is precisely the opposite: to make use of *all* the tools available to you&#8211;F#, Boo, Nemerle, C# and/or VB, as the problem dictates.</p>
<p>After all, who wants to own just a hammer? Sounds boring, to me.</p>
<p>&#8212;</p>
<p><em>Ted Neward is a Principal Consultant with ThoughtWorks, an international consultancy developing agile solutions. He is fluent in Java, C#, Scala, F#, C++, and a few other languages, and spends a lot of time studying programming languages, virtual execution engines, and scalable enterprise systems. He currently resides in the Pacific Northwest.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://devshaped.com/2009/03/beyond-vb-and-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with Brownfield Code</title>
		<link>http://devshaped.com/2009/01/working-with-brownfield-code/</link>
		<comments>http://devshaped.com/2009/01/working-with-brownfield-code/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 06:03:43 +0000</pubDate>
		<dc:creator>Derek</dc:creator>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[belcham]]></category>
		<category><![CDATA[brownfield]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://devshaped.com/2009/01/working-with-brownfield-code/</guid>
		<description><![CDATA[By Donald Belcham
During our careers as developers we sit in training courses, conference sessions and vendor demos in which we hear about how easy and great technology XYZ is for creating applications. And almost every one of them assumes that we&#8217;re working on new development. I&#8217;m not sure about you, but I find that new [...]]]></description>
			<content:encoded><![CDATA[<p>By <a href="http://www.igloocoder.com" target="_blank">Donald Belcham</a></p>
<p><a href="http://devshaped.com/wp-content/uploads/2009/01/donald-belcham.jpg"><img title="Donald_Belcham" style="border-right: 0px; border-top: 0px; display: inline; margin: 0px 0px 22px 22px; border-left: 0px; border-bottom: 0px" height="57" alt="Donald_Belcham" src="http://devshaped.com/wp-content/uploads/2009/01/donald-belcham-thumb.jpg" width="85" align="right" border="0" /></a>During our careers as developers we sit in training courses, conference sessions and vendor demos in which we hear about how easy and great technology XYZ is for creating applications. And almost every one of them assumes that we&#8217;re working on new development. I&#8217;m not sure about you, but I find that new (or greenfield) application development has been fairly rare in my career.</p>
<p>More often than not, we developers are working in companies that already have a suite of custom software. If you&#8217;re brought in to work on a specific project, it&#8217;s rare that the project hasn&#8217;t had something already started on it. As a result, most developers spend a large part of their careers working with or on someone else&#8217;s code. I don&#8217;t think this is a bad thing. Instead I think that it is something that we should embrace with good practices, strong tooling and a strong desire to succeed. </p>
<p> <span id="more-5"></span>If these projects aren&#8217;t classified as greenfield, how should we refer to them? One of the most common terms in application development is &#8216;legacy&#8217;. In his highly regarded book &quot;Working Effectively with Legacy Code&quot;, Michael Feathers defines legacy code as:
</p>
<p style="font-style: italic">&quot;&#8230;code from the past maintained because it works&quot;</p>
<p>I completely agree with this definition, but it does leave us with a gap. Partially completed applications fall squarely in between legacy (maintained and working) and greenfield (not inhibited by past technical decisions or debt). They have incurred some amount of technical debt and are probably constrained by some design or architectural decisions. They also are only partially completed so we&#8217;re not working with the code base solely to maintain an already functioning application. Heck, none of the application may function at all yet. It&#8217;s these applications that we developers often find ourselves working on.</p>
<h2>What is Brownfield?</h2>
<p>Brownfield is an increasingly common term being used to define application code bases that are neither greenfield nor legacy. My definition of brownfield is:</p>
<p style="font-style: italic">&quot; a project, or codebase, that was previously created and may be contaminated by poor practices, structure, and design but has the potential to be revived through comprehensive and directed refactoring&quot;.</p>
<p>Brownfield applications exist all over the world, at all companies and in most project teams. Unfortunately they&#8217;re the norm, not the exception in our industry. The developer across the world, sitting next to you, and even you and I are all creating brownfield applications on a daily basis.</p>
<p>The fact is that as soon as we write a line of code, we have accepted that we are going to maintain it in that form. No matter how well you write code, you are, at the point of finishing that line of code, incurring some level of technical debt and some level of technical constraint going forward. Every single line of code you write is adding to or otherwise modifying the level at which those debts exist.</p>
<p>These statements shouldn&#8217;t scare you. With today&#8217;s tools (Visual Studio, Resharper, CodeRush and others) modifying code after it has been created is easier than ever. Refactoring code to lessen the debt or constraints that it places on the project and team is something that is actively encouraged in development circles. There are some things that are important to ensuring that you can do this efficiently and effectively.</p>
<h2>Confidence</h2>
<p>The largest factor that you need to take into account when working with brownfield code is the confidence level that you, your testers and your client will have with the act of modifying code, without breaking functionality. Nothing scares testers and clients more than the prospect of failing regression tests and bugs introduced to already functional code. It&#8217;s not just frustrating for them; it&#8217;s also very demoralizing for a development team. As soon as defects are being introduced from what should be innocuous code refactorings, the development team starts to lose confidence in their abilities to manage the code, their abilities to work with the code in its current state, and the their ability to deliver a product to the client. Those things are a well baked recipe for disaster.</p>
<p>I have seen this on projects which I&#8217;ve joined part way through their completion. In one case I was working with a team where the developers and the business analysts would physically break into cold sweats when there was mention of having to alter one component within the application. They did anything that they could to avoid having to fix bugs or rework that code. That was a team that had completely lost its confidence.</p>
<p>There are some tools that you can use to build or maintain a team&#8217;s confidence. One of them is automated testing. Even if your team is currently confident about its ability to refactor code, creating a suite of unit and/or integration tests will prove to them that their confidence isn&#8217;t misplaced. When a team is lacking confidence, adding tests prior to making changes and ensuring that they&#8217;re still passing after the changes have been effected will work to rebuild that confidence.</p>
<p>I know that some of you will now be saying that you don&#8217;t have the time, resources or budget to build a comprehensive test suite for your brownfield application. You&#8217;re probably right. Creating tests after the code has been completed is a laborious task, more so if your project has a significant amount of code. Instead of worrying about comprehensive application-wide test suites, let&#8217;s think about them in a more localized and granular fashion.</p>
<p>If you&#8217;re looking to rework a small portion of an application to increase its maintainability, work first at creating a good test suite for that small portion of the application. This approach of creating confidence-building tests only for the portions of the application that are going to be changed will allow you to minimize the effort required for creating tests while maximizing the confidence the team has in changes it makes. This approach will possibly never see your application have a comprehensive test suite, but any changes that you have made will be covered by tests.</p>
<p>The advice for creating tests prior to refactoring code also stands true when the team is faced with modifying code to fix defects or to add new functionality. In the case of fixing defects, first creating a test that exposes the bug (and fails as a result of that bug) allows you to have full confidence that you&#8217;ve fixed it. Likewise creating tests that confirm new functionality prior to creating the code to implement those capabilities within the application will give you a strong understanding of when you&#8217;ve completed the required task.</p>
<h2>All Shall Build</h2>
<p>Confidence in implementing, fixing and refactoring code is only one part of the brownfield project experience. Confidence on projects comes in many forms. For instance, do you have full confidence that anyone on your project team could correctly compile and deploy your application to any of your testing, staging or production environments? My experience is that there is usually one person on the team who can perform this task and it usually involves a combination of black magic, voodoo and chicken sacrifices.</p>
<p>Why not work towards a scenario where any one of the developers on the team can, and does, regularly create a release package? Traditional methods of compiling applications in the .NET sphere have been limited to &quot;Rebuild All&quot; within the Visual Studio IDE. While there can be some automation included through the use of pre- and post-build events, &quot;Rebuild All&quot; is a largely manual process when you include tasks such as test execution and release package construction. While this can work, it doesn&#8217;t necessarily offer the consistency, or flexibility, of using a build script. There are many build scripting tools and languages available to .NET developers. Each offers the same fundamental features, but each also offers a twist.</p>
<p>If you create a compilation, testing and release script that is available to every developer on the team, it becomes one of your projects mechanisms for creating confidence in release management. If the script is available to all developers at all times, they should be encouraged, through simple tooling and fast execution, to run it as many times per day as possible. Every time that you run a script like this you are testing a technically complex portion of your release management process. If that process is being executed tens of times per day, the confidence level of the team and its management and clients should soar.</p>
<h2>Social Considerations</h2>
<p>We could continue this article with a long and detailed discussion on the merits of using fundamental OO code practices to ensure that your code is flexible, decoupled and robust. Instead I&#8217;d like to finish with a brief discussion on the social aspect of working with brownfield applications.</p>
<p>Joining an already started project can present interesting issues both in personal and team dynamics. We all join a new project or job thinking that we can bring greatness to the team or job. As a result we often head into these new engagements bringing suggestions about changes to techniques, tools or practices that we&#8217;ve had success with in the past. Unfortunately this usually happens without us taking the time to properly and completely assess the current situation. This lack of understanding around past decisions and current situations, combined with the vocal desire to try to improve things, often leads new team members to be seen in a negative light.</p>
<p>When joining a team we also have to be aware that the currently serving team members probably have an emotional attachment to the current code base. While many developers believe that they are able to openly take constructive criticism of their past or present endeavours, often they can&#8217;t. When suggesting changes to a code base, new team members need to be cognizant of the potential negative impact that they may be inflicting on the team&#8217;s morale. While this is a delicate situation to have to step around while working to improve code, it is one that is vitally important if the team, as a whole, is going to improve productivity, maintainability and quality going forward. Getting team members to believe in the reasons behind the changes that you&#8217;re proposing instead of the changes themselves can be an effective technique.</p>
<p>Many projects that we developers encounter should be categorized as brownfield. While each of these projects encounters its own set of unique issues, there are some underlying problems that are seen on many. Projects might suffer from a lack of confidence in code, releases and quality. They can also have severe maintainability issues caused by poor coding practices. Those technical issues can be some of the easiest to solve, but each technical problem can expose a series of potentially debilitating social and team cohesion issues.</p>
<p>Don&#8217;t let any of these issues scare you though. You&#8217;re probably already working on a brownfield project and having to deal with many of them. Remember that much of what we do in this industry is deal in areas of confidence between developers and management, developers and clients, and developers amongst themselves.</p>
<p>&#8212;</p>
<p><em>Donald Belcham is an independent contractor in Edmonton, Alberta, Canada who specializes in software development with the .NET platform.&#160; With more than 7 years experience delivering Web and Smart Client applications to government and Fortune 100 clients in North America and the South Pacific, he has experience and knowledge in the entire software development life cycle.&#160; Combining that experience with his passion for agile development practices and solid OO fundamentals, Donald works to provide the client with software that works for their business.</em></p>
<p><em>Recognized by Microsoft for his technical skill and community contribution with the Microsoft MVP award in C#, Donald is a notable leader in the developer community.&#160; In addition to being a founding member, and current President, of the Edmonton .NET User Group, Donald regularly speaks for .NET User Groups and Code Camps across North America on topics ranging from development practices to the intricacies of different technologies.</em></p>
<p><em>His thoughts on software development can be found on his blog at <a href="http://www.igloocoder.com" target="_blank">www.igloocoder.com</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://devshaped.com/2009/01/working-with-brownfield-code/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
