SlideShare a Scribd company logo
Arnaud Bouchez | Synopse
Reduce our Technical Debt
20161108T154500 - 20161108T170000
Reduce our Technical Debt
• Notions
– Technical Debt
– Working Effectively with Legacy Code
• Dependency breaking
• Separation of concerns
• Seams
• Testing
Reduce our Technical Debt
• Technical Debt
• Working Effectively with Legacy Code
– Software Seams
– Dependency breaking techniques
– Testing is Everything
• mORMot to the rescue
Technical Debt
• BBM /Quick & dirty way
sets up with a technical debt
– Like a financial debt,
incurs interest payment
• Extra efforts in any future development
• Higher maintenance costs
Technical Debt
• BBM /Quick & dirty way
sets up with a technical debt
– Difficult to measure
• As software productivity is hard to estimate
• No immediate impact on client software
• Mythical man month from management side
Technical Debt
http://martinfowler.com/bliki/TechnicalDebtQuadrant.html
Technical Debt
• Debt does smell
– Long standing bugs
• Support and customers know workarounds
– Underestimated effort evaluation
• Simple tasks take a lot of time or resources
Technical Debt
• Debt does smell
– Unexpected regressions
• “Edit and pray” maintenance style
– Only the initial code writers dare touch it
• Difficult to find people willing to join
• Even the initial coders fail on the task
Technical Debt
• Hard to manage
– First step is to face and evaluate it
• Like any debt, could be eventually resolved
– Bankrupt is possible
• Need clear, prioritized and pragmatic approach
Technical Debt
• Hard to manage
– Could be integrated into backlog
• Handle debt as part of legacy system
– Full rewrite may not be the solution
• Netscape syndrome
• Technology change mirage
Working Effectively with Legacy Code
• Hard problem, but not unsolvable
Working Effectively
with Legacy Code
The book
Working Effectively with Legacy Code
“Legacy Code
offers far more possibilities
for the application of design skill
than new feature do”
Michael Feathers, p. 249
Working Effectively with Legacy Code
– Identify where code changes are needed
– Get legacy code into a test harness
– Write tests to protect against regressions
– Introduce proper OOP and SOLID patterns
– Interface between old and new code
– Progressive introduction of SOA
Working Effectively with Legacy Code
• Identify Software Seams
Working Effectively with Legacy Code
• Identify Software Seams
Working Effectively with Legacy Code
• Identify a Software Seam
– In Clothing
• The place where two parts are stitched together
• The piece on each side
only touches the other right at the seam
• You may be able to replace a piece with another
Working Effectively with Legacy Code
• Identify a Software Seam
– In Software
• A place where you can alter behavior in your
program without editing in that place
Working Effectively with Legacy Code
• Identify a Software Seam
– Identify the place
where there is a well defined interface
– Allow to replace implementation
without the rest of the software being able to tell
– Prepare Dependency Injection
or Dependency Inversion
e.g. about persistence or third-party feature
Working Effectively with Legacy Code
• Identify a Software Seam
– Allow to replace implementation
without the rest of the software being able to tell
– Use Dependency Injection
first implementation may be 1:1
but will reduce coupling for future evolution
Working Effectively with Legacy Code
• Identify a Software Seam
– In Real Life Legacy Software
• There is no such place
where there is a well defined interface
• “Let there be light”, thanks to iterative refactoring
• Follow dependency breaking techniques
Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
– Adapt from existing
– Where you need to (instability, new features)
– Create a production implementation
– Create a fake implementation
– Write associated test cases
– Refine your interfaces
– Iterate
Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities big picture
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
Working Effectively with Legacy Code
1. Know your subject
– In a perfect DDD-oriented world
• Reading the code as a book introduces you
into the reality the computer program is modeling
• Legacy code tends to obfuscate reality
in implementation details
due to BBM iteration
was code focused, not business focused
Working Effectively with Legacy Code
1. Know your subject
– First gather a high vision of the problem
• From non-tech experts
• Straight to the main points
• Asking for a 5 min presentation from tech experts
Working Effectively with Legacy Code
1. Know your subject
– Ask support for long-standing bugs
– Ask customers for their wishes
• Customers have workarounds for bugs,
not for unexpected behavior
– Ask managers for upcoming features
– Ask older coders
• For the positive aspects of the legacy software
• For what should have been done in another way
Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
Working Effectively with Legacy Code
2. Identify responsibilities
– Probably no documentation
or deprecated documentation
– No code conventions
• Naming, style, design
• Procedural style:
– Spaghetti methods
– Stored procedures
– RAD
Working Effectively with Legacy Code
2. Identify responsibilities
– Start from a fresh eye
• Even if you work on this code since decades
• This is an expert’s work, not for rookies
• What should we have done?
• Don’t waste time
Working Effectively with Legacy Code
2. Identify responsibilities
– Heuristics to find light in the darkness
• Legacy implementation is valuable
– You will learn how the reality is modelized
• Code archeologists enjoy ancient times
– Software “exegesis”
over several layers
with long history
and a lot of material
– Nihil novi sub sole
Working Effectively with Legacy Code
2. Identify responsibilities
– Heuristics to find light in the darkness
• Read the code, as a fast book reader
• Keep in mind known bugs and new feature requests
Working Effectively with Legacy Code
2. Identify responsibilities
– Heuristics to find light in the darkness
• Read the code, as a fast book reader
• Keep in mind known bugs and new feature requests
• Group classes and methods
• Identify relationships
• Link to stored data structures
Working Effectively with Legacy Code
2. Identify responsibilities
– Heuristics to find light in the darkness
• Read the code, as a fast book reader
• Keep in mind known bugs and new feature requests
• Group classes and methods
• Identify relationships
• Link to stored data structures
• Note any change that would be needed
• Ignore the bugs
Working Effectively with Legacy Code
2. Identify relationships
– Between variables and methods
– Evaluate if existing coupling is worth it
– Guess abusive class re-use in several contexts
– Guess how it may be uncoupled in the future
– Don’t be fooled by implementation details
– Ignore the bugs
Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
Working Effectively with Legacy Code
3. Study data structures
“Bad programmers worry about the code.
Good programmers worry about data structures
and their relationships.” Linus T.
Working Effectively with Legacy Code
3. Study data structures
– Legacy database is where logic remains
• Extract business knowledge from Relational Model
• Using tools, or existing (old) architecture diagrams
– Identify SQL patterns in code
• Copy & pasta blocks may be Seams
• Eventually refactored as Persistence Services
Working Effectively with Legacy Code
• Iterative Code Refactoring
4. Break out big classes
5. Break out huge functions
6. Encapsulate global references
Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
Working Effectively with Legacy Code
• Iterative Code Refactoring
4. Break out big classes
• Too much methods are killing the methds
– Confusing to use
– Difficult to expand / adapt
– Breaks Single Responsibility Principle (SOLID)
Working Effectively with Legacy Code
• Iterative Code Refactoring
4. Break out big classes
• Refactor by writing new uncoupled classes
executed within the legacy main class
– Old class remains as a Seam
– Old class signature is the Seam interface
– Real implementation moved in new classes
Working Effectively with Legacy Code
• Iterative Code Refactoring
4. Break out big classes
• Iterative process, using unitary testing
• Favor composition over inheritance (SRP)
• Introduce interface for abstraction
• Add unit tests on uncoupled software units
Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
Working Effectively with Legacy Code
• Iterative Code Refactoring
5. Break out huge functions
• Refactor a big function/method
into a new class / set of classes
• Preserve the function signature
as class constructors, or public properties
• Local variables as private members
Working Effectively with Legacy Code
• Iterative Code Refactoring
5. Break out huge functions
• Iterative process, using unitary testing
• First implement as a single class method
• Then cut it in smaller (private) methods
• Then several classes (SOLID)
• Favor composition over inheritance (SRP)
• Re-use classes when possible
Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
Working Effectively with Legacy Code
• Iterative Code Refactoring
6. Encapsulate global references
Identify global variables in disguise
• Singleton or static variables/functions
• Huge main class (TMainForm TDataModule)
• Everything which prevents reentrance
Working Effectively with Legacy Code
• Iterative Code Refactoring
6. Encapsulate global references
Two steps cleaning process
• Identify “families” of global variables or functions
and group them as classes
• Move from a global instance of the class
into an injection mechanism
Working Effectively with Legacy Code
• Iterative Code Refactoring
6. Encapsulate global references
• Enable proper unit testing
thanks to Dependency Injection
• Allows server-side concurrent execution
and progressive switch to SOA
Working Effectively with Legacy Code
• Refactoring to isolate seams via interfaces
1. Know your subject
2. Identify responsibilities
3. Study data structures
4. Break out big classes
5. Break out huge functions iterative process
6. Encapsulate global references
7. Testing is everything
Working Effectively with Legacy Code
7. Testing is everything
– This is perhaps the hardest part
• Especially if unitary test is new for your teams
• Induce new test code to write and debug
– But also the most valuable
• Avoid regressions and refactoring fear
• If you can test, your code is likely to be uncoupled
Working Effectively with Legacy Code
7. Testing is everything
– Getting legacy code under test
• To avoid regressions
• To ensure as safe as possible refactoring
• Define reference datasets, for automated testing
– Brute replay of whole application (not yet unit testing)
– Using e.g. Virtual Machines snapshots
• Test “Bug to bug” behavior of the modified code
– Once bugs are fixed, update reference datasets
Working Effectively with Legacy Code
7. Testing is everything
– Value the existing
• Numerous applications and proven User Interface
• Integrate new technologies and patterns
• Continuous integration during build process
Working Effectively with Legacy Code
7. Testing is everything
– TDD over each Software Seam
• Write a failing test case
• Compile
• Make it pass
• Repeat
Working Effectively with Legacy Code
7. Testing is everything
– Seams specific tests
• Unit testing of the well bounded new interface
• Regression testing against the existing
• Prepare integration with the future Seams
Working Effectively with Legacy Code
7. Testing is everything
– Uncoupled seams as interfaces
• Could be stubbed/mocked
• Could be reused
• Could be hosted on a Server (SOA/SaaS)
mORMot ToolBox
mORMot ToolBox
• Cross-cutting features
• Killer features
• Shared features
mORMot ToolBox
• Cross-cutting features
– Unit Test
– Logging
– TDocVariant JSON
– SynDB SynMongoDB
– SynCrypto SynECC
– Services
– IoC, stubs and mocks
mORMot ToolBox
• Cross-cutting features
– Unit Test
• Light and cross-platform
• Convention over configuration
• Integrated with logging
• Integrated with interface Stubs and Mocks
• Sample 07
mORMot ToolBox
• Cross-cutting features
– Logging
• Low overhead, fast value serialization
• Local or remote
• Set of events, not levels
• Fast viewer tool with method and threads profiling
• Exception catch, stack trace
• Used by the whole framework
• Sample 11
mORMot ToolBox
• Cross-cutting features
– TDocVariant custom type
Stores any transient value as document:
• Object
• Array
• Any nested combination of the two
mORMot ToolBox
• Cross-cutting features
– TDocVariant custom type
Low memory overhead
• Data allocation per blocks of variants
• Copy by reference can be enabled
• Instance lifetime managed by the compiler
mORMot ToolBox
• Cross-cutting features
– TDocVariant custom type
Direct objects or arrays JSON support
Late-binding magic
Perfect dynamic values for seams
mORMot ToolBox
• Cross-cutting features
– TDocVariant custom type
var V: variant; // stored as any variant
...
TDocVariant.New(V); // or slightly slower V := TDocVariant.New;
V.name := 'John'; // property accessed via late-binding
V.year := 1972;
// now V contains {"name":"john","year":1972}
var V1,V2: variant;
...
V1 := _Obj(['name','John','year',1972]);
V2 := _Obj(['name','John','doc',_Obj(['one',1,'two',2.5])]);
V1 := _Json('{"name":"John","year":1982}');
V2 := _Json('{name:"John",doc:["one",1,"two",2.5]}');
mORMot ToolBox
• Cross-cutting features
– TDocVariant custom type
writeln('name=',V1.name,' year=',V1.year);
// will write 'name=John year=1972'
writeln('name=',V2.name,' doc.one=',V2.doc.one,' doc.two=',doc.two);
// will write 'name=John doc.one=1 doc.two=2.5
V1.name := 'Mark'; // overwrite a property value
writeln(V1.name); // will write 'Mark'
V1.age := 12; // add a property to the object
writeln(V1.age); // will write '12'
writeln(V1); // implicit conversion to string -> as JSON
// will write '{"name":"Mark","year":1972,"age":12}'
writeln(VariantSaveJSON(V1)); // serialize as JSON text
mORMot ToolBox
• Cross-cutting features
• SynDB Direct RDBMS access layer
– Not linked to DB.pas
– Multi providers
– UTF-8 JSON
– Interface based
– Knows SQL dialects (used e.g. by the ORM)
– SynDBExplorer tool
mORMot ToolBox
• Cross-cutting features
• SynDB Direct RDBMS access layer
– Less data types
– By-pass TDataSet
– Unicode even before Delphi 2009
– Array binding
– Native JSON support
– Remote access
mORMot ToolBox
• Cross-cutting features
• SynMongoDB NoSQL acces
– MongoDB native access
– BSON types - TBSONVariant
– TDocVariant support
– Extended JSON
– MongoDB 3.2 support (SCRAM-SHA1)
mORMot ToolBox
• Cross-cutting features
• SynCrypto SynECC
– Introduce safe and fast encryption
• AES, SHA, MD5, PBKDF2, PRNG
• Optimized pascal or asm AES-NI, SSE4
– Certificate-based public key cryptography
• Content signature using ECDSA-secp256r1
• Transmission or file encryption ECDH / ECIES
• JSON-based Public Key Infrastructure (PKI)
mORMot ToolBox
• Cross-cutting features
• Services
– Daemonization made easy
– Console, install or service mode
– Remote administration interface
– Windows integration
– Cross-platform
mORMot ToolBox
• Cross-cutting features
• Inversion Of Concerns (IoC)
– Leverage interface types for seams
– Runtime class instance resolution
TInjectableObject TInterfaceResolver
– Mocks and stubs
(a killer feature)
mORMot ToolBox
• Killer features
– SOA
– ORM / ODM
– Stubs and Mocks
– MVC web portals
– DDD CQRS helpers
– SyNode
mORMot ToolBox
• Killer features
… to be detailed tomorrow

