Using the Pattern

As we have covered, there are many ways to use this pattern. This pattern can be combined with other patterns that are completely different, or the same pattern in combination with other MVC triads. As an example, we could have one MVC in our PHP code and another MVC in our JavaScript code. There are also many different ways to interpret the MVC patternno one way is the absolute and only way because the best solution for a situation is always the one that works best. As I said, this pattern can be used to simply organize your JavaScript and your PHP code into separate MVC patterns of their own, or it can be used to organize all your code into one combined MVC pattern. In the last section, we covered how we already combined our JavaScript objects for the Accordion component into an MVC pattern, whether or not we knew we were doing it when we built the accordion. Figure 15.5 shows a graphical representation of the PHP and the JavaScript organized into one combined MVC pattern.

Figure 15.5. Graphical representation of the PHP and JavaScript organized into one combined MVC pattern.

In conclusion, this pattern is a great way to abstract our code into layers so that all objects have a common pattern for interacting with other objects. By following this pattern, we avoid having mixed connections, which could ultimately lead to tracking down what objects are connected to others. Finding an issues is usually harder than fixing the issue itself, which is why when following common patterns, the maintenance tasks become easier to manage because there is a logical flow to the application. This allows us to focus more quickly on specific areas that may be causing issues, which is the power of this pattern because it becomes more than handling a programming taskit becomes a way to structure and manage large amounts of data in a more efficient manner.

Ajax for Web Application Developers
Ajax for Web Application Developers
ISBN: 0672329123
EAN: 2147483647
Year: 2007
Pages: 129
Authors: Kris Hadlock

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: