I've started a small application in WPF and used a Singleton class to handle all the application logic. Plus I had a few ObservableCollections there that are binded to DataGrids on the View.
The problem: what was supposed to be a small program started to grow in functionality and the code is now too hard to maintain, reuse and there is a high level of code coupling.
And so I've started to move the code to other classes. For example, I've a class that just handles the File readings. I've made this class static because I just run those methods once (when I need to import data to a database), and when they are finished I don't need those objects anymore and just forget that they exist.
Now I'm considering doing the same for other methods, like the ones that retrieve data form the database.
My doubt is if that is that the correct way to solve the problem? I'm afraid that the use of a static classes will be like a multiplication of singletons.
Aucun commentaire:
Enregistrer un commentaire