mORMot ToolBox
• Shared features
– Convention Over Configuration
– Cross-Platform and Cross-Compiler
– Fully integrated and coherent
– Made for scaling and performance
– Modular: pickup what is needed,
integrate with existing
– Open Source with active community
mORMot ToolBox
• Don’t be afraid
– Huge feature set
– Exhaustive / endless documentation
– Unusual concepts
• Where to start
– Run the samples
– Use the forum
– Publish your test project on github!
mORMot ToolBox
• Resources
– http://synopse.info
– http://synopse.info/forum
– http://blog.synopse.info
– http://github.com/synopse/mORMot
Includes exhaustive documentation,
samples and regression tests.
Q & A
©2016 Synopse / A.Bouchez

More Related Content

What's hot

Regular expression
Regular expressionRegular expression
Regular expression
Larry Nung
 
Clean Code @Voxxed Days Cluj 2023 - opening Keynote
Clean Code @Voxxed Days Cluj 2023 - opening KeynoteClean Code @Voxxed Days Cluj 2023 - opening Keynote
Clean Code @Voxxed Days Cluj 2023 - opening Keynote
Victor Rentea
 
Ekon24 from Delphi to AVX2
Ekon24 from Delphi to AVX2Ekon24 from Delphi to AVX2
Ekon24 from Delphi to AVX2
Arnaud Bouchez
 
