SlideShare a Scribd company logo
1 of 30
Download to read offline
A Journey from
Callback Hell
to
Kotlin Coroutines
Ahmed Nabil
Kotlin Egypt
@AhmedNMahran
Fri. Oct 21 2022
About Me
About Me
● Writing Code since I was 11
● ~10 years in Mobile App development
● Given talks to thousands of audiences
● Prev. Android Mentor at 1M Arab Coders.
● Worked at Hungerstation,Codly, and others.
● Software Tech. Lead at Vodafone (_VOIS).
● Head of Kotlin Egypt.
● Content creator (videos/articles)
Fri. Oct 21 2022
About Me
What
is Kotlin ?
Fri. Oct 21 2022
About Me
Kotlin
● A modern Programming Language.
● Developed by Jetbrains & Open-Source community
● Since 2010.
● Current Stable Version is 1.7.20 (as of 20-10-2022)
Fri. Oct 21 2022
About Me
Used to develop
● Multiplatform-Mobile
● Server-Side
● Web Front-End
● Android
● WatchOS
● Data Science
● and more
Fri. Oct 21 2022
About Me
Let
the journey
Begin
Fri. Oct 21 2022
Fri. Oct 21 2022
Fri. Oct 21 2022
About Me
ANR
● any operation > 16ms
may cause Lag
● I/O operations,
long-running operation
● Main thread should ONLY
do UI operations
Fri. Oct 21 2022
Fri. Oct 21 2022
About Me
Problem
Code running in Main
thread causing Crash or
Lag.
Fri. Oct 21 2022
About Me
Asynchronous
Code
Fri. Oct 21 2022
About Me
Approaches
● Threading
● Callbacks
● Futures, Promises
● Reactive Extensions (Rx)
● Coroutines
Fri. Oct 21 2022
About Me
Threads
A program splits itself
into 2 or more running
tasks
Fri. Oct 21 2022
About Me
Threads Limitations
● Expensive
● Not Infinite, limited with device capabilities
● Not always available, (e.g. JS doesn’t have threading)
● Hard to Error-handle and debug
Fri. Oct 21 2022
Fri. Oct 21 2022
About Me
Callbacks
a function sent as an
argument to another
function to be executed
at certain point in time.
Fri. Oct 21 2022
Fri. Oct 21 2022
About Me
Callback Limitations
● Nested Callbacks not easy to understand
● Hard to Error-handle and debug
Fri. Oct 21 2022
Fri. Oct 21 2022
About Me
Futures
and Promises
I promise I’ll return at
some point in the future.
Fri. Oct 21 2022
About Me
Limitations
● Nested Callbacks not easy to understand
● Return Type :
Needs changing the models (extra steps in getting the
data)
● Hard to Error-handle and debug
Fri. Oct 21 2022
About Me
Rx
Everything is a stream
and it’s observable
Needs learning new apis
:(
Fri. Oct 21 2022
About Me
Coroutines
Kotlin’s approach to work
with async. code
Fri. Oct 21 2022
Process
Thread1
Thread2
Coroutine1
Coroutine2
Coroutine3
Couroutine4
Fri. Oct 21 2022
About Me
Coroutines
● No new apis needed, same language used (kotlin)
● Return type doesn’t change.
● Write sequential code while being thread-safe
● Lightweight, can run many of them in one thread,
● Easy to switch between threads
● Platform independent
● Easy to debug and detect errors.
Fri. Oct 21 2022
Fri. Oct 21 2022
Don’t Miss
My Workshop
6:00 PM today
Fri. Oct 21 2022
About Me
Follow Me
@AhmedNMahran
Thanks!
Youtube
(contains all my links)
Fri. Oct 21 2022
Thanks
Ahmed Nabil
Kotlin Egypt
@AhmedNMahran
Fri. Oct 21 2022

More Related Content

Similar to DroidConEgypt-21-10-2022-Coroutines-AhmedNabil.pdf

Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...mfrancis
 
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...CodiLime
 
Continuous delivery journey - Montgomery county JUG
Continuous delivery journey - Montgomery county JUGContinuous delivery journey - Montgomery county JUG
Continuous delivery journey - Montgomery county JUGRaphaël Brugier
 
Android Study Jam
Android Study Jam Android Study Jam
Android Study Jam DSCMESCOE
 
Introduction to react native @ TIC NUST
Introduction to react native @ TIC NUSTIntroduction to react native @ TIC NUST
Introduction to react native @ TIC NUSTWaqqas Jabbar
 
Introduction_to_Kotlin.pptx
Introduction_to_Kotlin.pptxIntroduction_to_Kotlin.pptx
Introduction_to_Kotlin.pptxHARSHITJAIN068
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React NativeWaqqas Jabbar
 
Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?
Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?
Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?9 series
 
Is kotlin better option for android app development
Is kotlin better option for android app development Is kotlin better option for android app development
Is kotlin better option for android app development Concetto Labs
 
Mumbai MuleSoft Meetup #17 - GraphQL
Mumbai MuleSoft Meetup #17 - GraphQLMumbai MuleSoft Meetup #17 - GraphQL
Mumbai MuleSoft Meetup #17 - GraphQLAkshata Sawant
 
Angular Illumination
Angular IlluminationAngular Illumination
Angular IlluminationBryan Arbelo
 
Kotlin + spring boot = decision making platform
Kotlin + spring boot = decision making platformKotlin + spring boot = decision making platform
Kotlin + spring boot = decision making platformAndrei Chernyshev
 
Node js vs golang -which one is better ?
Node js vs golang -which one is better ?Node js vs golang -which one is better ?
Node js vs golang -which one is better ?ForceBolt
 
Continuous integration for androids
Continuous integration for androidsContinuous integration for androids
Continuous integration for androidsKirill Zotin
 
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...DynamicInfraDays
 

Similar to DroidConEgypt-21-10-2022-Coroutines-AhmedNabil.pdf (20)

Kotlin tech talk
Kotlin tech talkKotlin tech talk
Kotlin tech talk
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
 
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
 
Engineering Frontends
Engineering FrontendsEngineering Frontends
Engineering Frontends
 
Continuous delivery journey - Montgomery county JUG
Continuous delivery journey - Montgomery county JUGContinuous delivery journey - Montgomery county JUG
Continuous delivery journey - Montgomery county JUG
 
Intro to kotlin
Intro to kotlinIntro to kotlin
Intro to kotlin
 
Android Study Jam
Android Study Jam Android Study Jam
Android Study Jam
 
Introduction to react native @ TIC NUST
Introduction to react native @ TIC NUSTIntroduction to react native @ TIC NUST
Introduction to react native @ TIC NUST
 
Introduction_to_Kotlin.pptx
Introduction_to_Kotlin.pptxIntroduction_to_Kotlin.pptx
Introduction_to_Kotlin.pptx
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?
Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?
Why to Choose Kotlin in 2023 to Build Mobile Apps Faster?
 
Is kotlin better option for android app development
Is kotlin better option for android app development Is kotlin better option for android app development
Is kotlin better option for android app development
 
Mumbai MuleSoft Meetup #17 - GraphQL
Mumbai MuleSoft Meetup #17 - GraphQLMumbai MuleSoft Meetup #17 - GraphQL
Mumbai MuleSoft Meetup #17 - GraphQL
 
Angular Illumination
Angular IlluminationAngular Illumination
Angular Illumination
 
Kotlin + spring boot = decision making platform
Kotlin + spring boot = decision making platformKotlin + spring boot = decision making platform
Kotlin + spring boot = decision making platform
 
Node js vs golang -which one is better ?
Node js vs golang -which one is better ?Node js vs golang -which one is better ?
Node js vs golang -which one is better ?
 
Slides kotlin yajug
Slides kotlin yajugSlides kotlin yajug
Slides kotlin yajug
 
Continuous integration for androids
Continuous integration for androidsContinuous integration for androids
Continuous integration for androids
 
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
 
Container Days
Container DaysContainer Days
Container Days
 

Recently uploaded

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 

Recently uploaded (20)

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 

DroidConEgypt-21-10-2022-Coroutines-AhmedNabil.pdf