Programming and stuff

Archive for the ‘Coding’ Category

Architecture, it’s finally clicking.

First, a history

My professional coding career started at a small software house in the Midlands when I decided I’d had enough clicking ‘Next, Next, Next’ as an installer for them and moved into development.  This was a Visual Foxpro house. Surprised smileThere was no such thing as architecture, object oriented programming, design patterns, unit testing etc. Everything was either on a form load, button click or in one massive great ‘helper’ file.  And by ‘everything’, I mean ‘everything’: File access, database calls, presentation code, web service calls.  It was, in hindsight, a massive horrible mess that was fragile, difficult to work with, frightening and bug-ridden.  But I wasn’t aware of any other way, so this was just how it was done.

When I left that job, I moved to an ASP.NET / C# role (which is where I am now). The way of doing things here was slightly different. Database called were in a project called <something>Service where there would reside a massive class called <something>Manager.  This <something>Manager would be tightly coupled to Typed Datasets (back in the day) or Linq To Sql (or both).  There would then be a web project that would call methods on that Manager class to do stuff.  More often than not the automatically generated classes from the Typed Datasets or Linq To Sql would be returned from the Manager class and used directly in the web project (sometimes directly in the aspx). One other added complication was that nearly all of the business rules for the application would be in the Sql Server as stored procedures.

I wasn’t sure why, but doing things this was was getting me down. I started to slowly lose my coding mojo.  I wasn’t thinking about code, I wasn’t trying new stuff, I was just getting my job done and that was that. 

As time has gone by this way of doing things has irked me somewhat. I am irked. The main driving factor of my irk-age was the desire to unit test. So I started to look at unit testing, read some books, downloaded samples, listened to talks. And it all made sense, but still I couldn’t get my head around how to structure my apps so that all of that decoupled-ness and unit-testing-ness would be possible.

The click

Within a week of each other, I read Scott Millett’s book Professional ASP.NET Design Patterns and watched Uncle Bob’s Clean Code video on Architecture.  It was like having my eyes opened for the first time. It was like I was Neo and I could finally see The Matrix. I could also feel my long-lost coding mojo coming back. I’d catch myself thinking about Interfaces, IOC, design patterns, architecture at all times of the day.  I’d see something in some legacy code and immediately start to think of ways to decouple it, test it, clean it and improve it. The contents of my “Documents\Visual Studio 2010\Projects” folder was increasing by the day. I was happy. I am happy.

All those concepts that I’d been reading about, like coding to interfaces, forgetting about the database (for a while), seeing all those aspx’s as ‘details’, tell don’t ask, single responsibility, separation of concerns suddenly coalesced into something I could do and use.

The future

This is just the start, and I intend to blog my progress for as long as it takes. Which, will probably be forever as who on earth can claim that they’ve finished learning? 

Tag Cloud