Moodle application layers

In terms of application architecture, Moodle can be thought of as having three layers--diagrammatically looking rather like a layer cake:

By shine Oa (originally posted to Flickr as wedding cake) [CC BY 2.0 ( http://creativecommons.org/licenses/by/2.0)], via Wikimedia Commons

At the top is the presentation layer--this displays output to the user but also accepts data from users through HTML forms. Next is the business layer and, beneath that, the data layer. The data layer is relatively easy to understand: it is where user data is maintained, where quiz questions would be stored, where grades are recorded, and so on. The business layer is where the information from the data layer is processed ready to be passed up to the presentation layer--for example, quiz questions are formed into a quiz. The business layer is also responsible for taking data from the presentation layer and processing this ready for storage by the data layer--for example, the final grade from a quiz.

In the previous section, we have been considering what the user will see (the presentation layer). At the core of Moodle sits the application data--the contents of the Moodle database. Sat between these three layers (including between the presentation layer and the user)--and the means by which application layers talk to each other--are the APIs.