SlideShare a Scribd company logo
1 of 5
1
©LuxoftTraining2012
Code Refáctoring
Small example
C++ Edittion
2
©LuxoftTraining2012
Пример
Crash with Segmentation fault
Back trace: DoSomethingMode::deactivate: 17
Logs:
 CompositeMode::activate
 CompositeMode::doSomething
 DoSomethingMode::doSomething
 CompositeMode::deactivate
 CompositeMode::activate
 CompositeMode::doAnother
3
©LuxoftTraining2012
Структура
4
©LuxoftTraining2012
Refactoring
Упрощать, а не усложнять
Улучшать маленькими шагами, а не все переписать
Сделать надежно, а не просто исправить ошибку
Главная ценность – понятность, а не
эффективность
Программиррование - это искусство, а не ремесло
5
©LuxoftTraining2012
Questions and Discussion

More Related Content

More from LogeekNightUkraine

Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...LogeekNightUkraine
 
Pavlo Zhdanov "Mastering solid and base principles for software design"
Pavlo Zhdanov "Mastering solid and base principles for software design"Pavlo Zhdanov "Mastering solid and base principles for software design"
Pavlo Zhdanov "Mastering solid and base principles for software design"LogeekNightUkraine
 
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"LogeekNightUkraine
 
Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"LogeekNightUkraine
 
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...LogeekNightUkraine
 
Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"LogeekNightUkraine
 
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"LogeekNightUkraine
 
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"LogeekNightUkraine
 
Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"LogeekNightUkraine
 
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"LogeekNightUkraine
 
Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"LogeekNightUkraine
 
Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”LogeekNightUkraine
 
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”LogeekNightUkraine
 
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"LogeekNightUkraine
 
Dmytro Safonov "Open-Source Map Viewers"
Dmytro Safonov  "Open-Source Map Viewers"Dmytro Safonov  "Open-Source Map Viewers"
Dmytro Safonov "Open-Source Map Viewers"LogeekNightUkraine
 
Serhii Matynenko "How to Deal with Logs, Migrating from Monolith Architecture...
Serhii Matynenko "How to Deal with Logs, Migrating from Monolith Architecture...Serhii Matynenko "How to Deal with Logs, Migrating from Monolith Architecture...
Serhii Matynenko "How to Deal with Logs, Migrating from Monolith Architecture...LogeekNightUkraine
 
Oleksii Parfeniuk "Leading a Development Team in FinTech"
Oleksii Parfeniuk "Leading a Development Team in FinTech"Oleksii Parfeniuk "Leading a Development Team in FinTech"
Oleksii Parfeniuk "Leading a Development Team in FinTech"LogeekNightUkraine
 
Maksym Ked "Plug-In C++ Application Architecture"
Maksym Ked "Plug-In C++ Application Architecture"Maksym Ked "Plug-In C++ Application Architecture"
Maksym Ked "Plug-In C++ Application Architecture"LogeekNightUkraine
 
Pavlo Zhdanov "Java and Swift: How to Create Applications for Automotive Head...
Pavlo Zhdanov "Java and Swift: How to Create Applications for Automotive Head...Pavlo Zhdanov "Java and Swift: How to Create Applications for Automotive Head...
Pavlo Zhdanov "Java and Swift: How to Create Applications for Automotive Head...LogeekNightUkraine
 
Oleksandr Kutsan "SmartDeviceLink and Mobile Applications on the Automotive H...
Oleksandr Kutsan "SmartDeviceLink and Mobile Applications on the Automotive H...Oleksandr Kutsan "SmartDeviceLink and Mobile Applications on the Automotive H...
Oleksandr Kutsan "SmartDeviceLink and Mobile Applications on the Automotive H...LogeekNightUkraine
 

More from LogeekNightUkraine (20)

Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...Oleksandr Kutsan "Using katai struct to describe the process of working with ...
Oleksandr Kutsan "Using katai struct to describe the process of working with ...
 
