Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I am of the view that applications are so different from each other and our understanding of how applications should be written is still very limited. Past Windows Forms applications I have worked on have been so different from each other. Some of the design differences I have seen are (including most combinations):</p> <ul> <li>Directly talk to the database (2 tier)</li> <li>Use a backend that has been written for the given application (3 tier)</li> <li>Use a set of web services that were written for use by many applications and can’t be changed for your application. (Service-oriented architecture)</li> <li>Updates being done by <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete" rel="nofollow noreferrer">CRUD</a> operations</li> <li>Updates being done with the <a href="http://en.wikipedia.org/wiki/Command_pattern" rel="nofollow noreferrer">command pattern</a> (sending commands to backend server)</li> <li>Lots of usages of <a href="http://www.akadia.com/services/dotnet_databinding.html" rel="nofollow noreferrer">data binding</a> / no usages of data binding</li> <li>Most data being “table like” (e.g. invoices) that work well in standard grid controls / need custom controls for most of the UI data.</li> <li>One developer / teams of 10 or 20 developers (just on the UI)</li> <li>Lots of unit test using mocks etc / no unit tests </li> </ul> <p>Therefore I don’t think it’s possible to create one implementation of MVC (or MVP) that always fits well.</p> <p>The best posts I have seen really <strong>explaining</strong> MVC and <strong>why</strong> an MVC system is built the way it is, is the <a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your-own-cab-series-table-of-contents.aspx" rel="nofollow noreferrer">"Build Your Own CAB" series by Jeremy D Miller</a>. After working though it you should be able to understand your options a lot better. <a href="http://smartclient.codeplex.com/" rel="nofollow noreferrer">Microsoft's Smart Client Guidance (CAB / Microsoft Composite Application Block)</a> should also be considered. It is a bit complex, but it can work well for applications that have a good fit.</p> <p>Selecting an <a href="http://rdn-consulting.com/blog/2008/02/01/selecting-a-mvcmvp-implementation-for-a-winforms-project/" rel="nofollow noreferrer">MVC/MVP Implementation for a Winforms Project</a> give an overview that is worth reading. A lot of people like <a href="http://trac.puremvc.org/PureMVC%5FCSharp" rel="nofollow noreferrer">PureMVC</a>. I have never used it, but I would look at it the next time I need a MVC framework.</p> <p>"<a href="http://en.wikipedia.org/wiki/Presenter_First" rel="nofollow noreferrer">Presenter First</a>" is a software development approach that combines the ideas of the Model View Presenter (MVP) design pattern and <a href="http://en.wikipedia.org/wiki/Test-driven_development" rel="nofollow noreferrer">test-driven development</a>. It lets you start off by writing tests in the customer’s language. For example:</p> <blockquote> <p>"When I click the 'save' button then the file should be saved and the unsaved file warning should disappear.”</p> </blockquote> <p>I have no experience using "Presenter First," but I will give it a try when I get a chance, as it looks very promising.</p> <p>Other Stack&nbsp;Overflow questions you may may wish to look at are <a href="https://stackoverflow.com/questions/2406/looking-for-a-mvc-sample-for-winforms">here</a> and <a href="https://stackoverflow.com/questions/122388/how-would-you-implement-mvc-in-a-windowsforms-application">here</a>.</p> <p>If you are thinking of using <strong>WPF</strong> at any point take a look at the <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx" rel="nofollow noreferrer">Model-View ViewModel (MVVM)</a> pattern. Here is a very good video you should take a look at: <a href="http://blog.lab49.com/archives/2650" rel="nofollow noreferrer">Jason Dolinger on Model-View-ViewModel</a>. </p> <p><a href="http://aviadezra.blogspot.com/2009/08/mvp-mvvm-winforms-data-binding.html" rel="nofollow noreferrer">MVVM (Model View View Model) Design Pattern for Winforms</a> give another option that may make it easer to convert to WPF if ever needed. <a href="http://codermike.com/magical-trevor" rel="nofollow noreferrer">Magical.Trevor</a> is yet another MVVM sample for Windows Forms that also includes auto binding based on property names.</p> <hr> <p>Also ask yourself <strong>why</strong> you are using MVC.</p> <ul> <li>Do you wish to be able to unit test as much code as possible?</li> <li>Are you trying to allow as much code as possible to be reused?</li> <li>Are you trying to make your code base easy to understand?</li> <li>101 other reasons that can be valid for a given project.</li> </ul> <p>Once you are clear on your <strong>aims</strong>, it becomes easier to choose one implementation or another.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload