SlideShare a Scribd company logo
1
P R O G R A M M I N G
= !
W R I T I N G C O D E
• A L L S L I D E S A R E I N E N G L I S H
• T Y P O S M AY O C C U R
Y O U D O N ’ T K N O W E N G L I S H ?
2
3
• S O F T WA R E
E N G I N E E R
• W E B A N D M O B I L E
• R U B Y / P H P /
O B J E C T I V E C /
S W I F T
• 1 1 Y E A R S O F
E X P E R I E N C E
• Q U I M B I K , I N C /
U S A
G U S TA V O C U N H A
4
•I N F R A S T R U C T U R E ?
•S U P P O RT ?
•W O R K S ?
•P R O G R A M M I N G ?
5
P R O C E S S
W R I T I N G
T E S T I N G
M A I N T E N A N I N G
[ W I K I P E D I A ]
D E F I N E : P R O G R A M ?
6
• ~ 300 Programming Languages - Wikipedia
• Learn all of them? NO!
• Make mistakes is common and acceptable
• Which language should I learn?
Does the language really matters?!?!?!?!
F* NO!!!!!!
7
P R O G R A M M I N G I S E A S Y
8
I D O T H I S O N A D A I LY B A S I S
I N E V E R M A K E M I S TA K E S !
R E A L LY ?
H T T P : / / I . I M G U R . C O M / B T J Z E D W. J P G9
10
H T T P : / / I . I M G U R . C O M / L Z B I E . J P G
11
H T T P : / / PA S T E B I N . C O M / P T RY 5 G 2 A
Construtor
+ 40 parâmetros
PA S T I E . O R G / PA S T E S / 8 2 7 2 3 8 6
H T T P S : / / G I S T. G I T H U B . C O M /
A N O N Y M O U S /
A A 4 6 E 8 D B 0 9 8 D C B D 3 B 4 2 8
12
13
C O D E S M E L L
14
C O D E S M E L L
( … ) I S A S U R FA C E I N D I C A T I O N T H A T U S U A L LY
C O R R E S P O N D S T O A D E E P E R P R O B L E M I N T H E
S Y S T E M ( … )
K E N T B E C K
15
C O D E S M E L L
• Duplicate Code
• Long Method
• Large Class
• Long Parameter List
• + 10 more symptoms
16
D U P L I C AT E C O D E
C O D E S M E L L
17
Most common problem
Solution
• Same class, different methods
• Extract code to new method
• Different classes
• Sibling classes
• Move code to parent class
• If code is similar, but not equal, break into methods that has
same code and methods with different information
• Unrelated classes
• Check design
L O N G M E T H O D
C O D E S M E L L
18
Hard to understand, easy to solve
Solution
• Break the methods into smaller methods (subroutines)
• Big method will become a method caller
• Easier to maintain
Problems
• Hard to read
• Usually loses it’s main purpose
L A R G E C L A S S
C O D E S M E L L
19
Also known as Ninja Class
Solution
• Break the attributes into components (like address)
• Usually, attributes with same prefix/suffix is likely to become a
component
• Reduces duplicate code
Problems
• Loses it’s purpose
• Does more then one thing
• Duplicate code (often)
• Has many object-cadidates inside it
L O N G PA R A M E T E R L I S T
C O D E S M E L L
20
Change one of them and you will be in trouble
Solution
• Remove any parameters that can be retrieved from objects already
sent
Problems
• On Procedural Programming, you had to send every detail a function
needed
• On Object Oriented Programming, you can send enough to get what
the method needs
H T T P : / / W W W. A M A Z O N . C O M / G P / P R O D U C T / 0 2 0 1 4 8 5 6 7 2
21
F O R F U R T H E R I N F O R M AT I O N
I N R U B Y…
Gems
• flog - Flog shows you the most torturous code you wrote. The
more painful the code, the higher the score.
• flay - Flay analyzes ruby code for structural similarities.
Differences in literal values, names, whitespace, and
programming style are all ignored.
• reek - is a tool that examines Ruby classes, modules and methods
and reports any Code Smells it finds
• brakeman - is a static analysis tool which checks Ruby on Rails
applications for security vulnerabilities.
22
H T T P : / / W W W. S L I D E S H A R E . N E T / M A R T I N T S C H / R E FA C T O R I N G - C O D E - S M E L L
23
T W O M O R E T H I N G S …T W O M O R E T H I N G S …
24
25
18 de abril
Colégio Contato
alagoasdevday.com.br
26
Q U E S T I O N S ?
27
T H A N K Y O U !
28
Gustavo Cunha
gmmcal.com.br
[twitter|github|facebook].com/gmmcal
+GustavoCunha

