July 7, 2023

Declarative versus Imperative

A lot of the Jetpack Compose propaganda brags that Compose is declartive rather than imperative. Maybe so, but exactly what does this mean and why is it better if indeed it is.

The React web framework makes the same claim, so you can read the literature on React for insight. A declarative language lets you express what you want as a final result. An imperative language on the other hand expects you to express the steps along the way in detail. This is a lot like functional programming, where you define what things are rather than telling the computer what to do.

Amusingly, I find Jetpack Compose described as "reactive" -- whatever that is supposed to mean.

Of course I find myself wondering if this is just the latest software development fad that people have gotten excited about. No doubt that is true, but that is no reason to throw the baby out with the bathwater. Declarative UI programming is a useful programming paradigm. Almost anything would be better than editing reams of XML files like the old "view" based android UI programming scheme.


Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org