21.1. Designing the Core
The steps to becoming a great programmer revolve around the core of the application:
You program procedurally using a collection of includes.
Next you build your own framework to use as a base for your next project.
You then abandon your framework and leveraging existing proven frameworks in your project.
Normally, I move forward using what I've learned by getting to step 3 and would recommend one of the frameworks mentioned in Chapter 2. However, because I'm trying to demonstrate the usage of Design Patterns from an initial planning perspective, I am opting to create a very simple framework. While existing frameworks would jumpstart this application, the code is already written by someone else. I can only make guesses as to the thought processes of the original programmers.
A type of architecture I favor is Model-View-Controller, or MVC. To begin the core of the application, I'm going to build three objects, a controller, a module (or model), and a view object.
Figure 21-1. Figure 21-1
The Controller object (Figure 21-1) will be responsible for determining what type of action the application is trying to accomplish from the web request. It has two public methods, __construct() and render(). __construct() will be responsible for making sense of the web request. It will also process any posted information. render() will be responsible for executing the proper ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access