SlideShare a Scribd company logo
1 of 41
Download to read offline
The road to green
code (with Sonar)
olivierlegoaer
The limits to (software) growth
How it started (2011) How it's going (2022)
The software eco-*
Software eco-design
eco-coding
eco-writing code
eco-programmiNg
green coding
“the most responsible software is
the one we don't build”
(S)Low-tech
Crossroads: make your choice
High-tech
+ eco-coding
First law of eco-coding
energy = (more code)2
e = mc2
Energy versus Performance
Computer/Device A B
Energy (in joules) 30 20
Time (in seconds) 10 20
Energy-efficient vs Run-time-efficient
Basic eco-coding incentives
💰 Money
The fewer resources SmartContracts* consume,
the lower the costs
⭐ Reputation
Bad reviews left on app stores can ruin your
business
*programs running within a BlockChain
French roadmap
JUILLET
Stratégie d’accélération
numérique
écoresponsable
Haut Comité pour le
Numérique
Écoresponsable
2023
Towards an eco-score
cyber-score (effective in oct. 2023) eco-score (open challenge)
source source
What if an eco-score?
Information
App stores display the eco-score to the
end-users (and include it in their ranking algorithm)
Regulation
(Sustainable) Cloud providers refuse the
deployment of program lower than D
A
D
eco-score
Think global & mobile-first
Ecological impact
Direct Indirect
10% (FR)
25%
90% (FR)
75%
Lifespan
(...more devices!!!)
Energy
consumption
eq. CO2, water, abiotic resources
🔋Li-ion battery wear
Loosely adapted from “iNUM : impacts environnementaux du numérique en France” (Jan. 2021)
On the need of eco-friendly apps
source: pCloud
source: Atos & Greenspector
Limited impacts
Green programming languages?
You don't always have a choice!
What about the runtime?
Mobile apps are programs, but rarely algorithms*
programming language: there is no silver bullet!
Rui Pereira et al. “Ranking Programming Languages
by Energy Efficiency”. Science of Computer
Programming, volume 205. Elsevier, 2021.
*mathematically provable object
Code smells: The good old classics
● Feature Envy
● God Class
● Blob Class
● Long Method
● Long Parameter List
...
Code smells: The new challengers
● Internal Setter
● Leaking Thread
● Leaking Inner Class
● Member Ignoring Method
● No Low Memory Resolver
● Hashmap Usage
● Init OnDraw
...
Greater impacts
Why Android-specific matters
Battery-killers are nestled at the platform-level, not the language-level
Luckily, every Android project has a well-defined, meaningful structure
More than just source code needs to be inspected:
Energy-greedy components
Hardware-related Component Avg. energy consumption (J)
display 139.784567875382
camera 84.1856142588254
microphone 81.8998646885348
gravity 71.3078291080087
magnetic_field 69.6877663025097
gyroscope 69.3777997221
accelerometer 67.9535327322522
cpu 66.6925401713931
room_database 66.0762976599094
speaker 65.6659164078901
gps 65.6478179873468
local_storage 64.5536233840085
ambientlight 63.0030057575923
networking 62.6477966616013
Back to the 2 scopes
Ecological impact
Direct Indirect
10% (FR)
25%
90% (FR)
75%
Lifespan
(...more devices!!!)
Energy
consumption
eq. CO2, water, abiotic resources
Scope #1: energy consumption
🪄 Avoid extraneous animation 💤 Avoid keep screen on
Scope #2: device lifespan
⚖ Fight software obesity ♻ Support aging devices
Green code
smells
Open source catalog
Licence CC BY-NC-ND
40+ code smells arranged in 8 categories,
crosscutting scope 1 & 2
Description based on Java (but Kotlin-ready)
Smells ≠ bugs ≠ refactorings
https://github.com/cnumr/best-practices-mobile
R&D taxonomy
Finding and Fixing
Energy inefficiencies
Developer-centric User-centric
Finding Fixing
Static Analysis Dynamic Analysis Instrumentation Refactoring Collaborative Standalone
Finding Fixing
User-driven Autonomous
Adapted from Marimuthu C. et al., “Energy Diagnosis of Android Applications: A Thematic Taxonomy and Survey”. ACM Comput. Surv. 53, 6, Article 117 (February 2021)
Here comes
ecoCode
Rationales
World-class solution to
improve code quality
No guidelines on how to
write energy-friendly apps
“Green as You Code” sounds good
Screenshots*
*self-hosted instance of the ecoCode SonarQube plugin
Bypassing limitations
Outdated On-going
Related works
Academic
EcoAndroid [Ribeiro et al., 2021]
E-Debitum [Maia et al., 2020]
xAL [Fatimaa et al., 2020]
aDoctor [Iannone et al., 2020]
Green Android Lint [Le Goaer, 2019]
Non-Academic
Green Software Insights [CAST, 2023]
EcoSonar [Accenture, 2022]
Greensight Sonar [Capgemini, 2022]
Ecoscan [Enedis, 2020]
Digital commons
Avoid reinventing the wheel every time
Open Source improves IT sustainability. ecoCode
cannot but be OSS
Build a community first (e.g., through
hackathons). The lines of code will follow
Many to watch, few to make
Green Code Initiative (GCI)
https://github.com/green-code-initiative
Food for thought
How clean|green code relate?
Clean Code
Green Code
Code Quality
Clean Code Green Code
or
is-a-kind-of
is-composed-of
Green software supply chain
Greening the software is noble, but greening the software supply chain too
Motto: Wherever there is code, there can be best practices for green
The “Everything-as-code” is a huge potential reservoir of green code smells :
infrastructure-as-code, configuration-as-code, platform-as-code, …
Static analysis: The great filter
Very few general rules of thumb withstand
the filter of static program analysis
(“use cache”, “not too much videos”, etc.)
Pro Tips: Must be rooted at syntax-level
Bottom-up approach is the preferred way
to find new rules/patterns/best-practices
source
source
The art of static detection
Challenges
🛑 Post-processing
🔎 Cross-scanning
🚩 False positive/negative
Opportunities
🎨 Taint analysis
🕸 Call Graph/Control Flow Graph
🧠 Machine-Learning
The plague of evaluation
Unlike 90’s code smells, green code smells are still in their infancy
Do not expect green code to do what clean code has barely done
Sometimes common sense is enough
Android is a fast-paced platform, which makes things even more challenging
Round-trip engineering
design-time run-time
ETSdiff
UX/UI
“Wow effect” is important to engage early-adopters
Our revamped UI was hardcoded. A new menu entry is recommended by Sonar
Tailoring the SonarQube UI to green-specific concepts would require diving deep
Developers can find green code burdensome. Gamification can help
The end.