SOC Verification using SystemVerilog
SOC Verification using SystemVerilog SOC Verification using SystemVerilog
SOC Verification using SystemVerilog
Ramdas Mozhikunnath
 
re:mobidyc the overview
re:mobidyc the overviewre:mobidyc the overview
re:mobidyc the overview
ESUG
 
Clean architecture - Protecting the Domain
Clean architecture - Protecting the DomainClean architecture - Protecting the Domain
Clean architecture - Protecting the Domain
Victor Rentea
 
The Art of Clean code
The Art of Clean codeThe Art of Clean code
The Art of Clean code
Victor Rentea
 
The tests are trying to tell you something@VoxxedBucharest.pptx
The tests are trying to tell you something@VoxxedBucharest.pptxThe tests are trying to tell you something@VoxxedBucharest.pptx
The tests are trying to tell you something@VoxxedBucharest.pptx
Victor Rentea
 
Easily emulating full systems on amazon fpg as
Easily emulating full systems on amazon fpg asEasily emulating full systems on amazon fpg as
Easily emulating full systems on amazon fpg as
RISC-V International
 
Kamailio :: A Quick Introduction
Kamailio :: A Quick IntroductionKamailio :: A Quick Introduction
Kamailio :: A Quick Introduction
Olle E Johansson
 
Clean Code III - Software Craftsmanship
Clean Code III - Software CraftsmanshipClean Code III - Software Craftsmanship
Clean Code III - Software Craftsmanship
Theo Jungeblut
 
Unit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of PurityUnit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of Purity
Victor Rentea
 
Ddd reboot (english version)
Ddd reboot (english version)Ddd reboot (english version)
Ddd reboot (english version)
Thomas Pierrain
 
Using Kamailio for Scalability and Security
Using Kamailio for Scalability and SecurityUsing Kamailio for Scalability and Security
Using Kamailio for Scalability and Security
Fred Posner
 
Фильтрация соцсетей и лишнего трафика: использование L7 возможностей в Mikrotik
Фильтрация соцсетей и лишнего трафика: использование L7 возможностей в MikrotikФильтрация соцсетей и лишнего трафика: использование L7 возможностей в Mikrotik
Фильтрация соцсетей и лишнего трафика: использование L7 возможностей в Mikrotik
mikrotik-training
 
Tiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVMTiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVM
Igor Veresov
 
