mind the gap - architecture versus code @ berlin expert days 2016
TRANSCRIPT
by
Mind the Gap Architecture versus Code
BerlinExpertDaysSeptember2016
OliverB.Fischer-E-PostDevelopmentGmbH
2
3
Was ist Software Architektur?
EinestrukturierteoderhierarchischeAnordnungderSystemkomponentensowiedieBeschreibungIhrerBeziehungen.
HelmutBalzert
4
Was ist Software Architektur?
ThefundamentalorganisaBonofasystemembodiedinitscomponents,theirrelaBonshipstoeachother,andtheenvironment,andtheprinciplesguidingitsdesignandevoluBon.
IEEE1471-2000
5
Was ist Software Architektur?
...fromtheplethoraofdefiniBonsthevaryconceptofSoGwareArchitectureisfuzzytothepointofuHeruselessness...
SEI@CMI:JohnCarter
Alotoffolksmean:
ThatpeculiarconsistencyandhomogenityofDesignthatwouldgivearisetotheeaseofuseandreuse,whichiswishedforbythedeveloperwhocallshimself„TheSoGwareArchitect“.
...[which]implodesimmediatlyontheappointmentofasecondSoGwareArchitect...
6
Ziele von Software Architektur
SoGware-Qualität
Prozess Qualität Produkt-Qualität
Wartbarkeit Brauchbarkeit
PrüVarkeit Änderbarkeit Portabilität
Lesbarkeit Strukturiertheit Einfachheit
7
Ziele von Software Architektur
DurchSoGwareArchitekturwollenwirerhalten:§ WartbareSoGware§ VerständlicheSoGware§ Anpassbarebzw.ErweiterbareSoGware§ EffizienteSoGware
8
Wann Software Architektur entsteht
SoGwareArchitekturentstehtsobaldsichzweiPersonenübereinenAspekteinesDingsoderdasZusammenspielzweierDingeabsBmmen.
9
Wann Software Architektur entsteht
SoBwareArchitekturentstehtsobaldsichzweiPersonen[übereinenAspekteinesDingsoderdasZusammenspielzweierDinge]absImmen.
10
Software Architektur ist Kommunikation
SoGwareArchitekturist[auch]KommunikaBonüberStrukturen,BeziehungenundPrinzipien...
...umbesserundleichterarbeitenzukönnen.
11
Software Architektur ist Kommunikation
SoGwareArchitekturmußVerständnisschaffen,nichtnurfürdasWie,sondernauchfürdasWarum!
12
Software Architektur ist Kommunikation
DreiRollen-Model
Domainexperte Entwickler User
13
Software Architektur ist Kommunikation
EinfachsterFall
§ Domainexperte§ Entwickler§ User
14
Software Architektur ist Kommunikation
Eswirdschwieriger...
§ Domainexperte § Entwickler§ User
15
Software Architektur ist Kommunikation
Eswirdschwieriger...
§ Domainexperte § Entwickler § User
16
Software Architektur ist Kommunikation
DasTeamwirdgrößer
§ Domainexperte § Entwickler § User
17
Software Architektur ist Kommunikation
Esverteiltsich...
TeaminBerlin TeaminMünchen
18
Software Architektur ist Kommunikation
Esverteiltsichgeographischundkulturell
IchsprecheDeutsch...
Яговорюпо-русский
IspeakEnglisch
19
Software Architektur ist Kommunikation
Unddannauchzeitlich...
20
Software Architektur ist Kommunikation
Achja:Microservices...
21
Altlasten & Technische Schulden
VeralteteLibraries....
NeueLösungsansätze
DivergierendeMakroarchitektur
22
Wir brauchen Regeln
HastDumalZeit?Ja,waswillstDudenn?
IchhabedaeineIdee.Laßmalhören...
......
Ja,somachenwirdas!
§1.JedesSystem...§2.JedeMethode...§3.AufjedemServer...§4....
23
Wir brauchen Regeln
§1.JedesSystem...§2.JedeMethode...§3.AufjedemServer...§4....
Regelnentstehenmeistinformell
24
Wir brauchen Regeln
InformelleRegelnhabenGrenzen...
§ GrößedesTeamserschwertKommunikaBon§ EntstehungvonInselwissen§ FluktuaBon§ Charaktertypen
25
Lösungsansatz
ÜberführungvoninformellenRegelninformaleRegeln.
26
Lösungsansatz
„Wirschreibendasauf!“„Wo?“
„ImWiki!“
Zitat„Wiki,derOrtwoInformaBonenzumSterbenhingehen.“
27
Lösungsansatz
„Wirschreibendasauf!“„Wo?“
„ImWiki!“
W hereI informaBonK illsI tself
28
Lösungsansatz
DokumentaIon!=
KommunikaIon
29
Lösungsansatz
HelfenReviews?
30
Lösungsansatz
HelfenTools?
jQAssistant
MindTheGap!Architecturevs.Code
31
32
hHp://jQAssistant.org§ OpenSource- GPLv3
§ Currentrelease:1.1.3- iniBated:03/2013- firststablerelease:04/2015
§ Neo4jCommunityEdiBonembedded- noinstallaBonnecessary
33
§ TheIdea- ScansoGwarestructures
- Storeinadatabase
- Executequeries§ Addhigherlevelconcepts§ FindconstraintviolaBons
- CreateReports
àProvidefeedbacktodeveloperswithinbuildprocess
Database
Findall…
34
CommandLine/Maven
Scan
Analyze
Report
Plugins
Plugins
Plugins
35
§ Availablescannerplugins
§ PluginAPIispublic
*.class
RDBMSSchema
GitJaCoCo
FindBugsCheckStyle
LiquibaseJAR,WAR,EARZIP
applicaBon.xmlweb.xml
MANIFEST.MF /META-INF/services/*
beans.xml
pom.xml surefire-reports.xml
GZ
*.properBes
*.xsd
M2Repository
*.yaml
Software As A Graph
MindTheGap!Architecturevs.Code
36
37
§ Allweneedis…- Nodes- Labels- ProperBes- RelaBonships
§ Modelingisjust…- Takingapen- Drawingthestructuresonawhiteboard(i.e.thedatabase)
§ Wedon‘tneed…- Foreignkeys- Tablesandschemas- Deepknowledgeingraphtheory
Type
EXTENDSfqn:org.springframework.samples.
petclinic.model.Owner
Project
ArBfact
Maven
CONTAINS
Package
name:org
CONTAINS
Package
name:springframework CONTAINS
Package
name:petclinic
Package
CONTAINS
name:model
name:petclinic
CONTAINS
Package
name:samples
CREATES
RETURNS
READS
Field
DECLARES
name:address
Package
name:model
Class
Type
CONTAINS
fqn:org.springframework.samples.petclinic.model.Person
name:Person
AnnotaBon
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()
AnnotaBon
ANNOTATED_BY
Type
OF_TYPEfqn:javax.persistence.EnBty
40
TypeType
Class
EXTENDS
§ ExploreanapplicaBonusingqueries- Whichclassextendsfromanotherclass?
§ Let‘sconvertthistoASCIIart…- ()asnodes- -[]->asdirectedrelaBonships
41
TypeType
Class
EXTENDS
§ ExploreanapplicaBonusingqueries- Whichclassextendsfromanotherclass?
§ Let‘sconvertthistoASCIIart…- ()asnodes- -[]->asdirectedrelaBonships
()-[]->()
42
C2Type
C1Type
Class
EXTENDS
§ ExploreanapplicaBonusingqueries- Whichclassextendsfromanotherclass?
§ Let‘sconvertthistoASCIIart…- ()asnodes- -[]->asdirectedrelaBonships
(c1)-[]->(c2)
43
C2Type
C1Type
Class
EXTENDS
§ ExploreanapplicaBonusingqueries- Whichclassextendsfromanotherclass?
§ Let‘sconvertthistoASCIIart…- ()asnodes- -[]->asdirectedrelaBonships
(c1)-[:EXTENDS]->(c2)
44
§ ExploreanapplicaBonusingqueries- Whichclassextendsfromanotherclass?
§ Let‘sconvertthistoASCIIart…- ()asnodes- -[]->asdirectedrelaBonships
(c1:Class)-[:EXTENDS]->(c2:Type)
C2Type
C1Type
Class
EXTENDS
45
§ ExploreanapplicaBonusingqueries- Whichclassextendsfromanotherclass?
§ PaHernmatchingisthecoreprincipleofCypherMATCH(c1:Class)-[:EXTENDS]->(c2:Type)RETURNc1.fqn,c2.fqn
C2Type
C1Type
Class
EXTENDS
Demo #1
MindTheGap!Architecturevs.Code
46
hHp://jqassistant.org/get-started/
Building The Bridge
MindTheGap!Architecturevs.Code
47
48
§ Analyze- ExecuBonofrules
§ DefinedinAsciiDocorXMLdocuments
- Concepts§ Enrichdatamodel
- Constraints§ DetectviolaBons
- Group§ AllowdifferentexecuBonprofiles
49
ConstraintGroup
Concept ConceptConcept
Includes
Requires Requires
Requires
50
§ Concept==JPAEntities[[jpa2:Entity]].Labelsalltypesannotatedwith@javax.persistence.EntitywithJpaandEntity.[source,cypher,role=concept]----MATCH(t:Type)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(a:Type)WHEREa.fqn="javax.persistence.Entity"SETt:Jpa:EntityRETURNtASEntity----
51
§ Concept
EnBty
JpaType
Class
fqn:org.springframework.samples.petclinic.model.Owner
name:Owner
AnnotaBon
ANNOTATED_BY
Type
OF_TYPEfqn:javax.persistence.EnBty
52
§ Constraint[[model:JpaEntityInModelPackage]].AllJPAentitiesmustbelocatedinpackagesnamed"model".[source,cypher,role=constraint,requiresConcepts="jpa2:Entity"]----MATCH(package:Package)-[:CONTAINS]->(entity:Jpa:Entity)WHEREpackage.name<>"model"RETURNentityASEntityInWrongPackage----
53
§ Group[[default]][role=group,includesConstraints="model:JpaEntityInModelPackage"]==NamingRulesThefollowingnamingrulesapply:-<<model:JpaEntityInModelPackage>>
54
§ AsciiDoc§ Wikisyntax
§ Renderingto- DocBook- HTML
§ ExecutablespecificaBon- Codingrules- Design&Architecture
Demo #2
MindTheGap!Architecturevs.Code
55
hHp://github.com/buschmais/spring-petclinic
56
- HolisBcviewoncodestructureandsystemarchitecture
- ExploraBonofexisBngstructures
- ValidaBonofrules- ExecutablearchitectureanddesignspecificaBon
- Rulesusingtermsfromarchitecture&designlanguage