More Related Content

Similar to Eco-friendly mobile app development best practices

IT Solution through IoT Development
IT Solution through IoT DevelopmentIT Solution through IoT Development
IT Solution through IoT DevelopmentAndri Yadi
 
European Green IT Webinar 2014 - Kaliterre (France)
European Green IT Webinar 2014 - Kaliterre (France)European Green IT Webinar 2014 - Kaliterre (France)
European Green IT Webinar 2014 - Kaliterre (France)GreenLabCenter
 
Using Natural Language Processing(NLP), Voice Recognition and Internet of Thi...
Using Natural Language Processing(NLP), Voice Recognition and Internet of Thi...Using Natural Language Processing(NLP), Voice Recognition and Internet of Thi...
Using Natural Language Processing(NLP), Voice Recognition and Internet of Thi...IRJET Journal
 
Slideshare startup contest
Slideshare startup contestSlideshare startup contest
Slideshare startup contestThierry LEBOUCQ
 
IRJET - Automatic Toll E-Tickting System for Transportation and Finding o...
IRJET -  	  Automatic Toll E-Tickting System for Transportation and Finding o...IRJET -  	  Automatic Toll E-Tickting System for Transportation and Finding o...
IRJET - Automatic Toll E-Tickting System for Transportation and Finding o...IRJET Journal
 
Automatic Car Parking
Automatic Car ParkingAutomatic Car Parking
Automatic Car ParkingIRJET Journal
 
IoT Programmable Block
IoT Programmable BlockIoT Programmable Block
IoT Programmable BlockAntor Ahmed
 
AIoT: Intelligence on Microcontroller
AIoT: Intelligence on MicrocontrollerAIoT: Intelligence on Microcontroller
AIoT: Intelligence on MicrocontrollerAndri Yadi
 
Technical Seminar ppt.pptx
Technical Seminar ppt.pptxTechnical Seminar ppt.pptx
Technical Seminar ppt.pptxKarunGowda3
 
GREEN PAUWARE - For a power-thrifty mobile app marketplace
GREEN PAUWARE - For a power-thrifty mobile app marketplaceGREEN PAUWARE - For a power-thrifty mobile app marketplace
GREEN PAUWARE - For a power-thrifty mobile app marketplaceOlivier Le Goaër
 
IEEE College of Technology MAES SE 2020 - Coding Fun
IEEE College of Technology MAES SE 2020 - Coding FunIEEE College of Technology MAES SE 2020 - Coding Fun
IEEE College of Technology MAES SE 2020 - Coding FunMadelenReyes
 
iotppt-170729110848.pdf
iotppt-170729110848.pdfiotppt-170729110848.pdf
iotppt-170729110848.pdfKishor Mhaske
 
IRJET- Efficient IoT based Smart Dustbin for Clean Environment
IRJET- Efficient IoT based Smart Dustbin for Clean EnvironmentIRJET- Efficient IoT based Smart Dustbin for Clean Environment
IRJET- Efficient IoT based Smart Dustbin for Clean EnvironmentIRJET Journal
 
IoT Based Garbage Monitoring System ppt
IoT Based Garbage Monitoring System pptIoT Based Garbage Monitoring System ppt
IoT Based Garbage Monitoring System pptRanjan Gupta
 
Exploring the Trend Toward the Edge | Eclipse IoT Day Santa Clara 2019
Exploring the Trend Toward the Edge | Eclipse IoT Day Santa Clara 2019Exploring the Trend Toward the Edge | Eclipse IoT Day Santa Clara 2019
Exploring the Trend Toward the Edge | Eclipse IoT Day Santa Clara 2019Eclipse IoT
 
Finding Resource Manipulation Bugs in Linux Code
Finding Resource Manipulation Bugs in Linux CodeFinding Resource Manipulation Bugs in Linux Code
Finding Resource Manipulation Bugs in Linux CodeAndrzej Wasowski
 

Similar to Eco-friendly mobile app development best practices (20)

IT Solution through IoT Development
IT Solution through IoT DevelopmentIT Solution through IoT Development
IT Solution through IoT Development
 
European Green IT Webinar 2014 - Kaliterre (France)
European Green IT Webinar 2014 - Kaliterre (France)European Green IT Webinar 2014 - Kaliterre (France)
European Green IT Webinar 2014 - Kaliterre (France)
 
Using Natural Language Processing(NLP), Voice Recognition and Internet of Thi...
Using Natural Language Processing(NLP), Voice Recognition and Internet of Thi...Using Natural Language Processing(NLP), Voice Recognition and Internet of Thi...
Using Natural Language Processing(NLP), Voice Recognition and Internet of Thi...
 
Slideshare startup contest
Slideshare startup contestSlideshare startup contest
Slideshare startup contest
 
IRJET - Automatic Toll E-Tickting System for Transportation and Finding o...
IRJET -  	  Automatic Toll E-Tickting System for Transportation and Finding o...IRJET -  	  Automatic Toll E-Tickting System for Transportation and Finding o...
IRJET - Automatic Toll E-Tickting System for Transportation and Finding o...
 
New resume 2years exp
New resume 2years expNew resume 2years exp
New resume 2years exp
 
Automatic Car Parking
Automatic Car ParkingAutomatic Car Parking
Automatic Car Parking
 
IoT Programmable Block
IoT Programmable BlockIoT Programmable Block
IoT Programmable Block
 
12682076.ppt
12682076.ppt12682076.ppt
12682076.ppt
 
AIoT: Intelligence on Microcontroller
AIoT: Intelligence on MicrocontrollerAIoT: Intelligence on Microcontroller
AIoT: Intelligence on Microcontroller
 
Technical Seminar ppt.pptx
Technical Seminar ppt.pptxTechnical Seminar ppt.pptx
Technical Seminar ppt.pptx
 
GREEN PAUWARE - For a power-thrifty mobile app marketplace
GREEN PAUWARE - For a power-thrifty mobile app marketplaceGREEN PAUWARE - For a power-thrifty mobile app marketplace
GREEN PAUWARE - For a power-thrifty mobile app marketplace
 
IEEE College of Technology MAES SE 2020 - Coding Fun
IEEE College of Technology MAES SE 2020 - Coding FunIEEE College of Technology MAES SE 2020 - Coding Fun
IEEE College of Technology MAES SE 2020 - Coding Fun
 
