2

We want to create a huge C# application that uses MVC design pattern. Could somebody guide us how do we start?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
sk7
  • 29
  • 2
  • 7
    You start by defining your problem, planning, and then writing code. Then you come to Stack Overflow when you have actual coding questions or at least specific questions relating to technology decisions. – Sean Hill Feb 21 '11 at 04:38
  • 1
    Step One: [Write a spec.](http://www.joelonsoftware.com/articles/fog0000000036.html) – Cody Gray - on strike Feb 21 '11 at 04:40

1 Answers1

5

If you are planning to do this in Winforms I would suggest moving to WPF.

I was/and currently am in the exact same situation, I'm building an LOB for a very high profile client.

I made mockups in win-forms, then I realized I was going to need a proper framework, I looked around and didn't find much and tried writing my own MVC framework which was a horrendous mess.

Here are some win-form mvc stuff I found:
https://stackoverflow.com/questions/2406/looking-for-a-mvc-sample-for-winforms
Looking for clean WinForms MVC tutorial for C#
How would you implement MVC in a Windows Forms application?
Implementing MVC with Windows Forms

I just made the move to WPF last week and I'm pretty happy, I'm not suggesting that it is impossible to implement a good Windows Forms app. I'm sure there are huge Windows Forms apps out there.

I'm merely saying if you are starting from scratch and if you can afford it, do consider WPF. It definitely helped me.

Here is how WPF helps with good UI separation:

  1. Views in XAML can be customized and data bound and are completely separate from logic. (As opposed to windows forms code behind)
  2. WPF supports the MVVM pattern, its neat and simple, and doesn't require huge frameworks. (I've used it in a tiny Silverlight app very successfully) Do have a look at the MVVM Light Toolkit Although sometimes you won't even need a framework.
  3. WPF does allow you to make good (professional) looking apps, I'm not talking eye candy, for example a checked Listbox, or a treeview-grid is quite simple to make in WPF. You can always upgrade your app later to support enhanced looks etc.

This is just my 2 cents from my own experience last month ok!? =)

Community
  • 1
  • 1
gideon
  • 19,329
  • 11
  • 72
  • 113
  • Why? You can't write big applications in WinForms, but you can in WPF? I had no idea I've done the impossible. – Cody Gray - on strike Feb 21 '11 at 04:39
  • 4
    I think his point was that NEW dev should be done on NEW tech... – Nate Feb 21 '11 at 04:40
  • I'd recommend using WinForms... if you want your app to look like it was written for Windows 98. It's SHOCKING how much more flexibility and control WPF gives you over your app than WinForms does. – Mark Carpenter Feb 21 '11 at 04:45
  • With that logic, you should write an iPad application instead. That's the newest and greatest tech around. I don't really understand how this type of thing is considered an "answer" to a question, and I particularly don't care for the tired "logic" that if something is newer, it's *always* better. – Cody Gray - on strike Feb 21 '11 at 04:45
  • 1
    @Pwninstein: Having seen the utter abomination that is most applications written using WPF, I sometimes wish we'd go back to Windows 98 when you could at least expect a consistent user experience. The added flexibility and control over your app is often misused by developers who think they can re-implement better scrollbars and every other widget than the designers of the OS (hint: you can't). The point is, that type of flexibility isn't always necessary, and you can produce fully modern applications using WinForms. – Cody Gray - on strike Feb 21 '11 at 04:47
  • @Cody Gray - to each his own. WPF has been a pleasure to work with over the past couple of years - I can honestly say that my job wouldn't be as enjoyable if I still had to use WinForms. – Mark Carpenter Feb 21 '11 at 04:52
  • @Code Gray I'm not suggesting moving into WPF just because its new, see my last line, I myself vowed never to move to WPF 8 months ago when I took up my project, but I was doing the same thing the OP is doing a month ago and I just poured my experience ok? =) – gideon Feb 21 '11 at 04:55
  • @Pwninstein: Understood, but to be fair, that is a very different argument from "it's impossible to create decent-looking applications using WinForms", or the more sarcastic, "I'd recommend using WinForms...if you want your app to look like it was written for Windows 98." – Cody Gray - on strike Feb 21 '11 at 04:56
  • @giddy: Yes, your updated answer is much better than the original. Sharing experiences is worthwhile; sharing an opinion the length of a single sentence is rarely so. (+1) – Cody Gray - on strike Feb 21 '11 at 04:57
  • @Code Gray true, but like the hundred posts I've read on SO about WPF, the technology is NOT about eye candy, it was easy for a junkie like me to write properly separated code in WPF. Thats what its mostly about, and it took months for my to realized that. – gideon Feb 21 '11 at 04:59
  • @Code Gray Glad you understand! I just posted a one line first and then hit edit immediately and fleshed out my answer. :) – gideon Feb 21 '11 at 05:01
  • @Nate can you revise your comment based on the current answer? – gideon Feb 21 '11 at 05:02
  • 1
    @giddy -- my point stands, the newest technology (WPF) enables more modern design patterns to be applied more easily. WPF makes MVVM easy, WinForms makes MVC hard. – Nate Feb 22 '11 at 22:49
  • @Nate oh, ok :) (I thought you mean't I was suggesting blindly adopting new technologies) – gideon Feb 23 '11 at 04:07
  • @giddy not blindly, but its almost always worth looking into what the latest and greatest offers, I've found in many (not all) cases, it solves issues I've struggled with in the past. – Nate Feb 23 '11 at 16:08