SlideShare a Scribd company logo
1 of 44
Download to read offline
1
​Stefano Bonetta
stefano.bonetta@here.com
ziby_bonny
bonnyfone
Simon Joecks
simon.joecks@here.com
s_joecks
joecks
​
Starting from
scratch in 2017
Droidcon Berlin
September 4th
, 2017
Why this talk?
We had the chance to start from scratch
(actually we’ve “just” started J)
Android development in 2017
• Different languages J
• Stable/tested/validated libraries for (almost) everything
• Extremely active community
• Modern IDE and tooling
• Android Architecture Components
Why we/you/someone should use Kotlin
1. Kotlin provides more beef/tofu than Java J
2. Has zero cost (~)
3. Designed to prevent common programming mistakes
4. Programmer happiness
5. Java interoperability
6. Well tested by real-world projects
7. Now a first class citizen in Android
Risks (probably just in our mind)
• We are learning by doing and making mistakes
• Many language traits to play with may lead to
go overboard
Good to know
1. Compiler and standard library are released under
Apache 2 license
2. Since version 1.0 Kotlin is backwards compatible!
3. Not just for JVM! (native, JS...)
Suggestions for/from newbies (like us!)
1. Start from prototypes (end to end)
2. Embrace the language incrementally
3. Share within the team on daily basis
4. Be humble, ask!
ARCHITECTURE
Architecture Components
LiveData
ViewModel
No concrete application example
Lets try it
First try!
- MVVM using ViewModel and LiveData
- LiveData for everything
e.g. Observe the users repository, switch to the next screen
when the user finishes the registration process
No clear control flow
Not testable
from XKCD
MVVM Reloaded
1. A view observes only one observable within the view-model.
2. A view-model can observe multiple sources.
3. All (view) interactions are calls to the view-model.
Rule 1: A view observes only one observable
We are HERE | July 201715 © 2017 HERE | Confidential
Rule 2: A view-model can observe multiple sources
(View and Model can’t)
Rule 3: All (view) interactions are calls to the view-model.
More to cover
• Back navigation
• Service interaction
• Notifications and Toasts
• Permissions
• Full Article: “Architecture Components MVVM”
https://medium.com/@simon.joecks/android-architecture-components-mvvm-part-1-1bd138959535
• Fork the code!
https://github.com/joecks/android-architecture/tree/dev-todo-mvvm-single-live
Network
Network
• Standard libraries widely adopted (Retrofit, Volley…)
• API documentation makes self-generating client-side
code maintainable
• Swagger/REST/JSON combo widely adopted
• But there are alternatives
(not just different libraries)
• “client directly calls methods on a server
application as if it was a local object”
• Uses protocol buffers by default
(but JSON can also be used)
• Support bidirectional streaming
(“up to”)
• Built-in SSL/TLS authentication
• Take advantage of HTTP/2
• No caching concept
• Mainly focus on performance
• Allows micro services and clients to
communicate in the same way
• “client defines the structure of the data required,
and the data is returned with exactly the same
structure from the server”
• Uses JSON [gzip]
(but specification is generic)
• Explicit interactions:
query, mutation, subscription
• Build-in introspection system
(GraphiQL browser)
• Based on REST/HTTP
• 3-layer caching
• Mainly focus on flexibility, organize data as a graph
Swagger vs gRPC vs GraphQL
• All of them generate client-side platform-specific code
automatically (with different quality)
• All of them have schemas
• All of them are validated solutions
• Which one to choose?
Swagger vs gRPC vs GraphQL
• Difficult to choose “on the paper”
• Licensing model can be a blocker
(e.g. Facebook’s patent clause using GraphQL)
• Create a working end-to-end scenario (close to the real
problem) can facilitate the decision process
- ”hands on” experience
- benchmarking
Swagger vs gRPC vs GraphQL
Example: a testing scenario focused on final user’s performance
Swagger vs gRPC vs GraphQL
Client-side benchmarks: memory and time
Swagger vs gRPC vs GraphQL
Results:
• gRPC provides the best performance
(but this is generally use-case dependent since GraphQL can
potentially aggregate multiple backend calls in a single client call)
• GraphQL provides an excellently organized interface to
the data at no extra cost
• Swagger/REST is just…ok
PERSISTENCE CACHING
Caching/Persistence/Offline
• Is “offline first” always the way to go?
• Caching is usually good enough for “online” apps
• Network + Persistence -> Structure -> Pattern
• Repository pattern allows to defer decisions
Repository: caching approaches
1. Caching at network level
2. Caching at repository level
Note: these are not mutually exclusive
Caching inside the network layer
• Can be “for free”, depending on
the network layer
• With the proper policies, can be
used to retain data across
configuration changes / app
restores with minimum effort
• Can also cover “offline” use cases
(e.g. if contents are identified
through URI)
Caching inside the Repository
• Orchestrate resources
• Lots of conversions between
network/disk/memory
entities
• Several approaches to deal
with memory/disk
persistence
Example: libraries comparison (context specific!)
Name Type Pro Cons License
SQLite
baseline
SQLite • Build-in • lot of boilerplate and error-
prone code
/
Room SQLite-based • Inter-operable with other
Architecture Components (LiveData,
ViewModel)
• Google supported
• still in alpha
• doesn't handle
nested Entity automatically
(is it a con?)
/
DbFlow SQLite-based • Additional modules available: Kotlin
extensions, encryption (SQLCipher),
RX
• one-man project?
(+50 contributors)
MIT
Paper NoSQL • Key/value storage (value can also be
a Kotlin/Java object)
• one-man project?
(+6 contributors)
Apache 2.0
Realm Object Database • cross platform support
• Realm Browser to explore/debug the
data
• JSON responses can be parsed
directly into Realm objects
• uses own native libraries
• not SQLite-based
Apache 2.0
CI
Continuous Integration
is feedback to the developer
• Did I build it right?
• Did I break something?
Focus: CI as code
• Jenkins
• Job DSL
• Pipeline
• Treating CI as code
Ø Version control
Ø Abstraction/re-use
Ø Code review
Ø Testing
Ø Deploy
What is Jenkins Job DSL?
• Create Jenkins Job via
code
• Groovy DSL to generate
job configurations
• Job configurations are
XML files
• No effect at runtime
Job DSL
XML Configuration
Jenkins job
Benefits of Job DSL
• Code instead of configuration page
• Job DSL code can be stored in the same repo of the app
• Code review for changes before they go into production
• Easy templating (code can be reused)
• Deployment to multiple instances (production/staging)
Bonus: Gradle Job DSL Plugin
• A Gradle plugin to manage Job DSL scripts
• Created for the HERE WeGo mobile apps CI
(Android/iOS), currently used by many project inside
HERE
https://github.com/heremaps/gradle-jenkins-jobdsl-plugin
What is Jenkins Pipeline?
• Pipeline DSL to generate pipelines
• Works at execution time
• Currently under heavy development
(Blue Ocean UI)
• CI validation of CI code
(test CI changes in pre-submit verification)
Jenkins job
@Library('my_awesome_library') _
pipeline {
agent {
docker {
image ’your_docker_url.com'
}
}
options {
timestamps()
ansiColor('xterm')
}
environment {
LANG = 'en_US.UTF-8'
}
stages {
stage('Build') {
steps {
sh './gradlew assembleDebug'
}
}
stage('Unit tests') {
steps {
sh './gradlew test'
}
}
}
post {
always {
archive 'app/build/outputs/apk/debug/*.apk'
}
}
}
Job DSL vs Pipeline (?)
• Job DSL runs at job creation time, Pipeline at execution time
Suggestion: use Job DSL and Pipeline together
• Job DSL to create the Pipeline jobs (“bootstrap the pipeline”)
• Pipeline defines the business logic
Tip: Always test changes in isolation with
pre-submit checks
Developer‘s
machine
Download code
Code Hosting Server
1
New change
created locally
Create/modify
files
2
Upload change for
review with peers
3 No
Yes
Rework
5.a
Submit5.b
Accepted
Pre-submit
4
Code
Review
Automated
Tests
WRAP UP
Starting from scratch in 2017
1. Use Kotlin J
2. Consider Architecture Components (lifecycle awareness!)
3. Consider GraphQL or gRPC (based on your context)
4. Use Repository pattern (defer decisions, minimize refactoring effort)
5. CI as code
6. …and more!
Build smarter with location data from HERE
developer.here.com
Thank you!