iotppt-170729110848.pdf
iotppt-170729110848.pdfiotppt-170729110848.pdf
iotppt-170729110848.pdf
 
IRJET- Efficient IoT based Smart Dustbin for Clean Environment
IRJET- Efficient IoT based Smart Dustbin for Clean EnvironmentIRJET- Efficient IoT based Smart Dustbin for Clean Environment
IRJET- Efficient IoT based Smart Dustbin for Clean Environment
 
IoT Based Garbage Monitoring System ppt
IoT Based Garbage Monitoring System pptIoT Based Garbage Monitoring System ppt
IoT Based Garbage Monitoring System ppt
 
Exploring the Trend Toward the Edge | Eclipse IoT Day Santa Clara 2019
Exploring the Trend Toward the Edge | Eclipse IoT Day Santa Clara 2019Exploring the Trend Toward the Edge | Eclipse IoT Day Santa Clara 2019
Exploring the Trend Toward the Edge | Eclipse IoT Day Santa Clara 2019
 
Finding Resource Manipulation Bugs in Linux Code
Finding Resource Manipulation Bugs in Linux CodeFinding Resource Manipulation Bugs in Linux Code
Finding Resource Manipulation Bugs in Linux Code
 
GreenDroid
GreenDroidGreenDroid
GreenDroid
 
GreenDroid
GreenDroidGreenDroid
GreenDroid
 

More from Olivier Le Goaër

Ecological Impact of Native vs. Cross-Platform Mobile Apps: a Preliminary Study
 Ecological Impact of Native vs. Cross-Platform Mobile Apps: a Preliminary Study Ecological Impact of Native vs. Cross-Platform Mobile Apps: a Preliminary Study
Ecological Impact of Native vs. Cross-Platform Mobile Apps: a Preliminary StudyOlivier Le Goaër
 
PowDroid: Energy Profiling of Android Applications (ASE 2021 [Workshop] SUSTA...
PowDroid: Energy Profiling of Android Applications (ASE 2021 [Workshop] SUSTA...PowDroid: Energy Profiling of Android Applications (ASE 2021 [Workshop] SUSTA...
PowDroid: Energy Profiling of Android Applications (ASE 2021 [Workshop] SUSTA...Olivier Le Goaër
 
Enforcing Green Code With Android Lint
Enforcing Green Code With Android LintEnforcing Green Code With Android Lint
Enforcing Green Code With Android LintOlivier Le Goaër
 
Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !Olivier Le Goaër
 
Executable modeling & dynamic adaptation
Executable modeling & dynamic adaptationExecutable modeling & dynamic adaptation
Executable modeling & dynamic adaptationOlivier Le Goaër
 
Adaptation d'exécution de modèles : vers des iDSML adaptables
Adaptation d'exécution de modèles : vers des iDSML adaptablesAdaptation d'exécution de modèles : vers des iDSML adaptables
Adaptation d'exécution de modèles : vers des iDSML adaptablesOlivier Le Goaër
 
Android executable modeling: beyond android programming
Android executable modeling: beyond android programmingAndroid executable modeling: beyond android programming
Android executable modeling: beyond android programmingOlivier Le Goaër
 
Yet another DSL for cross platforms mobile development
Yet another DSL for cross platforms mobile developmentYet another DSL for cross platforms mobile development
Yet another DSL for cross platforms mobile developmentOlivier Le Goaër
 
Introduction à l'approche ADM de l'OMG
Introduction à l'approche ADM de l'OMGIntroduction à l'approche ADM de l'OMG
Introduction à l'approche ADM de l'OMGOlivier Le Goaër
 
Syntaxe concrète des DSL en IDM [avec Xtext]
Syntaxe concrète des DSL en IDM [avec Xtext]Syntaxe concrète des DSL en IDM [avec Xtext]
Syntaxe concrète des DSL en IDM [avec Xtext]Olivier Le Goaër
 

More from Olivier Le Goaër (14)

Ecological Impact of Native vs. Cross-Platform Mobile Apps: a Preliminary Study
 Ecological Impact of Native vs. Cross-Platform Mobile Apps: a Preliminary Study Ecological Impact of Native vs. Cross-Platform Mobile Apps: a Preliminary Study
Ecological Impact of Native vs. Cross-Platform Mobile Apps: a Preliminary Study
 
PowDroid: Energy Profiling of Android Applications (ASE 2021 [Workshop] SUSTA...
PowDroid: Energy Profiling of Android Applications (ASE 2021 [Workshop] SUSTA...PowDroid: Energy Profiling of Android Applications (ASE 2021 [Workshop] SUSTA...
PowDroid: Energy Profiling of Android Applications (ASE 2021 [Workshop] SUSTA...
 
Enforcing Green Code With Android Lint
Enforcing Green Code With Android LintEnforcing Green Code With Android Lint
Enforcing Green Code With Android Lint
 
Introduction au langage SQL
Introduction au langage SQLIntroduction au langage SQL
Introduction au langage SQL
 
Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !
 
Executable modeling & dynamic adaptation
Executable modeling & dynamic adaptationExecutable modeling & dynamic adaptation
Executable modeling & dynamic adaptation
 
Cours JavaScript
Cours JavaScriptCours JavaScript
Cours JavaScript
 
Adaptation d'exécution de modèles : vers des iDSML adaptables
Adaptation d'exécution de modèles : vers des iDSML adaptablesAdaptation d'exécution de modèles : vers des iDSML adaptables
Adaptation d'exécution de modèles : vers des iDSML adaptables
 
Formation VBA Excel
Formation VBA ExcelFormation VBA Excel
Formation VBA Excel
 
Android executable modeling: beyond android programming
Android executable modeling: beyond android programmingAndroid executable modeling: beyond android programming
Android executable modeling: beyond android programming
 
Yet another DSL for cross platforms mobile development
Yet another DSL for cross platforms mobile developmentYet another DSL for cross platforms mobile development
Yet another DSL for cross platforms mobile development
 
Introduction à l'approche ADM de l'OMG
Introduction à l'approche ADM de l'OMGIntroduction à l'approche ADM de l'OMG
Introduction à l'approche ADM de l'OMG
 
Syntaxe concrète des DSL en IDM [avec Xtext]
Syntaxe concrète des DSL en IDM [avec Xtext]Syntaxe concrète des DSL en IDM [avec Xtext]
Syntaxe concrète des DSL en IDM [avec Xtext]
 
Programmation sous Android
Programmation sous AndroidProgrammation sous Android
Programmation sous Android
 

Recently uploaded

What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfLivetecs LLC
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 

Recently uploaded (20)

What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
How to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdfHow to Track Employee Performance A Comprehensive Guide.pdf
How to Track Employee Performance A Comprehensive Guide.pdf
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 

Eco-friendly mobile app development best practices

  • 1. The road to green code (with Sonar) olivierlegoaer
  • 2. The limits to (software) growth How it started (2011) How it's going (2022)
  • 3. The software eco-* Software eco-design eco-coding eco-writing code eco-programmiNg green coding “the most responsible software is the one we don't build”
  • 4. (S)Low-tech Crossroads: make your choice High-tech + eco-coding
  • 5. First law of eco-coding energy = (more code)2 e = mc2
  • 6. Energy versus Performance Computer/Device A B Energy (in joules) 30 20 Time (in seconds) 10 20 Energy-efficient vs Run-time-efficient
  • 7. Basic eco-coding incentives 💰 Money The fewer resources SmartContracts* consume, the lower the costs ⭐ Reputation Bad reviews left on app stores can ruin your business *programs running within a BlockChain
  • 9. Towards an eco-score cyber-score (effective in oct. 2023) eco-score (open challenge) source source
  • 10. What if an eco-score? Information App stores display the eco-score to the end-users (and include it in their ranking algorithm) Regulation (Sustainable) Cloud providers refuse the deployment of program lower than D A D eco-score
  • 11. Think global & mobile-first Ecological impact Direct Indirect 10% (FR) 25% 90% (FR) 75% Lifespan (...more devices!!!) Energy consumption eq. CO2, water, abiotic resources 🔋Li-ion battery wear Loosely adapted from “iNUM : impacts environnementaux du numérique en France” (Jan. 2021)
  • 12. On the need of eco-friendly apps source: pCloud source: Atos & Greenspector
  • 14. Green programming languages? You don't always have a choice! What about the runtime? Mobile apps are programs, but rarely algorithms* programming language: there is no silver bullet! Rui Pereira et al. “Ranking Programming Languages by Energy Efficiency”. Science of Computer Programming, volume 205. Elsevier, 2021. *mathematically provable object
  • 15. Code smells: The good old classics ● Feature Envy ● God Class ● Blob Class ● Long Method ● Long Parameter List ...
  • 16. Code smells: The new challengers ● Internal Setter ● Leaking Thread ● Leaking Inner Class ● Member Ignoring Method ● No Low Memory Resolver ● Hashmap Usage ● Init OnDraw ...
  • 18. Why Android-specific matters Battery-killers are nestled at the platform-level, not the language-level Luckily, every Android project has a well-defined, meaningful structure More than just source code needs to be inspected:
  • 19. Energy-greedy components Hardware-related Component Avg. energy consumption (J) display 139.784567875382 camera 84.1856142588254 microphone 81.8998646885348 gravity 71.3078291080087 magnetic_field 69.6877663025097 gyroscope 69.3777997221 accelerometer 67.9535327322522 cpu 66.6925401713931 room_database 66.0762976599094 speaker 65.6659164078901 gps 65.6478179873468 local_storage 64.5536233840085 ambientlight 63.0030057575923 networking 62.6477966616013
  • 20. Back to the 2 scopes Ecological impact Direct Indirect 10% (FR) 25% 90% (FR) 75% Lifespan (...more devices!!!) Energy consumption eq. CO2, water, abiotic resources
  • 21. Scope #1: energy consumption 🪄 Avoid extraneous animation 💤 Avoid keep screen on
  • 22. Scope #2: device lifespan ⚖ Fight software obesity ♻ Support aging devices
  • 24. Open source catalog Licence CC BY-NC-ND 40+ code smells arranged in 8 categories, crosscutting scope 1 & 2 Description based on Java (but Kotlin-ready) Smells ≠ bugs ≠ refactorings https://github.com/cnumr/best-practices-mobile
  • 25. R&D taxonomy Finding and Fixing Energy inefficiencies Developer-centric User-centric Finding Fixing Static Analysis Dynamic Analysis Instrumentation Refactoring Collaborative Standalone Finding Fixing User-driven Autonomous Adapted from Marimuthu C. et al., “Energy Diagnosis of Android Applications: A Thematic Taxonomy and Survey”. ACM Comput. Surv. 53, 6, Article 117 (February 2021)
  • 27. Rationales World-class solution to improve code quality No guidelines on how to write energy-friendly apps
  • 28. “Green as You Code” sounds good
  • 29. Screenshots* *self-hosted instance of the ecoCode SonarQube plugin
  • 31. Related works Academic EcoAndroid [Ribeiro et al., 2021] E-Debitum [Maia et al., 2020] xAL [Fatimaa et al., 2020] aDoctor [Iannone et al., 2020] Green Android Lint [Le Goaer, 2019] Non-Academic Green Software Insights [CAST, 2023] EcoSonar [Accenture, 2022] Greensight Sonar [Capgemini, 2022] Ecoscan [Enedis, 2020]
  • 32. Digital commons Avoid reinventing the wheel every time Open Source improves IT sustainability. ecoCode cannot but be OSS Build a community first (e.g., through hackathons). The lines of code will follow Many to watch, few to make Green Code Initiative (GCI) https://github.com/green-code-initiative
  • 34. How clean|green code relate? Clean Code Green Code Code Quality Clean Code Green Code or is-a-kind-of is-composed-of
  • 35. Green software supply chain Greening the software is noble, but greening the software supply chain too Motto: Wherever there is code, there can be best practices for green The “Everything-as-code” is a huge potential reservoir of green code smells : infrastructure-as-code, configuration-as-code, platform-as-code, …
  • 36. Static analysis: The great filter Very few general rules of thumb withstand the filter of static program analysis (“use cache”, “not too much videos”, etc.) Pro Tips: Must be rooted at syntax-level Bottom-up approach is the preferred way to find new rules/patterns/best-practices source source
  • 37. The art of static detection Challenges 🛑 Post-processing 🔎 Cross-scanning 🚩 False positive/negative Opportunities 🎨 Taint analysis 🕸 Call Graph/Control Flow Graph 🧠 Machine-Learning
  • 38. The plague of evaluation Unlike 90’s code smells, green code smells are still in their infancy Do not expect green code to do what clean code has barely done Sometimes common sense is enough Android is a fast-paced platform, which makes things even more challenging
  • 40. UX/UI “Wow effect” is important to engage early-adopters Our revamped UI was hardcoded. A new menu entry is recommended by Sonar Tailoring the SonarQube UI to green-specific concepts would require diving deep Developers can find green code burdensome. Gamification can help