MS Stubs framework

A colleague of mine recently came across Stubs – a Lightweight Stub Framework for .NET and suggested I take a look. Having used both Moq and Rhino Mocks in the past, I was intrigued, and thought I should take a closer look.

I may have gotten the wrong end-of-the-stick, but it seems that Stubs uses code-generation to generate stubs, rather than the more typical dynamic code approach used by other frameworks (reflection and expression trees).

My initial thoughts are:

  • I wonder how well the code-gen approach works with TDD? I don’t fancy having to re-run a tool manually every time I create a new interface; the less friction the better!
  • I generally would tend to favour dynamic code (reflection, expression trees etc) over code-gen unless performance is a key-factor, since this results in less code to maintain. It may be the case that code-gen here can make a significant reduction in execution time of tests in larger code-bases, although it would be interesting to see some stats for this. It would also be interesting to see whether this approach works out favourably on a long-running project (where interfaces are likely to change) as I can see maintenance of the stubs being a potential issue.
  • It’s good to see Microsoft favouring type-safe code rather than using magic strings as they had in other projects (like asp.net MVC)

 

I seems like this could be an interesting project to keep an eye on, but for the mean-while at least, I think I’ll stick to Rhino Mocks!

Interesting post from Oren…‏

http://ayende.com/Blog/archive/2009/06/09/avoid-externalizing-decisions-from-your-domain-model.aspx

Extract:

Boolean methods worry me because of their implications. If you have a Boolean method here, it means that somewhere else you have an if statement that works based on this method.

The “legacy” application I took ownership of when starting at my current employer is teeming with boolean methods – UserAccount as an example of this; IsSuspended, IsActive, IsAuthenticated etc. Funnily enough if I “Find Usages” they tend to have two types of usage; making decisions as to what to display in the UI, and validating whether an action can take place.

Oren hasn’t suggested his preferred approach to tackling this kind of problem but I would favour:

a) having these boolean methods moved out of my entity, and onto a view model for when I need this data when binding a view (my repositories can retrieve “suspended” or “not-suspended” users based on specifications).

b) when boolean properties (like IsActive) are used to determine whether or not to display a link to an action, based on the state of the domain (like  re-activate User for inactive accounts) then I’d prefer this responsibility to be delegated to to my application layer in a class responsible for application co-ordination, rather than having this logic my domain.

What do you think?

I’ve learnt so much from…

…reading blogs. This originally started with me stumbling along Los Techies (I believe it was a post by Jimmy Bogard), and adding this to my favourites. After doing the same for several other bloggers, this became unmanageable and a colleague of mine pointed me in the direction of the popular feed-reading service Google Reader.

I imagine that most people reading this right now probably will have their own RSS-feed aggregator, but if they haven’t, I would definitely recommend Google Reader as it makes it very easy to keep up with new posts. I currently use the Reader application on my iPhone while on the train to/from work, so I can us this “dead-time” productively.

According to Google Readers “trends” feature, on average I read 12 posts a day from my 53 subscriptions. A large amount of these seem to be posted by Oren aka Ayende Rahien – I have no idea how he manages to post so often, especially considering his posts are usually very thought provoking.

Anyway, the reason I’m writing all this was to share links to a few of the blog-authors I feel I’ve learnt the most from (you can see my Google Reader shared items here). These guys are super-smart (I mean clever rather than well dressed), and almost every post I read from them is a gem.

In no particular order:

  • Rob Conery – A fantastic, usually very entertaining writing style, with great content, especially on ASP.NET MVC. I’m also very jealous that he lives in Hawaii.
  • Jimmy Bogard – Every post is very clearly written and well thought out. A definite must-have on your feed-reader. Content generally covers things like SOLID principles, Agile development, and Doman-Driven Design. Author of to OSS tool AutoMapper.
  • Grey Young – A very inspiring blog, which I will read over-and over again. Content usually covers: DDD (specifically distributed domain-driven design), design patterns and agile development.
  • Jeremy Miller – I’ve got a lot of respect for this guy. He’s clearly a very intelligent chap. His blog often includes writing about: Software Architecture, Design Patterns, Test Driven Development, and Alt.Net. Author of the StructureMap IoC tool and FubuMVC.
  • Chad Myers – Chad’s posts are always very cohesive and well written, and along with Jimmy Bogard was one of the first blog-authors to inspire me with their work. His blog often covers topics like TDD, SOLID principles, and ALT.NET. Author of FubuMVC
  • Jan Van Ryswyck – Having only found Jan’s blogs on Elegant Code quite recently, it says quite a lot that he’s made it into my top list of blog-authors. His recent posts on fluent interfaces are typical of the inspirational pots he writes.
  • Ian Cooper – Ian’s blog contains some great material on persistence ignorance, nhibernate, TDD and BDD, and Linq. Less active than the bloggers above, but certainly worth adding to your feed-reader.

Other very good blog-authors to check out:

 

Whose blogs would you recommend?

Active Blogger?!

Hmm. Perhaps not.

Over the last four months (has it really been that long?!) I’ve been very quiet in terms of blogging. Silent in fact. Over this time a lot has happened for me – I changed jobs (I now work for a company in London), I relocated from Bournemouth into “the city”, and then went on holiday…for a month and a half!

I have however been itching write a few posts and have a couple in mind that have yet to make it into digital form. Before I do though, I wanted to make some sample code available from my previous post. Although this code was really just a spike for me to try out the Entity Framework POCO Adapter, hopefully it may be of some use to someone.

The “Implementing a Customer Search Service with DDD, BDD and the Entity Framework” sample can be found on my skydrive here: http://cid-811a86b9c84017e5.skydrive.live.com/browse.aspx/Public

 

*DISCLAIMER* Please don’t consider this sample as anything more than just a spike – the code is quite far from best practice (for a start, I attempted to use an IOC container in my tests, YUCK!). *DISCLAIMER*

What purpose does the Repository Pattern have?

There’s currently a very interesting discussion taking place on Tobin Harris’ blog about the usage of Repositories. Although I added my initial thoughts to the post, I had a few additional thoughts on my journey home from work, and I’ve had a bit of a re-think on some of my views. Let me see if I can explain…

NB: I’ve repeated some of my comments from Tobin’s blog, so I apologise if you’ve read some of this already!

 

Should a repository return IQueryable?

I’ve mentioned this on a couple of my previous posts, and also on Tobin’s blog, but I’ve generally found that exposing IQueryable from your repositories adds some complexity issues in managing the differing limitations of the underying provider.

In my experiments with L2S and the Entity Framework, I’ve noticed that the support for IQueryable varies somewhat between provider implementations, perhaps due to the bloated interface of IQueryable. Other issues I’ve noticed in my travels include the lack of common IQueryable provider support for Expression.Invoke – a technique used in some approaches to combining predicates. This technique cannot be used by the Entity Framework for instance (although a general solution to that can be found here). All this makes exposing IQueryable from a repository needlessly complicated.

I’m sold on the idea that the primary purpose of the repository is to obtain a reference to the root of an aggregate. A repository should therefore behave like a collection of Entities. Contrary to this, repositories that return IQueryable are returning a query object. I think this probably goes against the original purpose of a repository.

Steve Burman also highlighted a key consideration as part of the discussion on Tobin’s blog; ideally, SQL execution should never occur outside of the boundary of a repository. By returning an un-enumerated IQueryable object, we are exposing ourselves to just that and opens us up for potential abuse.

 

Where do specifications fit in with the Repository Pattern?

I generally believe specifications to be a domain concept, containing things like GoldCustomerSpecification and the like. In general I put most of my specifications alongside other domain artifacts, but only where the specification represents a domain concept. In the case of the GoldCustomerSpecification, it belongs in the domain since there is a “gold customer” in our ubiquitous language. This may be “all customers who’ve spend over £250 in the last month are considered to be gold customers” or something to that effect. I see these kinds specifications as value objects, since they seem to fit Evans description of a value object:

An object that represents a descriptive aspect of the domain with no conceptual identity is called a VALUE OBJECT. VALUE OBJECTS are instantiated to represent elements of the design that we care about only for what they are, not who or which they are.

