Brownfield Application Development (Part 1) - Managing Motivation and Energy

[This is the first in a meandering and irregularly published series on brownfield / legacy application development.]

TL;DR: measure stuff that makes you happy when it gets better.

Working on a brownfield application can be frustrating, demotivating, difficult, energy-sapping and soul-crushing; or to put it in other words: "let's just re-write it".

Sometimes a re-write might be the best choice, and sometimes the people with the cash might let you do it - but more often than not we inherit an application and have no choice but to work on it.

Once you come to terms with the fact that you can't do a re-write you have to either start looking sources of happiness and motivation or give up and not care.

One way too look at a bad (tightly coupled, no tests, un-unit-testable etc.) brownfield application is that it offers a goldmine of potential for improvements.

One of the biggest motivators is a sense of progress. In brownfield development you need to find something to give you a sense of that progress. In Agile we see user stories moving across the wall and getting to the 'done' column, this is one sense of progress, but sometimes this may not be enough if you know that you're actually leaving the codebase in a worse state than when you found it.

For me, one great motivator is knowing that overall the codebase is getting better, it gives me a sense of personal achievement and I know that we are a small step closer to be able to respond more quickly to changing business requirements in the future.

We have tools to measure different aspects of code quality; the key thing is to find some metrics that make you happy when you see the lines going up on the graph. The 2 simplest ones to start using are number of tests and code coverage: while these only give a partial view of code quality when you see the figures getting better week-in, week out, it can start to engender a sense of pride in the code-base. This new-found sense of pride can lead to less of a tolerance for Broken Windows.

Once you start to feel this sense of pride and potential it can become a powerful motivational force: "how awesome will it be when we get 50% code coverage!", "wow I can't believe we had zero tests to start with now we have 500!", etc.

Once you get that initial 'buzz' going you can start to add a few more metrics such as lines of duplicated code, cyclomatic complexity, etc. I'm not sure if it is a good idea to throw all these things onto the graph at the start of the project as it may seem overwhelming: "what's the point, look how bad it is, we'll never be able to make it better".

One of the things to be careful of with this approach is that developers should not see the graph as the end goal, but rather a helpful friend that whispers in their ear "you doing a pretty good job dude, keep it up". It's also important not to concentrate too heavily on the actual numbers: "why has our coverage only gone up by 1% this week", the important thing is the line is going up - it's about the trend over time, not the individual measurements.

It's probably not a good idea to link KPI, bonus amounts, yearly reviews to these figures either - as pretty soon you'll end up with 110% code coverage ;)

One last point: brownfield development can be really hard, but it can also offer a great opportunity for growth and learning new techniques for dealing with the problems inherent in brownfield app development.


FeatureToggle Now On NuGet

FeatureToggle is now available via NuGet

Just search in NuGet Package Manager for FeatureToggle or in Package Manager Console:

PM> Install-Package FeatureToggle

PM> Install-Package FeatureToggle.WPFExtensions

The NuGet packages are the easiest way to get started, they will create an example feature toggle and app/web.config entries to help you get started.

Project home page:


Februaries Windows 7 Phone Roundup

"The Windows Phone SDK 7.1.1 Update – CTP provides a new 256 MB device emulator image and an updated 512 MB emulator, and it provides the ability to deploy, run, debug and profile your Windows Phone applications and games in the 512 MB emulator or the 256 MB emulator. "

“A Case Study for Building Advanced Windows Phone Applications: Connecting with Cloud Services"

"The Windows Phone DataContext feature allows you generate a DataContext for use in Windows Phone projects, based on an existing database, saving you a large coding effort."

"Microsoft is pleased to announce the beta release of the Amazon Web Services (AWS) SDK for Windows Phone. Built by Microsoft as an open source project, this SDK provides developers quickly connect and integrate Windows Phone applications with AWS (S3, SimpleDB, and SQS Cloud Services)"

"Choosing between Panoramas, Pivots and/or Pages"

Amazing list of a gazillion WP7 resources : "The Big Dummies Guide for Windows Phone Developer Resources"

