SlideShare ist ein Scribd-Unternehmen logo
1 von 48
Downloaden Sie, um offline zu lesen
THEY CALL IT LEGACY
Because it's killing me to work on it
Tuesday, July 9, 13
WHERE DO I START?
Tuesday, July 9, 13
WHO AM I?
• Twitter: @arlen
• GitHub: Paladin
• Blog: http://www.theodicius.com
• Coderwall: https://coderwall.com/paladin
• MojoLive: http://mojolive.com/profile/paladin
• LinkedIn: www.linkedin.com/in/arlenwalker/
Tuesday, July 9, 13
LEGACY CODE
It's everywhere
Tuesday, July 9, 13
IT WASTHERE BEFORE
YOU ARRIVED
It'll be there after you're gone
Tuesday, July 9, 13
YOU DON'T
UNDERSTAND IT
Will those who follow you understand yours?
Tuesday, July 9, 13
YOU DON'T KNOWTHEIR
SKILL OR KNOWLEDGE
How will those who follow you know yours?
Tuesday, July 9, 13
THETRUTH IS INTHE
CODE
Yes,Agent Mulder. But where?
Tuesday, July 9, 13
Tuesday, July 9, 13
NOWTHATYOU HAVE IT
What are you going to do with it?
Tuesday, July 9, 13
REWRITE IT?
Tuesday, July 9, 13
Tuesday, July 9, 13
WATCH ME REWRITETHAT
CODE FROM SCRATCH!
That trick never works!
Tuesday, July 9, 13
WHAT’STHE PAIN POINT?
Why are you here in the first place?
Tuesday, July 9, 13
THETARRASCH PRINCIPLE
“When there is nothing
concrete to do, improve the
position of your worst
piece.”
Tuesday, July 9, 13
OK, SIGGY OLD BOY
How do I measure my
“worst piece” of software?
Tuesday, July 9, 13
W. EDWARDS DEMING
"You can't manage what
you can't measure"
Tuesday, July 9, 13
STOP AND SMELLTHE
CODE
Code “smells” are simple metrics you can use to
quickly locate potential trouble spots
Tuesday, July 9, 13
ODOR - STATIC CALL
Class::method() syntax reduces the code’s flexibility
Tuesday, July 9, 13
ODOR - LONG
ARGUMENT LIST
Many arguments may mean the method is connected
to the code in too many ways.
Tuesday, July 9, 13
ODOR - LONG METHOD
Too many lines may mean the method is trying to do
too much
Tuesday, July 9, 13
ODOR - LARGE CLASS
A class with too many methods may be trying to do
too much
Tuesday, July 9, 13
MORE COMPLEX CODE
METRICS
Tuesday, July 9, 13
NPATH COMPLEXITY
Number of paths through the code
Tuesday, July 9, 13
ACYCYLIC
DEPENDENCIES
Classes that depend upon classes that depend upon
them
Tuesday, July 9, 13
CYCLOMATIC
COMPLEXITY
Paths - nodes + 2 * endpoints
Tuesday, July 9, 13
CHANGE RISK ANALYSIS
AND PREDICTION
CC(m)^2 * (1 – Coverage(m)/100)^3 + CC(m)
Tuesday, July 9, 13
ARETHERETESTS?
Don't be silly
Tuesday, July 9, 13
YOU NEEDTESTS
Tests need seams
Tuesday, July 9, 13
DEBUGGINGTHROUGHTESTINGTHE COMPLETE
CODE STACK
Tuesday, July 9, 13
Find an existing seam, if possible
Create new seams by sprouting a new class or
method
Tuesday, July 9, 13
NOWYOU HAVETESTS
Are we there yet?
Tuesday, July 9, 13
HOW DO I USETHE
METRICS?
Tuesday, July 9, 13
SIMPLICATE
Tuesday, July 9, 13
TOO MANY METHODS?
Look to move some methods into new objects
Tuesday, July 9, 13
METHODTOO LONG?
Extract smaller methods from it.
Tuesday, July 9, 13
OBJECTTOO COMPLEX?
Simplify the coding by enforcing command/query
separation
Tuesday, July 9, 13
TOOLS!
You said there would be tools!
Tuesday, July 9, 13
DANGER,WILL ROBINSON!!
Don’t confuse the map with
the territory.The metrics are
a map to the location of
possible problems in your
code.They are not your
code.
Use the metrics, don’t let the
metrics use you.
Publicity photo from “Lost in Space”
Tuesday, July 9, 13
COPY/PASTE DETECTION
Finds code duplication in your project. Extracting them into a
single method will make future maintenance easier It will also
shorten the methods including them.
Identical methods across multiple classes make good
candidates for inheritance orTraits.
https://github.com/sebastianbergmann/phpcpd
Tuesday, July 9, 13
PHPUNIT
The most popular automated unit testing framework for php,
used in most significant open source projects, such as Drupal,
Joomla, Zend Framework2, Symfony2, etc.
Calculates a CRAP index on the code as part of the coverage
report, but only for code executed as part of running the tests.
Manual: http://phpunit.de/manual/current/en/index.html (also
available in ePub and PDF files)
Code: https://github.com/sebastianbergmann/phpunit/
Tuesday, July 9, 13
PHP MESS DETECTOR
The PHP Project Mess Detector goes through single files or an
entire project looking for many potential problem areas. It has
some factors included in it, but you can create your own tests,
if you have others you’d like to rely on.
http://phpmd.org
Tuesday, July 9, 13
PHP DEPEND
PHP Depend is a small program that generates several
different reports about the condition of a code project it’s
pointed at.Aside from the “normal” reports, it produces two
graphics that are quite useful for giving you a general idea of
what you’re looking at: the Abstraction-Instability Chart and
the Overview Pyramid.
Code & Docs: http://www.pdepend.org/
Tuesday, July 9, 13
THE OVERVIEW PYRAMID
This is a high-level view of the metrics of the system. It
calculates the cyclomatic complexity, counts lines of code,
methods, classes and packages. It also counts the distinct
method calls, and “fan-out,” the references from a class to a
class in a different inheritance branch, and analyses the
inheritance heirarchy.
Tuesday, July 9, 13
OVERVIEW PYRAMID CHART
The overview Pyramid
charts for Drupal,Wordpress
and Joomla give us a “50,000
ft” view of the systems.
Tuesday, July 9, 13
ABSTRACTION AND
INSTABILITY
The Abstraction metric (0-1) is measure of how easily the
system can be expanded/modified.
The instability metric (0 - 1) is an attempt to measure the ease
of change.
Packages approaching [0,0] are rigid. Packages approaching [1,1]
are completely abstract, therefore useless.The “happy meridian”
is a diagonal through the center of the chart.
http://www.objectmentor.com/resources/articles/oodmetrc.pdf
Tuesday, July 9, 13
ABSTRACTION-INSTABILITY
CHART
These are the A-I charts for
Drupal,Wordpress, and Joomla.
Drupal has very few objects
but they’re well balanced.
Wordpress has more, but no
abstraction.
Joomla has a wide range of
objects, not all well-balanced.
Tuesday, July 9, 13
SYMFONY2
Here are the charts for the
Symfony2 framework.
The overview looks very
good, while the A-I chart
shows a well-distributed mix
of objects in the system.
Tuesday, July 9, 13

Weitere ähnliche Inhalte

Ähnlich wie Where do i start?

OSMC 2013 | Flapjack - monitoring notification system by Birger Schmidt
OSMC 2013 | Flapjack - monitoring notification system by Birger SchmidtOSMC 2013 | Flapjack - monitoring notification system by Birger Schmidt
OSMC 2013 | Flapjack - monitoring notification system by Birger SchmidtNETWAYS
 
Engineering culture
Engineering cultureEngineering culture
Engineering culturePamela Fox
 
Analytics Brownbag
Analytics Brownbag Analytics Brownbag
Analytics Brownbag DataTactics
 
Data Breaking Bad at Berlin Buzzwords
Data Breaking Bad at Berlin BuzzwordsData Breaking Bad at Berlin Buzzwords
Data Breaking Bad at Berlin BuzzwordsMapR Technologies
 
Data Tactics Analytics Brown Bag (Aug 22, 2013)
Data Tactics Analytics Brown Bag (Aug 22, 2013)Data Tactics Analytics Brown Bag (Aug 22, 2013)
Data Tactics Analytics Brown Bag (Aug 22, 2013)Rich Heimann
 
The Seneca Pattern at EngineYard Distill 2013 Conference
The Seneca Pattern at EngineYard Distill 2013 ConferenceThe Seneca Pattern at EngineYard Distill 2013 Conference
The Seneca Pattern at EngineYard Distill 2013 ConferenceRichard Rodger
 
