The joy, pain and wonders of web development

Functional Decomoposition For Testability

test tubes of separate colours In this article, I describe a very simple way to break down your business logic code, in a way that makes testing easier.


Moving to Dapper

Dapper man with cane Towards the end of 2008, when we started building our current code base, I recommended that the team use a new data access technology that Microsoft were shipping with Visual Studio: LINQ to SQL (or LINQ2SQL). It felt good to be getting on the ORM bandwagon with an "out of the box" Microsoft framework. Unfortunately, within a year, Microsoft had shifted their focus to Entity Framework and it became apparent the LINQ2SQL was a dead end product.


Paging in ASP.NET MVC

One thing that really bugs me is to find blocks of code that have been copied and pasted all over a code base. Of course this violates the DRY principle, so we should always look for refactorings that can remove the duplication. A case that I came across recently was copied HTML paging UI components - the next, previous links that live at the bottom of any list view page. It doesn't seem like a lot of code to copy, but there's the little rules such as "only show the next link if you're not already on the last page" which you really don't want coded separately everywhere. The important thing was that the URLs needed for the next or previous links were different for each list page (e.g. list of customers versus list of products).