Top Banner
Marcos Barreto Mobile Project Leader @ MercadoLivre Scaling the Mobile Development Android DevConference 2016 - São Paulo
75

Android DevConference - Scaling Mobile Development

Apr 16, 2017

Download

Technology

iMasters
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Android DevConference - Scaling Mobile Development

Marcos BarretoMobile Project Leader @ MercadoLivre

Scaling the Mobile DevelopmentAndroid DevConference 2016 - São Paulo

Page 2: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Context

How it all started… ?

Page 3: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Context

Nowadays...

❖ +52.000 live only from Mercado Livre

❖ +15 countries

❖ ~ 3 sales per second

❖ ~100 MM registered users

❖ 15% to 40% of SI are from Mobile!

❖ +16 MM downloads

Page 4: Android DevConference - Scaling Mobile Development

Publicidade

Page 5: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

From an old world to a new world

Page 6: Android DevConference - Scaling Mobile Development
Page 7: Android DevConference - Scaling Mobile Development

Publicidade

Page 8: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Page 9: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Microservices

http://developers.mercadolibre.com/

Page 10: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Microservices

https://www.acamica.com/mercadolibre

Page 11: Android DevConference - Scaling Mobile Development

Publicidade

Page 12: Android DevConference - Scaling Mobile Development
Page 13: Android DevConference - Scaling Mobile Development

Desktop

Search Team

Desktop

VIP Team

Desktop

MyML Team iOS Team

HomeSearch

VIPMyML

Desktop

Home Team Android Team

HomeSearch

VIPMyML

Page 14: Android DevConference - Scaling Mobile Development

Desktop iOS

Android

Home Team

Desktop iOS

Android

Search Team

Desktop iOS

Android

VIP Team

Desktop iOS

Android

MyML Team

Android Architecture Team

iOS Architecture Team

Page 15: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Context

What we wanted to do?

❖ Different teams collaborating in the development of

mobile apps.

❖ Improve code quality & reduce bugs.

❖ Facilitate the mobile development.

❖ Support new teams in the native app development.

❖ Agile development, new features to prod faster.

Page 16: Android DevConference - Scaling Mobile Development

Scaling the Mobile Code2

Page 17: Android DevConference - Scaling Mobile Development
Page 18: Android DevConference - Scaling Mobile Development
Page 19: Android DevConference - Scaling Mobile Development
Page 20: Android DevConference - Scaling Mobile Development
Page 21: Android DevConference - Scaling Mobile Development
Page 22: Android DevConference - Scaling Mobile Development
Page 23: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Scaling the Mobile code

Status

● Tightly coupled code

● Constant merge and rebase problems

● Manual and unstable testing

● Difficult coordination between teams.

● Publishing to the store: manually, error prune

Page 24: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

From an old world to a new world

Page 25: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Componentization

Page 26: Android DevConference - Scaling Mobile Development

How did we do it ?3

Page 27: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Componentization

MELI APP

Shared Libs & SDKs

Navigation Module

Home Module

SearchModule

VIPModule

Legacy AppCHO

Module

Page 28: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Componentization

Characteristics

❖ Each module is a repository in Github

❖ Different Front-Ends are build based on the OS

(Android,iOS) and our MELI SDK (set of libraries).

❖ Each module is an application that works on its own

(with a TestApp).

Page 29: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Componentization

iOS Android OS

Core Libs

ML APPMELI SDK

Home Search VIP

Commons UI Rest Client

Authentication NetworkingTrack lib 3

Track lib 1 Track lib 2

Track lib 4Notifications

CHO SI . . .

Page 30: Android DevConference - Scaling Mobile Development

How do the modules communicate ?4

Page 31: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

How do the modules communicate ?

Page 32: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

How do the modules communicate ?

Navigation

● Modules don't know each other and the navigation is

through predefined URLs

● 100% decoupled and each module is “Deep Linking” Ready

Intent intent = new Intent(this);

intent.setData(

Uri.parse("myscheme://myhost/segment1?queryparam1=val1&queryparam2=val2"));

startActivity(intent);

Page 33: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

How do the modules communicate ?

Navigation

● Parameters are passed by query string or path params.○ Pro: Simple and known.

○ Con: The Uri has to be parsed.

mycompanydeeplink://item/meuItemId

Page 34: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Navigation Example

...

<activity android:name=".activities.MyActivity" android:launchMode="singleTop" android:theme="@style/Theme.MLTheme">

<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" />

<data android:host="myhost" android:scheme="myscheme" /> </intent-filter> </activity>

...

Page 35: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Navigation Example

public class MyActivity extends AppCompatActivity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

// myscheme://myhost/segment1?queryparam1=val1&queryparam2=val2