Selecting a Web Framework
Selecting a Web FrameworkSelecting a Web Framework
Selecting a Web Frameworkpamselle
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkJeremy Kendall
 
Drupal, rotative numérique pour un groupe de presse
Drupal, rotative numérique pour un groupe de presseDrupal, rotative numérique pour un groupe de presse
Drupal, rotative numérique pour un groupe de presseAudaxis
 
Drupal - Digital publishing platform for Press & Media group
Drupal - Digital publishing platform for Press & Media groupDrupal - Digital publishing platform for Press & Media group
Drupal - Digital publishing platform for Press & Media groupEric Fesler
 
Drupal: Internet Lego - What is Drupal?
Drupal: Internet Lego - What is Drupal?Drupal: Internet Lego - What is Drupal?
Drupal: Internet Lego - What is Drupal?Eric Aitala
 
Essential Test-Driven Development
Essential Test-Driven DevelopmentEssential Test-Driven Development
Essential Test-Driven DevelopmentTechWell
 
How We Look At Software
How We Look At SoftwareHow We Look At Software
How We Look At SoftwareDevrim Yasar
 
Intro to Yahoo Tech
Intro to Yahoo TechIntro to Yahoo Tech
Intro to Yahoo TechDav Glass
 
Bio-IT Asia 2013: Informatics & Cloud - Best Practices & Lessons Learned
Bio-IT Asia 2013: Informatics & Cloud - Best Practices & Lessons LearnedBio-IT Asia 2013: Informatics & Cloud - Best Practices & Lessons Learned
Bio-IT Asia 2013: Informatics & Cloud - Best Practices & Lessons LearnedChris Dagdigian
 
Approaching real-time-hadoop
Approaching real-time-hadoopApproaching real-time-hadoop
Approaching real-time-hadoopChris Huang
 
Ten Groovy Little JavaScript Tips
Ten Groovy Little JavaScript TipsTen Groovy Little JavaScript Tips
Ten Groovy Little JavaScript TipsTroy Miles
 
6 tips on faster data journalism workflows
6 tips on faster data journalism workflows6 tips on faster data journalism workflows
6 tips on faster data journalism workflowsPaul Bradshaw
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Eugene Lazutkin
 

Ähnlich wie Where do i start? (20)

OSMC 2013 | Flapjack - monitoring notification system by Birger Schmidt
OSMC 2013 | Flapjack - monitoring notification system by Birger SchmidtOSMC 2013 | Flapjack - monitoring notification system by Birger Schmidt
OSMC 2013 | Flapjack - monitoring notification system by Birger Schmidt
 
Engineering culture
Engineering cultureEngineering culture
Engineering culture
 
Analytics Brownbag
Analytics Brownbag Analytics Brownbag
Analytics Brownbag
 
Data Breaking Bad at Berlin Buzzwords
Data Breaking Bad at Berlin BuzzwordsData Breaking Bad at Berlin Buzzwords
Data Breaking Bad at Berlin Buzzwords
 
Data Tactics Analytics Brown Bag (Aug 22, 2013)
Data Tactics Analytics Brown Bag (Aug 22, 2013)Data Tactics Analytics Brown Bag (Aug 22, 2013)
Data Tactics Analytics Brown Bag (Aug 22, 2013)
 
The Seneca Pattern at EngineYard Distill 2013 Conference
The Seneca Pattern at EngineYard Distill 2013 ConferenceThe Seneca Pattern at EngineYard Distill 2013 Conference
The Seneca Pattern at EngineYard Distill 2013 Conference
 
Selecting a Web Framework
Selecting a Web FrameworkSelecting a Web Framework
Selecting a Web Framework
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
 
Drupal, rotative numérique pour un groupe de presse
Drupal, rotative numérique pour un groupe de presseDrupal, rotative numérique pour un groupe de presse
Drupal, rotative numérique pour un groupe de presse
 
Drupal - Digital publishing platform for Press & Media group
Drupal - Digital publishing platform for Press & Media groupDrupal - Digital publishing platform for Press & Media group
Drupal - Digital publishing platform for Press & Media group
 