There are also some specifications however, that are better suited to live outside the domain. An example of this is search criteria objects. These application layer objects tend to be formed from a combination of domain specifications (like GoldCustomerSpec) with other adhoc criteria (like name=”bob”). Steve Burman has proposed a good mechanism for creating adhoc specifications with can be found here.

Colin Jack reaffirmed my believe that this kinds of specifications are better left outside of the domain, and summarised that “ad hoc specs just speak to the language of the implementation not the language of the domain and so (in my view) are best used outside the domain.” I agree entirely; specifications like CustomerNameSpecification (things like name=”bob”) don’t form a part of our ubiquitous language, and therefore shouldn’t be part of our domain.

 

Are generic repositories worthwhile?

Another question that was raised was that with the use of specifications in our repositories, do we even need custom repositories anymore? Instead of having ICustomerRepository, IOrderRepository etc. could we just have IRepository<customer> and IRepository<order> instead?

I’ve been using generic repositories in my more recent work,  and these repositories have taken the form:

    public interface IRepository<TAggregateRoot>
        where TAggregateRoot : class, IAggregateRoot
    {
        /// <summary>
        /// Find entities by specification.
        /// </summary>
        IList<TAggregateRoot> Find(ISpecification<TAggregateRoot> criteria);
        
        // More stuff here… 
 

 

For me, a great benefit of generic repositories like the one above (using LINQ) is the ability to instantly gain from being able to write the following for ANY entity that is an aggregate root:

     repository.Find(criteria); 

Since the criteria can be any specification, or composite of multiple specifications (domain specifications or otherwise), they are a very powerful tool.

Colin raised some very valid questions about generic repositories, and their ability to encapsulate all details of persistence not just querying. Specifically, how do you say that:

  • aggregate X is never deleted, or that its not deleted its archived,
  • that aggregate Y is built up from multiple data sources,
  • that query Z is very expensive and needs to be done using SQL.

In my repository implementations (such as a LINQ to SQL implementation) I can quite readily add custom persistence related logic, such as “aggregate X is never deleted”, or “that its not deleted its archived” etc, and this persistence logic solely exists in the implementation of the repository. This logic can be implemented in the same way as standard L2S i.e. By using the LINQ to SQL designer to graphically configure SPROCs to execute in response to Insert/Update/Delete operations on our data model classes.

I’ve also created a mechanism in my repositories to implement fetching strategies (using technique similar to the one suggested here), so specific entities can be pre-fetched where required. This allows me to optimise my data retrieval for specific use-cases.

 

Some further twists

Colin’s questions got me thinking. Perhaps we could have our cake, and eat it too? We could specify custom repositories that inherit behaviour from our default implementation. That way you can implement optimizations as and when you feel they are necessary. For example, the following repository may have an override for Find() that has some specific performance tweak:

CustomerRepository : DefaultRepository<customer>, ICustomerRepository

Now this is where it gets interesting. My generic repository interface also defines method signatures like:

void Insert(T item);
void Delete(T item);
 

Of course I may not ALWAYS want to allow inserts, deletes to my entities. Rather than throw a NotImplementedException for these cases, a better option is to use the Interface Segregation Principle to separate “updates” from “queries”. Perhaps use a ILoader interface and a IPersister interface to define this. Now here’s the crunch point…with generic repositories, are we even still using the repository pattern at all?!

It’d be great to get some thoughts on this!

Implementing a Customer Search Service – Part 2

Continuing on from my previous post, let’s start off by coding up the unit tests based on the behaviour scenarios we laid out. To ease my transition towards the BDD-like way of writing tests, I’m using xUnit along with a really handy base class and observation attribute developed by Fredrik Kalseth (check out his blog post here to see how this all works). As a refresher, the scenario I’ll be testing first is:

WHEN searching for customers

GIVEN customers exist matching the search criteria

THEN records matching the criteria will be retrieved from the persistence store AND customer summaries are returned AND the search is successful

And the coded test looks like this:

public class When_Searching_For_Customers 
              : Given_Customers_Exist_Matching_Criteria
{
    private ISearchResult<ICustomerSummary> _result;

    protected override void Observe()
    {
        ICustomerSearchService service = 
           new CustomerSearchService(_repository, _customerSummaryMapper);
        _result = service.Find(_criteria);
    }

    [Observation]
    public void Records_Matching_criteria_are_requested_from_repository()
    {
        Assert.Equal(1, _repositoryInvocationCount);
    }

    [Observation]
    public void Customer_Summaries_are_returned()
    {
        Assert.NotNull(_result.Hits);
    }

    [Observation]
    public void The_Search_is_successful()
    {
        Assert.True(_result.IsSuccessful);
    }
}

Pretty simple stuff. Following the Arrange, Act, Assert pattern for authoring tests, the “arranging” of the test takes place in the base class (which I’ll cover shortly), the “act” takes place by creating and invoking the service,  and finally there is then an assertion for each observation that we are hoping to prove.

The base class that manages the set-up of the test context looks like this:

public abstract class Given_Customers_Exist_Matching_Criteria 
                       : Specification
{
    protected IRepository<Customer> _repository;
    protected ICustomerSummaryMapper _customerSummaryMapper;
    protected ISearchCriteria<Customer> _criteria;
    protected int _repositoryInvocationCount;

    protected override void InitializeContext()
    {
        _repository = GetMockRepository();
       _customerSummaryMapper = GetMockCustomerMapper();
    }

    private static ICustomerSummaryMapper GetMockCustomerMapper()
    {
        var mock = new Mock<ICustomerSummaryMapper>();
        mock.Expect(map => map.MapFrom(It.IsAny<IList<Customer>>()))
            .Returns(new List<ICustomerSummary>());
        return mock.Object;
    }

    private IRepository<Customer> GetMockRepository()
    {
        var mockRepository = new Mock<IRepository<Customer>>();
        var mockCustomers = GetMockCustomers();
        mockRepository.Expect(rep => rep.Find(_criteria))
            .Returns(mockCustomers)
            .Callback(() => _repositoryInvocationCount++);
        return mockRepository.Object;
    }

    private static IList<Customer> GetMockCustomers()
    {
        var mockCustomers = new Mock<IList<Customer>>();
        mockCustomers.Expect(customers => customers.Count).Returns(10);
        return mockCustomers.Object;
    }
}

This class simply creates mocks for the dependencies of the SUT, such that we can test the unit in isolation. The only little extra here is that the mock repository behaves more like a test spy, since it allows us to monitor the number of times that the Find() method has been invoked.

 

Implementing the Service

Since I want to be completely flexible with my search criteria, I want the contract of my service to take in an abstraction of the Customer search criteria, rather than specifying a finite set of inputs. I think the following contract describes this quite well:

ISearchResult<ICustomerSummary> Find(ISearchCriteria<Customer> criteria);

 

I don’t want any of my data retrieval responsibilities leaking into the application layer. This work should be delegated repository. I therefore want my service to pass-through the search parameters into a repository implementation. Rather than making the repository aware of the presentation layer object ISearchCriteria, it is better to use a common, shared abstraction. A suitable abstraction to use here would be to use the specification pattern for the search criteria, and passing this abstraction to the repository.

As discussed briefly in my previous posts (and in detail here), I believe my repository should behave like a collection of entities (rather than serving up a query in the form IQueryable<T>). I also know my repository can only return a reference to entities defined as the root of an Aggregate.

Taking all this into account, I can specify my repository interface as:

public interface IRepository<TAggregateRoot>
    where TAggregateRoot : class, IAggregateRoot
{
    /// <summary>
    /// Find entities by specification.
    /// </summary>
    IList<TAggregateRoot> Find(ISpecificationExpression<TAggregateRoot> criteria);
}

NB: It’s likely that my Repository Interface will later include the ability to save new and updated entities, however as per YAGNI, I won’t include this for the moment.

 

Since my repository can only return a reference to an Aggregate Root, the Customer aggregate root will need to be mapped to the required CustomerSummary presentation object. A suitable interface for this mapper object could be:

ICustomerSummary MapFrom(Customer customer);
IEnumerable<ICustomerSummary> MapFrom(IList<Customer> customers);

All that remains then is to create an implementation of the service based on these interfaces. This is quite simply:

public ISearchResult<ICustomerSummary> Find(ISearchCriteria<Customer> criteria)
{
    var customers = _repository.Find(criteria);

    if (customers == null || customers.Count == 0)
    {
        return new CustomerSearchResult
        {
            IsSuccessful = false,
            FailureReasons = new[] { "No Customers found." }
        };
    }

    var summary = _mapper.MapFrom(customers);

    return new CustomerSearchResult { IsSuccessful = true, Hits = summary };
}

 

All that’s left is to create simple implementations for the remaining objects (CustomerSearchResult, CustomerSummary CustomerSearchCriteria) and we’re ready to rock. Now the logic of the Application Service is created and the tests pass, we can create a repository implementation making use of the Entity Framework sample’s EFPocoAdapter project. I’ll cover this in my next post.

Implementing a Customer Search Service with DDD, BDD and the Entity Framework

I’ve been keeping an eye on the evolution of the Entity Framework since the early VS2008 betas, but it’s lack of POCO support in its V1 release really put me off, especially since this made it particularly awkward to use Test Driven Development (TDD). For me, the final nail in the coffin was its apparent incompatibility with Domain-Driven Design (DDD), or so I thought…

Jaroslaw Kowalski recently posted on his blog about a sample project published on MSDN that allows an adapter layer to be written (generated), which will translate between POCO objects and Entity Framework-aware objects. By doing this, an application service can make use of features like Change Tracking, Lazy Loading, LINQ Queries, and Shadow State, without interfering with our POCO objects. This allows use to create our Domain Model without being distracted by persistence concerns, and even better, our model can be created independently from our database schema.

As you can imagine, this has re-ignited my interest in the Entity Framework, but before I’m sold on the idea, I figured I’d put the sample to the test by trying it out with service implemented following DDD.

Where to begin?

The published sample project (currently on version 1.0.3 at the time of writing) contains some simple POCO classes based on the Northwind database. Some of these POCO objects may be considered to be Entities, such a Product or Customer, and some may be considered to be value objects, such as CommonAddress (which by the way is also immutable). What we are missing in  the example though  (for the purposes of a well-rounded DDD test) is some clear Aggregate Boundaries, some repositories to retrieve references to our Aggregate roots and Services to provide a cohesive set of operations to our client applications.

Assuming an existing Entity, such as customer, can be made the root of its own aggregate, and that we can easily define our own repositories* by writing our own implementation of an EFPocoContext (the code-generated context will have IEntitySet<T> properties for each of our entities, not just the aggregate roots, so is inappropriate for DDD), all that remains to be proven then is a service implementation.

*It’s also debatable whether a repository should return a result in the form IQueryable<TEntity> since this is only a query object, and not the result itself (see this post for further discussion on this).

The Task

What I’d like to do is create a simple Application Service that allows a client application to search for customers. I’d like to extend the simple CustomerSearchService featured here to include the ability to search on a wider set of criteria, and return a collection of search results. The criteria for the search may relate to the  customer itself, the customers order detail, or a combination of criteria. In fact, as a sample range of criteria, lets use those listed by Jimmy Nilsson in his book “Applying Domain-Driven Design and Patterns”:

We should be able to query for customers who:

  • Have a name with “aa” in it. (Hidden Marketing for a Swedish car company.)
  • Ordered something last month.
  • Have orders with a total amount greater than one million.
  • Have a reference person called “Stig.”

Since I also want this example to test the compatibility of the Entity Framework with “modern development approaches”, I will also be test-driving the development following (as closely as I can) to the style of Behaviour Driven Development (BDD). Typically in BDD, the words “Given”, “When” and “Then” are often used to help drive out the scenarios. The word “Given” describes the context of the test, the state of the SUT if you will. The word “When” represents the unit of work or action that you are testing. The word “Then” simply describes each result, or observation expected from the system. For the purposes of this implementation, I shall use the following scenarios:

WHEN searching for customers

GIVEN customers exist matching the search criteria

THEN records matching the criteria will be retrieved from the persistence store AND customer summaries are returned AND the search is successful

GIVEN no customers match the search criteria

THEN the search is unsuccessful AND the client application is notified that no customers match the provided criteria.

 

So this should give me a decent starting point to kick off from. Next time we’ll code up the unit tests for this and crack on with the implementation.

Pluggable Dependencies Intermission

Wow, its been over a month since I posted last on this, and what a month it’s been. Over the last month I uncovered something pretty special: Domain-Driven Design by Eric Evans. Seriously, buy this book. Every developer should own a copy of this. Fact.

Right, now I’ve gotten that out of my system, I’ll continue with what I was planning on writing about. Something was up about my implementation. Something didn’t seem to smell right. I couldn’t put my finger on in, but I found myself coding myself into corners. I found myself coding unit tests that didn’t seem to be testing the right “layer” of code, and found myself getting mixed up in issues like “how to lazy-load collections” when really I knew that this persistence related code didn’t sit right amongst my business logic.

So, I did some research, and some reading, and here’s what I found…

Code Smells

When writing my first unit test for the problem in hand I made a few assumptions; first that the repository would be programmed against an abstraction (IPerson rather that Person) and second that the repository would return an IQueryable of Person objects. On reflection, perhaps I did this because I had an implementation in mind, or perhaps this was for another reason entirely, but I believe this lead me to a few issues and code smells.

First of all, I breached the YAGNI principle – I wasn’t trying to filter this list of people (or Persons), or at least, not at this stage of the game anyway, so I shouldn’t have been trying to return an IQueryable when perhaps an IEnumerable collection would have better represented the task in hand.

Secondly, I breached the purpose of the repository, to obtain a reference to the aggregate root, which in this case, should have been a collection of Person objects. What I actually returned was a IQueryable object; a query nothing else. Rather than try to explain why I believe this to be an issue, I think this is much better summed by Fredrik Normén in his post here. I really think Frederik hit the nail on the head in that a Repository should behave as a collection of entities, and to call a mechanism that serves up a query a “repository” goes against the original definition of what Martin Fowler and Evans intended.

I now think a better option to meet the goal of filtering a list of entities, or rather specifying the criteria a list of entities must adhere to in order to be returned by the repository (should I require this), would be to use the specification pattern. We can then compose our query using well defined domain concepts (like MandatoryPersonDetailsSpecification), chain specifications together if required (And/Or/Not) and then pass them into our repository. An example of this that I particularly like can be found on Scott Walkers blog here.

Code Responsibilities

I paused for thought when I realised I was writing unit tests that seemed to be testing the wrong “layer” of code. This was the code that sounded the alarm bells in my head:

[TestMethod]
public void Person_ShouldHave_Forename_Surname_Address_Fields_NotNull()
{
    var p = (from persons in rep.Repository<IPerson>()
                select persons).SingleOrDefault();

    Assert.IsNotNull(p.Forename);
    Assert.IsNotNull(p.Surname);
    Assert.IsNotNull(p.Address);
}

The code in question is testing that the repository is returning values for Forename, Surname and Address…but surely it’s not the repositories responsibility to enforce our business rule that a person must have these attributes?  I wanted to ensure that “draft” person objects could be captured in our domain, but full person details must be provided in order for a person to be “published”. So where was I going wrong?

Lets consider the facts – the concept of a “draft” person is a domain concept; the rules enforcing this should therefore be contained in the domain. I had previously considered this as a persistence only concern, however I had overlooked the fact that the rules defining whether a person was “complete” or “draft” have to exist in the domain.

I no longer necessarily require a “draft repository” for persisting temporary data; a draft person object (or a person deemed to be in a draft state) is more suitable in this context.

Lastly, in regard to lazy loading, my hunch is that by carefully considering where my aggregate boundaries are, I shouldn’t need to worry about lazy loading, especially considering this is such a basic example.

Where do I go next from here?

What this really drove home to me is that the first few hours of TDD really are the most painful. I’m going to stick with it though, and using that in conjunction with my new favourite book, I should be a few steps closer to writing more elegant code.

:)

