Introduction to Model-View-Presenter (MVP)
Over the course of developing the Tetris application, we attempted to add structure across our code base by separating out program files into different packages based on the tasks they performed. We tried to abstract application logic into the AppModel
class, and user interactions related to gameplay to be handled by the TetrisView
view class. This certainly brought some order into our code base in contrast with, say, putting all logic into one big class file.
Needless to say, there are better ways to separate concerns within an Android application. One way is the MVP pattern.
What is MVP?
MVP is a common pattern in Android that is derived from the Model-View-Controller (MVC) pattern. MVP attempts to view related concerns from application logic. There are many reasons for which this is done, such as:
- To increase the maintainability of a code base
- To improve application reliability

Let's familiarize ourselves with the actors in the MVP pattern.
Model
In...