Today I had a really interesting conversation with my CTO about something that seems simple:
Why did Android use XML for UI?
At first, it’s easy to look at it from today’s perspective and think:
“Why not just write everything in Kotlin?”
But the conversation went deeper than that.
XML and HTML are not that different
One of the first things we talked about is how XML and HTML are actually quite similar.
Both are markup languages.
Both describe structure.
But the key difference is intention.
HTML is flexible.
XML is strict.
And that strictness was exactly what Android needed.
Why Android chose XML
Back then, Android needed a way to describe UI that was:
- Structured
- Predictable
- Easy to parse
- Separate from business logic
XML fit perfectly.
It allowed the system to define layouts in a consistent way,
while keeping the UI description independent from the code.
It wasn’t about being “modern.”
It was about being reliable.
What started to break over time
But as apps became more complex, the limitations started to show.
- Too much separation between UI and logic
- Harder to handle dynamic behavior
- Boilerplate everywhere
- More friction when state changed
What once felt structured…
started to feel rigid.
What modern tools are actually solving
Tools like Jetpack Compose didn’t appear randomly.
They solve very specific problems that XML had.
Instead of describing UI as static structure:
- UI is now driven by state
- Logic and UI are closer
- Less boilerplate
- More flexibility
It’s not just a new syntax.
It’s a different mental model.
One important realization
Something that really stuck with me from that conversation:
Even if the way we write UI changed…
Android still needs to render something on screen.
Before, it was based on XML layouts.
Now, it’s based on composables and a runtime system.
But in the end:
everything becomes a structured UI that the system can understand and render.
What this changed for me
It made me think differently about how I see technologies.
Instead of asking:
“Is this better?”
I try to ask:
“What problem is this solving that didn’t exist before?”
And that changes everything.
Final thought
XML wasn’t a bad decision.
It was the right decision for its time.
And modern tools are not just improvements.
They are responses to new needs.
Understanding that…
helps you make better decisions as a developer.
Top comments (0)