More Related Content

What's hot

Building Multi-Site in Joomla
Building Multi-Site in JoomlaBuilding Multi-Site in Joomla
Building Multi-Site in Joomla
brian teeman
 
TCS: Ad Tools, Social Marketing Tools + List Building Tools
TCS: Ad Tools, Social Marketing Tools + List Building ToolsTCS: Ad Tools, Social Marketing Tools + List Building Tools
TCS: Ad Tools, Social Marketing Tools + List Building Tools
Roland Frasier
 
Development and Deployment: The Human Factor
Development and Deployment: The Human FactorDevelopment and Deployment: The Human Factor
Development and Deployment: The Human Factor
Boris Adryan
 
Comprehensive approach to delivering great developer products
Comprehensive approach to delivering great developer productsComprehensive approach to delivering great developer products
Comprehensive approach to delivering great developer products
LINE Corporation
 
Trust, Elections and Twitter (fscons 2017)
Trust, Elections and Twitter (fscons 2017)Trust, Elections and Twitter (fscons 2017)
Trust, Elections and Twitter (fscons 2017)
Patricia Aas
 
TCS: Competitive Intelligence Tools - Tools Presentation Part 1
TCS: Competitive Intelligence Tools - Tools Presentation Part 1TCS: Competitive Intelligence Tools - Tools Presentation Part 1
TCS: Competitive Intelligence Tools - Tools Presentation Part 1
Roland Frasier
 
Semantic BDD with ShouldIT?
Semantic BDD with ShouldIT?Semantic BDD with ShouldIT?
Semantic BDD with ShouldIT?
Richard McIntyre
 
Shift Your Paradigm of Learning: From Technology-Centered to Learner-Centered
Shift Your Paradigm of Learning: From Technology-Centered to Learner-CenteredShift Your Paradigm of Learning: From Technology-Centered to Learner-Centered
Shift Your Paradigm of Learning: From Technology-Centered to Learner-Centered
Randy Ziegenfuss, Ed.D.
 
Walk of Claim - A Meteor Meetup presentation
Walk of Claim - A Meteor Meetup presentationWalk of Claim - A Meteor Meetup presentation
Walk of Claim - A Meteor Meetup presentation
Stephan Hochhaus
 
Visual note-taking: listening, learning, remembering
Visual note-taking: listening, learning, rememberingVisual note-taking: listening, learning, remembering
Visual note-taking: listening, learning, remembering
Francis Rowland
 
Corel draw x4
Corel draw x4Corel draw x4
Corel draw x4
asep saepudin
 
Collaboration between LINE, Microsoft and AI by the developers, for the devel...
Collaboration between LINE, Microsoft and AI by the developers, for the devel...Collaboration between LINE, Microsoft and AI by the developers, for the devel...
Collaboration between LINE, Microsoft and AI by the developers, for the devel...
LINE Corporation
 
Laylay14311 oovoo chat_history
Laylay14311 oovoo chat_historyLaylay14311 oovoo chat_history
Laylay14311 oovoo chat_historylaylay23
 
The Belief System
The Belief System The Belief System
The Belief System
Sanjay Singh
 
Master’s voice: the rise of voice assistants
Master’s voice: the rise of voice assistantsMaster’s voice: the rise of voice assistants
Master’s voice: the rise of voice assistants
Daniel Harvey
 
Google positions for Rhinalnesc - week 1 2-3-4-5
Google positions for Rhinalnesc - week 1 2-3-4-5Google positions for Rhinalnesc - week 1 2-3-4-5
Google positions for Rhinalnesc - week 1 2-3-4-5
Cedric Farineau
 
From Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dotsFrom Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dots
Ronald Ashri
 
Agile and Scrum Methodology
Agile and Scrum MethodologyAgile and Scrum Methodology
Agile and Scrum Methodology
Kan Ouivirach, Ph.D.
 

What's hot (20)

