SlideShare a Scribd company logo
1 of 44
Download to read offline
1
So you "want" to maintain a
Python legacy code base
PyConUK 2016
César Cardenas Desales
2
About me
● Software Architect at Webrepublic AG
● Python user since v.2.0
● Co-organizer of the Swiss Python Summit (i.e.
PyCon Switzerland) and the Zurich Python User
Group
3
Agenda
❖ Introduction
❖ Maintenance “framework”
1. Understand (your system)
2. Safety net
3. Improve
4
Introduction
5
Why discuss maintenance?
● 50% software cost - Barry
Boehm
● 40 to 80% software costs -
Robert L. Glass
6
Computer programming
7
Software maintenance
8
9
Software maintenance?
10
11
Automotive Industry
● Warranty? 5 years or 100,000 KM
● Life-time: 100,000 to 200,000 KM
12
Rail Industry
● Short cycle maintenance: 80 years
13
Rail Industry
● Short cycle maintenance: 80 years
● Long cycle maintenance: 150 years
14
IT Industry?
● Linux kernel: 1991, 25 years
● LaTeX: 1985, 31 years
● U.S. Treasury Department - Individual Master File: 56
years
15
IT Industry?
● Linux kernel: 1991, 25 years
● LaTeX: 1985, 31 years
● U.S. Treasury Department - Individual Master File: 56
years
● Probably many Fortran or Cobol systems
COBOL programmer wanted
- 5 years experience life expectancy
16
IT Industry?
● Linux kernel: 1991, 25 years
● LaTeX: 1985, 31 years
● U.S. Treasury Department - Individual Master File: 56
years
● Probably many Fortran or Cobol systems
● Mine WAS 4 years
● Yours?
17
Maintenance: Raffle of a Tiger
18
The life of a maintainer (i.e. me)
1. “Our code is messy”
2. “Everyone’s code is messy” (3k LOC class)
3. “Somebody’s code is messy”
19
1 Understand
20
1 Understand - Context
● Code doesn’t live in a
void
● Ask users
● THE business case
● Interview power users
● Create personas
● Read use cases
● Write use cases
21
1 Understand - Architecture
● Understand the
architecture
● Create diagrams
22
1 Understand - Architecture
● Print critical code
● Read the code
● Do code walkthroughs
● Rubber duck debugging
23
1 Understand - Docs
● Read the docs
● Write the docs
● Comment the code
● Docstrings
● Doxygen
● Sphingx
24
1 Understand - Debug it
● Observe program behaviour
● For the sake of it
● pdb
● pudb
● ipdb
● Bugjar
● Winpdb
● Your IDE
25
1 Understand - Profile it
● Does 80/20 hold?
● cProfile, profile
● timeit
● heapy
● memory_profiler
● Your IDE
● top, htop
● IPython SnakeViz
26
1 Understand - Break it
● Scalability?
● What breaks?
● Why does it break?
● Does it matter?
● Recovery?
● nose, pytest
● Apache Benchmark
● Locust
● JMeter
● Adhoc scripts
27
2 Safety net
28
2 Safety net - Automated tests
● Regression tests
● Acceptance tests
● Data driven tests
● nose, pytest
● coverage
● selenium
● tox
29
2 Safety net - Fail often and early
● Neutral/Nightly build
● Continuous Integration
● Broken build =>
Not safe to release
30
2 Safety net - The build
● Github protected branches
● Jenkins
● Buildout
● Buildbot
● Travis CI
31
2 Safety net - Monitoring
● What errors are current?
● Opbeat
32
2 Safety net - Monitoring
● Visualize and filter log entries
● Logstash + Kibana
33
2 Safety net - Automate it all
● Because humans make
mistakes
● Provisioning deployment
● Ansible
● Salt
● Puppet
● Chef
34
3 Improve
35
3 Improve - The code
● Leave the code cleaner than you found it
● pep8 -> pycodestyle
● Flake8 (PyFlakes + pycodestyle)
● pylint
● radon
● Your IDE
36
3 Improve - The code
● Radon
○ LOC, SLOC
○ Cyclomatic Complexity
○ Maintainability Index
○ Halstead Metrics
37
38
3 Improve - The code
$ radon cc -o SCORE -s -a processing/tasks.py
39
3 Improve - The code
$ pylint bot.py
40
3 Improve - The people
● TDD if possible
● Do Code Reviews
41
3 Improve - The people
● Code Reviews
○ Spread knowledge
○ The Ego Factor
○ Increase quality of software
“Your reputation at stake
with every commit”
42
3 Improve - The people
● Code Reviews
○ Easily done with Github
○ Like washing your hands
after going to the toilet
43
Ask me
● Ascend a Swiss
(Python) summit
● Why can you buy
cornish pasties in
Mexico
44
Let’s make it happen.
Thank you.
@ccdesales

More Related Content

What's hot

Jenkins - Beyond Basics
Jenkins - Beyond BasicsJenkins - Beyond Basics
Jenkins - Beyond BasicsKnoldus Inc.
 
ETICS supporting compliance and interoperability, Gabriele Giammatteo, Engine...
ETICS supporting compliance and interoperability, Gabriele Giammatteo, Engine...ETICS supporting compliance and interoperability, Gabriele Giammatteo, Engine...
ETICS supporting compliance and interoperability, Gabriele Giammatteo, Engine...OW2
 
BUD17-TR01: Philosophy of Open Source
BUD17-TR01: Philosophy of Open SourceBUD17-TR01: Philosophy of Open Source
BUD17-TR01: Philosophy of Open SourceLinaro
 
[CONFidence 2016] Sławomir Kosowski - Introduction to iOS Application Securit...
[CONFidence 2016] Sławomir Kosowski - Introduction to iOS Application Securit...[CONFidence 2016] Sławomir Kosowski - Introduction to iOS Application Securit...
[CONFidence 2016] Sławomir Kosowski - Introduction to iOS Application Securit...PROIDEA
 
Software Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery ApproachSoftware Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery ApproachGiovanni Toraldo
 
TSC Sponsored BoF: Can Linux and Automotive Functional Safety Mix ? Take 2: T...
TSC Sponsored BoF: Can Linux and Automotive Functional Safety Mix ? Take 2: T...TSC Sponsored BoF: Can Linux and Automotive Functional Safety Mix ? Take 2: T...
TSC Sponsored BoF: Can Linux and Automotive Functional Safety Mix ? Take 2: T...Linaro
 
Introduction to Open Source
Introduction to Open SourceIntroduction to Open Source
Introduction to Open SourceGluster.org
 
Intro JBug Milano - January 2012
Intro JBug Milano - January 2012Intro JBug Milano - January 2012
Intro JBug Milano - January 2012JBug Italy
 
Responsibilities of gluster_maintainers
Responsibilities of gluster_maintainersResponsibilities of gluster_maintainers
Responsibilities of gluster_maintainersGluster.org
 

What's hot (10)

Jenkins - Beyond Basics
Jenkins - Beyond BasicsJenkins - Beyond Basics
Jenkins - Beyond Basics
 
Ctf cli
Ctf cliCtf cli
Ctf cli
 
ETICS supporting compliance and interoperability, Gabriele Giammatteo, Engine...
ETICS supporting compliance and interoperability, Gabriele Giammatteo, Engine...ETICS supporting compliance and interoperability, Gabriele Giammatteo, Engine...
ETICS supporting compliance and interoperability, Gabriele Giammatteo, Engine...
 
BUD17-TR01: Philosophy of Open Source
BUD17-TR01: Philosophy of Open SourceBUD17-TR01: Philosophy of Open Source
BUD17-TR01: Philosophy of Open Source
 
[CONFidence 2016] Sławomir Kosowski - Introduction to iOS Application Securit...
[CONFidence 2016] Sławomir Kosowski - Introduction to iOS Application Securit...[CONFidence 2016] Sławomir Kosowski - Introduction to iOS Application Securit...
[CONFidence 2016] Sławomir Kosowski - Introduction to iOS Application Securit...
 
Software Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery ApproachSoftware Delivery in 2016 - A Continuous Delivery Approach
Software Delivery in 2016 - A Continuous Delivery Approach
 
TSC Sponsored BoF: Can Linux and Automotive Functional Safety Mix ? Take 2: T...
TSC Sponsored BoF: Can Linux and Automotive Functional Safety Mix ? Take 2: T...TSC Sponsored BoF: Can Linux and Automotive Functional Safety Mix ? Take 2: T...
TSC Sponsored BoF: Can Linux and Automotive Functional Safety Mix ? Take 2: T...
 
Introduction to Open Source
Introduction to Open SourceIntroduction to Open Source
Introduction to Open Source
 
Intro JBug Milano - January 2012
Intro JBug Milano - January 2012Intro JBug Milano - January 2012
Intro JBug Milano - January 2012
 
Responsibilities of gluster_maintainers
Responsibilities of gluster_maintainersResponsibilities of gluster_maintainers
Responsibilities of gluster_maintainers
 

Similar to Software maintenance PyConUK 2016

Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipsterJulien Dubois
 
PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...
PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...
PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...Puppet
 
Python Linters at Scale.pdf
Python Linters at Scale.pdfPython Linters at Scale.pdf
Python Linters at Scale.pdfJimmy Lai
 
Android best practices 2015
Android best practices 2015Android best practices 2015
Android best practices 2015Sean Katz
 
OpenStack Cinder On-Boarding Education - Boston Summit - 2017
OpenStack Cinder On-Boarding Education - Boston Summit - 2017OpenStack Cinder On-Boarding Education - Boston Summit - 2017
OpenStack Cinder On-Boarding Education - Boston Summit - 2017Jay Bryant
 
Using protocol analyzer on mikrotik
Using protocol analyzer on mikrotikUsing protocol analyzer on mikrotik
Using protocol analyzer on mikrotikAchmad Mardiansyah
 
OpenStack Cinder On-Boarding Room - Vancouver Summit 2018
OpenStack Cinder On-Boarding Room - Vancouver Summit 2018OpenStack Cinder On-Boarding Room - Vancouver Summit 2018
OpenStack Cinder On-Boarding Room - Vancouver Summit 2018Jay Bryant
 
IoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSesIoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSesMender.io
 
In Need For A Linux Kernel Maintained For A Very Long Time? CIP Linux Kernel ...
In Need For A Linux Kernel Maintained For A Very Long Time? CIP Linux Kernel ...In Need For A Linux Kernel Maintained For A Very Long Time? CIP Linux Kernel ...
In Need For A Linux Kernel Maintained For A Very Long Time? CIP Linux Kernel ...Agustin Benito Bethencourt
 
Cinder Project On-Boarding - OpenInfra Summit Denver 2019
Cinder Project On-Boarding - OpenInfra Summit Denver 2019Cinder Project On-Boarding - OpenInfra Summit Denver 2019
Cinder Project On-Boarding - OpenInfra Summit Denver 2019Jay Bryant
 
DocDoku: Using web technologies in a desktop application. OW2con'15, November...
DocDoku: Using web technologies in a desktop application. OW2con'15, November...DocDoku: Using web technologies in a desktop application. OW2con'15, November...
DocDoku: Using web technologies in a desktop application. OW2con'15, November...OW2
 
DocDokuPLM presentation - OW2Con 2015 Community Award winner
DocDokuPLM presentation - OW2Con 2015 Community Award winnerDocDokuPLM presentation - OW2Con 2015 Community Award winner
DocDokuPLM presentation - OW2Con 2015 Community Award winnerDocDoku
 
CHIPS Alliance_Object Automation Inc_workshop
CHIPS Alliance_Object Automation Inc_workshopCHIPS Alliance_Object Automation Inc_workshop
CHIPS Alliance_Object Automation Inc_workshopObject Automation
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3Opersys inc.
 
Building a Small Datacenter
Building a Small DatacenterBuilding a Small Datacenter
Building a Small Datacenterssuser4b98f0
 
Cinder On-boarding Room - Berlin (11-13-2018)
Cinder On-boarding Room - Berlin (11-13-2018)Cinder On-boarding Room - Berlin (11-13-2018)
Cinder On-boarding Room - Berlin (11-13-2018)Jay Bryant
 
Building a Small DC
Building a Small DCBuilding a Small DC
Building a Small DCAPNIC
 
Angular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseAngular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseLINAGORA
 

Similar to Software maintenance PyConUK 2016 (20)

Software maintenance PyConPL 2016
Software maintenance PyConPL 2016Software maintenance PyConPL 2016
Software maintenance PyConPL 2016
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipster
 
PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...
PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...
PuppetConf 2016: Why Network Automation Matters, and What You Can Do About It...
 
Python Linters at Scale.pdf
Python Linters at Scale.pdfPython Linters at Scale.pdf
Python Linters at Scale.pdf
 
Android best practices 2015
Android best practices 2015Android best practices 2015
Android best practices 2015
 
OpenStack Cinder On-Boarding Education - Boston Summit - 2017
OpenStack Cinder On-Boarding Education - Boston Summit - 2017OpenStack Cinder On-Boarding Education - Boston Summit - 2017
OpenStack Cinder On-Boarding Education - Boston Summit - 2017
 
Using protocol analyzer on mikrotik
Using protocol analyzer on mikrotikUsing protocol analyzer on mikrotik
Using protocol analyzer on mikrotik
 
OpenStack Cinder On-Boarding Room - Vancouver Summit 2018
OpenStack Cinder On-Boarding Room - Vancouver Summit 2018OpenStack Cinder On-Boarding Room - Vancouver Summit 2018
OpenStack Cinder On-Boarding Room - Vancouver Summit 2018
 
IoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSesIoT: Contrasting Yocto/Buildroot to binary OSes
IoT: Contrasting Yocto/Buildroot to binary OSes
 
Scaling xtext
Scaling xtextScaling xtext
Scaling xtext
 
In Need For A Linux Kernel Maintained For A Very Long Time? CIP Linux Kernel ...
In Need For A Linux Kernel Maintained For A Very Long Time? CIP Linux Kernel ...In Need For A Linux Kernel Maintained For A Very Long Time? CIP Linux Kernel ...
In Need For A Linux Kernel Maintained For A Very Long Time? CIP Linux Kernel ...
 
Cinder Project On-Boarding - OpenInfra Summit Denver 2019
Cinder Project On-Boarding - OpenInfra Summit Denver 2019Cinder Project On-Boarding - OpenInfra Summit Denver 2019
Cinder Project On-Boarding - OpenInfra Summit Denver 2019
 
DocDoku: Using web technologies in a desktop application. OW2con'15, November...
DocDoku: Using web technologies in a desktop application. OW2con'15, November...DocDoku: Using web technologies in a desktop application. OW2con'15, November...
DocDoku: Using web technologies in a desktop application. OW2con'15, November...
 
DocDokuPLM presentation - OW2Con 2015 Community Award winner
DocDokuPLM presentation - OW2Con 2015 Community Award winnerDocDokuPLM presentation - OW2Con 2015 Community Award winner
DocDokuPLM presentation - OW2Con 2015 Community Award winner
 
CHIPS Alliance_Object Automation Inc_workshop
CHIPS Alliance_Object Automation Inc_workshopCHIPS Alliance_Object Automation Inc_workshop
CHIPS Alliance_Object Automation Inc_workshop
 
Headless Android at AnDevCon3
Headless Android at AnDevCon3Headless Android at AnDevCon3
Headless Android at AnDevCon3
 
Building a Small Datacenter
Building a Small DatacenterBuilding a Small Datacenter
Building a Small Datacenter
 
Cinder On-boarding Room - Berlin (11-13-2018)
Cinder On-boarding Room - Berlin (11-13-2018)Cinder On-boarding Room - Berlin (11-13-2018)
Cinder On-boarding Room - Berlin (11-13-2018)
 
