Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mind the Gap - Architecture versus Code @ W-JAX 2016

Mind the Gap is a talk by Oliver Fischer on the problem of keeping the intended architecture and the existing one very close to each other. One supposed way is to use jQAssistant to analyse any Java software system and to validate its conformance with the intended architecture.

  • Be the first to comment

Mind the Gap - Architecture versus Code @ W-JAX 2016

  1. 1. Oliver B. Fischer (@sweblogtweets) Mind the Gap Architektur versus Code
  2. 2. 2
  3. 3. 3 Was ist Software Architektur? Eine strukturierte oder hierarchische Anordnung der Systemkomponenten sowie die Beschreibung Ihrer Beziehungen. Helmut Balzert
  4. 4. 4 Was ist Software Architektur? The fundamental organisation of a system embodied in its components, their relationships to each other, and the environment, and the principles guiding its design and evolution. IEEE 1471-2000
  5. 5. 5 Was ist Software Architektur? ...from the plethora of definitions the vary concept of Software Architecture is fuzzy to the point of utter uselessness... SEI @ CMI: John Carter A lot of folks mean: That peculiar consistency and homogenity of Design that would give arise to the ease of use and reuse, which is wished for by the developer who calls himself „The Software Architect“. ...[which] implodes immediatly on the appointment of a second Software Architect...
  6. 6. 6 Ziele von Software Architektur Software-Qualität Prozess Qualität Produkt-Qualität Wartbarkeit Brauchbarkeit Prüfbarkeit Änderbarkeit Portabilität Lesbarkeit Strukturiertheit Einfachheit
  7. 7. 7 Ziele von Software Architektur Durch Software Architektur wollen wir erhalten:  Wartbare Software  Verständliche Software  Anpassbare bzw. Erweiterbare Software  Effiziente Software
  8. 8. 8 Wann Software Architektur entsteht Software Architektur entsteht sobald sich zwei Personen über einen Aspekt eines Dings oder das Zusammenspiel zweier Dinge abstimmen.
  9. 9. 9 Wann Software Architektur entsteht Software Architektur entsteht sobald sich zwei Personen [über einen Aspekt eines Dings oder das Zusammenspiel zweier Dinge] abstimmen.
  10. 10. 10 Software Architektur ist Kommunikation Software Architektur ist [auch] Kommunikation über Strukturen, Beziehungen und Prinzipien... ...um besser und leichter arbeiten zu können.
  11. 11. 11 Software Architektur ist Kommunikation Software Architektur muß Verständnis schaffen, nicht nur für das Wie, sondern auch für das Warum!
  12. 12. 12 Software Architektur ist Kommunikation Drei Rollen-Model Domainexperte Entwickler User
  13. 13. 13 Software Architektur ist Kommunikation Einfachster Fall  Domainexperte  Entwickler  User
  14. 14. 14 Software Architektur ist Kommunikation Es wird schwieriger...  Domainexperte  Entwickler  User
  15. 15. 15 Software Architektur ist Kommunikation Es wird schwieriger...  Domainexperte  Entwickler  User
  16. 16. 16 Software Architektur ist Kommunikation Das Team wird größer  Domainexperte  Entwickler  User
  17. 17. 17 Software Architektur ist Kommunikation Es verteilt sich... Team in Berlin Team in München
  18. 18. 18 Software Architektur ist Kommunikation Es verteilt sich geographisch und kulturell Ich spreche Deutsch... Я говорю по-русский I speak Englisch
  19. 19. 19 Software Architektur ist Kommunikation Und dann auch zeitlich...
  20. 20. 20 Software Architektur ist Kommunikation Ach ja: Microservices...
  21. 21. 21 Altlasten & Technische Schulden Veraltete Libraries.... Neue Lösungsansätze Divergierende Makroarchitektur
  22. 22. 22 Wir brauchen Regeln Hast Du mal Zeit? Ja, was willst Du denn? Ich habe da eine Idee. Laß mal hören... ... ... Ja, so machen wir das! §1. Jedes System... §2. Jede Methode... §3. Auf jedem Server... §4. ...
  23. 23. 23 Wir brauchen Regeln §1. Jedes System... §2. Jede Methode... §3. Auf jedem Server... §4. ... Regeln entstehen meist informell
  24. 24. 24 Wir brauchen Regeln Informelle Regeln haben Grenzen...  Größe des Teams erschwert Kommunikation  Entstehung von Inselwissen  Fluktuation  Charaktertypen
  25. 25. 25 Lösungsansatz Überführung von informellen Regeln in formale Regeln.
  26. 26. 26 Lösungsansatz „Wir schreiben das auf!“ „Wo?“ „Im Wiki!“ Zitat „Wiki, der Ort wo Informationen zum Sterben hingehen.“
  27. 27. 27 Lösungsansatz „Wir schreiben das auf!“ „Wo?“ „Im Wiki!“ W here I information K ills I tself
  28. 28. 28 Lösungsansatz Dokumentation != Kommunikation
  29. 29. 29 Lösungsansatz Helfen Reviews?
  30. 30. 30 Lösungsansatz Helfen Tools?
  31. 31. jQAssistant Mind The Gap! Architecture vs. Code 31
  32. 32. 32 http://jQAssistant.org  Open Source  GPL v3  Current release: 1.1.3  initiated: 03/2013  first stable release: 04/2015  Neo4j Community Edition embedded  no installation necessary
  33. 33. 33  The Idea  Scan software structures  Store in a database  Execute queries  Add higher level concepts  Find constraint violations  Create Reports  Provide feedback to developers within build process Database Find all…
  34. 34. 34 Command Line/ Maven Scan Analyze Report Plugins Plugins Plugins
  35. 35. 35  Available scanner plugins  Plugin API is public *.class RDBMS Schema Git JaCoCo FindBugs CheckStyle LiquibaseJAR, WAR, EARZIP application.xmlweb.xml MANIFEST.MF /META-INF/services/* beans.xml pom.xml surefire-reports.xml GZ *.properties *.xsd M2 Repository *.yaml
  36. 36. Software As A Graph Mind The Gap! Architecture vs. Code 36
  37. 37. 37  All we need is…  Nodes  Labels  Properties  Relationships  Modeling is just…  Taking a pen  Drawing the structures on a whiteboard (i.e. the database)  We don‘t need…  Foreign keys  Tables and schemas  Deep knowledge in graph theory Type EXTENDS fqn:org.springframework.samples. petclinic.model.Owner
  38. 38. Project Artifact Maven CONTAINS Package name:org CONTAINS Package name:springframework CONTAINS Package name:petclinic Package CONTAINS name:model name:petclinic CONTAINS Package name:samples CREATES
  39. 39. RETURNS READS Field DECLARES name:address Package name:model Class Type CONTAINS fqn:org.springframework. samples.petclinic. model.Person name:Person Annotation ANNOTATED_BY Type OF_TYPEfqn:javax.persistence.MappedSuperclass Type EXTENDS Class fqn:org.springframework. samples.petclinic. model.Owner name:Owner Type OF_TYPE fqn:java.lang.String DECLARES Method name:getAddress() Annotation ANNOTATED_BY Type OF_TYPEfqn:javax.persistence.Entity
  40. 40. 40 TypeType Class EXTENDS  Explore an application using queries  Which class extends from another class?  Let‘s convert this to ASCII art…  () as nodes  -[]-> as directed relationships
  41. 41. 41 TypeType Class EXTENDS  Explore an application using queries  Which class extends from another class?  Let‘s convert this to ASCII art…  () as nodes  -[]-> as directed relationships ()-[]->()
  42. 42. 42 C2 Type C1 Type Class EXTENDS  Explore an application using queries  Which class extends from another class?  Let‘s convert this to ASCII art…  () as nodes  -[]-> as directed relationships (c1)-[]->(c2)
  43. 43. 43 C2 Type C1 Type Class EXTENDS  Explore an application using queries  Which class extends from another class?  Let‘s convert this to ASCII art…  () as nodes  -[]-> as directed relationships (c1)-[:EXTENDS]->(c2)
  44. 44. 44  Explore an application using queries  Which class extends from another class?  Let‘s convert this to ASCII art…  () as nodes  -[]-> as directed relationships (c1:Class)-[:EXTENDS]->(c2:Type) C2 Type C1 Type Class EXTENDS
  45. 45. 45  Explore an application using queries  Which class extends from another class?  Pattern matching is the core principle of Cypher MATCH (c1:Class)-[:EXTENDS]->(c2:Type) RETURN c1.fqn, c2.fqn C2 Type C1 Type Class EXTENDS
  46. 46. Demo #1 Mind The Gap! Architecture vs. Code 46 http://jqassistant.org/get-started/
  47. 47. Building The Bridge Mind The Gap! Architecture vs. Code 47
  48. 48. 48  Analyze  Execution of rules  Defined in AsciiDoc or XML documents  Concepts  Enrich data model  Constraints  Detect violations  Group  Allow different execution profiles
  49. 49. 49 ConstraintGroup Concept ConceptConcept Includes Requires Requires Requires
  50. 50. 50  Concept == JPA Entities [[jpa2:Entity]] .Labels all types annotated with @javax.persistence.Entity with Jpa and Entity. [source,cypher,role=concept] ---- MATCH (t:Type)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(a:Type) WHERE a.fqn ="javax.persistence.Entity" SET t:Jpa:Entity RETURN t AS Entity ----
  51. 51. 51  Concept Entity JpaType Class fqn:org.springframework. samples.petclinic. model.Owner name:Owner Annotation ANNOTATED_BY Type OF_TYPEfqn:javax.persistence.Entity
  52. 52. 52  Constraint [[model:JpaEntityInModelPackage]] .All JPA entities must be located in packages named "model". [source,cypher,role=constraint,requiresConcepts="jpa2:Entity"] ---- MATCH (package:Package)-[:CONTAINS]->(entity:Jpa:Entity) WHERE package.name <> "model" RETURN entity AS EntityInWrongPackage ----
  53. 53. 53  Group [[default]] [role=group,includesConstraints="model:JpaEntityInModelPackage"] == Naming Rules The following naming rules apply: - <<model:JpaEntityInModelPackage>>
  54. 54. 54  AsciiDoc  Wiki syntax  Rendering to  DocBook  HTML  PDF  Executable specification  Coding rules  Design & Architecture
  55. 55. Demo #2 Mind The Gap! Architecture vs. Code 55 http://github.com/buschmais/spring-petclinic
  56. 56. 56  Holistic view on code structure and system architecture  Exploration of existing structures  Validation of rules  Executable architecture and design specification  Rules using terms from architecture & design language
  57. 57. Mail: info@jqassistant.org Web: jqassistant.org Twitter: @jqassistant Thank You! – Questions? by

    Be the first to comment

    Login to see the comments

  • dkoller

    Nov. 11, 2016

Mind the Gap is a talk by Oliver Fischer on the problem of keeping the intended architecture and the existing one very close to each other. One supposed way is to use jQAssistant to analyse any Java software system and to validate its conformance with the intended architecture.

Views

Total views

265

On Slideshare

0

From embeds

0

Number of embeds

4

Actions

Downloads

3

Shares

0

Comments

0

Likes

1

×