Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can I Keep The 'GUI' Layer Out Of The 'Business Logic' Layer?

I currently have a project that is a 'Business Object' project, and our goal is to have a clear separation between the GUI and the Business Objects. However, my project has a reference to System.Windows.Forms and that's a big red flag to everyone that my project is poorly designed.

My problem is that I'm using a 3rd party control called 'Active Query Builder'. It's literally a 'Control' as in GUI, System.Windows.Forms.Control; but it is never displayed anywhere, added to any Form's Controls collection. And it provides much of the core functionality of the Business Object.

Anyway, without the reference to System.Windows.Forms - I can't use the 3rd party control and the BO is horrifically broken. But I'm told I can't have a reference to System.Windows.Forms because it's bad coding practice.

And I'm at a complete loss for what to do.

Can someone with more design-pattern type experience offer up a solution?

like image 464
Rob P. Avatar asked Dec 18 '22 08:12

Rob P.


1 Answers

So you have a library which references WindowsForms, but doesn't use anything directly? Your BO project is not messing around with any of the forms?

I think you're fine then, the reference is a red flag which says wait why am I doing this. But so long as the layer is still logically seperated then IMHO your ok.

One thing you could do is abstract this out into another project that would handle interacting with the query builder. So your BO project would work with the Query Builder project which would know how to use this control.

like image 82
JoshBerke Avatar answered Dec 28 '22 08:12

JoshBerke