Functional Patterns with Java8 @Bucharest Java User Group
Functional Patterns with Java8 @Bucharest Java User GroupFunctional Patterns with Java8 @Bucharest Java User Group
Functional Patterns with Java8 @Bucharest Java User Group
Victor Rentea
 
Kotlin InDepth Tutorial for beginners 2022
Kotlin InDepth Tutorial for beginners 2022Kotlin InDepth Tutorial for beginners 2022
Kotlin InDepth Tutorial for beginners 2022
Simplilearn
 
Implementing Useful Clock Skew Using Skew Groups
Implementing Useful Clock Skew Using Skew GroupsImplementing Useful Clock Skew Using Skew Groups
Implementing Useful Clock Skew Using Skew Groups
M Mei
 
что такое программирование?
что такое программирование?что такое программирование?
что такое программирование?
TenelQasimli
 

What's hot (20)

Regular expression
Regular expressionRegular expression
Regular expression
 
Clean Code @Voxxed Days Cluj 2023 - opening Keynote
Clean Code @Voxxed Days Cluj 2023 - opening KeynoteClean Code @Voxxed Days Cluj 2023 - opening Keynote
Clean Code @Voxxed Days Cluj 2023 - opening Keynote
 
Ekon24 from Delphi to AVX2
Ekon24 from Delphi to AVX2Ekon24 from Delphi to AVX2
Ekon24 from Delphi to AVX2
 
SOC Verification using SystemVerilog
SOC Verification using SystemVerilog SOC Verification using SystemVerilog
SOC Verification using SystemVerilog
 
re:mobidyc the overview
re:mobidyc the overviewre:mobidyc the overview
re:mobidyc the overview
 
Clean architecture - Protecting the Domain
Clean architecture - Protecting the DomainClean architecture - Protecting the Domain
Clean architecture - Protecting the Domain
 
The Art of Clean code
The Art of Clean codeThe Art of Clean code
The Art of Clean code
 
The tests are trying to tell you something@VoxxedBucharest.pptx
The tests are trying to tell you something@VoxxedBucharest.pptxThe tests are trying to tell you something@VoxxedBucharest.pptx
The tests are trying to tell you something@VoxxedBucharest.pptx
 
Easily emulating full systems on amazon fpg as
Easily emulating full systems on amazon fpg asEasily emulating full systems on amazon fpg as
Easily emulating full systems on amazon fpg as
 
Kamailio :: A Quick Introduction
Kamailio :: A Quick IntroductionKamailio :: A Quick Introduction
Kamailio :: A Quick Introduction
 
Clean Code III - Software Craftsmanship
Clean Code III - Software CraftsmanshipClean Code III - Software Craftsmanship
Clean Code III - Software Craftsmanship
 
Unit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of PurityUnit Testing like a Pro - The Circle of Purity
Unit Testing like a Pro - The Circle of Purity
 
Ddd reboot (english version)
Ddd reboot (english version)Ddd reboot (english version)
Ddd reboot (english version)
 
Using Kamailio for Scalability and Security
Using Kamailio for Scalability and SecurityUsing Kamailio for Scalability and Security
Using Kamailio for Scalability and Security
 
Фильтрация соцсетей и лишнего трафика: использование L7 возможностей в Mikrotik
Фильтрация соцсетей и лишнего трафика: использование L7 возможностей в MikrotikФильтрация соцсетей и лишнего трафика: использование L7 возможностей в Mikrotik
Фильтрация соцсетей и лишнего трафика: использование L7 возможностей в Mikrotik
 
Tiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVMTiered Compilation in Hotspot JVM
Tiered Compilation in Hotspot JVM
 
Functional Patterns with Java8 @Bucharest Java User Group
Functional Patterns with Java8 @Bucharest Java User GroupFunctional Patterns with Java8 @Bucharest Java User Group
Functional Patterns with Java8 @Bucharest Java User Group
 
Kotlin InDepth Tutorial for beginners 2022
Kotlin InDepth Tutorial for beginners 2022Kotlin InDepth Tutorial for beginners 2022
Kotlin InDepth Tutorial for beginners 2022
 
Implementing Useful Clock Skew Using Skew Groups
Implementing Useful Clock Skew Using Skew GroupsImplementing Useful Clock Skew Using Skew Groups
Implementing Useful Clock Skew Using Skew Groups
 
что такое программирование?
что такое программирование?что такое программирование?
что такое программирование?
 

Similar to Ekon20 mORMot Legacy Code Technical Debt Delphi Conference

Cleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy ProjectsCleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy Projects
Mike Long
 
Art of refactoring - Code Smells and Microservices Antipatterns
Art of refactoring - Code Smells and Microservices AntipatternsArt of refactoring - Code Smells and Microservices Antipatterns
Art of refactoring - Code Smells and Microservices Antipatterns
El Mahdi Benzekri
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
Bhavin Gandhi
 
Eurosport's Kodakademi #2
Eurosport's Kodakademi #2Eurosport's Kodakademi #2
Eurosport's Kodakademi #2
Benjamin Baumann
 
Clean code
Clean codeClean code
Clean code
Simon Sönnby
 
Clean code, Feb 2012
Clean code, Feb 2012Clean code, Feb 2012
Clean code, Feb 2012cobyst
 
Ursula Sarracini - When Old Meets New: Codebases
Ursula Sarracini - When Old Meets New: CodebasesUrsula Sarracini - When Old Meets New: Codebases
Ursula Sarracini - When Old Meets New: Codebases
Anton Caceres
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
Shafiul Azam Chowdhury
 
Software Defects and SW Reliability Assessment
Software Defects and SW Reliability AssessmentSoftware Defects and SW Reliability Assessment
Software Defects and SW Reliability Assessment
Kristine Hejna
 
TDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleTDD and the Legacy Code Black Hole
TDD and the Legacy Code Black Hole
Noam Kfir
 
Rebuilding Legacy Apps with Domain-Driven Design - Lessons learned
Rebuilding Legacy Apps with Domain-Driven Design - Lessons learnedRebuilding Legacy Apps with Domain-Driven Design - Lessons learned
Rebuilding Legacy Apps with Domain-Driven Design - Lessons learned
Kacper Gunia
 
