PHP Model, Controller, and Control Objects
Now that you have seen examples of object-oriented programming in both PHP and JavaScript, it is time to revisit some examples from Chapter 2. The examples in Chapter 2 of the front, view, and business controllers, and the model were created as functions. While this works well and is fully functional, by changing the code to be object-oriented, further simplicity and greater flexibility can be achieved in larger-scale applications. Some of these objects and how they interact are shown in Figure 3-5.
As we did in Chapter 2, let’s begin with the model. The PHP example will be shown first, followed by the JavaScript example.
The purpose of the model is to hide the complexity of interacting with the data. ...
Get Oracle Database Ajax & PHP Web Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.