SlideShare a Scribd company logo
1 of 33
Architecture pitfalls in Android development.
(Why building apps is like building houses)
Thomas Krüger
Overview
● Explanation
● Principles
● Planning matters
● Pitfalls
● 2008: Mobile developer
● 2010: Freelancer
● Oracle certified Java Programmer
Who's speaking?
Foreword
● no golden way
● use whatever suits you best
● development "style" has to match
● "architecture" can be short-dated
"I don't have a solution
but I admire the problem"
Explanation
● Expose the structure
● hide the implementation details
● Realize all of the use cases and scenarios
Part of what you should have an eye on:
● Activities
● Services
● BroadcastReceiver
● Content Provider
● Intents (implicit/explicit)
...and Lifecycles
Building materials
Lifecycles
Proof of concept
● Possibilitycheck
● "Spike"(SCRUM)
o no result = alternative needed?
KISS principle
● keep it simple & stupid!
● Simple 2D Game
● Unity?
● Own OpenGL Engine?
● AndEngine?
Planning matters
● UML
o structure diagrams (i.e. class diagram)
o behavior diagrams (i.e. use case diagram)
o interaction diagrams (i.e. sequence diagram)
"A bad foundation
may cause a bad architecture"
1st: Plan it!
2nd: Implement it!
...or else...
Size of architecture
"How big gets your project?"
Size of architecture
DRY principle
Don't repeat yourself
"every piece of knowledge must have a single,
unambiguous, authoritative representation
within a system."
Second System Syndrome
"I've always done it this way"
Look for anti-pattern
● Spaghetti code
● Big ball of mud
● Gas fabric
● God object
● Yo-yo problem
● Magic values
Pitfalls
Device fragmentation
UI Threading
● use (multi-) threading wisely
● use advantage of AsyncTask
● don't leak the context
o context as static member = Bad idea!
o at least context as composition
o "getApplicationContext()" may be handy
Android's UI
● Don't create UI like in Java (Swing)
● use XML where possible
o use LayoutInflater
o reusability
o divide UI and logic
o clear MVP
Orientation lock
Good
● Don't worry about rotation (>lifecycle)
Bad
● usablity on some devices
● no distinct layouts (land/port)
When it's already too late...
Rethink
Redesign
Refactor
Release...?
Refurbish
Facade pattern
Facade pattern
Conclusion
● don't ignore the principles
● determine the right size
● plan your architecture
● rely on best practices
● dont fear to refactor
● look for pattern
● watch out for pitfalls
find me on
available @
Thank you!

More Related Content

Similar to Architecture pitfalls in android development

Create first android app with MVVM Architecture
Create first android app with MVVM ArchitectureCreate first android app with MVVM Architecture
Create first android app with MVVM Architecturekhushbu thakker
 
Xlab #2: wzorce projektowe
Xlab #2: wzorce projektoweXlab #2: wzorce projektowe
Xlab #2: wzorce projektoweXSolve
 
The Good, the Bad and the Ugly things to do with android
The Good, the Bad and the Ugly things to do with androidThe Good, the Bad and the Ugly things to do with android
The Good, the Bad and the Ugly things to do with androidStanojko Markovik
 
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.UA Mobile
 
[Game] Programming I Didn't Learn in School
[Game] Programming I Didn't Learn in School[Game] Programming I Didn't Learn in School
[Game] Programming I Didn't Learn in School💻 Anton Gerdelan
 
Joomla!Day Poland 2013 - Joomla Architecture (Ofer Cohen)
Joomla!Day Poland 2013 - Joomla Architecture  (Ofer Cohen)Joomla!Day Poland 2013 - Joomla Architecture  (Ofer Cohen)
Joomla!Day Poland 2013 - Joomla Architecture (Ofer Cohen)Ofer Cohen
 
Design patterns in javascript
Design patterns in javascriptDesign patterns in javascript
Design patterns in javascriptAyush Sharma
 
Javascript Frameworks (and How to Learn Them)
Javascript Frameworks (and How to Learn Them)Javascript Frameworks (and How to Learn Them)
Javascript Frameworks (and How to Learn Them)All Things Open
 
