Introducing the model-view-controller pattern
Model View Controller is the separation of different aspects of our app into distinct parts called layers. Android apps commonly use the model-view-controller pattern. A pattern is simply a recognized way to structure our code and other application resources, such as layout files, images, and databases.
Patterns are useful to us because, by conforming to a pattern, we can be more confident we are doing things right and are less likely to have to undo lots of hard work because we have coded ourselves into an awkward situation.
There are many patterns in computer science, but an understanding of MVC will be enough to create some professionally built Android apps.
We have been partly using MVC already, so let's look at each of the three layers in turn.
Model
The model refers to the data that drives our app and any logic/code that specifically manages it and makes it available to the other layers. For example, in our Note to Self app, the Note...