Sunday 1 August 2010

My Technology Stack

A bunch of people have been posting answers to David Burela’s ‘What is your preferred technology stack?’ question and I thought I’d join in. At work we’re just finishing up on a smallish project that uses this stack:

  • ASP.NET MVC 2.0
    If you’re developing web applications on Microsoft’s stack, the Web Forms vs MVC decision will have the most significant effect on your day to day development experience. I find Web Forms to be a harmful, leaky abstraction and cannot get enough of MVC’s simplicity, especially when it comes to AJAX development.
  • MVC Contrib
    Fills in some of ASP.NET MVC’s gaps.
  • jQuery
    Just don’t do JavaScript without it.
  • jQuery.UI, jQuery.Validate, jQuery.Form, jqGrid
    I use a few other jQuery plugins but these are the most useful ones.
  • NHibernate + Fluent NHibernate + NHibernate.Validator
    This should hardly come as a surprise, given that I’m a member of the Fluent NHibernate team. We’re using a trunk build of NHibernate 3.0 which includes the work on the new LINQ provider. In terms of Fluent NHibernate usage, we go the automapping route as our domain models are pretty straightforward. We sacrifice domain “purity” and use NHibernate.Validator’s attributes because they are just so damn convenient. I’d be quite comfortable with making a move to the fluent interface though.
  • Castle Windsor
    When it comes to IoC containers, I don’t have particularly strong feelings. I’ve used Structure Map a bit and I prefer it to Windsor but its easy to go with Windsor because Sharp Architecture includes it. My next home project that needs a container will use AutoFac as I’ve been meaning to try it.
  • Sharp Architecture
    Glue for ASP.NET MVC, Fluent NHibernate, Castle.Windsor and other projects. Sharp Architecture gives you a bunch of handy stuff and from a rapid development perspective its quite nice to drop in. But I’m not entirely comfortable with some of the assumptions it makes. For larger projects, I’ll reuse a bunch of the code from Sharp Architecture, rather than referencing it as a binary.
  • xVal
    Acts as a bridge between NHibernate.Validator and jQuery.Validate. This way we stick [NotEmpty] style attributes on our domain model and we get client side validation for free. I’m aware that ASP.NET MVC 2.0 includes some xVal style functionality but I wasn’t able to figure out if there was a better option so I just stuck with xVal since it worked so nice on my last MVC (1.0) project.
  • Elmah
    Drop it into your solution in 10 minutes and then forget about exception logging.
  • NUnit
    I’d like to try some other unit testing frameworks but its hard to find the time. NUnit works well enough for now.
  • Microsoft Team Foundation Server
    Ugh. We use it for source control, builds, and work tracking – and its my fault! (a mistake from many years ago, sigh). I wish we were using git.

The only problem with a stack like this is that when you decide to use a newer NHibernate build, you’ve got a whole bunch of projects to recompile. I’m still waiting for some clever folks to sort this problem out :)

Friday 12 March 2010

Talking Shop

Last week I was featured on the Talking Shop Down Under podcast. Fellow aussie Richard Banks was kind enough to extend me an invitation a few weeks back to join him on his show but I told him there were “… many more interesting aussies to interview before we get to me” and suggested he start with Joe Albahari (LINQPad rocks!!). Boy I knew I was in trouble when the very next podcast rolled through featuring Joe – Richard sure doesn’t waste any time!

In the podcast we discuss Fluent NHibernate, git, and my reasons for doing open source. For those of you that were hoping for some more Reactive Extensions content, I’m afraid I’ve been neglecting Rx lately so I didn’t feel qualified to talk much about it. Maybe next time?

Thanks to Richard for having me on the show, it was lots of fun. If you do have a listen, please feel free to leave a comment – this was my first podcast and I haven’t done a great deal of public speaking so I could benefit from some constructive criticism. Cheers!

Sunday 7 February 2010

Advanced Distributed Systems Design with Udi Dahan

