visualize your architecture and information
DESCRIPTION
Visualization is an effective method of communication and there is more than UML. Peter will in this presentation show a few of the most common methods and tools to visualize your system's design (or lack of it) and the theories used. You will also be able to visualize how the information in the system looks like from different perspectives in order to detect any "information dept" or how the system behaves in operation. The purpose of the presentation is to inspire you to use visualization as a technique to improve the quality of your software.TRANSCRIPT
Visualize your architecturePeter Norrhall, Chief Architect
Visualize your architecture© Extenda
Why Images?• ”A picture says more than 1000 words”
2
Visualize your architecture© Extenda
Thermometer
3
Microstates
Macrostate (Abstraction)
Visualize your architecture© Extenda
The holy number 7
4
7
1
13
2
21
95
Peter
Maria
Phrida
Linnea
Jakob
Moa
Alfons
1956 George Miller
Visualize your architecture© Extenda
Conscious Communication
5
7 = 2-3 bit / s
Visualize your architecture© Extenda
Unconscious Communication
6
Eyesight 10.000.000 bit/s
Touch 1.000.000 bit/s
Hearing 100.000 bit/s
Smell 100.000 bit/s
Taste 1.000 bit/s
M Zimmerman, Physiologie des Menchen
Visualize your architecture© Extenda
Les Misérables – Communication tree
7
Exformation -removed important information Association
Victor Hugo Publisher
?
!Tor Nörretranders, ”Märk Världen”
Visualize your architecture© Extenda
Pictures vs Text
8
Bla, bla, bla L-Mode
R-Mode + L-Mode
Visualize your architecture© Extenda
Why do we need Architect Documents?
9
Code
Xunit/BDD
Architect/Design Document
Visualize your architecture© Extenda
ISO 42010• Recommended practice for architectural description of software-
intensive systems
10
Visualize your architecture© Extenda
Architectural Views
11
Deployment
Functional
Process Non-Functional
Logical
Interface
Design
Intrastructure
Operational
Security
Data
http://www.codingthearchitecture.com/
Visualize your architecture© Extenda
Agile Development Documentation
12
Stakeholders
Developers
Architect/Developer
Code & Refactor
Refactor
Visualize your architecture© Extenda
Methods & Tools
13
Meta-model – UML/DDD/… – Association
Design Tools – White Board/Enterprise Architect/Visio/PPT/…
Exformation
Visualize your architecture© Extenda
The problem• Systems and software are evolving –> ”Document Dept” using
notioned based architecture or design• What is important and to whom? The sender or the receiver?
• http://martinfowler.com/ieeeSoftware/whoNeedsArchitect.pdf
• Perhaps the most important is to write/visualize• Andy Hunt, Pragmatic Thinking
14
Visualize your architecture© Extenda
Software Visualization• Generating images instead of doing it by hand when we want to
explore the information (microstates).
• Information visualization is essential in making sense out of large
data sets (microstates) by finding patterns.
• Generate and Display for a specific purpose
• Relationships between modules/components/classes/entities/…
• Code or Information dept
15
Visualize your architecture© Extenda
Visualize Software
16
Scanner/Parser
Data Source Code
Instrumentation
Running Systems
Mapper
Nodes: A, BEdges: A->B RendererModel
Diagram
Visualize your architecture© Extenda
Code Quality• The Code (source and test) is the actual system• Find Relations and dependencies
• Beneficial Relationships
• Finding unwanted relationships
• Code metrics
• Average Number of Methods (NOM) per Class
• Average Lines of Code (LOC) per method
• Average Cyclomatic Number (CYCLO) per line of code
• …
17
Visualize your architecture© Extenda
Code Metrics• Lines of Code• Average Number of Methods (NOM) per Class• Average Lines of Code (LOC) per method• Average Cyclomatic Number (CYCLO) per line of code • Duplication• Check-in counts / churn• Test Coverage• Coupling • …
18
Visualize your architecture© Extenda
Cyclomatic Complexity
19
if( c1() ) f1();else f2(); if( c2() ) f3();else f4();
http://en.wikipedia.org/wiki/Cyclomatic_complexity
Visualize your architecture© Extenda
Code Metrics• SonarSource
20
Visualize your architecture© Extenda
Code Metrics
21
Visualize your architecture© Extenda
Code Metrics – Industry Standard
22
Visualize your architecture© Extenda
Rules Compliance
23
Visualize your architecture© Extenda
Code Violations
24
Visualize your architecture© Extenda
Measure over time
25
Visualize your architecture© Extenda
Complexity Distribution
26
Visualize your architecture© Extenda 27
Visualize your architecture© Extenda
Find the truth
28
Visualize your architecture© Extenda
CodeCity
29
Visualize your architecture© Extenda
Dependencies
30
Visualize your architecture© Extenda
Dependencies• ”Design is beneficially related elements”, K Beck
• http://www.threeriversinstitute.org/blog/?p=111
• Predicting Subsystem Failures using Dependency Graph
Complexities
• http://research.microsoft.com/pubs/70340/tr-2006-126.pdf
31
Visualize your architecture© Extenda
Structure 101• Code Parser and Analyzer for Java, .Net and C/C++• Interactive explorer of relationships and quality of code finding and
displaying technical dept• CI ”integration”
32
Visualize your architecture© Extenda
Demo : Spring
33
Visualize your architecture© Extenda
Commercial Alternatives• Sotoarc/Sonargraph - http://www.hello2morrow.com/
34
Visualize your architecture© Extenda
Drawbacks• Package Dependencies• CC metrics = # faults?
35
Visualize your architecture© Extenda
Graphviz• You are in charge• Simple textual input -> different graphical output• Automated graph layout tool based on graph theory
• Developed by A&T, Common Public Licence
36
Visualize your architecture© Extenda
Model & Diagram
digraph G {
a->b;
}
37
$ dot -Tpng simple.dot –o simple.png
Visualize your architecture© Extenda
Graphs• Directed Graph
digraph G {
a -> b;
b -> c;
a -> c;
}
• Undirected Graph
graph G {
a -- b;
b -- c;
a -- c;
}
38
Visualize your architecture© Extenda
Layout• Dot – Hierarchy graph• Neato – Undirected graph using spring model• Twopi – Radial Layout• Circo – Circular Layout• Fdp – Undirected graphs using force-directed spring model• Sfdp – Similar to Fdp
39
Visualize your architecture© Extenda
Output Formats• PostScript (ps)• Structured Vector Graphics (svg)• Images (png, gif)• Imagemap (imap)• …
40
Visualize your architecture© Extenda
Graph Attributes• Size = ”x, y”• Rankdir = LR | RL | BT• Rotate=90• Stylesheet=”.css”• …
41
Visualize your architecture© Extenda
Information Dept : E-Commerce Catalog
42
Books
Software Engineering
Agile
Agile Development
Management 3.0
Programming
Novels
18th Century
Visualize your architecture© Extenda
Country #1 – Dot layout
43
Visualize your architecture© Extenda
Graph Attribute• Rotate=90
44
Visualize your architecture© Extenda
neato
45
Category
Product
$ neato -Tpng catalog.dot –o catalog.png
Visualize your architecture© Extenda
Node Attributes• Blue Box• node [shape=box,height=0.1,width=0.1,color=blue,style=filled]• product56001;• product57001;
• …
• Red Circle• node [shape=circle,style=filled,color=red,height=0.1,label="”]• category10002;• category10003;
46
Visualize your architecture© Extenda
Node Attribute• node [shape=circle,style=filled,color=red,height=0.3,label=""];• category10002;
• node [shape=circle,style=filled,color=red,height=0.1,label=""];• category10003;• category10004;• …
47
Visualize your architecture© Extenda
Highlight root category
48
Visualize your architecture© Extenda
Twopi – Radial Layout
49
Visualize your architecture© Extenda
Country #2
50
Visualize your architecture© Extenda
Country #3
51
Visualize your architecture© Extenda
Other• Component Dependencies (Spring XML Bean Config)• Ant Target Dependencies• Maven Jar Dependencies• …
52
Visualize your architecture© Extenda
Other tools• Enterprise Architect – Code (better suited for user generated)• Erwin – Database ER-model
53
Visualize your architecture© Extenda
Summary
54
Practice Exformation
Use Visualization
Question Metrics
Visualize your architecture© Extenda
Questions?
55
Visualize your architecture© Extenda
Referenser• ”Märk Världen”, Tor Nörretranders, ISBN 9100570702• http://martinfowler.com/ieeeSoftware/whoNeedsArchitect.pdf• http://en.wikipedia.org/wiki/Cyclomatic_complexity• http://www.enerjy.com/blog/?p=198 - CC > 74 not good• http://www.leshatton.org/Documents/TAIC2008-29-08-2008.pdf -
Tools• http://www.headwaysoftware.com/ - Structure 101• http://www.hello2morrow.com/ - Sonargraph• http://www.sonarsource.org/ - SonarSource• http://www.graphviz.org/ - Graphviz• Similar presentations• http://www.jfokus.se/jfokus11/preso/jf11_VizualizationsForCodeMetrics.pdf• http://erik.doernenburg.com/wp-content/archive/Doernenburg_SoftwareQuality_ver2a.pdf• http://www.slideshare.net/girba/pragmatic-quality-assessment-tutorial-icse-2008• http://www.infoq.com/presentations/Where-Did-My-Architecture-Go
[email protected]@peternorrhallLinkedIn
57