João P. BragançaA discussion came up recently on the DDD/CQRS forums recently, that got sidetracked into ‘where do the validations go’ (along with a lot of weird nonsense about async command queues, http status code pedantry, etc, but we’ll leave that for some other time). A large minority of developers - perhaps even a majority - seem to think that validations belong somewhere in the ‘trusted’ client.
I find this conclusion strange, as none of the .
João P. BragançaThe Soap Box Part We’ve heard this before, but it bears repeating: CQRS is not just for greenfield event-sourced ddd systems. It can apply to crappy brownfield systems too. It may even have more relevance there.
Let’s take the penultimate brownfield system, an ERP system. In particular, Navision. Navision has a fantastic interface for interacting with it (snipped for brevity):
public interface SalesPrice_Port { Read_Result Read(Read request); ReadMultiple_Result ReadMultiple(ReadMultiple request); Create_Result Create(Create request); Update_Result Update(Update request); Delete_Result Delete(Delete request); } In other words, a 100% behavior free SQL-like interface that isn’t sql because you have Create / Read instead of INSERT / SELECT.
João P. BragançaIn Part 1 of this series we looked at putting NancyFX as a simple http wrapper in front of YouTrack. Now we’re going to make it more RESTful - i.e. we will display the error page to the user agent and include the exception report form on that page.
We will do this by leveraging Nancy’s status code handling features. This will allow us to intercept any status code we want and modify the response.
João P. BragançaGetting the business users to try and recreate a bug is difficult to say the least. They may not remember what it is they did to reproduce. But you can bet that if you don’t fix it by yesterday you’re gonna get an earful. In fact we just did. This is me doing something about it :)
Turns out this is annoyingly easy with Nancy and the YouTrackSharp library, so easy that I’m not going to bother test driving this.
João P. BragançaHere where I work we use YouTrack for issue tracking. We have a small team, it’s easy to use and free.
We’re also trying to get the business side more involved with what we’re doing - to know that we’re not just talking to ourselves / the keyboard all day. Unfortunately the default search leaves much to be desired.
Really what I want to show is all current features without subtasks (too noisy) AND any ‘orphaned’ tasks, bugs etc.
João P. BragançaI just installed the Nancy Templates for Visual Studio for Visual Studio. Before this, creating a project for Nancy has always been a bit of a pain - adding a mvc project and then removing a whole bunch of crap you don’t need. Way too much fiddlery required.
What really got me was the minimalistic set of dependencies:
Compare that to an emptyMVC4 project:Seventeen is very inauspicious.A Nancy.Hosting.SelfHost project would have even less dependencies.
João P. BragançaAll I want to do is cache something for one day. MVC4 is seriously trolling me today:
public override void ExecuteResult(ControllerContext context) { context.HttpContext.Response.OutputStream.Write(contents, 0, contents.Length); context.HttpContext.Response.ContentType = contentType; context.HttpContext.Response.Headers.Set("Cache-Control", "public, max-age=86400"); context.HttpContext.Response.Headers.Set("Expires", DateTime.UtcNow.AddDays(1).ToString("r")); } And the response?
Cache-Control:private Content-Length:30262 Content-Type:image Date:Tue, 28 May 2013 22:18:07 GMT Expires:Wed, 29 May 2013 22:18:07 GMT ARRRRRGH. I don’t know why people who develop on the microsoft default stack put up with crap like this.