Some more reading on Dependency Injection and MVP

Wednesday, March 12th, 2008

In my new office I was studying the following articles.


I came to read these when I started to study about Unit Testing on ASP.NET projects. And here all use MVP. Its all new experience for me.
I have always been a fan of NTiers applications pattern. But now I am required to work on MVP with Feels little out of my normal brainwave, but its stimulating. Stepping out of my comfort zone, thinking architectures in a sort of reverse way, or top-down and bottom up in parallel. Currently the architectures I have managed to put up of Dependency Injection is through constructor injection. I am loving how pluggable and traceable the solution is becoming using MVP.

I am trying to explain or map MVP from a NTierian’s point of view. Lets say a solution have 4 projects (DAL, BLL, Facade and website). In NTiers Website will communicate with Facade. Facade will communication with BLL and website. BLL will communicate with DAL and facade. In NTier BLL handles the business logic with Data layer. Website’s ASPX pages handles the UI related business logic themselves in their code-behind files.

Now say if I am to translate the design in MVP. There is no 101 relation there. See the website will be called the ‘VIEW‘ but it will not handle the business logic related to the population of the GUI, a ‘PRESENTER‘ will do it with the help of the interfaces for each view ( Factory method). Now ‘MODEL‘ will act as the facade here who will handle all sorts of other logics, both Presenter and DAL have communication with it. Good to know that the DAL will always be DAL, no matter what framework it is in.

The work flow of MVP and MVC from Nikola Malovic

Actually I don’t know if I am right or wrong. Its just 3 to 4 days I am playing with MVP and this is what I felt. I am a complete beginner in t, so if anyone is reading do leave your view on it, and correct me if you find me wrong. It will be highly appreciated. My MVP readings will be found at Delicious.

I am working on a sample project where I am using MVP. I will write about it once i am done :).

For shortnote there are 3 types of dependency injection – Constructor Injection(I use it for NMock Unit testing my presenters), Setter Injection(Spring.NET framework), and Interface Injection(Avalon). I am still not wise enough to shade some lights on those. I will do that someday.