SlideShare une entreprise Scribd logo
1  sur  40
EvolveYour
Application
DO NOT LET REFACTORING SCARE YOU
Mário Nogueira | Software Engineer
Legacy Code
Legacy Code
• Must be maintained.
• New developments must be done.
• No one wants to touch it, or parts of it.
• A simple bug fix may require large refactoring.
Legacy Code
• We end up doing it like a carpenter and smashing a nail on to it.
• And hope we didn’t break anything in the process.
CAM2
CAM2 2018
CAM2 2018
The Good
• Market leader in metrology software
• Has existed for over 20 years.
• Continues to evolve in each release
• Adding new features and enhancements
CAM2 2018
The Not So Good
• Features were getting harder and harder to develop
• Part of the code base was built over 20 years ago.
• Customer were reporting bugs faster than we could solve them
• Fix 1 bug, 2 were created.
0
2
4
6
Bugs Reported Bugs Solved
CAM2 2018
• We decided that enough was enough and was time to revert this
situation
• We would no longer do easy fixes
• Only when no other option was available
• When going through parts of the code and a refactor was calling out
to be made, we would do it.
CAM2 2018
• For each bug that we were solving we created an automation test
• Our automation test suite quickly grew
• These tests allowed us to detect breaking behaviour faster, and fix it before
releases.
0
200
400
600
800
1000
1200
1400
Start Release 1 Release 2 Release 3 Release 4
Series 1
CAM2 2018
• Number of new bugs being reported decrease to nearly zero.
• We’ve also added:
• Remote logging
• Crash Detection
• We started detecting bugs and fixing them before customers had the
time to report them.
Ready for refactor
Release Cycles
Release Cycle
• Two Major Releases per year.
• New Features and Enhancements
• One Minor Release each month.
• Only Bug fixing
Continuous Deployment
Solution
PERSISTENCE
DOMAIN
SERVICES
Persistence
• Document based application.
• Every thing that was important for our customers is placed in it.
• Loosing or corrupt the information is not an option.
Persistence
• Binary serialization.
• After serialized you can’t read it.
• What is in memory gets flushed to a file.
• Can go from 2MB in disk to 400MB very quickly
• Persisted Services
• Application worked on top of it
New Persistence
• Our document infrastructure works as stream holder
• Basically a zip file
• Moving away from binary serialization
• Migrating old data to new format
• No longer persist services
New Persistence
• For now we are using SQLite
• Saving as required instead of flushing
• Saving a document is just compacting the entire stream into a .fcd
New Persistence
• Creating new streams
• One for SQLite database
• One for each plugin
FCD Document
(Decompressed) Binary
Data
SQLite
Database
Plugins Plugin1
Plugin 2
New Persistence
• Persistence is no longer our core, but a detail
DetailUI
Domain
Persistance Detail
Domain
Domain
• Not really like that, but messy
• A lot of dependencies
• Years of development on top of it
• Unit testing was hard due to a higher number of dependencies
• Couldn’t stop new developments in order to refactor
Domain
• Scattered through the solution
• Mixed with non-domain concerns
• Refactoring away was not an option
• That would take years… 40 years for a single developer
Domain
Domain
Component
Component
Services Refactoring
Component
Internal
Implementation
Entry Point
Exit Point
IntegrationTests
Services Refactoring
Component
Internal
Implementation
Entry Point
Exit Point
IntegrationTests
Refactored
Implementation
UnitTesting
MOB Programming
MOB Programming
Conclusion
Refactoring is Fun
• You shouldn’t be afraid of it
• You can learn a lot from it
• Refactoring will evolve your application and your expertise's
Bedtime reading
We are Hiring
• Software Engineer
• Software Quality Assurance Engineer
• Software Research – Computer Graphics
Questions?
Patrocinadores “GOLD”
Patrocinadores “Silver”
Patrocinadores “Bronze”
http://bit.ly/2I6HujY
* Para quem não puder preencher durante a reunião,
iremos enviar um email com o link à tarde
Formulário de Avaliação

Contenu connexe

Tendances

We Want You Back Automation
We Want You Back AutomationWe Want You Back Automation
We Want You Back Automation
Kevin Raffay
 

Tendances (20)

Embrace DevOps: Delivery Value with Puppet Automation
Embrace DevOps: Delivery Value with Puppet AutomationEmbrace DevOps: Delivery Value with Puppet Automation
Embrace DevOps: Delivery Value with Puppet Automation
 
Metrics-Driven Devops: Delivering High Quality Software Faster!
Metrics-Driven Devops: Delivering High Quality Software Faster! Metrics-Driven Devops: Delivering High Quality Software Faster!
Metrics-Driven Devops: Delivering High Quality Software Faster!
 
Micro Services - Smaller is Better?
Micro Services - Smaller is Better?Micro Services - Smaller is Better?
Micro Services - Smaller is Better?
 
We Want You Back Automation
We Want You Back AutomationWe Want You Back Automation
We Want You Back Automation
 
Continuous Deployment
Continuous DeploymentContinuous Deployment
Continuous Deployment
 
