NavigationUser login |
Developer GuideThis document describes Modern Merchant from a developer's perspective. To learn how to extend Modern Merchant using the plugin system, click here. MVC - Model, View, ControllerModern Merchant is built on a popular, proven architecture pattern called MVC. Read further to learn about how Modern Merchant uses MVC.ControllersThe Controllers are the overarching "backbone" of execution for any given request. The objects representing the Controller are easy to find because they are named with the word 'Controller'. Branching off the controller is the Model and View. The Controller objects in Modern Merchant are each divided into smaller parts called actions. Clients interact with the application by calling individual actions. More than one action may execute during a single request, but only one action may be requested by the client for each request. Each action is represented by a object method with a special naming convention: runXXXXAction(). Here is a partial example of a controller:
<?phpBusiness ObjectsBusiness Objects are the fundamental objects of the application. They represent the business' data and they enforce business' rules. Here is an example of a Business Object:
<?phpData Access Objects (DAO)Data Access Objects and Data Objects form the persistence mechanism of the Model. The Data Access Object is an object design pattern where an interface stores and retrieves business objects from a persistence engine (like a database). These objects are all named so that they end in DAO. Before the DAOs were introduced into Modern Merchant, all the SQL queries were performed within the Controller actions (see Controller). While this approach makes it easy to see how things work from top to bottom, it results in duplicated code, bloated controllers, and a codebase that is resistant to major changes. Here is a partial example of a DAO:
<?phpPlugins99% of Modern Merchant's code can be found in the various plugins that are installed. Writing Modern Merchant code means writing plugin code. See the plugin guide on instructions for developing a plugin.
|