Building Multi-Site in Joomla
Building Multi-Site in JoomlaBuilding Multi-Site in Joomla
Building Multi-Site in Joomla
 
TCS: Ad Tools, Social Marketing Tools + List Building Tools
TCS: Ad Tools, Social Marketing Tools + List Building ToolsTCS: Ad Tools, Social Marketing Tools + List Building Tools
TCS: Ad Tools, Social Marketing Tools + List Building Tools
 
Development and Deployment: The Human Factor
Development and Deployment: The Human FactorDevelopment and Deployment: The Human Factor
Development and Deployment: The Human Factor
 
Comprehensive approach to delivering great developer products
Comprehensive approach to delivering great developer productsComprehensive approach to delivering great developer products
Comprehensive approach to delivering great developer products
 
Corel draw x4
Corel draw x4Corel draw x4
Corel draw x4
 
Trust, Elections and Twitter (fscons 2017)
Trust, Elections and Twitter (fscons 2017)Trust, Elections and Twitter (fscons 2017)
Trust, Elections and Twitter (fscons 2017)
 
TCS: Competitive Intelligence Tools - Tools Presentation Part 1
TCS: Competitive Intelligence Tools - Tools Presentation Part 1TCS: Competitive Intelligence Tools - Tools Presentation Part 1
TCS: Competitive Intelligence Tools - Tools Presentation Part 1
 
Semantic BDD with ShouldIT?
Semantic BDD with ShouldIT?Semantic BDD with ShouldIT?
Semantic BDD with ShouldIT?
 
Shift Your Paradigm of Learning: From Technology-Centered to Learner-Centered
Shift Your Paradigm of Learning: From Technology-Centered to Learner-CenteredShift Your Paradigm of Learning: From Technology-Centered to Learner-Centered
Shift Your Paradigm of Learning: From Technology-Centered to Learner-Centered
 
Walk of Claim - A Meteor Meetup presentation
Walk of Claim - A Meteor Meetup presentationWalk of Claim - A Meteor Meetup presentation
Walk of Claim - A Meteor Meetup presentation
 
Visual note-taking: listening, learning, remembering
Visual note-taking: listening, learning, rememberingVisual note-taking: listening, learning, remembering
Visual note-taking: listening, learning, remembering
 
Corel draw x4
Corel draw x4Corel draw x4
Corel draw x4
 
Collaboration between LINE, Microsoft and AI by the developers, for the devel...
Collaboration between LINE, Microsoft and AI by the developers, for the devel...Collaboration between LINE, Microsoft and AI by the developers, for the devel...
Collaboration between LINE, Microsoft and AI by the developers, for the devel...
 
Laylay14311 oovoo chat_history
Laylay14311 oovoo chat_historyLaylay14311 oovoo chat_history
Laylay14311 oovoo chat_history
 
The Belief System
The Belief System The Belief System
The Belief System
 
Денис Волошко
Денис ВолошкоДенис Волошко
Денис Волошко
 
Master’s voice: the rise of voice assistants
Master’s voice: the rise of voice assistantsMaster’s voice: the rise of voice assistants
Master’s voice: the rise of voice assistants
 
Google positions for Rhinalnesc - week 1 2-3-4-5
Google positions for Rhinalnesc - week 1 2-3-4-5Google positions for Rhinalnesc - week 1 2-3-4-5
Google positions for Rhinalnesc - week 1 2-3-4-5
 
From Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dotsFrom Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dots
 
Agile and Scrum Methodology
Agile and Scrum MethodologyAgile and Scrum Methodology
Agile and Scrum Methodology
 

Viewers also liked

Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)
a16z
 
Visual Computing: The Road Ahead, NVIDIA CEO Jen-Hsun Huang at CES 2015
Visual Computing: The Road Ahead, NVIDIA CEO Jen-Hsun Huang at CES 2015 Visual Computing: The Road Ahead, NVIDIA CEO Jen-Hsun Huang at CES 2015
Visual Computing: The Road Ahead, NVIDIA CEO Jen-Hsun Huang at CES 2015
NVIDIA
 
10 of the Biggest Stories in Technology
10 of the Biggest Stories in Technology10 of the Biggest Stories in Technology
10 of the Biggest Stories in Technology
Brett Cotham
 
Hacking the Web
Hacking the WebHacking the Web
Hacking the Web
Mike Crabb
 
Let Non-Developers Develop your Site. Manu Raivio
Let Non-Developers Develop your Site. Manu RaivioLet Non-Developers Develop your Site. Manu Raivio
Let Non-Developers Develop your Site. Manu Raivio
Future Insights
 
What I learned teaching programming to 150 beginners
What I learned teaching programming to 150 beginnersWhat I learned teaching programming to 150 beginners
What I learned teaching programming to 150 beginners
Etiene Dalcol
 
Pair Programming demystified
Pair Programming demystifiedPair Programming demystified
Pair Programming demystified
Daftcode
 
The Programmer
The ProgrammerThe Programmer
The Programmer
Kevlin Henney
 
What is JSON-FP
What is JSON-FPWhat is JSON-FP
What is JSON-FP
Ben Lue
 
The Tester Role & Scrum
The Tester Role & ScrumThe Tester Role & Scrum
The Tester Role & Scrum
Johan Hoberg
 
Python for R developers and data scientists
Python for R developers and data scientistsPython for R developers and data scientists
Python for R developers and data scientists
Lambda Tree
 
Types of Production and Manufacturing
Types of Production and ManufacturingTypes of Production and Manufacturing
Types of Production and ManufacturingCasey Robertson
 
Wearable - storytelling or storydoing - Yiannis Lapatas
Wearable - storytelling or storydoing - Yiannis LapatasWearable - storytelling or storydoing - Yiannis Lapatas
Wearable - storytelling or storydoing - Yiannis Lapatas
IABRomania
 
Appraiser : How Airbnb Generates Complex Models in Spark for Demand Prediction
Appraiser : How Airbnb Generates Complex Models in Spark for Demand PredictionAppraiser : How Airbnb Generates Complex Models in Spark for Demand Prediction
Appraiser : How Airbnb Generates Complex Models in Spark for Demand Prediction
Yang Li Hector Yee
 
Writing Code That Lasts - Joomla!Dagen 2015
Writing Code That Lasts - Joomla!Dagen 2015Writing Code That Lasts - Joomla!Dagen 2015
Writing Code That Lasts - Joomla!Dagen 2015Rafael Dohms
 
The Rise of Wearable Technology
The Rise of Wearable Technology  The Rise of Wearable Technology
The Rise of Wearable Technology
Jonathan LeBlanc
 
Engineering your culture how to keep your engineers happy
Engineering your culture   how to keep your engineers happyEngineering your culture   how to keep your engineers happy
Engineering your culture how to keep your engineers happy
AgilePractitionersIL
 
3D print for manufacturing
3D print for manufacturing3D print for manufacturing
3D print for manufacturing
Gal Raz
 

Viewers also liked (19)

Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)
 
Visual Computing: The Road Ahead, NVIDIA CEO Jen-Hsun Huang at CES 2015
Visual Computing: The Road Ahead, NVIDIA CEO Jen-Hsun Huang at CES 2015 Visual Computing: The Road Ahead, NVIDIA CEO Jen-Hsun Huang at CES 2015
Visual Computing: The Road Ahead, NVIDIA CEO Jen-Hsun Huang at CES 2015
 
10 of the Biggest Stories in Technology
10 of the Biggest Stories in Technology10 of the Biggest Stories in Technology
10 of the Biggest Stories in Technology
 
Hacking the Web
Hacking the WebHacking the Web
Hacking the Web
 
Let Non-Developers Develop your Site. Manu Raivio
Let Non-Developers Develop your Site. Manu RaivioLet Non-Developers Develop your Site. Manu Raivio
Let Non-Developers Develop your Site. Manu Raivio
 
What I learned teaching programming to 150 beginners
What I learned teaching programming to 150 beginnersWhat I learned teaching programming to 150 beginners
What I learned teaching programming to 150 beginners
 
Pair Programming demystified
Pair Programming demystifiedPair Programming demystified
Pair Programming demystified
 
The Programmer
The ProgrammerThe Programmer
The Programmer
 
What is JSON-FP
What is JSON-FPWhat is JSON-FP
What is JSON-FP
 
The Tester Role & Scrum
The Tester Role & ScrumThe Tester Role & Scrum
The Tester Role & Scrum
 
Python for R developers and data scientists
Python for R developers and data scientistsPython for R developers and data scientists
Python for R developers and data scientists
 
