views:

53

answers:

1

I am currently refactoring code that coordinates multiple hardware components for data acquisition, and feeling a bit like I'm recreating the wheel. In particular, an MVC-like pattern seems to be emerging. Except, this has nothing to do with a GUI and I'm worried that I'm forcing this particular pattern where another might be more appropriate. Here's my scenario:

Individual hardware "component" classes obey interface contracts for each hardware type. Previously, component instances were orchestrated by a single monolithic InstrumentController class, which relied heavily on configuration + branching logic for executing a specific acquisition sequence. After an iteration, I have a separate controller for each component, with these controllers all managed by a small InstrumentControllerBase (or its derivatives). The composite system will receive "input" either programmatically or via inter-hardware component triggering - in either case these interactions are routed to, and handled by, the appropriate controller.

So, I have something that feels MVC-esque, but I don't know if that's because I'm forcing the point. With little direct MVC experience in application development, it's hard to know if I'm just trying to make my scenario fit MVC, where another pattern might be a good alternative or complimentary. My problem is, search results and wiki documentation of these family of patterns seems to immediately drop me into GUI-specific discussions.

I understand "M means Model data and the V means View" - but what do you call the superset pattern? Component-Commander-Controller?

Whence can I exhume examples exemplary?

+2  A: 

IMO a "view" is not necessarily a GUI component. The pattern is easiest to demonstrate with GUIs but that does not limit its usability to GUIs. If it works for you, don't worry about the name :-) And of course, feel free to tailor it according to your needs.

Update: Of more generic kins of MVC, the only example which surfaced in my mind (after a day's background processing) is PAC.

Péter Török
Thanks! I see what you mean - View could just mean the externally-pointing interaction surface of a module, or "object" if you will :). Was interested in keywords as I am hunting for good examples of the pattern outside GUI programming.
David Cuccia
@David see one possible candidate in my update.
Péter Török
Thanks - yes, I did see that, but I missed the great reference to Avgeriou and Zdun:Paris Avgeriou; Uwe Zdun (2005). "Architectural patterns revisited - a pattern language". Proceedings of 10th European Conference on Pattern Languages of Programs (EuroPlop 2005), Irsee, Germany, July 2005. pp. 1–39. (pdf: http://www.daimi.au.dk/MultiCore/attachment/wiki/StudyGroup08/Plan/)
David Cuccia