More Related Content

What's hot

ZF2: Writing Service Components
ZF2: Writing Service ComponentsZF2: Writing Service Components
ZF2: Writing Service ComponentsMike Willbanks
 
Rule jenkins with configuration as code
Rule jenkins with configuration as codeRule jenkins with configuration as code
Rule jenkins with configuration as codeChristian Rasp
 
Conquering AngularJS Limitations
Conquering AngularJS LimitationsConquering AngularJS Limitations
Conquering AngularJS LimitationsValeri Karpov
 
GoLang - Why It Matters
GoLang -  Why It MattersGoLang -  Why It Matters
GoLang - Why It Mattersrahul
 
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!Serdar Basegmez
 
Play 2 Java Framework with TDD
Play 2 Java Framework with TDDPlay 2 Java Framework with TDD
Play 2 Java Framework with TDDBasav Nagur
 
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the footHow to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the footDennis Doomen
 
Symfony vs. Message Brokers
Symfony  vs.  Message BrokersSymfony  vs.  Message Brokers
Symfony vs. Message BrokersGaetano Giunta
 
GWT Jug Stuttgart
GWT Jug StuttgartGWT Jug Stuttgart
GWT Jug Stuttgarthbraun
 
#JavaOne What's in an object?
#JavaOne What's in an object?#JavaOne What's in an object?
#JavaOne What's in an object?Charlie Gracie
 
