Common implementations of MVC pattern

By Jacob Chencha
iHub
  Published 21 Jun 2015
Share this Article

As far as design patterns go, MVC is the most well known pattern.

Model

This component contains the data structures and logic that are unique to your business. That is what the application does to add value. Examples of this would be your firebase models.

View

This component interacts with the users of the application.An example would be the html rendered in the browser. Ideally, the view should listen for changes in the model and respond to them.Most modern Javascript frameworks allow you to do this.

Controller

The controller processes requests incoming from the user and sends them to the model as commands.

Of course the pattern is a general principal. To its end a couple of popular implementations have emerged which we will look into in brief.

Configurator/Actor

In this pattern the controller writes out a request to shared file such as a dot file. A daemon running in the background would then read this file and perform an activity based on it.

Spooler/Daemon

This particular pattern is best illustrated by the print spool. The front end (your machine) drops files to be printed in a spool area. A printer daemon running in the background watches for new files and when they come it send them out to the printer. Once the job is done, the file is removed from the spool area. It is noteworthy that this pattern would work well with jobs that would benefit from batch processing.

Driver/Engine

In this pattern the driver provides commands and interprets output from an engine after startup. An example of this would be where a utility meant to periodically fetch content from say ten different websites starts up curl in the background and uses it to do the actual fetching.

Client/Server

This is the browser/server pair where requests are sent to a daemon running in the server such as nginx which then processes the request and sends a response back. This pattern can be thought of as an implementation of the Driver/Engine pattern. Do you know of any other implementation of the MVC pattern? Talk to us in the comment section below

comments powered by Disqus