Drupal: Internet Lego - What is Drupal?
Drupal: Internet Lego - What is Drupal?Drupal: Internet Lego - What is Drupal?
Drupal: Internet Lego - What is Drupal?
 
Essential Test-Driven Development
Essential Test-Driven DevelopmentEssential Test-Driven Development
Essential Test-Driven Development
 
How We Look At Software
How We Look At SoftwareHow We Look At Software
How We Look At Software
 
Intro to Yahoo Tech
Intro to Yahoo TechIntro to Yahoo Tech
Intro to Yahoo Tech
 
Bio-IT Asia 2013: Informatics & Cloud - Best Practices & Lessons Learned
Bio-IT Asia 2013: Informatics & Cloud - Best Practices & Lessons LearnedBio-IT Asia 2013: Informatics & Cloud - Best Practices & Lessons Learned
Bio-IT Asia 2013: Informatics & Cloud - Best Practices & Lessons Learned
 
Approaching real-time-hadoop
Approaching real-time-hadoopApproaching real-time-hadoop
Approaching real-time-hadoop
 
Why Strategic Decision Making Goes Wrong
Why Strategic Decision Making Goes WrongWhy Strategic Decision Making Goes Wrong
Why Strategic Decision Making Goes Wrong
 
Ten Groovy Little JavaScript Tips
Ten Groovy Little JavaScript TipsTen Groovy Little JavaScript Tips
Ten Groovy Little JavaScript Tips
 
6 tips on faster data journalism workflows
6 tips on faster data journalism workflows6 tips on faster data journalism workflows
6 tips on faster data journalism workflows
 
Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.Practical pairing of generative programming with functional programming.
Practical pairing of generative programming with functional programming.
 

Kürzlich hochgeladen

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
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
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 

Kürzlich hochgeladen (20)

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
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
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 

