Search code examples
c#.netwinformsdomain-driven-designscrum

Winforms Which Design Pattern / Agile Methodology to choose


I have developed desktop (winforms) applications without following any proper design pattern or agile methodologies. Now I have been given the task to re-write an existing ERP application in C# (Winforms). I have been reading about Domain Driven Design, scrum, extreme programming, layered architecture etc. Its quite confusing and really hard (because of time limitations) to go and try each and every method and then deciding which way to go. Its very hard for me to understand the bigger picture and see which pattern and agile methodology to follow. To be more specific about what I want to know is that:

  1. Is it possible to follow Domain Driven Design and still be agile.
  2. Should I choose Extreme programming or scrum in this specific scenario
  3. Where does MVP and MVVM fits, which one would be a better option for me

Solution

  • It is a very subjective and debatable kind of topic especially in the developer community. I am just writing down my thoughts. You may derive out the goodness [if any] out of it -

    Nobody applies a Design Pattern conciously while designing. There's always an iterative way to reach a good design. The OO principles should be S.O.L.I.D. You should choose your abstractions cleverly. Try to think in terms of interfaces.

    For your legacy code, I think you should first start with the domain classes. Basically, where your actual data model resides. Where you talk to your repository / data base. Start refactoring them one by one and create unit tests around them. I am not stressing on Test-Driven here. But, you need to have solid Unit Tests because you are rewriting it now. Once your domain classes are ready, it easy to hook on the UI following any standard pattern.

    You can have a look at this simple Winforms applications which has all elements of a normal UI pattern alongwith multithreading concept using backgroundworker -

    http://www.codeproject.com/Articles/88390/MVP-VM-Model-View-Presenter-ViewModel-with-Data-Bi

    This is also very helpful with a code sample detailed explanation - where he shows how to use MVVM for Winforms [parent of the above code project article] -

    http://aviadezra.blogspot.co.uk/2009/08/mvp-mvvm-winforms-data-binding.html

    I can't be more elaborative here as I said its a very subjective topic. You may search on some of Martin Fowler's articles as you proceed with your design. Hope this helps.