Sprint Planner Helper – Session 23

· March 28, 2009

This has been the longest of my sessions so far and by far. It has actually stretched over 4 separate “hours” and almost a week since my schedule has been busy with other stuff.

It had to do with me getting stuck on a thing the ASP.NET MVC framework that I didn’t get. This was related to the way the framework binds the data in the view to the values posted, and the UpdateModel method etc.

To make a long story short I have posted an item in the MVC-forum, and got some truly great feedback from Alberto. I recommend you reading it. Go on. Do it now.

Ok – from all this I learned some very useful lessons;

  • the most important was to use a separate ViewModel. That is – create classes that are streamlined to fit the view that the controller is exposing.
  • you can do some pretty funky stuff with the naming conventions in the view. For example: if you do this in the view: Html.TextBox(“Product.Name”, Model.Product.Name) will and then call UpdateModel(), the Product-property will get new-ed and the Name-value set.

My goal with this session was to continue the use of the IsValid/GetRuleViolations-pattern from Session 22.

But that broke down pretty fast – and I got to learn this pattern instead. I’ll take that any day! Much better knowledge. But I’ll get back to it – shortly.

**[UPDATED] **I managed to nail the ValidationSummary-stuff… Here is a picture of it:

ruleviolations

I have also pondered over me spending to much time in the MVC-trenches. If I re-read my initial intentions this is a DDD-learning project (as well as TDD and ASP.NET MVC). But I feel that the DDD-ing has been sidestepped for a while.

I guess that it has to do with that the ASP.NET MVC is a framework that you need to learn how to get your way around. These thing takes time and can stop you in your tracks.

DDD on the other hand is a bunch of design patterns and a mindset – that can take considerable time to master but is often quite easy to get up and running with.

I’ll try to get back to the DDD-part of this in next session. I had to leave to test that doesn’t work so I’ll have to fix that first. but then…

Twitter, Facebook