views:

57

answers:

1

I'm currently worried that my application design is somehow awkward, so I wanted to ask you how you design your applications.

I'm using C# and WinForms (Don't have the time to get into WPF right now unfortunately)

So I use a ProgramContext so I can have multiple Forms in the same Application and manage them. But the question is, where do I put the Program logic?

You see, I come from a web-background, so there It's easy to say: PHP does the logic, HTML displays.

But how is that with applications. Does the ProgramContext do the logic (Controller) and the WinForm displays it (View) - or is the ProgramContext itself a View that can control other views and the logic is put in the Program.cs?

I'm getting quite confused over this matter and hope someone can help me out.

+3  A: 

My recommendation would be that you check out Martin Fowler's "MVP Supervising Controller" pattern - it will be reasonably familiar if you've done MVC in PHP, but deals nicely with the winforms differences.

http://martinfowler.com/eaaDev/uiArchs.html

Sohnee
Okay, thanks for that - but still, it doesn't quite answer who the controller is in my case - Program.cs which creates the ProgramContext or the ProgramContext itself?
ApoY2k
Well, Program.cs just orchestrates the application, it shouldn't have anything more going on. You should have an actual controller for your application, called MyApplicationController, which prepares the model containing the required data and passes it to the view (and then receives the model back and decides what to do next).
Sohnee