if (getIntent().getData() != null) {

Uri deeplink = getIntent().getData();

List<String> segments = deeplink.getPathSegments();

String queryparam1 = deeplink.getQueryParameter("queryparam1");

String queryparam2 = deeplink.getQueryParameter("queryparam2");

Page 36: Android DevConference - Scaling Mobile Development

Wrapper 2.05

Page 37: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Wrapper

Meli API

Mobile Middleware(Wrapper)

Page 38: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Wrapper

Meli API

Mobile Middleware(Wrapper)

texttranslationsbehaviour

Page 39: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Wrapper

Meli API

Mobile Middleware(Wrapper)

texttranslationsbehaviour

Page 40: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Wrapper 2.0

Page 41: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Wrapper 2.0{

id: "sign_up",title: "Ainda não tem conta?",button: {

text: "Cadastre-se grátis",text_color: "#666666",background_color: "#ffffff"

},action: "meli://register",image: "http://static.ml.com/2b7c0ecb042a5.png",background_color: "#ffffff"

}

Page 42: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Wrapper 2.0

❖ The backend response can change based on the App version

(design the frapi with that in mind).

❖ The backend is easily modified, the apps are not.

❖ Backend changes must always be backward compatible.

Page 43: Android DevConference - Scaling Mobile Development

Quality assurance6

Page 44: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

A successful

Git Branching

Model

masterdevelop release

Page 45: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Release Process

❖ We didn't have a clear process.

❖ Releases were made when we thought it was a "good time".

❖ With many teams working with us, that needed to change.

Page 46: Android DevConference - Scaling Mobile Development
Page 47: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Agile Release Trains

❖ Every 2 weeks a new version is released.

❖ Every 2 weeks, the train passes by and takes with it all

merged PRs.

❖ A release train is implemented with

a Milestone in Github.

Page 48: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Agile Release Trains

Page 49: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Agile Release Trains

❖ The release is defined by a Milestone in Github.

➢ The tag is created with the Changelog.md file.

➢ The "train" is created with everything merged to

develop.

❖ After the release, a manual regression is run, and if no issues

are found ⇒ Progressive Rollout

Page 50: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Agile Release Trains

Release Manager

❖ Assigning Pull Requests.

❖ Tests for manual regression.

❖ Checking if everything is ok.

❖ Creating the "What's New"

❖ Creating the APK and rolling it out.

❖ Following issues.

Page 51: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

How to I add a new Feature ?

❖ Must have:

➢ Unit tests

➢ Screenshots of the changes

➢ Changes for the What's New

➢ New Regression tests

➢ Dependencies declaration.

Page 52: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

How to I add a new Feature ?

❖ Will my feature be added ?

➢ Only if the PR was made with time.

➢ Code quality is up to the standards.

➢ Doesn't have bugs.

➢ CR was made and changes were made.

➢ Dependencies are met.

❖ The feature will be added only if it's merged

Page 53: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Agile Release Trains

Agile Release Trains

★ Better communication.

★ Different teams can estimate based on this schedule.

★ New versions are better tested and controlled.

Page 54: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Status: Testing Automation

❖ Tests were ran manually in the developer machine.

❖ Unstable tests.

❖ Each team added new tests, increasing a lot the number of

tests.

❖ To scale ⇒ everything must be automated.

Page 55: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Android Testing Pyramid

Page 56: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Testing Automation

Page 57: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Page 58: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Continuous Integration❖ Tests were ran manually by the developer.

❖ Hard to tell when the tests were green or not.

❖ The work of the Release Manager was nearly impossible!.

Page 59: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Continuous Integration in Github

One pull request to fix X

One pull request to fix Y

One pull request to fix Z

Page 60: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Continuous Integration in Github

One pull request to fix X

One pull request to fix Y

One pull request to fix Z

Page 61: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Continuous Integration

Page 62: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Continuous Integration

Page 63: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Continuous Deployment❖ The APK is generated in Travis

❖ How ?

● If the last commit to release or master contains [ci deploy].

● A tag and a release is created in github using as changelog

the Changelog.md file.

● The APK is automatically published to HockeyApp and to

the PlayStore in Alpha.

Page 64: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Page 65: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Quality assurance

Code Review

❖ Code standards.

❖ Improve code quality and documentation.

❖ Share good practices.

❖ Reduce bugs.

❖ Accept constructive comments.

Page 66: Android DevConference - Scaling Mobile Development

Well… how that worked out ??6

Page 67: Android DevConference - Scaling Mobile Development

We had one big-fat-repo

Page 68: Android DevConference - Scaling Mobile Development

Distributed development

Page 69: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Pull Request of a new feature...

Page 70: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Reduced crashes● App crashes down from ~10.000/day to less than 1000/day

Page 71: Android DevConference - Scaling Mobile Development

Challenges7

Page 72: Android DevConference - Scaling Mobile Development

Distributed bugs

Page 73: Android DevConference - Scaling Mobile Development

Evangelize good practices

Page 74: Android DevConference - Scaling Mobile Development

This is our visionBuilding the foundation to Build a 3B Company by FY20

Mercado Livre Experience http://mercadolivreexperience.com.br/2016/

cupom AndroidDev 20% desconto tem comida gratis!!

Page 75: Android DevConference - Scaling Mobile Development

Marcos Barreto@marbarfa