Structuring the code
Structuring the codeStructuring the code
Structuring the codeIman Tunggono
 
Full stack development
Full stack developmentFull stack development
Full stack developmentArnav Gupta
 
Study Jam: Android for Beginners, Summary
Study Jam: Android for Beginners, SummaryStudy Jam: Android for Beginners, Summary
Study Jam: Android for Beginners, SummaryConstantine Mars
 
When and how to explore: an engineer's guide
When and how to explore:  an engineer's guideWhen and how to explore:  an engineer's guide
When and how to explore: an engineer's guideJulie Pitt
 
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...Radovan Semancik
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016maiktoepfer
 
Clean low-code - OutSystens
Clean low-code - OutSystensClean low-code - OutSystens
Clean low-code - OutSystensHasan Derawan
 
Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?Jérôme Petazzoni
 

Similar to Architecture pitfalls in android development (20)

Create first android app with MVVM Architecture
Create first android app with MVVM ArchitectureCreate first android app with MVVM Architecture
Create first android app with MVVM Architecture
 
Xlab #2: wzorce projektowe
Xlab #2: wzorce projektoweXlab #2: wzorce projektowe
Xlab #2: wzorce projektowe
 
The Good, the Bad and the Ugly things to do with android
The Good, the Bad and the Ugly things to do with androidThe Good, the Bad and the Ugly things to do with android
The Good, the Bad and the Ugly things to do with android
 
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
Критика "библиотечного" подхода в разработке под Android. UA Mobile 2016.
 
[Game] Programming I Didn't Learn in School
[Game] Programming I Didn't Learn in School[Game] Programming I Didn't Learn in School
[Game] Programming I Didn't Learn in School
 
Joomla!Day Poland 2013 - Joomla Architecture (Ofer Cohen)
Joomla!Day Poland 2013 - Joomla Architecture  (Ofer Cohen)Joomla!Day Poland 2013 - Joomla Architecture  (Ofer Cohen)
Joomla!Day Poland 2013 - Joomla Architecture (Ofer Cohen)
 
Design patterns in javascript
Design patterns in javascriptDesign patterns in javascript
Design patterns in javascript
 
Javascript Frameworks (and How to Learn Them)
Javascript Frameworks (and How to Learn Them)Javascript Frameworks (and How to Learn Them)
Javascript Frameworks (and How to Learn Them)
 
Structuring the code
Structuring the codeStructuring the code
Structuring the code
 
Full stack development
Full stack developmentFull stack development
Full stack development
 
Spock pres
Spock presSpock pres
Spock pres
 
Solid Principles
Solid PrinciplesSolid Principles
Solid Principles
 
Study Jam: Android for Beginners, Summary
Study Jam: Android for Beginners, SummaryStudy Jam: Android for Beginners, Summary
Study Jam: Android for Beginners, Summary
 
When and how to explore: an engineer's guide
When and how to explore:  an engineer's guideWhen and how to explore:  an engineer's guide
When and how to explore: an engineer's guide
 
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...
How To Maintain Million Lines Of Open Source Code And Remain Sane or The Stor...
 
Engineering Frontends
Engineering FrontendsEngineering Frontends
Engineering Frontends
 
Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016Not Your Fathers C - C Application Development In 2016
Not Your Fathers C - C Application Development In 2016
 
Clean low-code - OutSystens
Clean low-code - OutSystensClean low-code - OutSystens
Clean low-code - OutSystens
 
RealDay: Angular.js
RealDay: Angular.jsRealDay: Angular.js
RealDay: Angular.js
 
Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?Docker and Go: why did we decide to write Docker in Go?
Docker and Go: why did we decide to write Docker in Go?
 