How I Got Started In Software Development

This post is another development meme that I’ve seen crop up on a few blogs I subscribe to – the basic gist being that you answer a bunch of questions about the origins of your interest/career in software development, and then pass on the meme to others who you’d be interested in finding out more about! I was passed this meme by Scott Lovegrove, so thanks to him for this!

1. How old were you when you started programming?
My first experience with “programming” was when I was in Sixth Form where I wrote a basic Fantasy Football application using Microsoft Excel macro language (if you can really call that programming!!) , so I must’ve been about 16.

2. How did you get started in programming?
Subsequent to my brush with very basic programming in Sixth Form, I didn’t really get started until I started my degree at University (Computing/Software Engineering Management).

3. What was your first language?
Hmm…excluding Microsoft Excel macro language, the first language I coded with was C.

4. What was the first real program that you wrote?
Wasn’t everybody’s first application Hello World?! If I remember rightly, my first university program was a nightclub admission application – tracking the movement of clubber’s from entry, to the dancefloor, to the VIP area…something like that anyway!

5. What languages have you used since you started programming?
In no particular order: HTML, javascript, XSLT, XPath, UML (if modelling languages count?!), C, Java, C#, ASP, ASP.NET, .Net 2, 3.0 and 3.5, Perl, PHP, SQL (for both SQL Server and Oracle), and both the BNF and VDM specification languages.