Types of Production and Manufacturing
Types of Production and ManufacturingTypes of Production and Manufacturing
Types of Production and Manufacturing
 
Avr lecture8
Avr lecture8Avr lecture8
Avr lecture8
 
Wearable - storytelling or storydoing - Yiannis Lapatas
Wearable - storytelling or storydoing - Yiannis LapatasWearable - storytelling or storydoing - Yiannis Lapatas
Wearable - storytelling or storydoing - Yiannis Lapatas
 
Appraiser : How Airbnb Generates Complex Models in Spark for Demand Prediction
Appraiser : How Airbnb Generates Complex Models in Spark for Demand PredictionAppraiser : How Airbnb Generates Complex Models in Spark for Demand Prediction
Appraiser : How Airbnb Generates Complex Models in Spark for Demand Prediction
 
Writing Code That Lasts - Joomla!Dagen 2015
Writing Code That Lasts - Joomla!Dagen 2015Writing Code That Lasts - Joomla!Dagen 2015
Writing Code That Lasts - Joomla!Dagen 2015
 
The Rise of Wearable Technology
The Rise of Wearable Technology  The Rise of Wearable Technology
The Rise of Wearable Technology
 
Engineering your culture how to keep your engineers happy
Engineering your culture   how to keep your engineers happyEngineering your culture   how to keep your engineers happy
Engineering your culture how to keep your engineers happy
 
3D print for manufacturing
3D print for manufacturing3D print for manufacturing
3D print for manufacturing
 

Similar to Programming != Writing Code

Witchcraft
WitchcraftWitchcraft
Witchcraft
Brooklyn Zelenka
 
Web development with tests
Web development with testsWeb development with tests
Web development with tests
Gustavo Cunha
 
From Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsFrom Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the Dots
Ronald Ashri
 
TDD Using the SOLID Principles
TDD Using the SOLID PrinciplesTDD Using the SOLID Principles
TDD Using the SOLID PrinciplesJenna Pederson
 
So You Want to Start Refactoring?
So You Want to Start Refactoring?So You Want to Start Refactoring?
So You Want to Start Refactoring?
jillianefoley
 
Reducing Resistance: Deployment as Surface
Reducing Resistance: Deployment as SurfaceReducing Resistance: Deployment as Surface
Reducing Resistance: Deployment as Surface
Jeffrey Hulten
 
Ninja Correlation of APT Binaries
Ninja Correlation of APT BinariesNinja Correlation of APT Binaries
Ninja Correlation of APT Binaries
CODE BLUE
 
Architecting your IT career
Architecting your IT careerArchitecting your IT career
Architecting your IT career
John Mark Troyer
 
From Data Points to Data Lakes
From Data Points to Data LakesFrom Data Points to Data Lakes
From Data Points to Data Lakes
Jesus Rogel
 
PowerPoint Presentation about Programming 101 for Girls
PowerPoint Presentation about Programming 101 for GirlsPowerPoint Presentation about Programming 101 for Girls
PowerPoint Presentation about Programming 101 for Girls
Imelda Reyes
 
Switching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to AgileSwitching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to Agile
Doc Norton
 
UX in E-commerce & Conversion
UX in E-commerce & ConversionUX in E-commerce & Conversion
UX in E-commerce & Conversion
Elymar Apao
 
Chris Wróbel (vRational): Using VR and Imitation Machine Learning Algorithms ...
Chris Wróbel (vRational): Using VR and Imitation Machine Learning Algorithms ...Chris Wróbel (vRational): Using VR and Imitation Machine Learning Algorithms ...
Chris Wróbel (vRational): Using VR and Imitation Machine Learning Algorithms ...
AugmentedWorldExpo
 
Hotel Tonight - Mobile Innovation Summit
Hotel Tonight - Mobile Innovation SummitHotel Tonight - Mobile Innovation Summit
Hotel Tonight - Mobile Innovation Summit
kendrickapp
 
Take the red pill
Take the red pillTake the red pill
Take the red pill
Adrian Perreau de Pinninck
 
Agree to Disagree
Agree to DisagreeAgree to Disagree
Agree to Disagree
Sushant Hiray
 
Reduce, Reuse, Refactor
Reduce, Reuse, RefactorReduce, Reuse, Refactor
Reduce, Reuse, Refactor
cklosowski
 
