Cross-posted from ricardocosteira.com
A few days ago, I worked on a sample project for a tutorial. It was a very simple app: a list of images, where you could click any image to view it in full screen. The code was simple, well structured, did what it had to do, and did it well. There was only one problem: the
RecyclerView responsible for showing the image list was resetting its state, i.e., its scroll position, when you came back to it after checking an image in full screen.
Well, this can’t be right… I know I’m doing everything I’m supposed…
A few months ago, I was washing my dishes while listening to episode 148 of the Fragmented podcast. In this episode, Donn Felker and Kaushik Gopal talk about architecture. To be specific, about an MVI-like architecture that Kaushik has been using.
This architecture specifies that each screen has one and only one
ViewModel, that exposes a single observable to the
Fragment. This observable emits the screen’s state: when an update is required, the observable emits a new state object, which the view uses to update its state. To emit a state update, the
ViewModel has to receive an…
Change will always affect your software. No matter the domain, the uses cases, the developers, or even the users. Change is the one constant in software development.
This is one of the first topics addressed by the authors of the renowned Head First Design Patterns. They approach it as one reason for the importance of design patterns.
“No matter how well you design an application, over time an application must grow and change or it will die.“
— Head First Design Patterns, Chapter 1, page 8
Along with design patterns, the authors also introduce a bundle of design principles. While…