Implementing Object Oriented MVC in Python and also in plain Javascript vs. Vue.js Javascript framework
Is converting a plain Javascript GUI app to OO MVC worth it?
The Model View Controller (MVC) design pattern is almost universally acknowledged as a good thing — it separates the concerns of the model from the view, with the controller responding to events and populating the GUI.
But does the average Javascript (and JQuery) programmer, who is building a web app, and who is not using a fancy framework like Angular or Vue.js using MVC? Arguably if you have a JSON data structure that you want to visualise (the model), and some GUI event handler functions (controllers) then you are doing some form of MVC.
I believe there are benefits to introducing proper controller classes and Observer design pattern events to your GUI apps, and doing MVC in a more organised way.
I believe there are benefits to introducing proper controller classes and Observer design pattern events to your GUI apps, and doing MVC in a more organised way.
So I went about building a small, simple, traditional form based application in Javascript in three different ways!
A simple, ad-hoc, plainjavascript/JQuery implementation
An Object Oriented, MVC(Model View Controller) implementation utilising the Observer design pattern
A Vue.jsimplementation
I built the various implementations in both Javascript and Python
I built the various implementations in both Javascript and Python — so that you can chose which language you are more familiar with. The main article uses Javascriptand the DOM for its discussion and examples.
The Python implementation has a section at the bottom of the article.
Modules being visualised
List of repository modules/files being visualised in the above diagram: