Sunday, January 29, 2017

Model Viewer Controller

Model Viewer Controller


Since the very first time I tried to write codes until two weeks ago I never realize whats so important about having a good abstraction to what we are going to code. My interest in MVC came when I tried thinlet, a tool for Java that separate UI from the business process. While the business place take places at one or some classes, the UI itself being written in an XML file that contain both the UI and its interfaces to the business process.

OK, now what is this MVC really about? In my own words it is: A separation between Model (Data), Viewer (UI), and Controller (The Business Process). Why it is so important anyway? Imagine you build a huge application. When you have reached the latest stage, then the customer ask for some minor changes in requirement. What will happened? A total mess, huge cost... Its probably debatable, but I already tasted it :P

So, hows the implementation of MVC? Simply said, create your application with a will to do this: never mix Model, Viewer, and Controller code in the same place. Create interfaces to connect one to another. This may be a lot of work... but believe me, its worthed :) You can try something like this: User Interface (User Action Called) --> Controller (Update Model) --> Model --> Controller (Update User Interface) --> Interface

Available link for download