Reputation: 6934
I am building a WinForms application that interacts with a running application. This application accepts COM commands to interact with live entities(objects).
My question is; what is the best way (design/architecture wise) to go about coding such an application? There is no need for me to code up classes/interfaces to represent the entities of which are described in the existing applications object model. As of now I have only the form class Visual Studio has created for me (and its designer class) containing all of my logic .. what is suggested? I have never really implemented MVC/MVP, is this such a case?
Upvotes: 1
Views: 104
Reputation: 10225
Disclaimer: I've never ever developed against a COM object in my life.
Question: what's the relationship between your WinForms app you're building and the COM based application it's calling?
Architecturally, if the Winform app is something that's going to stick around longer than the COM app then you'll want to use some form of abstraction between the WinForm's app and the COM app - so that when the COM app goes away it's not hard to reuse the WinForm app with whatever's replaced the COM app.
If the WinForms app's reason for living is the COM app then it's possibly not worth it (but I'd almost be inclined to anyway).
At the most basic level, add a new class library to your WinForm solution and put all the com dependencies and code in there; your WinForm app will then reference this project. If you wanted to be even more tidy you could use interfaces, dependency Inversion, etc.
Upvotes: 1