The Correlation between Schedule Pressure & Low Quality
Research suggests that
- 40% of all software errors are caused by pressure on developers to complete quicker (Glass 2004)
- Under extreme schedule pressure, code defects increase by 400% (Jones 2004)
- Projects which aim to have the lowest number of defects also have the shortest schedules (Jones 2000)
This makes sense is you consider that good engineering practises are the first to leave the building under pressure to finish, and most teams will revert to quick & dirty hacks to get things implemented, without complete testing etc.
My personal opinion is that the only way to shorted development cycles is to reduce the feature set. Its pleasing for me to see that the research seems to back this up.
When deciding which features will be dropped; I think its worth revisiting the business requirements that are driving a particular set of features. In many cases a simpler “design” could suffice; for example a fancy calendar widget could be replaced with a simple textbox; a little used settings screen could be retired in favour of manually changing config files; or overly complex but little used workflows could be put on the back burner.
I maintain that a lot of “features” can be dropped, without actually impairing the business functionality of the system.
Just remember, what every you do DON’T consider dropping testing or QA in an effort to meet your deadline; unless you want to guarantee that you will continue to miss all future deadlines until the project gets cancelled!
ASP.NET MVC Beta – Setting properties on ViewControls
In ASP.NET MVC Beta, it isn’t possible to set properties on partials when calling them with Html.RenderPartial.
Rusty Zarse blogged about a useful ViewData helper class, which allows you to set properties by passing values to the partial through the ViewData.
I’ve extended this slightly to enable the following syntax:
1 2 3 4 5 6 7 8 | <% Html.RenderPartial("YUIDataTable", ViewDataDictionaryBuilder.Create( new { DataTableId = "QuoteDataTable", ConfigNamespace = "QuoteDataTableConfig", HideFilter = true }));%> |
Which sets properties on a ViewUserControl like this:
1 2 3 4 5 6 7 8 9 10 11 | public partial class YUIDataTable : ViewUserControl { public string ConfigNamespace { get; set; } public string DataTableId { get; set; } public bool HideFilter { get; set; } protected void Page_Load(object sender, EventArgs e) { ViewDataDictionaryBuilder.SetPropertiesToViewDataValues(this); } } |
Here is the full helper code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | using System; namespace MvcHelpers { /// /// With thanks to http://www.vitaminzproductions.com/technology-blog/index.php/2008/11/12/setting-properties-using-aspnet-mvc/ /// public static class ViewDataDictionaryBuilder { public static System.Web.Mvc.ViewDataDictionary Create(object data, ModelType model) where ModelType : class { return (System.Web.Mvc.ViewDataDictionary)CreateInternal(new System.Web.Mvc.ViewDataDictionary(model), data); } public static System.Web.Mvc.ViewDataDictionary Create(object data, object model) { return CreateInternal(new System.Web.Mvc.ViewDataDictionary(model), data); } public static System.Web.Mvc.ViewDataDictionary Create(object data) { return CreateInternal(new System.Web.Mvc.ViewDataDictionary(), data); } private static System.Web.Mvc.ViewDataDictionary CreateInternal(System.Web.Mvc.ViewDataDictionary dictionary, object data) { AddPropertiesToViewData(dictionary, data); return dictionary; } private static void AddPropertiesToViewData(System.Web.Mvc.ViewDataDictionary dictionary, object data) { if (data == null) return; System.Reflection.PropertyInfo[] properties = data.GetType().GetProperties(); foreach (var property in properties) { dictionary.Add(property.Name, property.GetValue(data, null)); } } public static void SetPropertiesToViewDataValues(System.Web.Mvc.ViewUserControl viewUserControl) { foreach (var property in viewUserControl.GetType().GetProperties()) { if (viewUserControl.ViewData[property.Name] != null) property.SetValue(viewUserControl, Convert.ChangeType(viewUserControl.ViewData[property.Name], property.PropertyType), null); } } } } |
Hope that’s useful to you!
Announcing the TDD TestHelpers opensource project
Whenever I start working on a project; I invariably find myself writing a collection of TDD test helper methods. I quick survey of other TDDers reveals the same; and thus the birth of my latest opensource project, TestHelpers (http://code.google.com/p/testhelpers/).
The aim of the project is to centralise all those little test helper methods you end up creating into a useful assembly you can use to jumpstart your next project. Things like:
- Comparers
- Generic object comparers
- DataSet comparers
- Test Data generators
- Builder pattern
- Automocking containers
For example, I’ve just added an “AssertValues” functor; which helps you check whether the values of who object instances are the same.
One area I keep using asserts like this is in integration tests; where I want to check that the objects I’m persisting to the database via my ORM actually end up in the database in a non-mangled form. In this case, I new up entityA, persist it, reload it into entityB and then need to check that all the values in entityB are the same as those in entityA.
A standard Assert.AreEqual will fail, because entityA and entityB are different instances. But, my helper method AssertValues.AreEqual will pass, because it checks the (serialized) string values of entityA and entityB.
Here is another, simpler example to illustrate the concept.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | [TestFixture] public class StandardObjectsTests { public class StringContainer { public string String1 { get; set; } public string String2 { get; set; } } [Test] public void ObjectsWithSameValue_ShouldBeEqual() { var stringContainer1 = new StringContainer {String1 = "Test String1", String2 = "Test String 2"}; var stringContainer2 = new StringContainer {String1 = "Test String1", String2 = "Test String 2"}; Assert.AreNotEqual(stringContainer1, stringContainer2); AssertValues.AreEqual(stringContainer1, stringContainer2); } } |
I’m sure you have a bunch of similar helper methods lying about your projects.
How about contributing them to the TestHelper project?
DDD7 – Nov 21, Microsoft campus, Reading UK
Wow. DDD, the community conference for UK MS developers, hosted by Microsoft, but completly driven by the community continues to go from strength to strength. This year, the 400 places were filled within 4 hours of this annoucement that registration was open via twitter.
I really enjoyed Mike Hadlow’s talk on IOC injection; with specific reference to his opensource eCommerce application, SutekiShop. Clearly an expert on the subject on ASP.NET MVC, Onion architecture, Repositories & Services, and binding it all together with IOC; he is also a gifted presenter. If you’re looking for a reference implementation of an ASP.NET MVC application (or indeed just a loosely coupled, TDD driven web application); I’d strongly advise you to check out Mike’s SVN repo.
Toby Henderson gave an interesting demo of how you can run .NET apps under Linux (Ubuntu) using Mono. Worth bearing in mind when considering your hosting & deployment options.
Sebastien Lambla gave a highly entertaining (if opinionated) presentation of a series of WFP tips and tricks. My favourite tip (which isn’t really WPF related)
Tired of always checking if your event delegates are null before calling them? Just declare them with a standard empty delegate. Then they are never null!
1 | event MyEvent = delegate {}; |
Recommended book: WPF Unleashed by Adam Nathan
As always it was a great event – remember, if you want to be at DDD8 (2009); sign up early!
See www.developerday.co.uk for slides & videos from all sessions