Recently uploaded

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Recently uploaded (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Architecture pitfalls in android development

Editor's Notes

  1. COOL TO BE HERE BLA
  2. EXPLANATION PRINCIPLES PLANNING PITFALLS
  3. NO GOLDEN WAY USE WHATEVER SUITS U BEST DEVELOPMENT STYE HAS TO MATCH ARCHITECTURE CAN BE SHORT DATED
  4. ARCHI = ... Framework Archi - OUR archi Expose the structure / hide the implementation details Realize all of the use cases and scenarios
  5. ACTIVITIES SERVICES BROADCASTRECEIVER CONTENT PROVIDER INTENTS LIFECYCLES
  6. LIFECYCLES AFFECT YOUR ARCHITECTURE!!! ACTIVITY = STH LIKE A PRESENTER AS IN MVP YOUR ARCHI STICKS TO YOUR ACTIVITY.. IN A SPECIAL WAY BE AWARE OF YOUR CONTEXT!
  7. LETS MAKE A 100 STAGE HOUSE! YOU WOULD NOT BUILD A HOUSE WITHOUT AN APPROPRIATE PLAN! check of possibility Spike: simple prototype, no result in timebox: alternative?
  8. DONT REINVENT THE WHEEL IMAGINE U WANT 2 DEVELOP A SIMPLE 2D GAME WICH TECHNOLOGY WOULD U CHOOSE? CANVAS? UNITY? OWN ENGINE? OR ANDENGINE?
  9. GAS FACTORY U WONT BUILD A SMALL HOUSE WITH A HUGE CRANE, RIGHT? BUT IN SOFTWARE DEVELOPMENT IT OFTEN HAPPENS
  10. A LOT OF DIAGRAMS DIVIDED INTO STRUCTURE BEHAVIOUR INTERACTION DIAGRAM USE WHATEVER SUITS U (FOREWORD)
  11. I USUALLY START WITH... GET AN OVERVIEW OF ALL POSSIBLE ACTIONS
  12. LETS GET TECHNICAL CLEAN UML = CLEAN ARCHI JUST RECOMMENDATION
  13. MAY LOOK CONFUSE STILL CLEAN, LOOSE COUPLING
  14. CLEAN UML FROM THE BEGINNING LEADS TO CLEAN ARCHI LEADS TO LESS BUGS IN FINAL PRODUCT ....in THEORY =D
  15. PLAN EVERY NEW PART (in a big project)
  16. THATS WHAT MAY HAPPEN IF U JUST HACK
  17. DETERMINE SIZE HACKATHON SMALL APP HOBBY PRIVATE APP ANTI PATTERN "GAS FABRIC" -> small problem > big archi
  18. PROFESSIONAL APP CORPORATE APP BIG ARCHI = MORE PLANNING
  19. MODEL DRIVEN ARCHI WICH MEANS: COPY N PASTE IS EVIL! REPETITION LEADS TO INCONSISTENCY
  20. HAVE U SEEN A HOUSE WITH DOORS INSTEAD OF WINDOWS? DONT OVER-REUSE STUFF
  21. DOESNT MATTER WHATS REQUIRED OVER-REUSAGE
  22. SPAGHETTI CODE: NO STRUCTURE BIG BALL OF MUD. NO ARCHI GAS FABRIC. A LOOOOOT OF CODE ... FOR NOTHING GOD OBJECT. ONE OBJECT DOES IT ALL YOYO PROBLEM: FLIPPING THROUGH CODE WITHOUT CONCEPT
  23. AS OF HASANS SESSION YEASTERDAY SPEED / RESOLUTION GAME DEV BEST PRACTICES!
  24. USE MULTI THREADÍNG WITH CAUTION ASYNC TASK IS A COOL WRAPPER DONT LEAK THE CONTEXT
  25. DONT CREATE UI LIKE IN "NORMAL JAVA" XML AND ANDROID MVC IS GREAT; COOL REUSAGE DIVIDE UI AND YOUR LOGIC
  26. DONT WORRY ABOUT ROTATION USABILITY SUCKS ONE SOME DEVICES NO DISTINCT LAYOUTS FOR LAND/PORT
  27. RETHINK REDESIGN REFACTOR REFURBISH RELEASE DONT FEAR TO REFACTOR
  28. RED CRINGLE
  29. GET BAD ARCHI CAPSULATED
  30. don't ignore the principles determine the right size plan your architecture rely on best practices dont fear to refactor look for pattern watch out for pitfalls