Building static libraries for iOS with CocoaPods
Building static libraries for iOS with CocoaPodsBuilding static libraries for iOS with CocoaPods
Building static libraries for iOS with CocoaPodsSigmapoint
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experienceAlex Tumanoff
 

What's hot (20)

ZF2: Writing Service Components
ZF2: Writing Service ComponentsZF2: Writing Service Components
ZF2: Writing Service Components
 
Rule jenkins with configuration as code
Rule jenkins with configuration as codeRule jenkins with configuration as code
Rule jenkins with configuration as code
 
Conquering AngularJS Limitations
Conquering AngularJS LimitationsConquering AngularJS Limitations
Conquering AngularJS Limitations
 
Deno Crate Organization
Deno Crate OrganizationDeno Crate Organization
Deno Crate Organization
 
GoLang - Why It Matters
GoLang -  Why It MattersGoLang -  Why It Matters
GoLang - Why It Matters
 
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
Engage 2015 - 10 Mistakes You and Every XPages Developer Make. Yes, I said YOU!
 
Node.js architecture (EN)
Node.js architecture (EN)Node.js architecture (EN)
Node.js architecture (EN)
 
Play 2 Java Framework with TDD
Play 2 Java Framework with TDDPlay 2 Java Framework with TDD
Play 2 Java Framework with TDD
 
How to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the footHow to practice TDD without shooting yourself in the foot
How to practice TDD without shooting yourself in the foot
 
Symfony vs. Message Brokers
Symfony  vs.  Message BrokersSymfony  vs.  Message Brokers
Symfony vs. Message Brokers
 
GWT Jug Stuttgart
GWT Jug StuttgartGWT Jug Stuttgart
GWT Jug Stuttgart
 
#JavaOne What's in an object?
#JavaOne What's in an object?#JavaOne What's in an object?
#JavaOne What's in an object?
 
Building static libraries for iOS with CocoaPods
Building static libraries for iOS with CocoaPodsBuilding static libraries for iOS with CocoaPods
Building static libraries for iOS with CocoaPods
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experience
 
