Webocreation

Saturday, April 16, 2011

Model-View-Controller in Opencart






Model-View-Controller in Opencart
Opencart is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. In practice, it permits your ecommerce site which will contain minimal scripting since the presentation is separate from the PHP scripting.
  • The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database.
  • The View is the information that is being presented to a user. A View will normally be a web page, but in Opencart, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of "page".
  • The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.
Opencart has a fairly loose approach to MVC since Models are not required. If you don't need the added separation, or find that maintaining models requires more complexity than you want, you can ignore them and build your application minimally using Controllers and Views. Opencart also enables you to incorporate your own existing scripts not needed to follow the patterns but it will effects when you wanted to upgrade the Opencart  If we follow the patterns then it will be easy for us and the system.

Design and Architectural Goals with the reference of E-commerce

The goal of Opencart is to maximize the performance, capability, and flexibility in the smallest, lightest possible package.
To meet this goal programmers are committed to benchmarking, re-factoring, and simplifying at every step of the development process, rejecting anything that doesn't further the stated objective.
From a technical and architectural standpoint, Opencart was created with the following objectives:
  • Dynamic Instantiation. In Opencart, components are loaded and routines executed only when requested, rather than globally. No assumptions are made by the system regarding what may be needed beyond the minimal core resources, so the system is very light-weight by default. The events, as triggered by the HTTP request, and the controllers and views you design will determine what is invoked.
  • Loose Coupling. Coupling is the degree to which components of a system rely on each other. The less components depend on each other the more reusable and flexible the system becomes. Our goal was a very loosely coupled system.
  • Component Singularity. Singularity is the degree to which components have a narrowly focused purpose. In Opencart, each class and its functions are highly autonomous in order to allow maximum usefulness.
Opencart is a dynamically instantiated, loosely coupled system with high component singularity. It strives for simplicity, flexibility, and high performance in a small footprint package.

MVC description of the opencart, opencart design and architectural goals

1 comment: