Friday, August 29, 2008

I have failed you .NET

Recently I have asked to help the IT council at the Bank I work at, identify a technology to help them build small applications quickly. But still allow these applications to be built on a technology that allows for the following criteria:

  1. Has a data store (could be flat file, cloud, DB etc)
  2. Data Access
  3. Single Sign On security
  4. Audit compliance
  5. Logging
  6. Ability to interface to other applications
  7. UI data entry – Forms basic screen workflow that possibly could be configured
  8. Personalization
  9. Widget/Gadget ability (think WebParts or Google gadgets)

Each of these things would then be measured on :

  1. Solve something elegantly
  2. Ease of Development + Pace of development
  3. Ease of support
  4. Robust – Can be made production capable
  5. Ease of which to get development resources
  6. Future proof considerations
  7. Economy/Cost. i.e. A really expensive solution will lose points.

So with my little Microsoft hat on I thought I would throw together a little demo on how .NET does all this with SQL Server (Express if need be). All of that stuff is so damn easy with ASP.NET even though I haven’t touched it in nearly 2 years. They liked my concepts and asked me to present 3 weeks later a little demo. No problems.

So with the distractions of the Olympics, my 1st weekend out of town in 6 months, investing in a new business venture, doing my yearly tax, applying for a UK visa, buying a new house and preparing to move out of my current house; I thought I would be able to knock up a web site to show case how .NET can do all the above. Ok so I was a bit ambitious, however I did produce web site with some functionality. The limited functionality however did everything requested short of Auditing (which I am sure the IT council thinks is the same as Logging). I did present some Auditing options as static screen shots.

It was actually a very reassuring process. I reassured myself that yes I can create a system that can get good test code coverage, with setup/tear down database and was FxCop compliant. That makes me feel all fuzzy. Next thing I was reassured that yes, .NET is a great platform as is so nice to use VS2008 to just get things to work.

What I delivered was :

  1. Single-sign-on via Windows security in ASP.NET (wow! One line of config)
  2. AzMan Authentication. I knocked up an application policy in AzMan manager and used the AzManRoleProvider to enforce it against my site map. I also have an IAuthorize interface which my implementation passed of to AzMan. Seriously, AzMan rocks.
  3. AOP Logging. I’m not a big fan of logging, but as far as logging goes I do like the solution I provided.
  4. Personalization through skins/themes and, well, you guessed it the Personalization framework in ASP.NET. Users could choose their them on the fly and it would be remembered for that user.
  5. Widgets/Gadgets via the WebPart framework. That was great. I never used it before and I had it up and running in minutes.
  6. Sql Express database with build up and tear down scripts of schema and data.
  7. Integration tests for the services to the database.

However I didn’t have time to teach myself WCF and WF in 3 weeks and watch Usain Bolt, Michael Phelps and the Polish women’s volleyball team. So thanks to a recent Readify community event I had seen the Expense report demo application and thought I would use that. So that added Messaging and Workflow to my presentation.

Well I thought it was pretty good what I could showcase given about 30hrs of effort (including power point time). The only problem with .NET and the toys available is, well, it all just works. I only wrote a handful of classes (maybe 20-30 with tests?).

BUT… apparently that wasn’t good enough. Of the other 4 entries, you could imagine if there was LAMP entry or Java entry that was a very compelling argument then sure go with that option. Instead there was SharePoint, Tibco, Jade and a Hosted entry. I know SharePoint is almost the same as ASP.NET but was a slightly different angle to my presentation, but probably coupled with WF or InfoPath could be a nice little application framework. Tibco is more a product offering so requires one more thing to learn, but it also looks like it has some nice stuff. Hosted applications? for a Bank? Surely I have mistaken what they are offering. And finally Jade.

