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?
A BRIEF COMPOSE HISTORY A BRIEF COMPOSE HISTORY 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
A BIT OF COMPOSIN' A BIT OF COMPOSIN' @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")
REVISITING GOOGLE AND REVISITING GOOGLE AND KOTLIN KOTLIN 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)
TALENT ACQUISITION TALENT ACQUISITION 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
WHY WE CARE NOW WHY WE CARE NOW 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
WHAT WE WANT WHAT WE WANT 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
KOTLINIZE! KOTLINIZE! 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
CLEAN UP YOUR LAYOUTS CLEAN UP YOUR LAYOUTS 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
GO EASY ON DATA BINDING GO EASY ON DATA BINDING 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
A BIT MORE COMPOSIN' A BIT MORE COMPOSIN' 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 ) {
EVEN MORE COMPOSIN' EVEN MORE COMPOSIN' (INSERT ANDROID STUDIO HERE) (INSERT ANDROID STUDIO HERE)
CLEAN UP YOUR CLEAN UP YOUR ARCHITECTURES ARCHITECTURES 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
IDENTIFY TACTICAL UI IDENTIFY TACTICAL UI IMPROVEMENTS IMPROVEMENTS MAKE GOOGLE HAPPY! USERS TOO! MAKE GOOGLE HAPPY! USERS TOO! Landscape? Dark mode? Split-screen?
PONDER MOONSHOTS PONDER MOONSHOTS 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?
BUDGET PLAY TIME BUDGET PLAY TIME 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)
PREPARE ARGUMENTS FOR PREPARE ARGUMENTS FOR MANAGEMENT MANAGEMENT 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 one)
R-E-L-A-X R-E-L-A-X 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
WHERE TO GET THIS WHERE TO GET THIS PRESENTATION PRESENTATION https://commonsware.com/presos/2020-06-Compose/
Recommend
More recommend