It meet up 1 0 лебедева, лоханов
It meet up 1 0 лебедева, лохановIt meet up 1 0 лебедева, лоханов
It meet up 1 0 лебедева, лоханов
 
How Hootsuite Manages Its Growing Microservice Landscape
How Hootsuite Manages Its Growing Microservice LandscapeHow Hootsuite Manages Its Growing Microservice Landscape
How Hootsuite Manages Its Growing Microservice Landscape
 
Scheduled releases @ Commit Porto 2016
Scheduled releases @ Commit Porto 2016Scheduled releases @ Commit Porto 2016
Scheduled releases @ Commit Porto 2016
 
From Zero to Serverless (DogFoodCon 2018)
From Zero to Serverless (DogFoodCon 2018)From Zero to Serverless (DogFoodCon 2018)
From Zero to Serverless (DogFoodCon 2018)
 
DevOps: Find Solutions, Not More Defects
DevOps: Find Solutions, Not More DefectsDevOps: Find Solutions, Not More Defects
DevOps: Find Solutions, Not More Defects
 
DevOps at Lowe's - Our Journey
DevOps at Lowe's - Our JourneyDevOps at Lowe's - Our Journey
DevOps at Lowe's - Our Journey
 
Inspect THIS! mobile inspection tool for facility & asset management
Inspect THIS! mobile inspection tool for facility & asset managementInspect THIS! mobile inspection tool for facility & asset management
Inspect THIS! mobile inspection tool for facility & asset management
 
BOSE - Josh Steckler - Automating Automation: Build environments, on-demand
BOSE - Josh Steckler - Automating Automation: Build environments, on-demandBOSE - Josh Steckler - Automating Automation: Build environments, on-demand
BOSE - Josh Steckler - Automating Automation: Build environments, on-demand
 
Using The Right Tool For The Job
Using The Right Tool For The JobUsing The Right Tool For The Job
Using The Right Tool For The Job
 
Helsinki JAM - Jenkins CasC
Helsinki JAM - Jenkins CasCHelsinki JAM - Jenkins CasC
Helsinki JAM - Jenkins CasC
 
Siebel Monitoring Tools
Siebel Monitoring ToolsSiebel Monitoring Tools
Siebel Monitoring Tools
 
Implementing Test Automation: What a Manager Should Know
Implementing Test Automation: What a Manager Should KnowImplementing Test Automation: What a Manager Should Know
Implementing Test Automation: What a Manager Should Know
 
How to Reduce Time to Market Using Microsoft DevOps Solutions
How to Reduce Time to Market Using Microsoft DevOps SolutionsHow to Reduce Time to Market Using Microsoft DevOps Solutions
How to Reduce Time to Market Using Microsoft DevOps Solutions
 
FUG Agile software engineering practices
FUG Agile software engineering practicesFUG Agile software engineering practices
FUG Agile software engineering practices
 
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
Sencha Roadshow 2017: Sencha Upgrades - The Good. The Bad. The Ugly - Eva Luc...
 

Similaire à Evolve your application

The challenges and pitfalls of database deployment automation
The challenges and pitfalls of database deployment automationThe challenges and pitfalls of database deployment automation
The challenges and pitfalls of database deployment automation
DBmaestro - Database DevOps
 
Introduction to dev ops
Introduction to dev opsIntroduction to dev ops
Introduction to dev ops
Len Bass
 
Understand release engineering
Understand release engineeringUnderstand release engineering
Understand release engineering
gaoliang641
 
Under the hood daum ucc.20071105
Under the hood daum ucc.20071105Under the hood daum ucc.20071105
Under the hood daum ucc.20071105
Sung Kyu Park
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
Hannes Lowette
 

Similaire à Evolve your application (20)

Why retail companies can't afford database downtime
Why retail companies can't afford database downtimeWhy retail companies can't afford database downtime
Why retail companies can't afford database downtime
 
Continuous Delivery: releasing Better and Faster at Dashlane
Continuous Delivery: releasing Better and Faster at DashlaneContinuous Delivery: releasing Better and Faster at Dashlane
Continuous Delivery: releasing Better and Faster at Dashlane
 
Continuous delivery @wcap 5-09-2013
Continuous delivery   @wcap 5-09-2013Continuous delivery   @wcap 5-09-2013
Continuous delivery @wcap 5-09-2013
 
The challenges and pitfalls of database deployment automation
The challenges and pitfalls of database deployment automationThe challenges and pitfalls of database deployment automation
The challenges and pitfalls of database deployment automation
 
DBmaestro's State of the Database Continuous Delivery Survey- Findings Revealed
DBmaestro's State of the Database Continuous Delivery Survey- Findings RevealedDBmaestro's State of the Database Continuous Delivery Survey- Findings Revealed
DBmaestro's State of the Database Continuous Delivery Survey- Findings Revealed
 
2016 09-dev opsjourney-devopsdaysoslo
2016 09-dev opsjourney-devopsdaysoslo2016 09-dev opsjourney-devopsdaysoslo
2016 09-dev opsjourney-devopsdaysoslo
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best Practices
 