Create Your Own Starter Files
Create Your Own Starter FilesCreate Your Own Starter Files
Create Your Own Starter Files
Emily Lewis
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....
Mike Harris
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
Juggernaut Liu
 
2009 training - tim m - object oriented programming
2009   training - tim m - object oriented programming2009   training - tim m - object oriented programming
2009 training - tim m - object oriented programming
Tim Mahy
 
Guide to Destroying Codebases The Demise of Clever Code
Guide to Destroying Codebases   The Demise of Clever CodeGuide to Destroying Codebases   The Demise of Clever Code
Guide to Destroying Codebases The Demise of Clever Code
Gabor Varadi
 
Refactoring workshop
Refactoring workshop Refactoring workshop
Refactoring workshop
Itzik Saban
 
Principled And Clean Coding
Principled And Clean CodingPrincipled And Clean Coding
Principled And Clean Coding
Metin Ogurlu
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
Steven Smith
 

Similar to Ekon20 mORMot Legacy Code Technical Debt Delphi Conference (20)

Cleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy ProjectsCleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy Projects
 
Art of refactoring - Code Smells and Microservices Antipatterns
Art of refactoring - Code Smells and Microservices AntipatternsArt of refactoring - Code Smells and Microservices Antipatterns
Art of refactoring - Code Smells and Microservices Antipatterns
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
 
Eurosport's Kodakademi #2
Eurosport's Kodakademi #2Eurosport's Kodakademi #2
Eurosport's Kodakademi #2
 
Clean code
Clean codeClean code
Clean code
 
Clean code, Feb 2012
Clean code, Feb 2012Clean code, Feb 2012
Clean code, Feb 2012
 
Ursula Sarracini - When Old Meets New: Codebases
Ursula Sarracini - When Old Meets New: CodebasesUrsula Sarracini - When Old Meets New: Codebases
Ursula Sarracini - When Old Meets New: Codebases
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
 
Code quality
Code quality Code quality
Code quality
 
Software Defects and SW Reliability Assessment
Software Defects and SW Reliability AssessmentSoftware Defects and SW Reliability Assessment
Software Defects and SW Reliability Assessment
 
TDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleTDD and the Legacy Code Black Hole
TDD and the Legacy Code Black Hole
 
Rebuilding Legacy Apps with Domain-Driven Design - Lessons learned
Rebuilding Legacy Apps with Domain-Driven Design - Lessons learnedRebuilding Legacy Apps with Domain-Driven Design - Lessons learned
Rebuilding Legacy Apps with Domain-Driven Design - Lessons learned
 
Create Your Own Starter Files
Create Your Own Starter FilesCreate Your Own Starter Files
Create Your Own Starter Files
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 
2009 training - tim m - object oriented programming
2009   training - tim m - object oriented programming2009   training - tim m - object oriented programming
2009 training - tim m - object oriented programming
 
Guide to Destroying Codebases The Demise of Clever Code
Guide to Destroying Codebases   The Demise of Clever CodeGuide to Destroying Codebases   The Demise of Clever Code
Guide to Destroying Codebases The Demise of Clever Code
 
Refactoring workshop
Refactoring workshop Refactoring workshop
Refactoring workshop
 
Principled And Clean Coding
Principled And Clean CodingPrincipled And Clean Coding
Principled And Clean Coding
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
 

More from Arnaud Bouchez

EKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdfEKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdf
Arnaud Bouchez
 
EKON27-FrameworksExpressiveness.pdf
EKON27-FrameworksExpressiveness.pdfEKON27-FrameworksExpressiveness.pdf
EKON27-FrameworksExpressiveness.pdf
Arnaud Bouchez
 
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMotEkon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Arnaud Bouchez
 
Ekon23 (1) Kingdom-Driven-Design
Ekon23 (1) Kingdom-Driven-DesignEkon23 (1) Kingdom-Driven-Design
Ekon23 (1) Kingdom-Driven-Design
Arnaud Bouchez
 
Ekon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOAEkon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOA
Arnaud Bouchez
 
Ekon20 mORMot WorkShop Delphi
Ekon20 mORMot WorkShop DelphiEkon20 mORMot WorkShop Delphi
Ekon20 mORMot WorkShop Delphi
Arnaud Bouchez
 
Ekon20 mORMot SOA Delphi Conference
Ekon20 mORMot SOA Delphi Conference Ekon20 mORMot SOA Delphi Conference
Ekon20 mORMot SOA Delphi Conference
Arnaud Bouchez
 
2016 mORMot
2016 mORMot2016 mORMot
2016 mORMot
Arnaud Bouchez
 
A1 from n tier to soa
A1 from n tier to soaA1 from n tier to soa
A1 from n tier to soa
Arnaud Bouchez
 
D1 from interfaces to solid
D1 from interfaces to solidD1 from interfaces to solid
D1 from interfaces to solid
Arnaud Bouchez
 
A3 from sql to orm
A3 from sql to ormA3 from sql to orm
A3 from sql to orm
Arnaud Bouchez
 
A2 from soap to rest
A2 from soap to restA2 from soap to rest
A2 from soap to rest
Arnaud Bouchez
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-design
Arnaud Bouchez
 
A4 from rad to mvc
A4 from rad to mvcA4 from rad to mvc
A4 from rad to mvc
Arnaud Bouchez
 
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMotDelphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Arnaud Bouchez
 

More from Arnaud Bouchez (15)

EKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdfEKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdf
 
EKON27-FrameworksExpressiveness.pdf
EKON27-FrameworksExpressiveness.pdfEKON27-FrameworksExpressiveness.pdf
EKON27-FrameworksExpressiveness.pdf
 
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMotEkon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
 
Ekon23 (1) Kingdom-Driven-Design
Ekon23 (1) Kingdom-Driven-DesignEkon23 (1) Kingdom-Driven-Design
Ekon23 (1) Kingdom-Driven-Design
 
Ekon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOAEkon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOA
 
Ekon20 mORMot WorkShop Delphi
Ekon20 mORMot WorkShop DelphiEkon20 mORMot WorkShop Delphi
Ekon20 mORMot WorkShop Delphi
 