Building a Small DC
Building a Small DCBuilding a Small DC
Building a Small DC
 
Angular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entrepriseAngular v2 et plus : le futur du développement d'applications en entreprise
Angular v2 et plus : le futur du développement d'applications en entreprise
 

More from Cesar Cardenas Desales

PyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applicationsPyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applicationsCesar Cardenas Desales
 
Migrate to Python 3 using the six library
Migrate to Python 3 using the six libraryMigrate to Python 3 using the six library
Migrate to Python 3 using the six libraryCesar Cardenas Desales
 
PyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applicationsPyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applicationsCesar Cardenas Desales
 
Writing and deploying serverless python applications
Writing and deploying serverless python applicationsWriting and deploying serverless python applications
Writing and deploying serverless python applicationsCesar Cardenas Desales
 
Scalable Web applications with Elastic Beanstalk as your PAAS: a primer
Scalable Web applications with Elastic Beanstalk as your PAAS: a primerScalable Web applications with Elastic Beanstalk as your PAAS: a primer
Scalable Web applications with Elastic Beanstalk as your PAAS: a primerCesar Cardenas Desales
 
Distributed Task Processing with Celery - PyZH
Distributed Task Processing with Celery - PyZHDistributed Task Processing with Celery - PyZH
Distributed Task Processing with Celery - PyZHCesar Cardenas Desales
 

More from Cesar Cardenas Desales (8)

PyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applicationsPyConIT 2018 Writing and deploying serverless python applications
PyConIT 2018 Writing and deploying serverless python applications
 
Migrate to Python 3 using the six library
Migrate to Python 3 using the six libraryMigrate to Python 3 using the six library
Migrate to Python 3 using the six library
 
PyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applicationsPyConIE 2017 Writing and deploying serverless python applications
PyConIE 2017 Writing and deploying serverless python applications
 
Writing and deploying serverless python applications
Writing and deploying serverless python applicationsWriting and deploying serverless python applications
Writing and deploying serverless python applications
 
Scalable Web applications with Elastic Beanstalk as your PAAS: a primer
Scalable Web applications with Elastic Beanstalk as your PAAS: a primerScalable Web applications with Elastic Beanstalk as your PAAS: a primer
Scalable Web applications with Elastic Beanstalk as your PAAS: a primer
 
Unit Testing with Nose
Unit Testing with NoseUnit Testing with Nose
Unit Testing with Nose
 
Distributed Task Processing with Celery - PyZH
Distributed Task Processing with Celery - PyZHDistributed Task Processing with Celery - PyZH
Distributed Task Processing with Celery - PyZH
 
Code Reviews in Python - PyZh
Code Reviews in Python - PyZhCode Reviews in Python - PyZh
Code Reviews in Python - PyZh
 