Facilities for Agile
Facilities for AgileFacilities for Agile
Facilities for Agile
Pierre E. NEIS
 
ResearchGate - How do 'Social Networks for Scientists' Affect Libraries?
ResearchGate - How do 'Social Networks for Scientists' Affect Libraries?ResearchGate - How do 'Social Networks for Scientists' Affect Libraries?
ResearchGate - How do 'Social Networks for Scientists' Affect Libraries?
Keita Bando
 
Evaluacion sofia serrano 6 a
Evaluacion sofia serrano 6 aEvaluacion sofia serrano 6 a
Evaluacion sofia serrano 6 asamuel0711
 

Similar to Programming != Writing Code (20)

Witchcraft
WitchcraftWitchcraft
Witchcraft
 
Web development with tests
Web development with testsWeb development with tests
Web development with tests
 
From Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsFrom Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the Dots
 
TDD Using the SOLID Principles
TDD Using the SOLID PrinciplesTDD Using the SOLID Principles
TDD Using the SOLID Principles
 
So You Want to Start Refactoring?
So You Want to Start Refactoring?So You Want to Start Refactoring?
So You Want to Start Refactoring?
 
Reducing Resistance: Deployment as Surface
Reducing Resistance: Deployment as SurfaceReducing Resistance: Deployment as Surface
Reducing Resistance: Deployment as Surface
 
Ninja Correlation of APT Binaries
Ninja Correlation of APT BinariesNinja Correlation of APT Binaries
Ninja Correlation of APT Binaries
 
Architecting your IT career
Architecting your IT careerArchitecting your IT career
Architecting your IT career
 
From Data Points to Data Lakes
From Data Points to Data LakesFrom Data Points to Data Lakes
From Data Points to Data Lakes
 
PowerPoint Presentation about Programming 101 for Girls
PowerPoint Presentation about Programming 101 for GirlsPowerPoint Presentation about Programming 101 for Girls
PowerPoint Presentation about Programming 101 for Girls
 
Switching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to AgileSwitching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to Agile
 
UX in E-commerce & Conversion
UX in E-commerce & ConversionUX in E-commerce & Conversion
UX in E-commerce & Conversion
 
Chris Wróbel (vRational): Using VR and Imitation Machine Learning Algorithms ...
Chris Wróbel (vRational): Using VR and Imitation Machine Learning Algorithms ...Chris Wróbel (vRational): Using VR and Imitation Machine Learning Algorithms ...
Chris Wróbel (vRational): Using VR and Imitation Machine Learning Algorithms ...
 
Hotel Tonight - Mobile Innovation Summit
Hotel Tonight - Mobile Innovation SummitHotel Tonight - Mobile Innovation Summit
Hotel Tonight - Mobile Innovation Summit
 
Take the red pill
Take the red pillTake the red pill
Take the red pill
 
Agree to Disagree
Agree to DisagreeAgree to Disagree
Agree to Disagree
 
Reduce, Reuse, Refactor
Reduce, Reuse, RefactorReduce, Reuse, Refactor
Reduce, Reuse, Refactor
 
Facilities for Agile
Facilities for AgileFacilities for Agile
Facilities for Agile
 
ResearchGate - How do 'Social Networks for Scientists' Affect Libraries?
ResearchGate - How do 'Social Networks for Scientists' Affect Libraries?ResearchGate - How do 'Social Networks for Scientists' Affect Libraries?
ResearchGate - How do 'Social Networks for Scientists' Affect Libraries?
 
Evaluacion sofia serrano 6 a
Evaluacion sofia serrano 6 aEvaluacion sofia serrano 6 a
Evaluacion sofia serrano 6 a
 

Recently uploaded

Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 

Recently uploaded (20)

Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 