WTF!?! Hands up who knows what Jade is. It is one of those concepts that died like it should have and only really exists as I understand in New Zealand where it is taught at the Uni in Christshurch and has some Major NZ customers which are specks on an international scale. From what I understand it is an OO language and DB rolled into one. From my experience integrating with it for some eCommerce stuff, it performs awfully. And even if I am wrong on all counts, it still fails to meet a bunch of the criteria like:

  • Ease of support – Localized mainly to NZ. Cant really compare it to the massive corporate and community support available for .NET, Java, PHP etc. Even in NZ no one considers it a major player (I know I’m from NZ).
  • Ease of which to get development resources – Where! On Seek.Com.au there were 19 jobs for Jade (11 of which were based in NZ). Compare that to 3200 for .NET and 2500 for Java.
  • Future proof considerations. Jade might not exist in 3 years!
  • Economy/Cost. How much are you going to have to pay for the guys to build and maintain this stuff.
  • Really I must be the worst presenter in the world, or the Jade guy used some black magic. Cause you guessed it, the IT council decided that Jade + Hosted offering were the way to go. Well surly a hosted offereing is going to make single sign on a bit tricky. Nexy, if I really thought Jade was a good language/concept/platform I would have not thrown out the 2 books I had on Jade, or  I may have taken some interest in the awful system I had to integrate to 3 years ago.

    My humble apologies .NET, I have failed you.

    Thursday, August 21, 2008

    Projects – Measuring success and providing boundaries

    Working in the software industry lends itself to a lot of project work. Projects are an interesting beast that seem to be somewhat misunderstood and all too easily fail. Over the past few weeks I have had several discussions regarding all sorts of “projects” and reasons why the forecast is glum on their outcome. These projects are varied as running a sports coaching clinic, change management and of course the software project.

    From my experience with project work, some projects felt good and you always knew they would succeed and others either started shaky or had a honeymoon period that eventually declined into a shaky project. Just to be clear I’m not a PM and this article isn’t so much about how to overcome politics, project buy-in or using Project office. I’m just pointing out some very basic principals that anyone involved in the project should be able to pick up on and should be able to implement on any size project be it professional or getting your son to keep the garden “Clean and Green” (a Stephen Covey analogy).

    First: Set the success criteria. For a project to keep the garden clean, the success criteria might be “Clean and Green”. This is fairly easy to measure. If the grass or plants die or go brown, its not green. If rubbish or leaves start building up then its not clean. Easy.

    If you are on a software project you may have the project success criteria and also some standards to be measured on. For example the development team may require 95% unit test coverage and comments on public types and members [standards]. The project may require an Order approval Use-Case. The measurement of this use case being delivered should be outlined by the business requirements [success criteria].

    Well that seems obvious so what?

    Second: Do not mandate how to implement the project. Step one was to provide a way to measure success, step two is not telling the team how to do it. Provide the boundaries but don’t turn your team in to drones. First it puts too much weight on someone to create all the “How’s”, second it undermines the talent of your team. Generally it is useful to provide an example of some “How’s” and explain why they could be good for meeting the success criteria. We provide an MVP pattern that allows for testing on our WPF client screens. The developer can use that pattern or another pattern if they wish, as long as the “unit test” measurable is met.

    Third: Regular Feedback. A project is fluid. It could have many factors that could change priorities or direction of the project. Like ship at sea, a project needs to be steered. We cant just point the ship in one direction and fix the rudder, we might get blown off course. With constant feedback things that we never would or could have been thought of in advance can be identified. Here are some examples of feedback that have sailed or sunk a project depending on when there were identified:

    • An e-commerce app that works great in one industry (IT Distribution) but failed miserably in another (Bulk Food delivery). The basket scaled to ~30 items. Most usages in the IT industry would place small orders once a day. However restaurants and Hotels tended to restock everything at the start of the week and the 200-300 item basket would blow out to over 1MB in HTML. When the basket tried to refresh on every modification the system became unusable on the target client’s dial up modems.
    • 4 signifcant digits is normally fine for most measurements, unless you are working with GIS data. This was caught early as saved a project from certain failure.
    • Feature creep that came from a “User” that described a “Would have” as a “Must have”. This required an large change in the cost of the project. On further feedback with other users it was identified correctly as out of scope.

    Regular feedback as one method of improving communication sure can help keep the project on track for success. Keeping everyone in contact with each other is also a good way of ensuring people feel like a valued part of the project.

    Fourth : Features, Cost, Time: Pick two. Some projects I have been on a PM hands over some requirements and tells me this must be done by X date. Unless the PM is very experienced, lucky or has some good metrics on build times; this just wont work. One is the function of the other two.

    • pick the features and cost and I can tell you the time it will take
    • pick the features and time and I can tell you the cost
    • pick the time and cost and I can tell you what features can be done

    The fourth point become fairly specific to commercial projects but the first three points can be applied to most “projects”. For me the second point is hard to do. For many it feel natural to control the outcome by controlling the detail. I have to learn to trust my team and let go.

    FxCop 1.36 is out

    I’m a bit of a fan of FxCop. Obviously it is a great static code analysis tool, but it is also great tool for learning. The new version has some bug fixes and support for new language features like anonymous methods and lambda expressions.

    See the release note from the Code analysis and Code Metrics blog.

    Wednesday, August 20, 2008

    .Net user group videos – Perth (Perth DNUG)

    For those that attend the Perth .Net User Group meetings, you may have noticed the video camera recently. I have finally got all of my toys working together to get the files off the camera and on to the web.

    In order of appearance:

    Community Launch topics – July 3rd

    Dave Gardner presenting Web development in Visual Studio 2008: MP4 Video (140MB ~20min)

    Mike Minutillo presenting CSharp 3.0: MP4 Video (154MB ~22min)

    Alistair Waddell LINQ and LINQ-to-SQL Features: MP4 Video (151MB ~22min)

    Mitch Denny presenting Testable Workflows : MP4 Video (109MB ~15min)

    Bill Chestnut Hands On WCF – Jul 10

    Bill Chestnut presenting Hands on WCF : MP4 Video (400MB ~57min)

    Dwayne Read Agile .NET – Aug 7

    Dwayne Read from Strategic Systems presents a discussion on Agile practices in a .Net environment.

    Apologies for the video. The final 10 minutes of the video were cut out. While they were key to the presentation I still thought there was value in releasing the video anyway.

    MP4 Video(388MB ~55min)

    Thursday, August 14, 2008

    Spec# – Contracts in C#

    It looks like the research project Spec# that Microsoft has been working is available to download and play with. Obviously I am behind on the times as this stuff looks like it has been available for some time.

    http://research.microsoft.com/SpecSharp/

    From what I understand from feedback form the ALT.NET event in Seattle and the channel 9 videos (http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Contract-Oriented-Programming-and-Spec/ & http://channel9.msdn.com/forums/Coffeehouse/226756-Using-Spec-in-VS-2005/), Spec# aims to provide us with compile time verification of what constitutes a method or class contract. Just as the shift from VB to .NET meant I had access to a strongly typed world, the shift Spec# looks to offer is further verification on a class or method contract. At a basic level this gives verification on null parameters and some contractual awareness of exceptions.

    I doubt there is any production value in what spec# provides at the moment, but is worth keeping an eye on as the expectation of reliable and durable software keeps increasing.

    Thursday, August 7, 2008

    WPF Styles BasedOn keyless resource

    This post isn't so much to share any new found glory on WPF as it is a note to myself. I can never remember the syntax of basing a WPF style upon the existing default style.

    For example I may want to create a default style for all of my buttons to have a background of "AliceBlue"

    <Style TargetType="Button">
      <Setter value="AliceBlue" property="Background" />
    </Style>

    If I create another style it will not automatically pick up the default styles set above.

    <Style TargetType="Button" x:Key="NewButtonStyle">
      <Setter value="Red" property="Foreground" />
    </Style>

    The fix is to specify the type as the resource key for the BasedOn property.

    <Style TargetType="Button" x:Key="OverrideButtonStyle" BasedOn="{StaticResource {x:Type Button}}">
      <Setter value="Red" property="Foreground" />
    </Style>

    Notice that the middle button wont get the blue background

    <StackPanel>
      <Button>Default</Button>
      <Button Style="{StaticResource NewButtonStyle}">New</Button>
      <Button Style="{StaticResource OverrideButtonStyle}">Override</Button>
    </Stackpanel>

    Nothing new here!