SlideShare a Scribd company logo
Activities vs Fragments
By: Abdel Rahman Shaltoot
• A look at how we (used to) do things
• Comparison between coding styles
• Building for modularity and testability
• Pros and cons with an all Activity build
• Pros and cons with an all Fragment build
• Proposing a yet-to-be-tested-enough solution
Overview
Simple Weather App
Simple Weather App
Simple Weather App
Simple Weather App
Simple Weather App
Simple Weather App++
Simple Weather App++
Simple Weather App++
So let’s change that
Define and Separate Your
Concerns
Simple Weather App (Cool
Edition)
Simple Weather App (Cool
Edition)
Simple Weather App (Cool
Edition)
Simple Weather App (Cool
Edition)
Simple Weather App (Cool
Edition)
Simple Weather App (Cool
Edition)
Simple Weather App (Cool
Edition)
Simple Weather App (Cool
Edition)
Simple Weather App (Cool
Edition)
Umm… How is related to
Activities vs Fragments again?
Build for Modularity and Testability
Pros of an all Activity build
• Activities mainly act as view controllers, which allows
them to hold their own state (Context).
• Testing Activities is much easier than Fragments
• Back-stack handling is done by the framework in the
background
Cons of an all Activity build
• Activities mainly act as view controllers, which allows
them to hold their own state (Context)
• Testing Activities is much easier than Fragments
• The views created in Activities may not always be the
best suited views for different sizes of screens
• Activities can’t be reused as a whole
Pros of an all Fragment build
• Fragments, by design, are made to be reusable
components
• They are the “only” way to optimize our apps’ UI to fit
bigger screens
Cons of an all Fragment build
• Complicated life-cycle events that are already nested
inside the Activity’s life-cycle events
• Fragments can’t communicate amongst each other
unless it is through an Activity
• Testing Fragments requires the presence of the
Activity’s Context.
• Handling the changes in the back-stack must be done
manually
Custom Views to the Rescue

More Related Content

Similar to Activities vs fragment

SpringCloudConfig.pptx.pdf
SpringCloudConfig.pptx.pdfSpringCloudConfig.pptx.pdf
SpringCloudConfig.pptx.pdf
Knoldus Inc.
 
Reactive - Is it really a Magic Pill?
Reactive - Is it really a Magic Pill?Reactive - Is it really a Magic Pill?
Reactive - Is it really a Magic Pill?
Tech Triveni
 
Win8 development lessons learned jayway
Win8 development lessons learned jaywayWin8 development lessons learned jayway
Win8 development lessons learned jayway
Andreas Hammar
 
Microsoft ALM Platform Overview
Microsoft ALM Platform OverviewMicrosoft ALM Platform Overview
Microsoft ALM Platform OverviewSteve Lange
 
Marionette talk 2016
Marionette talk 2016Marionette talk 2016
Marionette talk 2016
Kseniya Redunova
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM tools
Larry Cai
 
Devops for drupal
Devops for  drupalDevops for  drupal
Devops for drupal
Kris Buytaert
 
Agile
AgileAgile
Agile
Komal2525
 
The Rocky Cloud Road
The Rocky Cloud RoadThe Rocky Cloud Road
The Rocky Cloud Road
Gert Drapers
 
RxSwift
RxSwiftRxSwift
RxSwift
Sally Ahmed
 
Durable Functions vs Logic App : la guerra dei workflow!!
Durable Functions vs Logic App : la guerra dei workflow!!Durable Functions vs Logic App : la guerra dei workflow!!
Durable Functions vs Logic App : la guerra dei workflow!!
Massimo Bonanni
 
Xp conf-tbd
Xp conf-tbdXp conf-tbd
Xp conf-tbd
XP Conference India
 
Going agile with scrum
Going agile with scrumGoing agile with scrum
Going agile with scrum
Mayur Sand
 
ADUF - Adaptable Design Up Front
ADUF -  Adaptable Design Up FrontADUF -  Adaptable Design Up Front
ADUF - Adaptable Design Up Front
Hayim Makabee
 
Preparing for DevOps
Preparing for DevOpsPreparing for DevOps
Preparing for DevOps
Eklove Mohan
 
Juc oct 2014 final
Juc oct 2014 finalJuc oct 2014 final
Juc oct 2014 final
Perfecto Mobile
 
Orchestration, the conductor's score
Orchestration, the conductor's scoreOrchestration, the conductor's score
Orchestration, the conductor's score
Salesforce Engineering
 
The Software Development Process
The Software Development ProcessThe Software Development Process
The Software Development Process
Cesar Augusto Nogueira
 
Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021
WrapPixel
 
Significance Of Component Base Architecture
Significance Of Component Base ArchitectureSignificance Of Component Base Architecture
Significance Of Component Base Architecture
chathurag
 

Similar to Activities vs fragment (20)

SpringCloudConfig.pptx.pdf
SpringCloudConfig.pptx.pdfSpringCloudConfig.pptx.pdf
SpringCloudConfig.pptx.pdf
 
Reactive - Is it really a Magic Pill?
Reactive - Is it really a Magic Pill?Reactive - Is it really a Magic Pill?
Reactive - Is it really a Magic Pill?
 
Win8 development lessons learned jayway
Win8 development lessons learned jaywayWin8 development lessons learned jayway
Win8 development lessons learned jayway
 
Microsoft ALM Platform Overview
Microsoft ALM Platform OverviewMicrosoft ALM Platform Overview
Microsoft ALM Platform Overview
 
Marionette talk 2016
Marionette talk 2016Marionette talk 2016
Marionette talk 2016
 
Agile & ALM tools
Agile & ALM toolsAgile & ALM tools
Agile & ALM tools
 
Devops for drupal
Devops for  drupalDevops for  drupal
Devops for drupal
 
Agile
AgileAgile
Agile
 
The Rocky Cloud Road
The Rocky Cloud RoadThe Rocky Cloud Road
The Rocky Cloud Road
 
RxSwift
RxSwiftRxSwift
RxSwift
 
Durable Functions vs Logic App : la guerra dei workflow!!
Durable Functions vs Logic App : la guerra dei workflow!!Durable Functions vs Logic App : la guerra dei workflow!!
Durable Functions vs Logic App : la guerra dei workflow!!
 
Xp conf-tbd
Xp conf-tbdXp conf-tbd
Xp conf-tbd
 
Going agile with scrum
Going agile with scrumGoing agile with scrum
Going agile with scrum
 
ADUF - Adaptable Design Up Front
ADUF -  Adaptable Design Up FrontADUF -  Adaptable Design Up Front
ADUF - Adaptable Design Up Front
 
Preparing for DevOps
Preparing for DevOpsPreparing for DevOps
Preparing for DevOps
 
Juc oct 2014 final
Juc oct 2014 finalJuc oct 2014 final
Juc oct 2014 final
 
Orchestration, the conductor's score
Orchestration, the conductor's scoreOrchestration, the conductor's score
Orchestration, the conductor's score
 
The Software Development Process
The Software Development ProcessThe Software Development Process
The Software Development Process
 
Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021
 
Significance Of Component Base Architecture
Significance Of Component Base ArchitectureSignificance Of Component Base Architecture
Significance Of Component Base Architecture
 

More from Inova LLC

MVVM presentation
MVVM presentationMVVM presentation
MVVM presentation
Inova LLC
 
Benefits of idea treasury
Benefits of idea treasuryBenefits of idea treasury
Benefits of idea treasury
Inova LLC
 
Advertising
Advertising Advertising
Advertising
Inova LLC
 
Market research
Market researchMarket research
Market research
Inova LLC
 
Disc Personality Type
Disc Personality TypeDisc Personality Type
Disc Personality Type
Inova LLC
 
UI vs UX workshop
UI vs UX workshopUI vs UX workshop
UI vs UX workshop
Inova LLC
 
Positive thinking
Positive thinkingPositive thinking
Positive thinking
Inova LLC
 
Sketch app interface
Sketch app interfaceSketch app interface
Sketch app interface
Inova LLC
 
Inova
InovaInova
Inova
Inova LLC
 
Inova
InovaInova
Inova
Inova LLC
 
CSED 2018 Orientation
CSED 2018 OrientationCSED 2018 Orientation
CSED 2018 Orientation
Inova LLC
 
Objective C Tricks
Objective C TricksObjective C Tricks
Objective C Tricks
Inova LLC
 
Mind map Introduction
Mind map IntroductionMind map Introduction
Mind map Introduction
Inova LLC
 
Agile scheduling
Agile schedulingAgile scheduling
Agile scheduling
Inova LLC
 
Business plan
Business planBusiness plan
Business plan
Inova LLC
 
Introduction to Sencha touch
Introduction to Sencha touchIntroduction to Sencha touch
Introduction to Sencha touch
Inova LLC
 
Introduction to Agile
Introduction to AgileIntroduction to Agile
Introduction to Agile
Inova LLC
 
Internet Presence
Internet PresenceInternet Presence
Internet Presence
Inova LLC
 
Agile Planning for value
Agile Planning for valueAgile Planning for value
Agile Planning for value
Inova LLC
 
Agile estimate size
Agile estimate sizeAgile estimate size
Agile estimate size
Inova LLC
 

More from Inova LLC (20)

MVVM presentation
MVVM presentationMVVM presentation
MVVM presentation
 
Benefits of idea treasury
Benefits of idea treasuryBenefits of idea treasury
Benefits of idea treasury
 
Advertising
Advertising Advertising
Advertising
 
Market research
Market researchMarket research
Market research
 
Disc Personality Type
Disc Personality TypeDisc Personality Type
Disc Personality Type
 
UI vs UX workshop
UI vs UX workshopUI vs UX workshop
UI vs UX workshop
 
Positive thinking
Positive thinkingPositive thinking
Positive thinking
 
Sketch app interface
Sketch app interfaceSketch app interface
Sketch app interface
 
Inova
InovaInova
Inova
 
Inova
InovaInova
Inova
 
CSED 2018 Orientation
CSED 2018 OrientationCSED 2018 Orientation
CSED 2018 Orientation
 
Objective C Tricks
Objective C TricksObjective C Tricks
Objective C Tricks
 
Mind map Introduction
Mind map IntroductionMind map Introduction
Mind map Introduction
 
Agile scheduling
Agile schedulingAgile scheduling
Agile scheduling
 
Business plan
Business planBusiness plan
Business plan
 
Introduction to Sencha touch
Introduction to Sencha touchIntroduction to Sencha touch
Introduction to Sencha touch
 
Introduction to Agile
Introduction to AgileIntroduction to Agile
Introduction to Agile
 
Internet Presence
Internet PresenceInternet Presence
Internet Presence
 
Agile Planning for value
Agile Planning for valueAgile Planning for value
Agile Planning for value
 
Agile estimate size
Agile estimate sizeAgile estimate size
Agile estimate size
 

Recently uploaded

2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 

Recently uploaded (20)

2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 

Activities vs fragment