Programming != Writing Code

  • 1. 1 P R O G R A M M I N G = ! W R I T I N G C O D E
  • 2. • A L L S L I D E S A R E I N E N G L I S H • T Y P O S M AY O C C U R Y O U D O N ’ T K N O W E N G L I S H ? 2
  • 3. 3
  • 4. • S O F T WA R E E N G I N E E R • W E B A N D M O B I L E • R U B Y / P H P / O B J E C T I V E C / S W I F T • 1 1 Y E A R S O F E X P E R I E N C E • Q U I M B I K , I N C / U S A G U S TA V O C U N H A 4
  • 5. •I N F R A S T R U C T U R E ? •S U P P O RT ? •W O R K S ? •P R O G R A M M I N G ? 5
  • 6. P R O C E S S W R I T I N G T E S T I N G M A I N T E N A N I N G [ W I K I P E D I A ] D E F I N E : P R O G R A M ? 6
  • 7. • ~ 300 Programming Languages - Wikipedia • Learn all of them? NO! • Make mistakes is common and acceptable • Which language should I learn? Does the language really matters?!?!?!?! F* NO!!!!!! 7
  • 8. P R O G R A M M I N G I S E A S Y 8 I D O T H I S O N A D A I LY B A S I S I N E V E R M A K E M I S TA K E S ! R E A L LY ?
  • 9. H T T P : / / I . I M G U R . C O M / B T J Z E D W. J P G9
  • 10. 10 H T T P : / / I . I M G U R . C O M / L Z B I E . J P G
  • 11. 11 H T T P : / / PA S T E B I N . C O M / P T RY 5 G 2 A Construtor + 40 parâmetros
  • 12. PA S T I E . O R G / PA S T E S / 8 2 7 2 3 8 6 H T T P S : / / G I S T. G I T H U B . C O M / A N O N Y M O U S / A A 4 6 E 8 D B 0 9 8 D C B D 3 B 4 2 8 12
  • 13. 13 C O D E S M E L L
  • 14. 14
  • 15. C O D E S M E L L ( … ) I S A S U R FA C E I N D I C A T I O N T H A T U S U A L LY C O R R E S P O N D S T O A D E E P E R P R O B L E M I N T H E S Y S T E M ( … ) K E N T B E C K 15
  • 16. C O D E S M E L L • Duplicate Code • Long Method • Large Class • Long Parameter List • + 10 more symptoms 16
  • 17. D U P L I C AT E C O D E C O D E S M E L L 17 Most common problem Solution • Same class, different methods • Extract code to new method • Different classes • Sibling classes • Move code to parent class • If code is similar, but not equal, break into methods that has same code and methods with different information • Unrelated classes • Check design
  • 18. L O N G M E T H O D C O D E S M E L L 18 Hard to understand, easy to solve Solution • Break the methods into smaller methods (subroutines) • Big method will become a method caller • Easier to maintain Problems • Hard to read • Usually loses it’s main purpose
  • 19. L A R G E C L A S S C O D E S M E L L 19 Also known as Ninja Class Solution • Break the attributes into components (like address) • Usually, attributes with same prefix/suffix is likely to become a component • Reduces duplicate code Problems • Loses it’s purpose • Does more then one thing • Duplicate code (often) • Has many object-cadidates inside it
  • 20. L O N G PA R A M E T E R L I S T C O D E S M E L L 20 Change one of them and you will be in trouble Solution • Remove any parameters that can be retrieved from objects already sent Problems • On Procedural Programming, you had to send every detail a function needed • On Object Oriented Programming, you can send enough to get what the method needs
  • 21. H T T P : / / W W W. A M A Z O N . C O M / G P / P R O D U C T / 0 2 0 1 4 8 5 6 7 2 21 F O R F U R T H E R I N F O R M AT I O N
  • 22. I N R U B Y… Gems • flog - Flog shows you the most torturous code you wrote. The more painful the code, the higher the score. • flay - Flay analyzes ruby code for structural similarities. Differences in literal values, names, whitespace, and programming style are all ignored. • reek - is a tool that examines Ruby classes, modules and methods and reports any Code Smells it finds • brakeman - is a static analysis tool which checks Ruby on Rails applications for security vulnerabilities. 22
  • 23. H T T P : / / W W W. S L I D E S H A R E . N E T / M A R T I N T S C H / R E FA C T O R I N G - C O D E - S M E L L 23
  • 24. T W O M O R E T H I N G S …T W O M O R E T H I N G S … 24
  • 25. 25 18 de abril Colégio Contato alagoasdevday.com.br
  • 26. 26
  • 27. Q U E S T I O N S ? 27
  • 28. T H A N K Y O U ! 28 Gustavo Cunha gmmcal.com.br [twitter|github|facebook].com/gmmcal +GustavoCunha