Where do i start?

  • 1. THEY CALL IT LEGACY Because it's killing me to work on it Tuesday, July 9, 13
  • 2. WHERE DO I START? Tuesday, July 9, 13
  • 3. WHO AM I? • Twitter: @arlen • GitHub: Paladin • Blog: http://www.theodicius.com • Coderwall: https://coderwall.com/paladin • MojoLive: http://mojolive.com/profile/paladin • LinkedIn: www.linkedin.com/in/arlenwalker/ Tuesday, July 9, 13
  • 5. IT WASTHERE BEFORE YOU ARRIVED It'll be there after you're gone Tuesday, July 9, 13
  • 6. YOU DON'T UNDERSTAND IT Will those who follow you understand yours? Tuesday, July 9, 13
  • 7. YOU DON'T KNOWTHEIR SKILL OR KNOWLEDGE How will those who follow you know yours? Tuesday, July 9, 13
  • 8. THETRUTH IS INTHE CODE Yes,Agent Mulder. But where? Tuesday, July 9, 13
  • 10. NOWTHATYOU HAVE IT What are you going to do with it? Tuesday, July 9, 13
  • 13. WATCH ME REWRITETHAT CODE FROM SCRATCH! That trick never works! Tuesday, July 9, 13
  • 14. WHAT’STHE PAIN POINT? Why are you here in the first place? Tuesday, July 9, 13
  • 15. THETARRASCH PRINCIPLE “When there is nothing concrete to do, improve the position of your worst piece.” Tuesday, July 9, 13
  • 16. OK, SIGGY OLD BOY How do I measure my “worst piece” of software? Tuesday, July 9, 13
  • 17. W. EDWARDS DEMING "You can't manage what you can't measure" Tuesday, July 9, 13
  • 18. STOP AND SMELLTHE CODE Code “smells” are simple metrics you can use to quickly locate potential trouble spots Tuesday, July 9, 13
  • 19. ODOR - STATIC CALL Class::method() syntax reduces the code’s flexibility Tuesday, July 9, 13
  • 20. ODOR - LONG ARGUMENT LIST Many arguments may mean the method is connected to the code in too many ways. Tuesday, July 9, 13
  • 21. ODOR - LONG METHOD Too many lines may mean the method is trying to do too much Tuesday, July 9, 13
  • 22. ODOR - LARGE CLASS A class with too many methods may be trying to do too much Tuesday, July 9, 13
  • 24. NPATH COMPLEXITY Number of paths through the code Tuesday, July 9, 13
  • 25. ACYCYLIC DEPENDENCIES Classes that depend upon classes that depend upon them Tuesday, July 9, 13
  • 26. CYCLOMATIC COMPLEXITY Paths - nodes + 2 * endpoints Tuesday, July 9, 13
  • 27. CHANGE RISK ANALYSIS AND PREDICTION CC(m)^2 * (1 – Coverage(m)/100)^3 + CC(m) Tuesday, July 9, 13
  • 29. YOU NEEDTESTS Tests need seams Tuesday, July 9, 13
  • 31. Find an existing seam, if possible Create new seams by sprouting a new class or method Tuesday, July 9, 13
  • 32. NOWYOU HAVETESTS Are we there yet? Tuesday, July 9, 13
  • 33. HOW DO I USETHE METRICS? Tuesday, July 9, 13
  • 35. TOO MANY METHODS? Look to move some methods into new objects Tuesday, July 9, 13
  • 36. METHODTOO LONG? Extract smaller methods from it. Tuesday, July 9, 13
  • 37. OBJECTTOO COMPLEX? Simplify the coding by enforcing command/query separation Tuesday, July 9, 13
  • 38. TOOLS! You said there would be tools! Tuesday, July 9, 13
  • 39. DANGER,WILL ROBINSON!! Don’t confuse the map with the territory.The metrics are a map to the location of possible problems in your code.They are not your code. Use the metrics, don’t let the metrics use you. Publicity photo from “Lost in Space” Tuesday, July 9, 13
  • 40. COPY/PASTE DETECTION Finds code duplication in your project. Extracting them into a single method will make future maintenance easier It will also shorten the methods including them. Identical methods across multiple classes make good candidates for inheritance orTraits. https://github.com/sebastianbergmann/phpcpd Tuesday, July 9, 13
  • 41. PHPUNIT The most popular automated unit testing framework for php, used in most significant open source projects, such as Drupal, Joomla, Zend Framework2, Symfony2, etc. Calculates a CRAP index on the code as part of the coverage report, but only for code executed as part of running the tests. Manual: http://phpunit.de/manual/current/en/index.html (also available in ePub and PDF files) Code: https://github.com/sebastianbergmann/phpunit/ Tuesday, July 9, 13
  • 42. PHP MESS DETECTOR The PHP Project Mess Detector goes through single files or an entire project looking for many potential problem areas. It has some factors included in it, but you can create your own tests, if you have others you’d like to rely on. http://phpmd.org Tuesday, July 9, 13
  • 43. PHP DEPEND PHP Depend is a small program that generates several different reports about the condition of a code project it’s pointed at.Aside from the “normal” reports, it produces two graphics that are quite useful for giving you a general idea of what you’re looking at: the Abstraction-Instability Chart and the Overview Pyramid. Code & Docs: http://www.pdepend.org/ Tuesday, July 9, 13
  • 44. THE OVERVIEW PYRAMID This is a high-level view of the metrics of the system. It calculates the cyclomatic complexity, counts lines of code, methods, classes and packages. It also counts the distinct method calls, and “fan-out,” the references from a class to a class in a different inheritance branch, and analyses the inheritance heirarchy. Tuesday, July 9, 13
  • 45. OVERVIEW PYRAMID CHART The overview Pyramid charts for Drupal,Wordpress and Joomla give us a “50,000 ft” view of the systems. Tuesday, July 9, 13
  • 46. ABSTRACTION AND INSTABILITY The Abstraction metric (0-1) is measure of how easily the system can be expanded/modified. The instability metric (0 - 1) is an attempt to measure the ease of change. Packages approaching [0,0] are rigid. Packages approaching [1,1] are completely abstract, therefore useless.The “happy meridian” is a diagonal through the center of the chart. http://www.objectmentor.com/resources/articles/oodmetrc.pdf Tuesday, July 9, 13
  • 47. ABSTRACTION-INSTABILITY CHART These are the A-I charts for Drupal,Wordpress, and Joomla. Drupal has very few objects but they’re well balanced. Wordpress has more, but no abstraction. Joomla has a wide range of objects, not all well-balanced. Tuesday, July 9, 13
  • 48. SYMFONY2 Here are the charts for the Symfony2 framework. The overview looks very good, while the A-I chart shows a well-distributed mix of objects in the system. Tuesday, July 9, 13