Ekon20 mORMot SOA Delphi Conference
Ekon20 mORMot SOA Delphi Conference Ekon20 mORMot SOA Delphi Conference
Ekon20 mORMot SOA Delphi Conference
 
2016 mORMot
2016 mORMot2016 mORMot
2016 mORMot
 
A1 from n tier to soa
A1 from n tier to soaA1 from n tier to soa
A1 from n tier to soa
 
D1 from interfaces to solid
D1 from interfaces to solidD1 from interfaces to solid
D1 from interfaces to solid
 
A3 from sql to orm
A3 from sql to ormA3 from sql to orm
A3 from sql to orm
 
A2 from soap to rest
A2 from soap to restA2 from soap to rest
A2 from soap to rest
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-design
 
A4 from rad to mvc
A4 from rad to mvcA4 from rad to mvc
A4 from rad to mvc
 
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMotDelphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
 

Recently uploaded

Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 

Recently uploaded (20)

Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 

Ekon20 mORMot Legacy Code Technical Debt Delphi Conference

  • 1. Arnaud Bouchez | Synopse Reduce our Technical Debt 20161108T154500 - 20161108T170000
  • 2. Reduce our Technical Debt • Notions – Technical Debt – Working Effectively with Legacy Code • Dependency breaking • Separation of concerns • Seams • Testing
  • 3. Reduce our Technical Debt • Technical Debt • Working Effectively with Legacy Code – Software Seams – Dependency breaking techniques – Testing is Everything • mORMot to the rescue
  • 4. Technical Debt • BBM /Quick & dirty way sets up with a technical debt – Like a financial debt, incurs interest payment • Extra efforts in any future development • Higher maintenance costs
  • 5. Technical Debt • BBM /Quick & dirty way sets up with a technical debt – Difficult to measure • As software productivity is hard to estimate • No immediate impact on client software • Mythical man month from management side
  • 7. Technical Debt • Debt does smell – Long standing bugs • Support and customers know workarounds – Underestimated effort evaluation • Simple tasks take a lot of time or resources
  • 8. Technical Debt • Debt does smell – Unexpected regressions • “Edit and pray” maintenance style – Only the initial code writers dare touch it • Difficult to find people willing to join • Even the initial coders fail on the task
  • 9. Technical Debt • Hard to manage – First step is to face and evaluate it • Like any debt, could be eventually resolved – Bankrupt is possible • Need clear, prioritized and pragmatic approach
  • 10. Technical Debt • Hard to manage – Could be integrated into backlog • Handle debt as part of legacy system – Full rewrite may not be the solution • Netscape syndrome • Technology change mirage
  • 11. Working Effectively with Legacy Code • Hard problem, but not unsolvable Working Effectively with Legacy Code The book
  • 12. Working Effectively with Legacy Code “Legacy Code offers far more possibilities for the application of design skill than new feature do” Michael Feathers, p. 249
  • 13. Working Effectively with Legacy Code – Identify where code changes are needed – Get legacy code into a test harness – Write tests to protect against regressions – Introduce proper OOP and SOLID patterns – Interface between old and new code – Progressive introduction of SOA
  • 14. Working Effectively with Legacy Code • Identify Software Seams
  • 15. Working Effectively with Legacy Code • Identify Software Seams
  • 16. Working Effectively with Legacy Code • Identify a Software Seam – In Clothing • The place where two parts are stitched together • The piece on each side only touches the other right at the seam • You may be able to replace a piece with another
  • 17. Working Effectively with Legacy Code • Identify a Software Seam – In Software • A place where you can alter behavior in your program without editing in that place
  • 18. Working Effectively with Legacy Code • Identify a Software Seam – Identify the place where there is a well defined interface – Allow to replace implementation without the rest of the software being able to tell – Prepare Dependency Injection or Dependency Inversion e.g. about persistence or third-party feature
  • 19. Working Effectively with Legacy Code • Identify a Software Seam – Allow to replace implementation without the rest of the software being able to tell – Use Dependency Injection first implementation may be 1:1 but will reduce coupling for future evolution
  • 20. Working Effectively with Legacy Code • Identify a Software Seam – In Real Life Legacy Software • There is no such place where there is a well defined interface • “Let there be light”, thanks to iterative refactoring • Follow dependency breaking techniques
  • 21. Working Effectively with Legacy Code • Refactoring to isolate seams via interfaces – Adapt from existing – Where you need to (instability, new features) – Create a production implementation – Create a fake implementation – Write associated test cases – Refine your interfaces – Iterate
  • 22. Working Effectively with Legacy Code • Refactoring to isolate seams via interfaces 1. Know your subject 2. Identify responsibilities 3. Study data structures 4. Break out big classes 5. Break out huge functions iterative process 6. Encapsulate global references 7. Testing is everything
  • 23. Working Effectively with Legacy Code • Refactoring to isolate seams via interfaces 1. Know your subject 2. Identify responsibilities big picture 3. Study data structures 4. Break out big classes 5. Break out huge functions iterative process 6. Encapsulate global references 7. Testing is everything
  • 24. Working Effectively with Legacy Code • Refactoring to isolate seams via interfaces 1. Know your subject 2. Identify responsibilities 3. Study data structures 4. Break out big classes 5. Break out huge functions iterative process 6. Encapsulate global references 7. Testing is everything
  • 25. Working Effectively with Legacy Code 1. Know your subject – In a perfect DDD-oriented world • Reading the code as a book introduces you into the reality the computer program is modeling • Legacy code tends to obfuscate reality in implementation details due to BBM iteration was code focused, not business focused
  • 26. Working Effectively with Legacy Code 1. Know your subject – First gather a high vision of the problem • From non-tech experts • Straight to the main points • Asking for a 5 min presentation from tech experts
  • 27. Working Effectively with Legacy Code 1. Know your subject – Ask support for long-standing bugs – Ask customers for their wishes • Customers have workarounds for bugs, not for unexpected behavior – Ask managers for upcoming features – Ask older coders • For the positive aspects of the legacy software • For what should have been done in another way
  • 28. Working Effectively with Legacy Code • Refactoring to isolate seams via interfaces 1. Know your subject 2. Identify responsibilities 3. Study data structures 4. Break out big classes 5. Break out huge functions iterative process 6. Encapsulate global references 7. Testing is everything
  • 29. Working Effectively with Legacy Code 2. Identify responsibilities – Probably no documentation or deprecated documentation – No code conventions • Naming, style, design • Procedural style: – Spaghetti methods – Stored procedures – RAD
  • 30. Working Effectively with Legacy Code 2. Identify responsibilities – Start from a fresh eye • Even if you work on this code since decades • This is an expert’s work, not for rookies • What should we have done? • Don’t waste time
  • 31. Working Effectively with Legacy Code 2. Identify responsibilities – Heuristics to find light in the darkness • Legacy implementation is valuable – You will learn how the reality is modelized • Code archeologists enjoy ancient times – Software “exegesis” over several layers with long history and a lot of material – Nihil novi sub sole
  • 32. Working Effectively with Legacy Code 2. Identify responsibilities – Heuristics to find light in the darkness • Read the code, as a fast book reader • Keep in mind known bugs and new feature requests
  • 33. Working Effectively with Legacy Code 2. Identify responsibilities – Heuristics to find light in the darkness • Read the code, as a fast book reader • Keep in mind known bugs and new feature requests • Group classes and methods • Identify relationships • Link to stored data structures
  • 34. Working Effectively with Legacy Code 2. Identify responsibilities – Heuristics to find light in the darkness • Read the code, as a fast book reader • Keep in mind known bugs and new feature requests • Group classes and methods • Identify relationships • Link to stored data structures • Note any change that would be needed • Ignore the bugs
  • 35. Working Effectively with Legacy Code 2. Identify relationships – Between variables and methods – Evaluate if existing coupling is worth it – Guess abusive class re-use in several contexts – Guess how it may be uncoupled in the future – Don’t be fooled by implementation details – Ignore the bugs
  • 36. Working Effectively with Legacy Code • Refactoring to isolate seams via interfaces 1. Know your subject 2. Identify responsibilities 3. Study data structures 4. Break out big classes 5. Break out huge functions iterative process 6. Encapsulate global references 7. Testing is everything
  • 37. Working Effectively with Legacy Code 3. Study data structures “Bad programmers worry about the code. Good programmers worry about data structures and their relationships.” Linus T.
  • 38. Working Effectively with Legacy Code 3. Study data structures – Legacy database is where logic remains • Extract business knowledge from Relational Model • Using tools, or existing (old) architecture diagrams – Identify SQL patterns in code • Copy & pasta blocks may be Seams • Eventually refactored as Persistence Services
  • 39. Working Effectively with Legacy Code • Iterative Code Refactoring 4. Break out big classes 5. Break out huge functions 6. Encapsulate global references
  • 40. Working Effectively with Legacy Code • Refactoring to isolate seams via interfaces 1. Know your subject 2. Identify responsibilities 3. Study data structures 4. Break out big classes 5. Break out huge functions iterative process 6. Encapsulate global references 7. Testing is everything
  • 41. Working Effectively with Legacy Code • Iterative Code Refactoring 4. Break out big classes • Too much methods are killing the methds – Confusing to use – Difficult to expand / adapt – Breaks Single Responsibility Principle (SOLID)
  • 42. Working Effectively with Legacy Code • Iterative Code Refactoring 4. Break out big classes • Refactor by writing new uncoupled classes executed within the legacy main class – Old class remains as a Seam – Old class signature is the Seam interface – Real implementation moved in new classes
  • 43. Working Effectively with Legacy Code • Iterative Code Refactoring 4. Break out big classes • Iterative process, using unitary testing • Favor composition over inheritance (SRP) • Introduce interface for abstraction • Add unit tests on uncoupled software units
  • 44. Working Effectively with Legacy Code • Refactoring to isolate seams via interfaces 1. Know your subject 2. Identify responsibilities 3. Study data structures 4. Break out big classes 5. Break out huge functions iterative process 6. Encapsulate global references 7. Testing is everything
  • 45. Working Effectively with Legacy Code • Iterative Code Refactoring 5. Break out huge functions • Refactor a big function/method into a new class / set of classes • Preserve the function signature as class constructors, or public properties • Local variables as private members
  • 46. Working Effectively with Legacy Code • Iterative Code Refactoring 5. Break out huge functions • Iterative process, using unitary testing • First implement as a single class method • Then cut it in smaller (private) methods • Then several classes (SOLID) • Favor composition over inheritance (SRP) • Re-use classes when possible
  • 47. Working Effectively with Legacy Code • Refactoring to isolate seams via interfaces 1. Know your subject 2. Identify responsibilities 3. Study data structures 4. Break out big classes 5. Break out huge functions iterative process 6. Encapsulate global references 7. Testing is everything
  • 48. Working Effectively with Legacy Code • Iterative Code Refactoring 6. Encapsulate global references Identify global variables in disguise • Singleton or static variables/functions • Huge main class (TMainForm TDataModule) • Everything which prevents reentrance
  • 49. Working Effectively with Legacy Code • Iterative Code Refactoring 6. Encapsulate global references Two steps cleaning process • Identify “families” of global variables or functions and group them as classes • Move from a global instance of the class into an injection mechanism
  • 50. Working Effectively with Legacy Code • Iterative Code Refactoring 6. Encapsulate global references • Enable proper unit testing thanks to Dependency Injection • Allows server-side concurrent execution and progressive switch to SOA
  • 51. Working Effectively with Legacy Code • Refactoring to isolate seams via interfaces 1. Know your subject 2. Identify responsibilities 3. Study data structures 4. Break out big classes 5. Break out huge functions iterative process 6. Encapsulate global references 7. Testing is everything
  • 52. Working Effectively with Legacy Code 7. Testing is everything – This is perhaps the hardest part • Especially if unitary test is new for your teams • Induce new test code to write and debug – But also the most valuable • Avoid regressions and refactoring fear • If you can test, your code is likely to be uncoupled
  • 53. Working Effectively with Legacy Code 7. Testing is everything – Getting legacy code under test • To avoid regressions • To ensure as safe as possible refactoring • Define reference datasets, for automated testing – Brute replay of whole application (not yet unit testing) – Using e.g. Virtual Machines snapshots • Test “Bug to bug” behavior of the modified code – Once bugs are fixed, update reference datasets
  • 54. Working Effectively with Legacy Code 7. Testing is everything – Value the existing • Numerous applications and proven User Interface • Integrate new technologies and patterns • Continuous integration during build process
  • 55. Working Effectively with Legacy Code 7. Testing is everything – TDD over each Software Seam • Write a failing test case • Compile • Make it pass • Repeat
  • 56. Working Effectively with Legacy Code 7. Testing is everything – Seams specific tests • Unit testing of the well bounded new interface • Regression testing against the existing • Prepare integration with the future Seams
  • 57. Working Effectively with Legacy Code 7. Testing is everything – Uncoupled seams as interfaces • Could be stubbed/mocked • Could be reused • Could be hosted on a Server (SOA/SaaS)
  • 59. mORMot ToolBox • Cross-cutting features • Killer features • Shared features
  • 60. mORMot ToolBox • Cross-cutting features – Unit Test – Logging – TDocVariant JSON – SynDB SynMongoDB – SynCrypto SynECC – Services – IoC, stubs and mocks
  • 61. mORMot ToolBox • Cross-cutting features – Unit Test • Light and cross-platform • Convention over configuration • Integrated with logging • Integrated with interface Stubs and Mocks • Sample 07
  • 62. mORMot ToolBox • Cross-cutting features – Logging • Low overhead, fast value serialization • Local or remote • Set of events, not levels • Fast viewer tool with method and threads profiling • Exception catch, stack trace • Used by the whole framework • Sample 11
  • 63. mORMot ToolBox • Cross-cutting features – TDocVariant custom type Stores any transient value as document: • Object • Array • Any nested combination of the two
  • 64. mORMot ToolBox • Cross-cutting features – TDocVariant custom type Low memory overhead • Data allocation per blocks of variants • Copy by reference can be enabled • Instance lifetime managed by the compiler
  • 65. mORMot ToolBox • Cross-cutting features – TDocVariant custom type Direct objects or arrays JSON support Late-binding magic Perfect dynamic values for seams
  • 66. mORMot ToolBox • Cross-cutting features – TDocVariant custom type var V: variant; // stored as any variant ... TDocVariant.New(V); // or slightly slower V := TDocVariant.New; V.name := 'John'; // property accessed via late-binding V.year := 1972; // now V contains {"name":"john","year":1972} var V1,V2: variant; ... V1 := _Obj(['name','John','year',1972]); V2 := _Obj(['name','John','doc',_Obj(['one',1,'two',2.5])]); V1 := _Json('{"name":"John","year":1982}'); V2 := _Json('{name:"John",doc:["one",1,"two",2.5]}');
  • 67. mORMot ToolBox • Cross-cutting features – TDocVariant custom type writeln('name=',V1.name,' year=',V1.year); // will write 'name=John year=1972' writeln('name=',V2.name,' doc.one=',V2.doc.one,' doc.two=',doc.two); // will write 'name=John doc.one=1 doc.two=2.5 V1.name := 'Mark'; // overwrite a property value writeln(V1.name); // will write 'Mark' V1.age := 12; // add a property to the object writeln(V1.age); // will write '12' writeln(V1); // implicit conversion to string -> as JSON // will write '{"name":"Mark","year":1972,"age":12}' writeln(VariantSaveJSON(V1)); // serialize as JSON text
  • 68. mORMot ToolBox • Cross-cutting features • SynDB Direct RDBMS access layer – Not linked to DB.pas – Multi providers – UTF-8 JSON – Interface based – Knows SQL dialects (used e.g. by the ORM) – SynDBExplorer tool
  • 69. mORMot ToolBox • Cross-cutting features • SynDB Direct RDBMS access layer – Less data types – By-pass TDataSet – Unicode even before Delphi 2009 – Array binding – Native JSON support – Remote access
  • 70. mORMot ToolBox • Cross-cutting features • SynMongoDB NoSQL acces – MongoDB native access – BSON types - TBSONVariant – TDocVariant support – Extended JSON – MongoDB 3.2 support (SCRAM-SHA1)
  • 71. mORMot ToolBox • Cross-cutting features • SynCrypto SynECC – Introduce safe and fast encryption • AES, SHA, MD5, PBKDF2, PRNG • Optimized pascal or asm AES-NI, SSE4 – Certificate-based public key cryptography • Content signature using ECDSA-secp256r1 • Transmission or file encryption ECDH / ECIES • JSON-based Public Key Infrastructure (PKI)
  • 72. mORMot ToolBox • Cross-cutting features • Services – Daemonization made easy – Console, install or service mode – Remote administration interface – Windows integration – Cross-platform
  • 73. mORMot ToolBox • Cross-cutting features • Inversion Of Concerns (IoC) – Leverage interface types for seams – Runtime class instance resolution TInjectableObject TInterfaceResolver – Mocks and stubs (a killer feature)
  • 74. mORMot ToolBox • Killer features – SOA – ORM / ODM – Stubs and Mocks – MVC web portals – DDD CQRS helpers – SyNode
  • 75. mORMot ToolBox • Killer features … to be detailed tomorrow 
  • 76. mORMot ToolBox • Shared features – Convention Over Configuration – Cross-Platform and Cross-Compiler – Fully integrated and coherent – Made for scaling and performance – Modular: pickup what is needed, integrate with existing – Open Source with active community
  • 77. mORMot ToolBox • Don’t be afraid – Huge feature set – Exhaustive / endless documentation – Unusual concepts • Where to start – Run the samples – Use the forum – Publish your test project on github!
  • 78. mORMot ToolBox • Resources – http://synopse.info – http://synopse.info/forum – http://blog.synopse.info – http://github.com/synopse/mORMot Includes exhaustive documentation, samples and regression tests.
  • 79. Q & A ©2016 Synopse / A.Bouchez