Jetpack Compose Migration: Is Now the Right Time?

Shift to Jetpack Compose from XML, suggesting a gradual, simple transition.

Shirsh Shukla
4 min readDec 12, 2023

Hello, and welcome to this article. There are still a lot of people, myself included, who work on XML projects. You know, there are just some older code bases that still use XML, and you can easily migrate to Jetpack Compose in just a week or so. Despite this, I believe there are many questions when migrating from XML to Compose.

In one sense, should you migrate to Compose, or are you perfectly happy with XML? Secondly, if it’s a good idea, how should it be done? Would it be better to migrate everything at once, or should it be done step-by-step? Thirdly, do you think it’s important to use XML or Compose when creating a new Android project? Here are a few quick questions that I will answer in this article.

Currently, I have worked on a variety of different projects of various sizes. I’ve worked on pure XML projects, projects that partly use Compose and partly XML, and pure Compose projects. In terms of choosing between XML or Compose, I think I have a good sense of what makes sense for a code base.

Migration to Compose isn’t just about telling you it’s the best technology. In my opinion, I should evaluate the issue from a company’s perspective, where time, money, and resources are crucial. The first question is: should you even migrate from Jetpack Compose to XML? As a result of my recent experience, where I have worked mostly on Compose and also on XML code bases, I strongly believe that Composed code bases are easier to maintain.

In terms of UI, they are easier to use, more convenient to work with, and easier to extend. Overall, many developers have told me that Jetpack Compose is much more enjoyable than XML. While that is true, it does not mean your first priority should be to migrate an XML codebase to Jetpack Compose.

According to my experience, there is a clear strategy that gives the greatest return on investment. As part of that strategy, we are going to build new features directly into Jetpack Compose. As you may know, Compose and XML are interoperable, so they perfectly work together. Hence, you can now start building new UIs directly in Jet Compose, while leaving the old code untouched.

As a result, you don’t need to waste time on refactoring, and you get a partly better code base as a reward. As an app developer, your number one priority should always be making your users happy and delivering a working product. No matter whether it is done with XML or Jetpack Compose, that is secondary. Make sure you keep your focus on the purposes of your app, the actual problems it should solve for your users.

Second, whenever you need to make changes to an older feature, I personally migrate its UI to Jetpack Compose as soon as possible. By migrating to Jet Compose first, you can take advantage of Jetpack Compose directly thereafter. This is because you need to modify that feature, which can be done faster with Compose code.

The Jetpack Compose migration strategy simplifies the process of migrating large XML code bases to Jetpack. As a result, migrating a large XML code base like this might take one or two years, but then you’ll be done. In order to migrate to Compose, the company does not need ten full-time developers who work on it full-time.

So that should have also answered your question about what Android project type you should now be using. Compose should definitely be used. You will find it to be very helpful. Consequently, if you have not yet learned Jetpack Compose, now is the time to learn it; otherwise, you will fall behind. We have to stay on top of the latest technologies that seem to be the future to develop Android, or develop software in general. So either play the game or lose. There must be a reason for most bigger companies to move to Compose, as I’ve heard of many doing so.

so that’s my take on moving from XML to Jetpack Compose in Android. What’s your experience been like? Drop a comment and let’s discuss about it. Whether you’ve had smooth sailing or hit some bumps, I’m curious to hear your thoughts. It’s all about sharing and learning from each other in this Android development journey, so spill the beans in the comments!

If you got something wrong? Mention it in the comments. I would love to improve. your support means a lot to me! If you enjoy the content, I’d be grateful if you could consider subscribing to my YouTube channel as well.

I am Shirsh Shukla, a creative Developer, and a Technology lover. You can find me on LinkedIn or maybe follow me on Twitter or just walk over my portfolio for more details. And of course, you can follow me on GitHub as well.

Have a nice day!🙂

--

--

Shirsh Shukla

SDE at Reliance Jio | Mobile Application Developer | Speaker | Technical Writer | community member at Stack Overflow | Organizer @FlutterIndore