Pavlo Zhdanov "Mastering solid and base principles for software design"
Pavlo Zhdanov "Mastering solid and base principles for software design"Pavlo Zhdanov "Mastering solid and base principles for software design"
Pavlo Zhdanov "Mastering solid and base principles for software design"
 
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
Serhii Zemlianyi "Error Retries with Exponential Backoff Using RabbitMQ"
 
Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"Iurii Antykhovych "Java and performance tools and toys"
Iurii Antykhovych "Java and performance tools and toys"
 
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
Eugene Bova "Dapr (Distributed Application Runtime) in a Microservices Archit...
 
Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"Aleksandr Kutsan "Managing Dependencies in C++"
Aleksandr Kutsan "Managing Dependencies in C++"
 
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
Yevhen Tatarynov "My .NET Application Allocates too Much Memory. What Can I Do?"
 
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"Alexandr Golyak, Nikolay Chertkov  "Automotive Testing vs Test Automatio"
Alexandr Golyak, Nikolay Chertkov "Automotive Testing vs Test Automatio"
 
Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"Michal Kordas "Docker: Good, Bad or Both"
Michal Kordas "Docker: Good, Bad or Both"
 
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
Kolomiyets Dmytro "Dealing with Multiple Caches, When Developing Microservices"
 
Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"Shestakov Illia "The Sandbox Theory"
Shestakov Illia "The Sandbox Theory"
 
Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”Dmytro Kochergin “Autotest with CYPRESS”
Dmytro Kochergin “Autotest with CYPRESS”
 
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”Ivan Dryzhyruk “Ducks Don’t Like Bugs”
Ivan Dryzhyruk “Ducks Don’t Like Bugs”
 
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
Nhu Viet Nguyen "Why C++ is Becoming a Necessity for QA Automation"
 
Dmytro Safonov "Open-Source Map Viewers"
Dmytro Safonov  "Open-Source Map Viewers"Dmytro Safonov  "Open-Source Map Viewers"
Dmytro Safonov "Open-Source Map Viewers"
 
Serhii Matynenko "How to Deal with Logs, Migrating from Monolith Architecture...
Serhii Matynenko "How to Deal with Logs, Migrating from Monolith Architecture...Serhii Matynenko "How to Deal with Logs, Migrating from Monolith Architecture...
Serhii Matynenko "How to Deal with Logs, Migrating from Monolith Architecture...
 
Oleksii Parfeniuk "Leading a Development Team in FinTech"
Oleksii Parfeniuk "Leading a Development Team in FinTech"Oleksii Parfeniuk "Leading a Development Team in FinTech"
Oleksii Parfeniuk "Leading a Development Team in FinTech"
 
Maksym Ked "Plug-In C++ Application Architecture"
Maksym Ked "Plug-In C++ Application Architecture"Maksym Ked "Plug-In C++ Application Architecture"
Maksym Ked "Plug-In C++ Application Architecture"
 
Pavlo Zhdanov "Java and Swift: How to Create Applications for Automotive Head...
Pavlo Zhdanov "Java and Swift: How to Create Applications for Automotive Head...Pavlo Zhdanov "Java and Swift: How to Create Applications for Automotive Head...
Pavlo Zhdanov "Java and Swift: How to Create Applications for Automotive Head...
 
Oleksandr Kutsan "SmartDeviceLink and Mobile Applications on the Automotive H...
Oleksandr Kutsan "SmartDeviceLink and Mobile Applications on the Automotive H...Oleksandr Kutsan "SmartDeviceLink and Mobile Applications on the Automotive H...
Oleksandr Kutsan "SmartDeviceLink and Mobile Applications on the Automotive H...
 

Yurii Skrypnyk "Refactoring Based on Example"

Editor's Notes

  1. Предложить группе найти ошибку Как исправить? Write test Fix error Protect with setActive Create mode variables New activateSubMode Replace existing activateSubMode Remove old activate sub mode Remove getSubMode Remove map and enum Use activateSubMode in deactivation