In my latest WPF applications I've been using a Singleton class, that I call Model, to contain all my application's logic, such as file reading, information handling, etc..

In the WPF Views or Windows I just call the methods that I need, when I need them: Model.Instance.GetProducts(string category);

Besides having always the same instance, I find this convenient because I can call any method that I want in any window, and I can define the Model in App.xaml to be a StaticResource and then do the bindings that I need. For example, set the Binding of a DataGrid to an ObservableCollection present in the Model.

What do you think of this approach? A few years ago at college, when working with Windows Forms we used to work with the MVC pattern, where the controller would contain some events that called methods from the Model, and those events would later be invoked by the Views.


1 Answer 1


God object is one of the worst "designs" you can create. Please, put some effort into separating different concerns. Your future self will thank you.

  • I was expecting that answer. The hard part how to fix it.
    – cap7
    Commented Apr 29, 2015 at 8:58
  • @cap7 Refactor it. Slowly and carefully.
    – Euphoric
    Commented Apr 29, 2015 at 9:00
  • I've already started. For example, I've a class that only handles the database querying. Since that class has no state and is just a series of related methods that, when given an input, will give you an output, it's is defined as static and once the methods are finished I just forget them. I don't know if that is the best option.
    – cap7
    Commented Apr 29, 2015 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.