Tuesday, February 5, 2008

Trying out ASP.NET MVC

A couple of weeks ago I wrote a web front-end for managing faxes on a fax server using Castle.Facilities.WindowsFax and ASP.NET MVC, mostly to get a feel for the latter. Although it's a very simple app (a couple of features are still missing), I got some impressions:

  • Windsor integration is a breeze thanks to MVCContrib.
  • I missed MonoRail's AccesibleThrough property. There is another option, setting the routing... but I kind of like the property better. Matter of taste, I guess.
  • Ajax is trivial thanks to the normal MVC routing, just like in MonoRail. I'm not a big fan of JS generation, I prefer to cut out the middle man and use directly jQuery, so I used the great taconite plugin to render ajax responses.
  • I like the possibility of having public methods on my controllers without them being exposed to the client. It would make testing easier in some cases. I know there is quite a controversy about testing private methods... or breaking encapsulation in order to enhance testability, but what if I wanted to test method GetRecords() on this controller? Sometimes it is convenient. No, I'm NOT saying this is good practice, just that it's nice to have the choice. Choice is good. And if you don't like [ControllerAction], you can always use Phil Haack's ConventionController. See? Choice :-)

Code is here.

1 comment:

Unknown said...

To test the view specially javascript (ajax), you are still going to need an web automation tool.

What do you think ?

Frederic Torres
www.InCisif.net
Web Testing with C# or VB.NET