Carlo Kok from RemObjects suggested a book to me “Getting things done” a while back (I’d recommend it too) – since then I have been using Get On Tracks, which is a web based app based on the suggestions in the book. It’s a pretty good app but I find it is very slow, painfully slow. So, due to the relentless part of my personality which compels me to constantly learn new things I have started an open source project on sourceforge.net – TaskSmart. This will be a web app I can use as a replacement for Get On Tracks, so I will get a faster app (hopefully) and also get to play with some new things along the way.
The ingredients for this application will be
- ASP MVC
- AJAX – Not used it before, possibly using jQuery
- Domain Driven Design – Only a few items I liked from the book
- UNITY – Dependency injection container
- NHibernate – Not used this before either
- Rhino Mocks – Used this quite a lot
- Test Driven Design – A must have!
- AutoMapper – To map domains to view model

- The web interface will be handled by ASP MVC controllers.
- These controllers will present a View Model to the interface.
- The controller will talk to the Application Layer using View Model instances as parameters.
- I think I will use AutoMapper to help the Application Layer to translate between Domain Classes and View Model.
- The Application Layer will act as a facade to the Domain classes.
- The Application Layer will manage all persistence using NHibernate.
In addition all dependencies will be injected using UNITY from Microsoft, this will make testing easier and also make it easier to compartmentalise the source code into smaller chunks which are easier to understand.
I have decided to manage constraints as individual objects, for example
- StringIsNotNullConstraint
- StringIsNotTooLongConstraint
- StringIsNotTooShortConstraint
- StringIsValidInternetEmailAddressConstraint
Previously I would have used object constraint language expressions and return a list of broken constraints as a collection of strings. This would mean that when I validate user input I would either have to manually reproduce the business constraints in the user interface (which is a pain when they need to change) or not validate on the client at all and leave it all to the server (which results in a wasted server request when we know for a fact that the user input will be rejected). So my idea here is that if my constraints are objects then I will be able to determine two things about the constraints.
- The way in which the constraint logically checks a value, such as “This string must be at least X characters in length”.
- The relevant properties of the constraint, such as exactly what the minimum number of characters is.
What I am hoping to do with this additional information is then to
- Define the constraints on my domain classes.
- AutoMap the relevant constraints to the View Model.
- Automatically convert these constraints into JavaScript.
- Have the client validate input in the web browser before it is submitted to the server for final validation.
This should give me the advantage of not having to waste server resources on a certainly invalid request, and also save me from having to define constraints in more than one place; updating on the domain class will automatically update the validation on the page.
It’s all a pretty tall order, but it should be interesting to say the least!