SlideShare uma empresa Scribd logo
1 de 12
Baixar para ler offline
Fighting code smells
Patterns to keep your code DRY
Code smells
• Warning signs in the code which indicate
weaknesses in design.
=> slow down development and increase risk of bugs
in future.
Code smells
• Duplicated Code
Code smells
• Long Method
Code smells
• Feature Envy
Code smells
• Data clumps
Code smells
• Message chains
Code smells
• Divergent change
Refactoring Patterns
• Extract Method
• Pull up Method
• Form Template Method
• Replace Method with Method Object
• Extract Class
Refactoring Patterns
• Demo: http://goo.gl/zpouEN
Read more…
• Refactoring: Improving Design of Existing Code - by
Martin Flower
• Refactoring: Ruby Edition - by Jay Fields, Shane
Harvie, Martin Flower and Kent Beck
• http://ghendry.net/refactor.html
• http://sourcemaking.com/refactoring
• Reek: Code smells detector - https://github.com/
troessner/reek
About @Vinh Bachsy
• Author: Vinh Bachsy @: bsdvinhuit@gmail.com
• You can follow me at:
• https://plus.google.com/+VinhBachsy
• https://www.facebook.com/vinh.bachsy
• And the Saigon.rb Meetup:
• http://www.meetup.com/saigon-rb/
• https://www.facebook.com/saigonrb

Mais conteúdo relacionado

Semelhante a Fighting code smells

The Times They Are a-Changin’: Domino Applications in the New World of HCL No...
The Times They Are a-Changin’: Domino Applications in the New World of HCL No...The Times They Are a-Changin’: Domino Applications in the New World of HCL No...
The Times They Are a-Changin’: Domino Applications in the New World of HCL No...
panagenda
 
ekb.py: KISS REST API
ekb.py: KISS REST APIekb.py: KISS REST API
ekb.py: KISS REST API
Yury Yurevich
 
ekbpy'2012- Юрий Юревич - Как сделать REST API на Python
ekbpy'2012- Юрий Юревич - Как сделать REST API на Pythonekbpy'2012- Юрий Юревич - Как сделать REST API на Python
ekbpy'2012- Юрий Юревич - Как сделать REST API на Python
it-people
 
Branding Essentials for Developers presentation at TEC2012
Branding Essentials for Developers presentation at TEC2012Branding Essentials for Developers presentation at TEC2012
Branding Essentials for Developers presentation at TEC2012
Sentri
 
Python korea 2012 11-24-github
Python korea 2012 11-24-githubPython korea 2012 11-24-github
Python korea 2012 11-24-github
LINE株式会社
 
Dominoapplikationen im Wandel der Zeit: Alles neu mit HCL Nomad Web
Dominoapplikationen im Wandel der Zeit: Alles neu mit HCL Nomad WebDominoapplikationen im Wandel der Zeit: Alles neu mit HCL Nomad Web
Dominoapplikationen im Wandel der Zeit: Alles neu mit HCL Nomad Web
panagenda
 

Semelhante a Fighting code smells (20)

Code smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software OdorsCode smells and Other Malodorous Software Odors
Code smells and Other Malodorous Software Odors
 
Style Is Cool
Style Is CoolStyle Is Cool
Style Is Cool
 
Become a better UX designer through code
Become a better UX designer through codeBecome a better UX designer through code
Become a better UX designer through code
 
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
 
Collaborative Software Development
Collaborative Software DevelopmentCollaborative Software Development
Collaborative Software Development
 
Magento 2 Development Best Practices
Magento 2 Development Best PracticesMagento 2 Development Best Practices
Magento 2 Development Best Practices
 
The Times They Are a-Changin’: Domino Applications in the New World of HCL No...
The Times They Are a-Changin’: Domino Applications in the New World of HCL No...The Times They Are a-Changin’: Domino Applications in the New World of HCL No...
The Times They Are a-Changin’: Domino Applications in the New World of HCL No...
 
ekb.py: KISS REST API
ekb.py: KISS REST APIekb.py: KISS REST API
ekb.py: KISS REST API
 
DevOps Toolkit - DevOps Day Salvador
DevOps Toolkit - DevOps Day SalvadorDevOps Toolkit - DevOps Day Salvador
DevOps Toolkit - DevOps Day Salvador
 
ekbpy'2012- Юрий Юревич - Как сделать REST API на Python
ekbpy'2012- Юрий Юревич - Как сделать REST API на Pythonekbpy'2012- Юрий Юревич - Как сделать REST API на Python
ekbpy'2012- Юрий Юревич - Как сделать REST API на Python
 
A tour of the c# language
A tour of the c# languageA tour of the c# language
A tour of the c# language
 
KSDG LT: 6分鐘node.JS就上手
KSDG LT: 6分鐘node.JS就上手KSDG LT: 6分鐘node.JS就上手
KSDG LT: 6分鐘node.JS就上手
 
Branding Essentials for Developers presentation at TEC2012
Branding Essentials for Developers presentation at TEC2012Branding Essentials for Developers presentation at TEC2012
Branding Essentials for Developers presentation at TEC2012
 
Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NET
 
DEEPSEC 2013: Malware Datamining And Attribution
DEEPSEC 2013: Malware Datamining And AttributionDEEPSEC 2013: Malware Datamining And Attribution
DEEPSEC 2013: Malware Datamining And Attribution
 
Python korea 2012 11-24-github
Python korea 2012 11-24-githubPython korea 2012 11-24-github
Python korea 2012 11-24-github
 
codEnforcer 2013
codEnforcer 2013codEnforcer 2013
codEnforcer 2013
 
Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?
 
