Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Improving legacy

Carola is managing the company WPS since 2014 where 120 developers and architects improve legacy systems all around the world. In this talk you will learn how to bring your old code base back to the path of virtue, step by step, so that maintenance is fun again.

  • Als Erste(r) kommentieren

Improving legacy

  1. 1. WPS - Workplace Solutions GmbH //// Hans-Henny-Jahnn-Weg 29 //// 22085 HAMBURG Improving Legacy Dr. Carola Lilienthal Carola.Lilienthal@wps.de, @cairolali www.wps.de
  2. 2. @cairolaliwww.llsa.de www.sustainable-software-architecture.com
  3. 3. @cairolali
  4. 4. @cairolali 7 41 63 128 90 bis 15 Mio bis 5 Mio bis 1 Mio bis 500.000 bis 100.000
  5. 5. @cairolali HOW DO WE SPEND OUR TIME? 70% 20% 10% Code verstehen Problem lösen Code schreiben Code comprehension Problem solving Writing code
  6. 6. @cairolali WELL-FORMED COMPLEX STRUCTURES = SAVING TIME! Cognitive Mechanisms HierarchiesChunking Schemata
  7. 7. @cairolali
  8. 8. @ naturfotographen-forum.de Marion Meixner
  9. 9. @cairolali public class XYManager { void registerService(Service s)… Service getService(String n)... void initializeServiceRegistry()… void initializeEventQueue()… void sendEvent(Event event)… void initializePrinterQueue()… void printDocument(Doc d)…}
  10. 10. @cairolali WELL-FORMED COMPLEX STRUCTURES = SAVING TIME! Cognitive Mechanisms HierarchiesChunking Schemata Well-formed architecture Modularity
  11. 11. @cairolali MODULARITY ▪High Cohesion and lose Coupling ▪Responsibility Driven Design ▪Separation of Concerns ▪Single Responsibility Principle
  12. 12. @cairolali FOUR MODULES Modul Green Modul Purple Modul Orange Modul Blue
  13. 13. @cairolali HIGH COHESION?
  14. 14. @cairolali HIGH COHESION!
  15. 15. @cairolali WELL-FORMED COMPLEX STRUCTURES = SAVING TIME! Cognitive Mechanisms HierarchiesChunking Schemata Well-formed architecture Modularity
  16. 16. @cairolali HIERARCHIES  
  17. 17. @cairolali WELL-FORMED COMPLEX STRUCTURES = SAVING TIME! Cognitive Mechanisms HierarchiesChunking Schemata Well-formed architecture Modularity Hierarchical Layerng
  18. 18. @cairolali
  19. 19. @cairolali WELL-FORMED COMPLEX STRUCTURES = SAVING TIME! Cognitive Mechanisms HierarchiesChunking Schemata Well-formed architecture Modularity Hierarchical Layerng Pattern Consistency
  20. 20. @cairolali PATTERN HELP US TO BE QUICK Domain Module Model View Controller ValueObject Service BusinessObject
  21. 21. @cairolali WRONG PATTERN STOP THE FLOW Domain Module Model View Controller ValueObject Service BusinessObject Factory ✓ createBusinessObject() ✓ createValueObject() × calculate(BO) × process(BO)
  22. 22. @cairolali WELL-FORMED COMPLEX STRUCTURES = SAVING TIME! Cognitive Mechanisms HierarchiesChunking Schemata Well-formed architecture Modularity Hierarchical Layerng Pattern Consistency
  23. 23. @cairolali
  24. 24. @cairolali TWO DIMENSIONS IN ON ARCHITECTURE Technical layering Domain layering Tree violations that are easy to resolve Difficult violations One component cuasing several problems One component causing a problem
  25. 25. @cairolali DOMAIN LAYERING IS MISSING Technical layering No domain layering Some violations of the technical layering Allmost all domain components need each other
  26. 26. @cairolali 119 classes from 4 components + 28 other classes
  27. 27. @cairolali 327 classes from 8 components That all need each other
  28. 28. @cairolali WELL-FORMED COMPLEX STRUCTURES = SAVING TIME! Cognitive Mechanisms HierarchiesChunking Schemata Well-formed architecture Modularity Hierarchical Layerng Pattern Consistency
  29. 29. @cairolali MODULARITY: SIMULAR-SIZED Typical metrics: ▪ LOC per method, class, package, components ▪ Duplicated Code ▪ Cyclomatic complexity ▪ Is the system balanced at different levels? ▪ Which code sections stand out due to their size? Anti-Pattern „Godclass“
  30. 30. @cairolali UNEVEN MODULES One big monolith with satellites 950.860 LOC 84.808 LOC
  31. 31. @cairolali UNEVEN MODULES 9 Components = 17 Subsystems
  32. 32. @cairolali 128 BUILD UNITS WITH NUMBER OF CLASSES ▪ 3 Mio of 9 Mio LOC ▪ 1/3 of the system
  33. 33. @cairolali 5.270 CLASSES IN ONE CYCLE IN ONE BUILDUNIT
  34. 34. @cairolali DOMAIN-DRIVEN ARCHITECTURE Domain Module B Domain Module A Loose coupling = as little coupling as possible! Technicallayering Domain Module C User Interface User InterfaceUser Interface Domain Application Domain Application Domain Application
  35. 35. @cairolali DOMAIN MODULES? UseCase-Driven
  36. 36. @cairolali DOMAIN MODULES? Models integrated in UseCasesUseCase-Driven
  37. 37. @cairolali WELL-FORMED COMPLEX STRUCTURES = SAVING TIME! Cognitive Mechanisms HierarchiesChunking Schemata Well-formed architecture Modularity Hierarchical Layering Pattern Consistency
  38. 38. @cairolali User Interface Domain Application Domain Module Domain Module Domain Module Model View Controller ValueObject Service Entity Layeringbypattern
  39. 39. @cairolali PATTERN CONFORMITY: GOOD EXAMPLE ☺ 90% of the source code can be assigned to pattern ☺ 0,1% violations between the pattern Eventer Processes Service
  40. 40. @cairolali
  41. 41. @cairolali WELL-FORMED COMPLEX STRUCTURES = SAVING TIME! Cognitive Mechanisms HierarchiesChunking Schemata Modularity Hierarchical Layerng Pattern Consistency → Consistent and integrated pattern → Use a pattern language → No cycles neither on architectural level nor on class level → responsibility → coupling → size → interfaces
  42. 42. @cairolali FREE TOOLS • SonarQube: ▪ Control station for quality metrics ▪ Platform for multiple plugins • JDepend: ▪ few metrics ▪ simple dependency analysis • JDepend + Google Architecture Rules: • simple architecture description • Ndepend/CDepend: ▪ Metrics ▪ dependency analysis • XRadar: ▪ Analysis of Java projects via maven ▪ Reports on complexity and architecture violations • Moose • Code City
  43. 43. @cairolali COMMERCIAL PRODUCTS ▪ Axivion Bauhaus: Java, C#, C/C++, Ada, VB and Cobol ▪ Lattix: Java, .Net, C/C++, Ada, Delphi and DB Systema ▪ Structure101: Java, C++, Ada ▪ SotoArc and Sonargraph: Java, C#, C/C++, ABAP, PHP ▪ Teamscale: C#, Java, ABAP ▪ Seerene: Java, C#, C/C++, ABAP
  44. 44. @cairolali ▪Do test driven development ▪Use design and architecture patterns ▪Write modular classes with one single responsibility ▪Aim for high cohesion and low coupling MOB ARCHITECTING WITH THE TEAM Structure101 SotoArc Lattix
  45. 45. @cairolali 612.869 LOC 14.756.435 LOC 252.062 LOC 804.093 LOC 543.388 LOC 1.035.668 LOC 486.358 LOC 175.258 LOC 42.311 LOC 193.383 LOC 643.466 LOC 245.754 LOC 2.890.204 LOC 141.696 LOC 512.086 LOC 9.988.363 LOC 200.591 LOC 922.949 LOC 22.658 LOC 663.862 LOC 3.270.188 LOC 1.521.357 LOC 0 2 4 6 8 10 MODULARITY MATURITY INDEX (MMI)
  46. 46. @cairolali @cairolali cl@wps.de Available in English since Summer 2019 www.sustainable-software-architecture.com THANK YOU FOR YOUR ATTENTION!

×