Node.js Chapter1
Node.js Chapter1Node.js Chapter1
Node.js Chapter1
 
EF Core (RC2)
EF Core (RC2)EF Core (RC2)
EF Core (RC2)
 
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
Javantura v4 - True RESTful Java Web Services with JSON API and Katharsis - M...
 
Introduction to Node.JS
Introduction to Node.JSIntroduction to Node.JS
Introduction to Node.JS
 
Dev ops using Jenkins
Dev ops using JenkinsDev ops using Jenkins
Dev ops using Jenkins
 

Similar to Starting from scratch in 2017

AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project Elad Hirsch
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2Docker, Inc.
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleIT Arena
 
Managing Changes to the Database Across the Project Life Cycle (presented by ...
Managing Changes to the Database Across the Project Life Cycle (presented by ...Managing Changes to the Database Across the Project Life Cycle (presented by ...
Managing Changes to the Database Across the Project Life Cycle (presented by ...eZ Systems
 
Managing changes to eZPublish Database
Managing changes to eZPublish DatabaseManaging changes to eZPublish Database
Managing changes to eZPublish DatabaseGaetano Giunta
 
Creating and Maintaining an Open Source Library
Creating and Maintaining an Open Source LibraryCreating and Maintaining an Open Source Library
Creating and Maintaining an Open Source LibraryNicholas Schweitzer
 
Surrogate dependencies (in node js) v1.0
Surrogate dependencies  (in node js)  v1.0Surrogate dependencies  (in node js)  v1.0
Surrogate dependencies (in node js) v1.0Dinis Cruz
 
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...Serdar Basegmez
 
Shipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOSShipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOSRoss Kukulinski
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Ganesh Kondal
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Derek Jacoby
 

Similar to Starting from scratch in 2017 (20)

AngularJS - Architecture decisions in a large project 
AngularJS - Architecture decisionsin a large project AngularJS - Architecture decisionsin a large project 
AngularJS - Architecture decisions in a large project 
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2
 
Meetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech PeopleMeetup. Technologies Intro for Non-Tech People
Meetup. Technologies Intro for Non-Tech People
 
Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
Managing Changes to the Database Across the Project Life Cycle (presented by ...
Managing Changes to the Database Across the Project Life Cycle (presented by ...Managing Changes to the Database Across the Project Life Cycle (presented by ...
Managing Changes to the Database Across the Project Life Cycle (presented by ...
 
Managing changes to eZPublish Database
Managing changes to eZPublish DatabaseManaging changes to eZPublish Database
Managing changes to eZPublish Database
 
Creating and Maintaining an Open Source Library
Creating and Maintaining an Open Source LibraryCreating and Maintaining an Open Source Library
Creating and Maintaining an Open Source Library
 
Surrogate dependencies (in node js) v1.0
Surrogate dependencies  (in node js)  v1.0Surrogate dependencies  (in node js)  v1.0
Surrogate dependencies (in node js) v1.0
 
Stackato v5
Stackato v5Stackato v5
Stackato v5
 
Stackato
StackatoStackato
Stackato
 
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
java completed units.docx
java completed units.docxjava completed units.docx
java completed units.docx
 
Shipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOSShipping NodeJS with Docker and CoreOS
Shipping NodeJS with Docker and CoreOS
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
 
java full 1.docx
java full 1.docxjava full 1.docx
java full 1.docx
 
java full.docx
java full.docxjava full.docx
java full.docx
 
Untangling - fall2017 - week 9
Untangling - fall2017 - week 9Untangling - fall2017 - week 9
Untangling - fall2017 - week 9
 
Power of Azure Devops
Power of Azure DevopsPower of Azure Devops
Power of Azure Devops
 

Recently uploaded

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringWSO2
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....rightmanforbloodline
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...caitlingebhard1
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 

Recently uploaded (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 

Starting from scratch in 2017

  • 2. Why this talk? We had the chance to start from scratch (actually we’ve “just” started J)
  • 3. Android development in 2017 • Different languages J • Stable/tested/validated libraries for (almost) everything • Extremely active community • Modern IDE and tooling • Android Architecture Components
  • 4.
  • 5.
  • 6. Why we/you/someone should use Kotlin 1. Kotlin provides more beef/tofu than Java J 2. Has zero cost (~) 3. Designed to prevent common programming mistakes 4. Programmer happiness 5. Java interoperability 6. Well tested by real-world projects 7. Now a first class citizen in Android
  • 7. Risks (probably just in our mind) • We are learning by doing and making mistakes • Many language traits to play with may lead to go overboard
  • 8. Good to know 1. Compiler and standard library are released under Apache 2 license 2. Since version 1.0 Kotlin is backwards compatible! 3. Not just for JVM! (native, JS...)
  • 9. Suggestions for/from newbies (like us!) 1. Start from prototypes (end to end) 2. Embrace the language incrementally 3. Share within the team on daily basis 4. Be humble, ask!
  • 12. First try! - MVVM using ViewModel and LiveData - LiveData for everything e.g. Observe the users repository, switch to the next screen when the user finishes the registration process No clear control flow Not testable
  • 14. MVVM Reloaded 1. A view observes only one observable within the view-model. 2. A view-model can observe multiple sources. 3. All (view) interactions are calls to the view-model.
  • 15. Rule 1: A view observes only one observable We are HERE | July 201715 © 2017 HERE | Confidential
  • 16. Rule 2: A view-model can observe multiple sources (View and Model can’t)
  • 17. Rule 3: All (view) interactions are calls to the view-model.
  • 18. More to cover • Back navigation • Service interaction • Notifications and Toasts • Permissions • Full Article: “Architecture Components MVVM” https://medium.com/@simon.joecks/android-architecture-components-mvvm-part-1-1bd138959535 • Fork the code! https://github.com/joecks/android-architecture/tree/dev-todo-mvvm-single-live
  • 20. Network • Standard libraries widely adopted (Retrofit, Volley…) • API documentation makes self-generating client-side code maintainable • Swagger/REST/JSON combo widely adopted • But there are alternatives (not just different libraries)
  • 21. • “client directly calls methods on a server application as if it was a local object” • Uses protocol buffers by default (but JSON can also be used) • Support bidirectional streaming (“up to”) • Built-in SSL/TLS authentication • Take advantage of HTTP/2 • No caching concept • Mainly focus on performance • Allows micro services and clients to communicate in the same way • “client defines the structure of the data required, and the data is returned with exactly the same structure from the server” • Uses JSON [gzip] (but specification is generic) • Explicit interactions: query, mutation, subscription • Build-in introspection system (GraphiQL browser) • Based on REST/HTTP • 3-layer caching • Mainly focus on flexibility, organize data as a graph
  • 22. Swagger vs gRPC vs GraphQL • All of them generate client-side platform-specific code automatically (with different quality) • All of them have schemas • All of them are validated solutions • Which one to choose?
  • 23. Swagger vs gRPC vs GraphQL • Difficult to choose “on the paper” • Licensing model can be a blocker (e.g. Facebook’s patent clause using GraphQL) • Create a working end-to-end scenario (close to the real problem) can facilitate the decision process - ”hands on” experience - benchmarking
  • 24. Swagger vs gRPC vs GraphQL Example: a testing scenario focused on final user’s performance
  • 25. Swagger vs gRPC vs GraphQL Client-side benchmarks: memory and time
  • 26. Swagger vs gRPC vs GraphQL Results: • gRPC provides the best performance (but this is generally use-case dependent since GraphQL can potentially aggregate multiple backend calls in a single client call) • GraphQL provides an excellently organized interface to the data at no extra cost • Swagger/REST is just…ok
  • 28. Caching/Persistence/Offline • Is “offline first” always the way to go? • Caching is usually good enough for “online” apps • Network + Persistence -> Structure -> Pattern • Repository pattern allows to defer decisions
  • 29. Repository: caching approaches 1. Caching at network level 2. Caching at repository level Note: these are not mutually exclusive
  • 30. Caching inside the network layer • Can be “for free”, depending on the network layer • With the proper policies, can be used to retain data across configuration changes / app restores with minimum effort • Can also cover “offline” use cases (e.g. if contents are identified through URI)
  • 31. Caching inside the Repository • Orchestrate resources • Lots of conversions between network/disk/memory entities • Several approaches to deal with memory/disk persistence
  • 32. Example: libraries comparison (context specific!) Name Type Pro Cons License SQLite baseline SQLite • Build-in • lot of boilerplate and error- prone code / Room SQLite-based • Inter-operable with other Architecture Components (LiveData, ViewModel) • Google supported • still in alpha • doesn't handle nested Entity automatically (is it a con?) / DbFlow SQLite-based • Additional modules available: Kotlin extensions, encryption (SQLCipher), RX • one-man project? (+50 contributors) MIT Paper NoSQL • Key/value storage (value can also be a Kotlin/Java object) • one-man project? (+6 contributors) Apache 2.0 Realm Object Database • cross platform support • Realm Browser to explore/debug the data • JSON responses can be parsed directly into Realm objects • uses own native libraries • not SQLite-based Apache 2.0
  • 33. CI
  • 34. Continuous Integration is feedback to the developer • Did I build it right? • Did I break something?
  • 35. Focus: CI as code • Jenkins • Job DSL • Pipeline • Treating CI as code Ø Version control Ø Abstraction/re-use Ø Code review Ø Testing Ø Deploy
  • 36. What is Jenkins Job DSL? • Create Jenkins Job via code • Groovy DSL to generate job configurations • Job configurations are XML files • No effect at runtime Job DSL XML Configuration Jenkins job
  • 37. Benefits of Job DSL • Code instead of configuration page • Job DSL code can be stored in the same repo of the app • Code review for changes before they go into production • Easy templating (code can be reused) • Deployment to multiple instances (production/staging)
  • 38. Bonus: Gradle Job DSL Plugin • A Gradle plugin to manage Job DSL scripts • Created for the HERE WeGo mobile apps CI (Android/iOS), currently used by many project inside HERE https://github.com/heremaps/gradle-jenkins-jobdsl-plugin
  • 39. What is Jenkins Pipeline? • Pipeline DSL to generate pipelines • Works at execution time • Currently under heavy development (Blue Ocean UI) • CI validation of CI code (test CI changes in pre-submit verification) Jenkins job @Library('my_awesome_library') _ pipeline { agent { docker { image ’your_docker_url.com' } } options { timestamps() ansiColor('xterm') } environment { LANG = 'en_US.UTF-8' } stages { stage('Build') { steps { sh './gradlew assembleDebug' } } stage('Unit tests') { steps { sh './gradlew test' } } } post { always { archive 'app/build/outputs/apk/debug/*.apk' } } }
  • 40. Job DSL vs Pipeline (?) • Job DSL runs at job creation time, Pipeline at execution time Suggestion: use Job DSL and Pipeline together • Job DSL to create the Pipeline jobs (“bootstrap the pipeline”) • Pipeline defines the business logic
  • 41. Tip: Always test changes in isolation with pre-submit checks Developer‘s machine Download code Code Hosting Server 1 New change created locally Create/modify files 2 Upload change for review with peers 3 No Yes Rework 5.a Submit5.b Accepted Pre-submit 4 Code Review Automated Tests
  • 43. Starting from scratch in 2017 1. Use Kotlin J 2. Consider Architecture Components (lifecycle awareness!) 3. Consider GraphQL or gRPC (based on your context) 4. Use Repository pattern (defer decisions, minimize refactoring effort) 5. CI as code 6. …and more!
  • 44. Build smarter with location data from HERE developer.here.com Thank you!