MVC Architechture & OOPs in JavaScript using PhoneGap

Introduction:
In this post, we’ll look into the creation of MVC architechture in Javascript. Using MVC in PhoneGap applications makes them modularize, which is much helpful during big projects and most of all, makes them easy & simple to handle and review during maintenance. Use of Oops concept, helps us making multiple instances of Model/Controller that can be used with multiple views, each having it’s own scope.

Description:
First of all, let’s have a look into the MVC architecture. As we know Model creates the bridge between the database and the Controller, whereas View manages the UI in associate with the Controller. So, the vital part is the Controller, which builds the passage between the Model and View, passing the data
to & fro. The Controller contains all the logical codes that need to be done, and rest Model & View just contains the code required to manipulate the data.
Let’s go with a small application for better understanding. So here is the basic requirement, we will be having some students info stored on the local sqlite database and our job is to retrive those students and list them on the list view.

Continue reading