top legacy sins
TRANSCRIPT
![Page 1: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/1.jpg)
Top Legacy SinsEberhard Wolff
Fellow@ewolff
![Page 2: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/2.jpg)
http://microservices-buch.de/ http://microservices-book.com/
![Page 3: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/3.jpg)
What should a Software Architect do?
![Page 4: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/4.jpg)
Create a Proper Architecture.
![Page 5: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/5.jpg)
Create a Proper Architecture.
Agree??
![Page 6: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/6.jpg)
I’m a Software Architect.
But I’m not doing architecture. !
![Page 7: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/7.jpg)
How important is Software
Architecture?
![Page 8: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/8.jpg)
Why would we care about Software Architecture?
![Page 9: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/9.jpg)
Software Architecture=Structure
![Page 10: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/10.jpg)
Architecture Goals: Quality
> All kinds of quality
> Performance
> Security
> …
> Focus of this presentation: Changeability
> Architects must understand customers & priority
![Page 11: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/11.jpg)
Architects must understand customer
![Page 12: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/12.jpg)
Software ArchitectureSet of
structures
comprise
software elements,
relations among them, and
properties of both.
![Page 13: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/13.jpg)
Why?
> Can work on modules in isolation
> Can work on collaboration of modules
> Fits in my head
Dan North
![Page 14: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/14.jpg)
Does He Care?
![Page 15: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/15.jpg)
Why?Great
Architecture
SoftwareEasy to change
Highproductivity
LowCost
![Page 16: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/16.jpg)
He Cares
€
![Page 17: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/17.jpg)
Why?Great
Architecture
SoftwareEasy to change
Highproductivity
LowCost
![Page 18: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/18.jpg)
What He Cares AboutGreat
Architecture
SoftwareEasy to change
Highproductivity
LowCost
![Page 19: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/19.jpg)
Is architecture the only factor for changeability?
![Page 20: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/20.jpg)
What is the best thing we can have in a
legacy code?
![Page 21: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/21.jpg)
Great architecture
orautomated tests?
![Page 22: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/22.jpg)
No Automated Tests
> No way to find bugs
> Changes almost impossible
> Legacy code = code without tests
> Michael FeathersWorking Effectively with Legacy Code
![Page 23: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/23.jpg)
Let’s add some automated UI tests
![Page 24: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/24.jpg)
Automated UI Tests
> Easy to implement
> Exactly what testers do manually
> Easy to understand for customers
> Test business processes
> Safety net
![Page 25: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/25.jpg)
Unit Tests
or automated UI tests?
![Page 26: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/26.jpg)
Many UI Tests Worse > Fragile: Changes to UI break test
> Business meaning of tests easily lost
> Takes long
> Often not reproducible
![Page 27: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/27.jpg)
Automated UI Tests
Automated Integration
Tests
Unit Tests
Manual Tests
![Page 28: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/28.jpg)
Automated UI Tests
Automated Integration
Tests
Unit Tests
Manual Tests
![Page 29: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/29.jpg)
SlowUnreliableExpensive
![Page 30: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/30.jpg)
Alternatives to automated UI tests?
![Page 31: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/31.jpg)
TextuellerAkzeptanztest
![Page 32: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/32.jpg)
Szenario> Möglicher Ablauf in einer Story
> Standardisierte Bestandteile:
> Gegeben... (Kontext)
> Wenn... (Ereignis)
> Dann... (erwartetes Ergebnis)
![Page 33: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/33.jpg)
Szenario: BeispielSzenario: Kunde registriert sich erfolgreich
Kontext
Ereignis
Erwartetes Ergebnis
Erwartetes Ergebnis
Gegeben ein neuer Kunde mit EMail [email protected] Vorname Eberhard Name Wolff
Wenn der Kunde sich registriert
Dann sollte ein Kunde mit der EMail [email protected] existieren
Und es sollte kein Fehler gemeldet werden
![Page 34: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/34.jpg)
RegistrationService registrationService;// Initialisierung RegistrationService// ausgelassen
private User kunde;private boolean fehler = false;
@Given("ein neuer Kunde mit "+"EMail $email Vorname $vorname"+" Name $name")public void gegebenKunde(String email,String vorname, String name) {kunde = new User(vorname, name,email);
}
![Page 35: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/35.jpg)
@When("der Kunde sich registriert")public void registerKunde() {try {
registrationService.register(kunde);} catch (IllegalArgumentException ex) {
fehler = true;}
}@Then("sollte ein Kunde mit der EMail $email existieren")public void existiert(String email) {assertNotNull(registrationService.getByEMail(email));
}@Then("es sollte kein Fehler gemeldet werden")
public void keinFehler() {assertFalse(fehler);
} }
![Page 36: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/36.jpg)
Test is about handling risk
![Page 37: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/37.jpg)
Tests for Risks> Algorithm / calculation wrong:
Unit test
> System failures:Unit tests
> Wiring / collaboration:Integration tests
> Business process:Integration test
> UI: UI test
![Page 38: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/38.jpg)
Example: User Registration
> Unit test
Validations
Database failure
> Integration test
Process
> UI test
Everything shown?
![Page 39: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/39.jpg)
Not Tested
> UI won’t test validation
> …or algorithms
> …or the process
> Risks handled elsewhere
![Page 40: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/40.jpg)
Automated UI Tests
Automated Integration
Tests
Unit Tests
Manual Tests
![Page 41: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/41.jpg)
Automated UI Tests.
Automated Integration
Tests
Unit Tests
ManualTests
Test Pyramid
![Page 42: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/42.jpg)
Test Pyramid instead of Automated UI Tests
![Page 43: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/43.jpg)
Great architecture
or fast & easy deployment?
![Page 44: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/44.jpg)
Deployment> Manual deployment is error prone
> Slow deployment
> Lots of code developed but not deployed
> i.e. more lean waste
> Slow feedback
> Slow time to recovery
![Page 45: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/45.jpg)
Leseprobe:
http://bit.ly/CD-Buch
![Page 46: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/46.jpg)
Continuous Delivery:Build Pipeline
CommitStage
AutomatedAcceptance
Testing
AutomatedCapacityTesting
ManualExplorative
TestingRelease
![Page 47: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/47.jpg)
Continuous Delivery
> Testing
> + automated deployment
> Testing: reduce probability of errors
> Automated deployment: better mean time to repair
![Page 48: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/48.jpg)
Continuous Delivery
> Make software easier to change
> & deploy
> Reliable and reproducible tests
> Automated deployed
> Fast & reliable
![Page 49: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/49.jpg)
What is a great architecture?
![Page 50: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/50.jpg)
UI
Logic
Database
![Page 51: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/51.jpg)
Is Three Tier a great architecture?
![Page 52: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/52.jpg)
Three Tier> Actually layer: no distribution
> By technology
> Layers can be replaced
> Layers can be developed independently
![Page 53: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/53.jpg)
Do you replace e.g. the persistence layer?
![Page 54: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/54.jpg)
Is it really simple to add e.g. mobile
clients?
![Page 55: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/55.jpg)
A better reason:Fits in my head.
![Page 56: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/56.jpg)
Redo the order
processing!
![Page 57: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/57.jpg)
Add feature to the
registration!
Can we change the persistence technology
instead?
Please?
![Page 58: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/58.jpg)
What is a persistence
technology??
![Page 59: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/59.jpg)
Registration Order Billing
UI
Logic
![Page 60: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/60.jpg)
Architecture> Should support changes
> …with business value
> Needs to model the domain
> Hard to get right
> Architect needs to understand the domain
![Page 61: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/61.jpg)
Is a great architecture free of cyclic
dependencies?
![Page 62: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/62.jpg)
A B
A depends on B
Changes to B influence A
![Page 63: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/63.jpg)
A B
A depends on B
Changes to B influence AB depends on A
Changes to A influence B
In fact one componentShould be two components
![Page 64: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/64.jpg)
Is a great architecture free of cyclic
dependencies?
![Page 65: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/65.jpg)
Cyclic dependencies: Architects’ Mortal Sin
![Page 66: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/66.jpg)
A B
A B
42
2
200
![Page 67: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/67.jpg)
Other Architecture Metrics
> High cohesion
> Elements of a module should belong together
> Low coupling
> Modules should not depend on each other
![Page 68: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/68.jpg)
Great Architecture
> Don’t overrate cyclic dependencies!
> Consider other metrics
> Architecture by domain
![Page 69: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/69.jpg)
The worst legacy problems?
![Page 70: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/70.jpg)
The project has a lot of cyclic
dependencies!
I know.…but that doesn’t
cause a lot of trouble
![Page 71: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/71.jpg)
Architects must understand customer
& his quality demands
![Page 72: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/72.jpg)
Quality
> Changeability
> Performance
> Security
> …
![Page 73: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/73.jpg)
No two projects are alike.
![Page 74: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/74.jpg)
No general rules.
![Page 75: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/75.jpg)
Sorry!
![Page 76: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/76.jpg)
SoftwareEasy to change
Automatedtests
Test pyramid
Fast & easy deployment
GreatArchitecture
No cyclic dependencies
Low coupling
High cohesion
![Page 77: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/77.jpg)
What should a Software Architect do?
![Page 78: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/78.jpg)
Create a Proper Architecture.
![Page 79: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/79.jpg)
Create a Proper Architecture.
![Page 80: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/80.jpg)
I’m a Software Architect.
But I’m not doing architecture.
There is more to changeable software than architecture.
![Page 81: Top Legacy Sins](https://reader031.vdocuments.us/reader031/viewer/2022030317/586f732f1a28ab10258b56a7/html5/thumbnails/81.jpg)
Thank You!@ewolff