I spent last week in Melbourne for a 5 day training course on distributed systems, run by Udi Dahan. I’ve been a fan of Udi’s work for a while now, so when I discovered that he was on his way to Australia I jumped at the chance to be immersed in his approach to designing scalable and reliable distributed systems. Let me tell you – I was not disappointed. I found Udi’s course to be very challenging – not in terms of difficulty, but rather that it was full of ideas that challenged my preconceptions. I was also very impressed with Udi’s presentation and communication skills. He really knows the material and has an amazing ability to give helpful, informative answers to really dumb questions :)

The course was focused on a few key ideas:

  • Service oriented architecture
  • Message based systems
  • Command / query responsibility segregation
  • Domain models

If you’d like a more detailed breakdown of the course content, Udi has provided an overview on his website.

I’ve tried to understand SOA before and struggled with the abstractness of the concept. I guess part of my difficulty has always come from the fact that I still approach the world with a “developer” mindset – I’ve never really bought into the concept of a non-coding architect and sometimes I struggle to understand the meaning and implications of an idea if I can’t see the actual effect on the code we write.

Thanks to Udi, I now have a basic understanding of what SOA means. I am comfortable with the idea of identifying business capabilities and describing them as services that consist of business components, which in turn consist of autonomous components that are individually deployable. I’m also comfortable with the idea of these autonomous components communicating with each other via a message bus using a combination of asynchronous request-reply and publish-subscribe. I am not yet sure how well my understanding will map to the existing literature on SOA, as I got the impression from some of the other students that Udi’s version of SOA was somewhat different to the SOA they had read about. My impression of SOA is that it is a slippery subject, where only the most abstract and vague definitions are widely accepted. That said, I can see a great deal of value in the analytical process and technical approach that Udi taught us.

Having skimmed Enterprise Integration Patterns, I was already familiar with the idea of message based systems and the advantages of temporal decoupling before I began the course. But Udi’s coverage of the topic helped fill in large gaps and also gave me a great deal of appreciation for the power and simplicity of his open source .NET based service bus, NServiceBus. My co-worker Malcolm nearly did a backflip when he saw how easy it is to begin using NServiceBus alongside WCF.

Command / query responsibility segregation (CQRS) is about recognising the difference between queries and commands as part of system architecture, and designing completely different paths for handling the two types of operations. Going into the course, I thought I was comfortable with the idea as I’d watched a number of videos on the topic from Greg Young, and had read a number of blog posts. It turned out that Udi had his own take on CQRS that I did not pick up on when reading his posts on the topic. Speaking of Udi’s posts on the topic of CQRS, I highly recommend this one if you’d like to learn more.

So how was Udi’s version of CQRS different to what I expected? One example immediately comes to mind. A necessary part of CQRS is some sort of persistent view model to facilitate the queries, and a transactional data model to facilitate the commands. So far, so good. Udi then introduced the idea that there may be some relationships that are only recorded in the persistent view model, and not in the transactional model – if later on you need that data in your transactional store, then backfill it with an ETL from your view model! Boy did that raise some incredulous looks, especially from yours truly! “What happened to my single source of truth?” I cried.

Udi also had some interesting ideas about domain models. In particular, we went into quite a bit of detail on the idea of aggregates, and how to ensure consistency. Has it ever occurred to you that perhaps there is something wrong with loading a Customer, and then lazily loading their Orders at some later point? What happens if one of the Orders are modified by another process, after the Customer is loaded but before the Orders are lazily loaded? Now the model loaded into memory is inconsistent! Even if your optimistic concurrency will protect you in most of these scenarios, its entirely possible that you’re updating some other object based on logic that has operated on your inconsistent snapshot. This problem seemed obvious once it was pointed out, but it had never occurred to me before.

There were so many interesting discussions and points of contention over the 5 days, this post has barely begun to skim the surface. It really was an eye opening experience for me, and some serious food for thought. If you ever get the opportunity to attend Udi’s course, don’t hesitate. Its worth it!

Now that I’ve finally managed to get something written down on the course, I’ll let myself read some of the summaries written by other attendees.