I started web development using Java, basically during my studies at the university. When working on my bachelor degree thesis I needed a web server back-end system (to my mobile J2ME client); I decided to do it "right". Spring (especially Spring.Web) for the application server part and Hibernate for the object relational mapping. Although having quite a tough time getting up that initial learning curve, the result payed out so well: everything nicely decoupled and testable. I loved it. Then, when starting to work professionally as a .Net developer things got more painful...After my studies (parallel to continuing with the MSc) I started to work professionally as a .Net developer, getting in touch with Asp.net (WebForms). And that just felt so strange. "Postback", "ViewState",...it was like imposing the WinForms technology on top of the web. Where was the usual request/response pattern?? Testability?? Sure, you can, but you don't want to fight with all the necessary setup you need to deal with when testing an ASP.net WebForms Page. The only way is to ensure that you keep that logic at a minimum possible and to rather defer it to some business layer class which is completely web-agnostic and which then can definitely be tested. And indeed, this is what our internal framework/class-library helped us to do.
Now we decided to change that, seriously evaluating ASP.net MVC as our server-side technology. And that feels so much like returning home :). And I'm really satisfied what I've seen so far from Microsoft regarding MVC. They really seem to have gotten it right this time. Everything is clearly separated, abstracted, exchangeable and mainly, testable!
Consider this really dummy ASP.net MVC controller:
public class AccountController : Controllerand the corresponding (if also naive) test case:
public JsonResult Filter(Account account)
return Json(new List<Account>()
[TestMethod]Now, isn't this simple??
public void TestFilter_FilterJuriStrumpflohner_ShouldReturnAccountInstance()
Account filterAccount = new Account()
Lastname = "Strumpflohner"
JsonResult result = new AccountController().Filter(filterAccount);
IList<Account> filterResult = result.Data as IList<Account>;
Assert.AreEqual(1, filterResult.Count, "There should be only one result");