In part 2, we will learn what is MVC pattern.
Model-View-Controller (MVC)
CodeIgniter is based on the Model-View-Controller development pattern aka “MVC“. MVC is a software approach that separates application logic from presentation.
Model
The Model represents the data structures (tables in your database). The model classes will contain functions that retrieve, insert and update the data in your database.
View
The View is the information that is showing to a user. Normally the View is a web page.
Controller
The Controller is a glue between the Model and the View.
MVC pattern diagram
Conclusion
In CodeIgniter3 tutorial part 2, we learn what is MVC pattern. From the diagram, we learn the Model represents the data structure from the database. We also learn the View represents the web page where the users can see the response from their request. We learn the Controller handles the requests from the user and communicates between the Model and View.
CodeIgniter3 tutorial series:
- CodeIgniter3 tutorial part 1 – Installation and Configuration application
- CodeIgniter3 tutorial part 2 – Explain MVC pattern with a simple diagram
- CodeIgniter3 tutorial part 3 – Create a Model, View, and Controller. Create routing.
- CodeIgniter3 tutorial part 4 – Add new data into the database via an adding form.