WHAT TO EXPECT WHEN WHAT TO EXPECT WHEN YOU'RE EXPECTING... JETPACK YOU'RE EXPECTING... JETPACK COMPOSE COMPOSE
Mark Murphy, CommonsWare mmurphy@commonsware.com
WHAT TO EXPECT WHEN WHAT TO EXPECT WHEN YOU'RE EXPECTING... JETPACK - - PowerPoint PPT Presentation
WHAT TO EXPECT WHEN WHAT TO EXPECT WHEN YOU'RE EXPECTING... JETPACK YOU'RE EXPECTING... JETPACK COMPOSE COMPOSE Mark Murphy, CommonsWare mmurphy@commonsware.com NEW TALK, WHO DIS? NEW TALK, WHO DIS? NEW TALK, WHO DIS? NEW TALK, WHO DIS?
Mark Murphy, CommonsWare mmurphy@commonsware.com
BECAUSE COMPOSE HASN'T BEEN AROUND LONG BECAUSE COMPOSE HASN'T BEEN AROUND LONG Announced at Google I|O 2019 First bits released fall 2019 Role: replacement UI framework Timeline Now: developer preview "Summer 2020": alpha 2021: stable
@Composable fun NewsStory() { val image = imageResource(R.drawable.header) Column(modifier = Modifier.padding(16.dp)) { val imageModifier = Modifier .preferredHeightIn(maxHeight = 180.dp) .fillMaxWidth() Image(image, modifier = imageModifier, contentScale = ContentScale.Crop) HeightSpacer(16.dp) Text("A day in Shark Fin Cove") Text("Davenport California")
THOSE WHO DO NOT LEARN FROM HISTORY... THOSE WHO DO NOT LEARN FROM HISTORY... 2017: Oh, you're interested in Kotlin? 2018: We support Kotlin! 2019: Kotlin first! But we still support Java! (hint: they said that once about Eclipse)
DEVELOPERS DON'T GROW ON TREES (USUALLY) DEVELOPERS DON'T GROW ON TREES (USUALLY) Hiring Android talent has been tough... until 2020 upended matters Being considered "behind the times" makes that tougher How long before you can't land talent because you're using Java? Reasonably likely that Compose will have a similar effect
VERSUS, Y'KNOW, LATER VERSUS, Y'KNOW, LATER Do you remember how that Kotlin migration went? Migrating to Compose will be narrower yet more complicated Narrower: effects grow closer you get to the UI rendering Complicated: less automatic tool support, most likely Perfect Planning Prevents Poor Production... Perhaps
BESIDES FEWER MURDER HORNETS BESIDES FEWER MURDER HORNETS Minimize transition pain... with minimal extraneous prep work, in case Compose fizzles Identify opportunities to improve the apps... as Compose itself is largely a lateral move
ALL THE THINGS! MOSTLY! ALL THE THINGS! MOSTLY! Compose relies upon a Kotlin compiler plugin to perform its magic Net: Java ain't walkin' through that door By the time Compose is mainstream, Java will be tech debt
THEY'RE PROBABLY CRUFTY THEY'RE PROBABLY CRUFTY Move everything you can into styles, themes, dimension resources, etc. Those still have roles in Compose More tools/libraries to assist, such as Accompanist Objective: minimize what is in the layouts, since those get rewritten
CAN'T MAKE AN OMELETTE... CAN'T MAKE AN OMELETTE... Data binding is tied to layout resources Layout resources are going away (mostly) Net: your binding expressions will need to get replaced Maybe don't change what you have, but perhaps don't add more to the pile
private data class AgreementViewState( val terms: Boolean, val privacy: Boolean ) { fun canProceed() = terms && privacy } @Composable fun Agreement() { Column( verticalArrangement = Arrangement.SpaceAround, horizontalGravity = Alignment.CenterHorizontally ) { val viewState = state { AgreementViewState(terms = false, privacy = f Column(horizontalGravity = Alignment Start) {
(INSERT ANDROID STUDIO HERE) (INSERT ANDROID STUDIO HERE)
YES, ALL OF THEM YES, ALL OF THEM Compose designed for unidirectional data flows State flows down Events flow up Widgets are not stateful May require some tweaking of your approaches (e.g., two-way data binding) Consistent architecture will simplify migration
MAKE GOOGLE HAPPY! USERS TOO! MAKE GOOGLE HAPPY! USERS TOO! Landscape? Dark mode? Split-screen?
CREW DRAGON HAS TOUCHSCREENS, SO... CREW DRAGON HAS TOUCHSCREENS, SO... Things that are "game changers" that Compose might make easier to achieve Example: Desktop via ui-desktop Kotlin/Multiplatform Windows/macOS/Linux via the JVM Can you expand your market with modest re-engineering?
SKIN YOUR KNEES EARLY! SKIN YOUR KNEES EARLY! By the time Compose reaches beta, try to start experimenting Partly, so you can learn and use that knowledge to better steer your plans Partly, so you can tell us what you need to succeed Tell your favorite GDE Tell your favorite Compose library maintainer Tell #compose on Kotlinlang Slack (or DM me there)
OR PERHAPS JUST GENTLE CONVERSATIONS OR PERHAPS JUST GENTLE CONVERSATIONS Why are we bothering with Compose? (recruiting) Will this interrupt our delivery schedules? (hopefully not, using progressive replacement) How does this help our users? (tactical UI changes plus moontshots) How does this help the CEO's golf game? (you're on your own for that
WHAT? WRONG QB? WHAT? WRONG QB? Expect a significant hype train All the cool kids will be slinging Compose code You will get your turn too Do right by your users and your team, and don't Compose without a plan
https://commonsware.com/presos/2020-06-Compose/