开发者

What do you call a generalized (non-GUI-related) "Model-View-Controller" architecture?

开发者 https://www.devze.com 2022-12-23 04:58 出处:网络
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 eme

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 m开发者_如何学Pythonore 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号