Understanding the Declarative Paradigm
Jetpack Compose marks a fundamental shift in Android UI development. While the traditional view-based approach is centered on components and classes, the new framework follows a declarative approach.
In Chapter 1, Building Your First Compose App, I introduced you to composable functions, the basic building blocks of a Compose-based UI. In this chapter, we will briefly review how Android UIs are implemented with traditional classes and techniques. You will learn about some issues of this approach, and how a declarative framework helps overcome them.
The main sections of this chapter are set out as follows:
- Looking at the Android view system
- Moving from components to composable functions
- Examining architectural concepts
We’ll start by looking at my second sample app, HelloView
. It is a re-implementation of the Hello
app from Chapter 1, Building Your First Compose App. HelloView
uses views, an XML layout file,...