04-29-2013 02:29 PM - edited 04-29-2013 02:30 PM
Hi,
I am trying to make my code more reusable and apply a consistent UX across all of the software I develop. Having spent ages looking at lots of different design patterns including producer/consumer, queued message handlers, Model View Controller and Model View Presenter, I have come to the conclusion that MVP (or its successors Passive View and Supervising Controller) is the most modular. I really like the idea that the UI is decoupled from the other logic and can be swapped easily with a dummy for unit testing, different system etc. While this is great in theory, I am having a hard time implementing it with the lack of local data binding/ability to create properties for a view. What I am trying to achieve is described here: http://blog.informatech.cr/2013/03/19/ui-design-using-model-view-presenter-part-1/ and here: http://blog.vuscode.com/malovicn/archive/2007/11/04/model-view-presenter-mvp-design-pattern-close-lo...
It’s seems so straight forward and logical in C#, but this doesn’t appear to be the case in LabVIEW.
I want to make the view as passive/dumb as possible and any changes that affect the view, handled by the view (e.g. if a string is too long to be displayed in the indicator the view handles the resizing positioning etc.).
Please help, going mad at the moment 😕
Note: Currently using LabVIEW 2009, but may be upgrading later this year.
Thanks,
Matt
04-30-2013 08:23 AM
Have you seen this by Mike Bailey?
Have tried a similar thing myself with the Presenter/Controller being the main VI that launches the View as a daemon, and then the model generally being an action engine or FGV that is called statically from the presenter/controller.
I must investigate MVC in C# at some point.
https://decibel.ni.com/content/docs/DOC-21531
05-01-2013 04:32 PM
Thanks David.
Yeah, I had a look at this a while back and stumbled upon it again recently. Also had a look at this: https://decibel.ni.com/content/docs/DOC-13311 (Apendix II of pdf) which was good at making sense of it all.
I will have another think about how to use these (my head's turned to mush at the moment). One thing I don't want to do is create lots classes if I can help it.