1

Is it correct that MVC is an architectural pattern only for user-interactive applications? (That is my understanding.)

An application can interact with users via GUI or CLI. Does MVC apply to both GUI and CLI applications? (I guess so, but am not sure.) What architectural pattern(s) is used for CLI, if not MVC?

If an application doesn't interact with users, what architectural pattern(s) is used similarly for non-interaction part of MVC if any?

Thanks.

  • <pedantry warning> I mean, it's technically not impossible to have a CLI application that pretty-prints its output, and you could use a homebrew MVC architecture for it, if you really wanted to. It'd be massive overkill and is not in any way indicative of current business standards. But technically, it's not only for GUI-driven applications. </pedantry warning> – Flater Dec 8 '19 at 15:10
  • Thanks. What architectural pattern(s) is used for CLI, if not MVC? – Tim Dec 8 '19 at 15:54
  • MVC is just one way to divide the tasklist of rendering output to the requester. Whether you use MVC or any other approach, the sum of its parts (rendering output to the requester) stays the same. What you're asking is akin to asking what vehicle you use to go to the shop, if not a car. You can use any vehicle, really. But if the shop is literally next door, a vehicle is overkill regardless. – Flater Dec 8 '19 at 20:13
2

If you see in wiki, they said,

Model–View–Controller is a software design pattern commonly used for developing user interfaces which divides the related program logic into three interconnected elements.

That means It works only for user-interactive applications.

If an application doesn't interact with users, what architectural pattern(s) is used?

It depends on the detail requirements of you application. For example, a robotic system can use Sense-Plan-Act pattern on the other hands a backend server can use Adapter pattern. Interpreter pattern can be used to interpret transferring messages over backend modules. Blackboard pattern can be used for non deterministic control strategy for backends and so on.


Blackboard pattern: The blackboard pattern is a behavioral design pattern that provides a computational framework for the design and implementation of systems that integrate large and diverse specialized modules, and implement complex, non-deterministic control strategies.

Adapter pattern: The adapter pattern is a software design pattern (also known as wrapper, an alternative naming shared with the decorator pattern) that allows the interface of an existing class to be used as another interface. It is often used to make existing classes work with others without modifying their source code.

Interpreter pattern: The interpreter pattern is a design pattern that specifies how to evaluate sentences in a language. The basic idea is to have a class for each symbol (terminal or nonterminal) in a specialized computer language. The syntax tree of a sentence in the language is an instance of the composite pattern and is used to evaluate (interpret) the sentence for a client.

  • Thanks. What architectural pattern(s) is used for CLI: MVC or something else? – Tim Dec 8 '19 at 15:54
1

Is it correct that MVC is an architectural pattern only for user-interactive applications? (That is my understanding)

Your understanding is correct.

Machine-interactive applications in contrast to user-interactive usually don't need to present views for the client API. Yet the controller and the model part are useful to be wrapped and exposed with an appropriate API.

Probably the Facade or Bridge should become a choice in such situation.

The main difference is that there's no need to render a view of the underlying model as the result of a request or action. Machine interfaces can interact more efficiently based on certain protocols.

  • Thanks. Sorry for confusion, when I wrote "user interactive", I meant both human user and machine user. (1) In case of human users (or regardless of human or machine), does MVC apply to both CLI and GUI, or just to GUI? (2) If an application doesn't interact with human or machine, is any part of MVC still useful? – Tim Dec 8 '19 at 13:11
  • @Tim The main difference I see is that a machine relying on parsing the diverse UIs is a heavy job to program, and involves a lot of overhead to do in machine based clients. There's rarely an easy, well defined, and predictable protocol presented to human users, because there's a significant difference for the communication at this level. Thus for machine-interactive applications I wouldn't use it. – πάντα ῥεῖ Dec 8 '19 at 13:17
  • @Tim Feel free to clarify your question please. – πάντα ῥεῖ Dec 8 '19 at 15:18
  • Thanks. What architectural pattern(s) is used for CLI: MVC or something else? – Tim Dec 8 '19 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.