Frontend Development - Supercharge your frontend development with little lang...
Frontend Development - Supercharge your frontend development with little lang...Frontend Development - Supercharge your frontend development with little lang...
Frontend Development - Supercharge your frontend development with little lang...
 
Dominoapplikationen im Wandel der Zeit: Alles neu mit HCL Nomad Web
Dominoapplikationen im Wandel der Zeit: Alles neu mit HCL Nomad WebDominoapplikationen im Wandel der Zeit: Alles neu mit HCL Nomad Web
Dominoapplikationen im Wandel der Zeit: Alles neu mit HCL Nomad Web
 

Mais de Silicon Straits

Mais de Silicon Straits (20)

[THE PIRATES’ 3-year anniversary] Jonas' story
[THE PIRATES’ 3-year anniversary] Jonas' story[THE PIRATES’ 3-year anniversary] Jonas' story
[THE PIRATES’ 3-year anniversary] Jonas' story
 
Focus - Quang Trung
Focus - Quang TrungFocus - Quang Trung
Focus - Quang Trung
 
“One man” development process model
“One man” development process model“One man” development process model
“One man” development process model
 
Silicon Straits Origin
Silicon Straits OriginSilicon Straits Origin
Silicon Straits Origin
 
Kotlin Overview
Kotlin OverviewKotlin Overview
Kotlin Overview
 
What we use to build Android apps at Silicon Straits
What we use to build Android apps at Silicon StraitsWhat we use to build Android apps at Silicon Straits
What we use to build Android apps at Silicon Straits
 
Silicon Straits Internship Program Review - Season 1
Silicon Straits Internship Program Review - Season 1Silicon Straits Internship Program Review - Season 1
Silicon Straits Internship Program Review - Season 1
 
[SIP 2015] Hardware Proposal: Ads view counter for AdsBox
[SIP 2015] Hardware Proposal: Ads view counter for AdsBox[SIP 2015] Hardware Proposal: Ads view counter for AdsBox
[SIP 2015] Hardware Proposal: Ads view counter for AdsBox
 
[SIP 2015] Design Proposal: Design and animated prototype
[SIP 2015] Design Proposal: Design and animated prototype[SIP 2015] Design Proposal: Design and animated prototype
[SIP 2015] Design Proposal: Design and animated prototype
 
[SIP 2015] iOS Proposal: VIPER
[SIP 2015] iOS Proposal: VIPER[SIP 2015] iOS Proposal: VIPER
[SIP 2015] iOS Proposal: VIPER
 
[SIP 2015] QA Intern: Test Automation
[SIP 2015] QA Intern: Test Automation[SIP 2015] QA Intern: Test Automation
[SIP 2015] QA Intern: Test Automation
 
[SIP 2015] Back-end Proposal: Chat System using Socket.io
[SIP 2015] Back-end Proposal: Chat System using Socket.io[SIP 2015] Back-end Proposal: Chat System using Socket.io
[SIP 2015] Back-end Proposal: Chat System using Socket.io
 
[SIP 2015] Marketing Proposal: Making edit flow more informative and simpler
[SIP 2015] Marketing Proposal: Making edit flow more informative and simpler[SIP 2015] Marketing Proposal: Making edit flow more informative and simpler
[SIP 2015] Marketing Proposal: Making edit flow more informative and simpler
 
[Ebook] UI Document - Tú Bùi
[Ebook] UI Document - Tú Bùi[Ebook] UI Document - Tú Bùi
[Ebook] UI Document - Tú Bùi
 
[Sharing T3] Tình hình chiến sự Siêu anh hùng - Tú Bùi
[Sharing T3] Tình hình chiến sự Siêu anh hùng - Tú Bùi[Sharing T3] Tình hình chiến sự Siêu anh hùng - Tú Bùi
[Sharing T3] Tình hình chiến sự Siêu anh hùng - Tú Bùi
 
[Sharing T1] How to take good photos - Anh Minh
[Sharing T1] How to take good photos - Anh Minh[Sharing T1] How to take good photos - Anh Minh
[Sharing T1] How to take good photos - Anh Minh
 
[Sharing T12] Tín dụng - Bí quyết tay trắng làm nên nợ nần - Minh Hòa
[Sharing T12] Tín dụng - Bí quyết tay trắng làm nên nợ nần - Minh Hòa[Sharing T12] Tín dụng - Bí quyết tay trắng làm nên nợ nần - Minh Hòa
[Sharing T12] Tín dụng - Bí quyết tay trắng làm nên nợ nần - Minh Hòa
 
[Sharing T12] Một số câu chuyện về Âm lịch và Dương lịch - Xuân Quang
[Sharing T12] Một số câu chuyện về Âm lịch và Dương lịch - Xuân Quang[Sharing T12] Một số câu chuyện về Âm lịch và Dương lịch - Xuân Quang
[Sharing T12] Một số câu chuyện về Âm lịch và Dương lịch - Xuân Quang
 
[2014 SSS Infographic] 2014, SSS có gì đặc biệt?
[2014 SSS Infographic] 2014, SSS có gì đặc biệt?[2014 SSS Infographic] 2014, SSS có gì đặc biệt?
[2014 SSS Infographic] 2014, SSS có gì đặc biệt?
 
[Sharing T11] Hussar - The winged cavalry - Cường Đoàn
[Sharing T11] Hussar - The winged cavalry - Cường Đoàn[Sharing T11] Hussar - The winged cavalry - Cường Đoàn
[Sharing T11] Hussar - The winged cavalry - Cường Đoàn
 

Último

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
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
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
giselly40
 

Último (20)

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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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]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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
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
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
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 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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 

Fighting code smells