6. What was your first programming gig?
My first programming job was my placement year at IQSystems Services Ltd, working as a Junior Software Developer on the IQUtopia product – a patient management solution, designed to support care provided outside the acute hospital environment..

7. If you knew then what you know now, would you have started programming?
Sure thing, I love it!

8. If there is one thing you learned along the way that you would tell new developers, what would it be?
Don’t try to re-invent the wheel. 9 times out of 10, the solution that you are looking for has already been considered in depth, and will be out there should you need it. As Scott said, Google is your friend. This applies to software design, as much as it applies to implementation so consider reading up on design patterns too!

9. What’s the most fun you’ve ever had… programming?
I generally get a kick out of solving complex business problems with software (rather than solving technical problems with software), so I think I’d say any of the examples where clients have turned around and thanked me for my efforts an input. I guess apart from that, I’ve generally had a lot of fun “playing with” the .NET 3.5 extensions over the period where it was in beta…particularly Dynamic Data, ADO.NET Data Services (Astoria).

 

So to continue this meme, I need to pass this on to other developers…

I’m not sure if any of my colleagues have a blog, but if not, they could start their blog with this! ;)

I would nominate: Rowan Dennigan, Tom Dudfield and Dave Masters.

Link-Listing – July 08

Since I’ve been distracted from blogging over the last few week (life’s been pretty hectic) I figured that to fill the gap left on my blog, I’d post create a link-listing to give some insight into the kind of things I’ve been reading when I get a few spare minute in the day. This should not only give a little more insight into my circle of interest to any of you who may be reading this, but it should also provide me a means to catalogue reference examples that have inspired me, in a way that doesn’t explode the favourites I’ve been storing in my web browser up until now!

Unit Testing and TDD
  • Arrange Act Assert and BDD specifications: A post describing how with the improved syntax of testing frameworks like Rhino Mocks 3.5, cleaner unit tests can be written, separating the the behaviour we want to observe from the mechanics of setting up tests.
Patterns and Practices

General Architecture
  • Classes that show up in every project: An insightful post by Jeremy D. Miller about common project layouts.
  • Advanced Domain Model queries using Linq: A series of posts by Luke Marshall detailing a solution to the problems between differences between Linq to objects and Linq to Sql that can arise when abstracting data access into generic repositories.
  • Default Architecture: Yves Goeleven provides a fantastic summary of a common architecture an project structure for modern applications.
Input & Business Rule Validation
  • Generic Validation: Another inspiring post from Udi Dahan, describing his proposed solution to a commonly found problem.
  • Input Validation vs.Business Rules Validation: Ayende Rahien’s take on the difference between input validation and business rules validation.
  • Entity validation: Yves Goeleven describes the validation techniques that can easily be used in a default repository implementation to include entity validation before changing their persistence state.

Hopefully you will find these links as useful and inspiring as I have!

Next Page »