Death to Manual Deployments
Death to Manual DeploymentsDeath to Manual Deployments
Death to Manual Deployments
 
Praxistaugliche notes strategien 4 cloud
Praxistaugliche notes strategien 4 cloudPraxistaugliche notes strategien 4 cloud
Praxistaugliche notes strategien 4 cloud
 
Nagios Conference 2014 - Bryan Heden - 10,000 Services Across The State of Ohio
Nagios Conference 2014 - Bryan Heden - 10,000 Services Across The State of OhioNagios Conference 2014 - Bryan Heden - 10,000 Services Across The State of Ohio
Nagios Conference 2014 - Bryan Heden - 10,000 Services Across The State of Ohio
 
Introduction to dev ops
Introduction to dev opsIntroduction to dev ops
Introduction to dev ops
 
In (database) automation we trust
In (database) automation we trustIn (database) automation we trust
In (database) automation we trust
 
Understand release engineering
Understand release engineeringUnderstand release engineering
Understand release engineering
 
Angular Ivy- An Overview
Angular Ivy- An OverviewAngular Ivy- An Overview
Angular Ivy- An Overview
 
Under the hood daum ucc.20071105
Under the hood daum ucc.20071105Under the hood daum ucc.20071105
Under the hood daum ucc.20071105
 
SQL Server DevOps Jumpstart
SQL Server DevOps JumpstartSQL Server DevOps Jumpstart
SQL Server DevOps Jumpstart
 
OnAndroidConf 2013: Accelerating the Android Platform Build
OnAndroidConf 2013: Accelerating the Android Platform BuildOnAndroidConf 2013: Accelerating the Android Platform Build
OnAndroidConf 2013: Accelerating the Android Platform Build
 
Taking Database Development to the 21st Century
Taking Database Development to the 21st CenturyTaking Database Development to the 21st Century
Taking Database Development to the 21st Century
 
CPP11 - Function Design
CPP11 - Function DesignCPP11 - Function Design
CPP11 - Function Design
 
Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®Build software like a bag of marbles, not a castle of LEGO®
Build software like a bag of marbles, not a castle of LEGO®
 

Dernier

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Dernier (20)

VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 

Evolve your application

Notes de l'éditeur

  1. First impressions when we think of Legacy Code, and we have to go work on it
  2. CAM2 2018 is a desktop application, made in WPF C#. Been around for many years and has had many faces and many names
  3. This is what it looks now
  4. As coisas que nao estao tao bem, que tem espaco para melhorar
  5. This would be great if we didn’t have new developments to do and could not stop them while we were refactoring :D But we were ready to start refactoring, making it more easy to develop new features, revisit old modules that were the foundation for many features on CAM2. We knew we had to star small and doing small increments between stories, and/or use some of the stories to do the refactor
  6. Big refactorings were only made in major releases, which allowed us to break a few functionalities while it was being developed
  7. As we switched to a continuous deployment module we could no longer keep things broken while the release date didn’t come. We could release at any givem moment. So we had to prepare and do the refactors with a diferent mindset
  8. Do a break. Explain this was our problem. Background story on what I’m talking today in here
  9. We decided to start with our persistence, since it’s a fundamental part of our application. For us and for our customers.
  10. Not an accurate representation on what our domain looks like. Only to get a notion on how coupled some of our components are. Many haven’t changed in 10 years.
  11. After some discussions we knew we wanted to go from the Big Ball of Mud to an Onion Architecture. AS metioned before we couldn’t just simply do it. So we had to start somewhere…
  12. We choose a part of our software. A somewhat instable and critical part. And started with it. Isolated the component Kept its interfaces as its API Changing it to an ACL – (Anti Corruption Layer) for the rest of the application Created a new public API for when the rest of the components are rebuilt Switching to the new API would delete the connections with the ACL
  13. We find entry points on our services/components. Where “Entra porco sai chourico” and built integrations tests on top of it, to gurantee that our component refactor would not break any existing functionality.
  14. After it was done. We were in conditions to safely refactor our code and internal implementations. This way if we borke something during the refactor our integration tests would alert us. And at the same time we were refactoring also created new and valuable unit testing.
  15. While we were discussing on how and when to do it, our Director of Software Enginnering came to us and purpose a challenge. Do the refactor on a component with MOB programming. At first we were septic I admin, but after the first session we were hooked up on it, and schedule pretty must one session a day. Relutantes
  16. It looks like a bloodbath. But its actually very helpful, cause everyone gts a chance to write code, or drag files around
  17. Survs ajuda com os inqueritos e Nucleo de Estudantes de Informática do ISEP que nos ajudaram e apoiaram na divulgação e na organização
  18. Survs ajuda com os inqueritos e Nucleo de Estudantes de Informática do ISEP que nos ajudaram e apoiaram na divulgação e na organização
  19. Para quem puder ir preenchendo, assim não chateio mais logo  É importante para recebermos nós feedback, e para darmos feedback aos nossos oradores http://goqr.me/