Recently uploaded

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Recently uploaded (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Software maintenance PyConUK 2016

  • 1. 1 So you "want" to maintain a Python legacy code base PyConUK 2016 César Cardenas Desales
  • 2. 2 About me ● Software Architect at Webrepublic AG ● Python user since v.2.0 ● Co-organizer of the Swiss Python Summit (i.e. PyCon Switzerland) and the Zurich Python User Group
  • 3. 3 Agenda ❖ Introduction ❖ Maintenance “framework” 1. Understand (your system) 2. Safety net 3. Improve
  • 5. 5 Why discuss maintenance? ● 50% software cost - Barry Boehm ● 40 to 80% software costs - Robert L. Glass
  • 8. 8
  • 10. 10
  • 11. 11 Automotive Industry ● Warranty? 5 years or 100,000 KM ● Life-time: 100,000 to 200,000 KM
  • 12. 12 Rail Industry ● Short cycle maintenance: 80 years
  • 13. 13 Rail Industry ● Short cycle maintenance: 80 years ● Long cycle maintenance: 150 years
  • 14. 14 IT Industry? ● Linux kernel: 1991, 25 years ● LaTeX: 1985, 31 years ● U.S. Treasury Department - Individual Master File: 56 years
  • 15. 15 IT Industry? ● Linux kernel: 1991, 25 years ● LaTeX: 1985, 31 years ● U.S. Treasury Department - Individual Master File: 56 years ● Probably many Fortran or Cobol systems COBOL programmer wanted - 5 years experience life expectancy
  • 16. 16 IT Industry? ● Linux kernel: 1991, 25 years ● LaTeX: 1985, 31 years ● U.S. Treasury Department - Individual Master File: 56 years ● Probably many Fortran or Cobol systems ● Mine WAS 4 years ● Yours?
  • 18. 18 The life of a maintainer (i.e. me) 1. “Our code is messy” 2. “Everyone’s code is messy” (3k LOC class) 3. “Somebody’s code is messy”
  • 20. 20 1 Understand - Context ● Code doesn’t live in a void ● Ask users ● THE business case ● Interview power users ● Create personas ● Read use cases ● Write use cases
  • 21. 21 1 Understand - Architecture ● Understand the architecture ● Create diagrams
  • 22. 22 1 Understand - Architecture ● Print critical code ● Read the code ● Do code walkthroughs ● Rubber duck debugging
  • 23. 23 1 Understand - Docs ● Read the docs ● Write the docs ● Comment the code ● Docstrings ● Doxygen ● Sphingx
  • 24. 24 1 Understand - Debug it ● Observe program behaviour ● For the sake of it ● pdb ● pudb ● ipdb ● Bugjar ● Winpdb ● Your IDE
  • 25. 25 1 Understand - Profile it ● Does 80/20 hold? ● cProfile, profile ● timeit ● heapy ● memory_profiler ● Your IDE ● top, htop ● IPython SnakeViz
  • 26. 26 1 Understand - Break it ● Scalability? ● What breaks? ● Why does it break? ● Does it matter? ● Recovery? ● nose, pytest ● Apache Benchmark ● Locust ● JMeter ● Adhoc scripts
  • 28. 28 2 Safety net - Automated tests ● Regression tests ● Acceptance tests ● Data driven tests ● nose, pytest ● coverage ● selenium ● tox
  • 29. 29 2 Safety net - Fail often and early ● Neutral/Nightly build ● Continuous Integration ● Broken build => Not safe to release
  • 30. 30 2 Safety net - The build ● Github protected branches ● Jenkins ● Buildout ● Buildbot ● Travis CI
  • 31. 31 2 Safety net - Monitoring ● What errors are current? ● Opbeat
  • 32. 32 2 Safety net - Monitoring ● Visualize and filter log entries ● Logstash + Kibana
  • 33. 33 2 Safety net - Automate it all ● Because humans make mistakes ● Provisioning deployment ● Ansible ● Salt ● Puppet ● Chef
  • 35. 35 3 Improve - The code ● Leave the code cleaner than you found it ● pep8 -> pycodestyle ● Flake8 (PyFlakes + pycodestyle) ● pylint ● radon ● Your IDE
  • 36. 36 3 Improve - The code ● Radon ○ LOC, SLOC ○ Cyclomatic Complexity ○ Maintainability Index ○ Halstead Metrics
  • 37. 37
  • 38. 38 3 Improve - The code $ radon cc -o SCORE -s -a processing/tasks.py
  • 39. 39 3 Improve - The code $ pylint bot.py
  • 40. 40 3 Improve - The people ● TDD if possible ● Do Code Reviews
  • 41. 41 3 Improve - The people ● Code Reviews ○ Spread knowledge ○ The Ego Factor ○ Increase quality of software “Your reputation at stake with every commit”
  • 42. 42 3 Improve - The people ● Code Reviews ○ Easily done with Github ○ Like washing your hands after going to the toilet
  • 43. 43 Ask me ● Ascend a Swiss (Python) summit ● Why can you buy cornish pasties in Mexico
  • 44. 44 Let’s make it happen. Thank you. @ccdesales