Northern Lights WP7 Toolkit - collection of tools such as : "NagForReview will ask, after a fix set of days and/or application starts, the user to review your app", "The checking of the application version against a txt file on a remote server enables you to inform the user, on startup of the app, that a newer version of your application is available", "The LittleWatson class let's you catch unhandled exception and automatically report them back to you through a webservice or let the user e-mail to you the next time the user opens up the application"

"Winning on the Marketplace: The differentiation game"

"With App Connect, your application can be launched from the Pictures Hub, enabling a convenient launch experience for picture-related applications. This topic describes how to create an application that can be launched from the Pictures Hub."

"Get Your Windows Phone Applications in the Marketplace Faster"

"Performance Considerations in Applications for Windows Phone"

"Performance Techniques for Windows Phone"

Windows Phone Background Agents Pitfalls

"Analyzing and Improving Windows Phone Application Performance"

Task based asynchronous programming CTP

Detailed discussion on memory costs in WP7 "WP7: CLR Managed Object overhead"

"7 Deadly Sins for … Windows Phone Developer"

MetroGridHelper - "fix those margins, align, and try and make your apps as beautiful and inspiring as you can"

A version of MetroGridHelper that works at design time in Visual Studio/Blend

"Silverlight Validation WP7"

Really awesome, clear and concise guidelines for using Windows Phone 7 App Bar

Adding a Privacy Policy to your app

"Designing Windows Phone Icons"

Great tutorial on creating icons in Expression Design


Record and playback sound

Dragging UI items

"An overview of fast application switching and page state in Windows Phone"

Introducing MoqaLate, (probably) The World's Only Mocking Framework for Windows Phone 7 (WP7)

"This sample is the bare bones “how to use accelerometer”"

Great guide from Telerik on how to market your app, contains advice and some great links.


Introducing (probably) The World's Only Mocking Framework for Windows Phone 7 (WP7)

Introducing MoqaLate

Whilst I love developing apps for Windows Phone 7, the testing aspect is hard! I'm a TDD-er by default and it's such a pain to have to hand roll my own mock objects. 

So I created MoqaLate.

It's an alpha version but is usable now.

Not sure framework is the right term but it's something that generates mocks from your interfaces.

Add to existing project from NuGet:

PM> Install-Package MoqaLate

Read more about the project.

Download an example solution.

Read (currently very basic!) documentation.

View on

Awesome overview diagram :)



January Monthly Windows Phone 7 Roundup

This is the first of a series of monthly posts highlighting some useful and cool Windows Phone 7 stuff.

There will be a post on or about the last day of each month, with an overall "post of the month"

PhoneGap now fully supports Windows Phone

Delete from a List animation

Caliburn.Micro v1.3 RTW With Mango Support

Mango Sample: a Secondary Tile in 5 Minutes

Speed up HTTP-heavy apps by using GZip

Change to Light/Dark theme in app code

A Lap Around Windows Phone 7.5 webcast

Changing the keyboard and IsNumeric

Post of the Month

From Concept to Code in 6 hours: Shipping my first Windows Phone App


Pushing To AppHarbor Using Mercural via Bitbucket

Rather than pushing Git to AppHarbor, you can create a (free) Mercurial repo on Bitbucket, grant read permissions to an AppHarbor user, set up a Bitbucket push to an AppHarbor build URL, then when you push to Bitbucket, AppHarbor will automatically pull your changes, build your app, run unit tests and auto deploy. Phew, long sentence :)


Baby Steps - Getting Started With Windows Phone 7 Development

These links are recommended reading to get started understanding developing for the Windows Phone 7 platform.

Recommended to be read in the order presented here, from most lightweight to most heavyweight.

The Metro design language overview - good for initial intro on what the platform stands for and the 'feel'.

Cool A3 Cheat Sheet showing loads of examples of usage of WP7 controls

Awesome Free eBook for Developers covering some important areas, plus some awesome inspirational examples of apps people have created.

UI Design and Interaction Guide for Windows Phone - 190+ pages - contains loads of detail

Happy reading :)