making an android app · 3/5/2020  · part 1: overview - mobile apps - android development - good...

17
Making an Android app The right way

Upload: others

Post on 23-May-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Making an Android appThe right way

Page 2: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Who am I?

Thomas Lindsjørn

Senior developer

Making apps for 10 years

Page 3: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Life as an app developer

● Teams / Scrum

● Job interviews

● Hobby projects

● In-house dev or

consultant?

Page 4: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Lecture overviewPart 1: Overview - Mobile apps - Android Development - Good architecture, why and how?

Part 2: Live coding - refactor a simple app to use good architectural principles

Page 5: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Cross platform Nativevs.

Page 6: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Cross platform / Hybrid● Code sharing - “write once, run everywhere”● Complicated testing - “write once, debug everywhere”● Features not available on all platforms● Different design guides and principles for each platform● Smaller ecosystem: Fewer resources, more bugs● Performance hits● Popular tools:

○ Xamarin - C#○ React Native - JS○ JS + HTML: Progressive Web Apps, Cordova○ Kotlin Native

Page 7: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Native● Great tools● Plenty of libraries● Performance● Design guides / principles● More languages:

○ Java or Kotlin for Android○ Obj-C or Swift for iOS○ JS / other language for web○ C# for Windows ○ Yet another language for backend?

● Costly / resource-heavy business wise in early / startup stages

Page 8: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Android frameworkLanguage:Java or Kotlin

C / C++

Page 9: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

What is a good code base?

● Robust● Performant● Good UX and design● Expected behaviour

● Easy to understand and expand the code

Product Owner

Developers

User

Other Stakeholders / team members

Page 10: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Principles of good architecture

● Maintainability● Testability● Performance

Separation of Concerns

Single responsibility principle

Page 11: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Overengineering KISS

Page 12: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

A bad example

Page 13: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

An example from Tidal

Page 14: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

The MVP Pattern

● Separates concerns● Provides testability

Page 15: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Modified MVP for Android:MVVM + repository● View lifecycle out of our control● Repository: Decide where to fetch Models

from - backend or cache?ViewModel

Page 16: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Final architecture

Page 17: Making an Android app · 3/5/2020  · Part 1: Overview - Mobile apps - Android Development - Good architecture, why and how? Part 2: Live coding - refactor a simple app to use good

Live coding - Refactor