The first concept in optimization is having a model by which to organize your program code. The name of the model that developers are using today is the MVC model. The acronym MVC expands to Model View Controller model, which sounds somewhat redundant; however, it is important to have a model for the thing that the code is supposed to represent, in addition to a model or an architecture for the code itself. For example, a motor vehicle has at least 2 wheels and a steering device. So, if you have modeled a real-life object like a motor vehicle, you probably have a blueprint that specifies these and other major factors. That is the model that your code is based on; because the code is a separate thing, it has its own architecture. The main workings of the program code are the model of the model.
The code model of the real-life model should operate without being attached to a Graphic User Interface, or the view. This allows the graphic user interaction to become a separate piece of code, the view portion of the MVC model.
Separating the model from the view allows you to change to a new GUI as appropriate without making any changes to the model that the code is trying to represent.
The third component of the MVC model is the controller. This is often considered to be the main method, or the driver program. This is the logic that you can not include in the model or in the view, but it makes them communicate with each other, so it drives the process.
Whenever you write a program, try to divide the code into these three components. It will help organize your code, and increase its maintainability and reusability.
Select the "Next" link to discuss the second guideline.
|Previous Page||Page 4 of 9||Next Page|
|Copyright 2012 Yvonne V. Richardson|