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.

Get Kotlin Programming By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.