l12 visualizing architecture

53
HÖNNUN OG SMÍÐI HUGBÚNAÐAR 2015 L12 VISUALIZING ARCHITECTURE

Upload: olafur-andri-ragnarsson

Post on 15-Apr-2017

604 views

Category:

Software


0 download

TRANSCRIPT

Page 1: L12 Visualizing Architecture

HÖNNUN OG SMÍÐI HUGBÚNAÐAR 2015L12 VISUALIZING ARCHITECTURE

Page 2: L12 Visualizing Architecture

Agenda

Why diagrams?Boxes and linesWhat are you trying to say?DiagramsContextContainerComponents

Page 3: L12 Visualizing Architecture

Reading

Simon Brown’s bookPart IV, Chapters 31-41

Page 4: L12 Visualizing Architecture

Why Diagrams?

Page 5: L12 Visualizing Architecture

Visualising Software Development

Page 6: L12 Visualizing Architecture

Why Diagrams?

Diagrams are communication toolsArchitecture is about Structure and VisionHow do you communicate this?

Visualisation of architecture is very importantAnd easy to get wrong – a rare skillDiagrams tend to be vague and easy to misunderstandMixing of many concepts into single diagram is confusingBoxes with lines

Page 7: L12 Visualizing Architecture

Traditional Approaches

Formal Rational Unified Process (RUP) and Structured System Analysis and Design (SSADM)Modeling languages such as Unified Modelling Language (UML)

In today’s agile world these formal process and strict languages are not favouredStill, there is need to communicated

Page 8: L12 Visualizing Architecture

Boxes and lines

Page 9: L12 Visualizing Architecture

Boxes and lines

Page 10: L12 Visualizing Architecture

Boxes and lines

Page 11: L12 Visualizing Architecture

Boxes and lines

Page 12: L12 Visualizing Architecture

Boxes and lines

Page 13: L12 Visualizing Architecture

Problems with Boxes and Lines

Colour coding is unexplainedPurpose is not explainedKey relationships are missing or ambiguousGeneric terms such as “business logic”Technology choices omittedLevels of abstractions mixedDiagrams often try to show too much detailsLack context or logical starting point

Page 14: L12 Visualizing Architecture

The Need for Sketches

Some developers favour TDD over diagramsAfter all, UML “isn’t cool”For some Agile means “No documentation”

But still, agile practices still need communication and diagrams are very important tool for that

No documentation mentality is dangerous and usually very expensive in the long run

Page 15: L12 Visualizing Architecture

Why Diagrams?

Helps everybody in the team get the “big picture”Shared vision

Focal point: what is being build, and howHelps technical conversations about how new features fit inMap that can be used to navigate the source codeHelps explain to others what the teams are buildingHelps new employees get on track

Page 16: L12 Visualizing Architecture

Why Diagrams?

Focus on high-level structureCreate a vision that everybody in the team can understand and commit to

Class diagrams are too details and should be considered temporary designs replaced by code

Context, Containers and Component diagrams are usually sufficient

Page 17: L12 Visualizing Architecture

Ineffective Sketches

Many teams struggle with diagrams

They mistakenly abandon documentation and diagrams in favour of agile

They don’t like UML but favour creating their own way (often ineffective)

Usually, it’s just lack of training

Page 18: L12 Visualizing Architecture

The C4Context, Container, Component, Classes

Page 19: L12 Visualizing Architecture

Goals with Diagrams

Create number of diagram with different levels of abstractions

Number of simpler diagrams can be more effective than one complex one - There is no one “Big Picture”

Page 20: L12 Visualizing Architecture

Abstractions

Page 21: L12 Visualizing Architecture

Abstractions

Classes: Smallest building blocks

Page 22: L12 Visualizing Architecture

Abstractions

Components: logical grouping of classes

Services are components

Example: Authentication Service

Services are a set of collaborating classes, sitting behind an API

Page 23: L12 Visualizing Architecture

Abstractions

Containers: what the component runs in

Web server, application server

Typically executable that are started as part of the systemJava EJB, .NET

Page 24: L12 Visualizing Architecture

Abstractions

System: highest level of abstraction

Made up of multiple containers and defines the links between them

Page 25: L12 Visualizing Architecture

Diagrams

Context: A high-level diagram that shows actors and system dependencies

Container: high-level technology choices and responsibilities

Component: for each container, what ware the key logical components and their relationships

Classes: showing classes and their relationships, useful to explain design patterns

Page 26: L12 Visualizing Architecture

Context Diagram

Useful starting point

IntentHelps identify what the system is, who is using it and how it fits into the existing IT environment

Page 27: L12 Visualizing Architecture
Page 28: L12 Visualizing Architecture

Context Diagram

StructureYour system is a block in the middleSurrounded by users and other systemsDetail is not importantFocus on people and systems, not technology and protocols

Page 29: L12 Visualizing Architecture

Context Diagram

Users, actors, roles, personas etcNormal user, customersAdminsBack-office staff

IT systemsActive DirectoryUser databaseRelocation serversExternal vs. internal

Page 30: L12 Visualizing Architecture

Context Diagram

InteractionsAnnotate the interactions (the lines) with useful information about the purposeFor example, list of most likely user stories

Page 31: L12 Visualizing Architecture

Context Diagram

MotivationWhy this diagram?It makes the context explicit so there are no assumptionsIt shows what is being added into the IT environmentHigh-level for technical and non-technical peopleGood starting point for discussions

AudienceTechnical and non-technical people

Page 32: L12 Visualizing Architecture
Page 33: L12 Visualizing Architecture

Container Diagram

High-level technology choices

IntentHelps identify overall shape,high-level technology decisions,responsibilities,container communications andfor developers, where the code is

Page 34: L12 Visualizing Architecture
Page 35: L12 Visualizing Architecture

Container Diagram

StructureSimple block diagram showing key technology choices

Container is any logical executable or processes that manage life-cycle of components

Container is usually a middleware that requires some commitment on operating

Page 36: L12 Visualizing Architecture

Example Containers

Web server (Apache, Tomcat, IIS, Jetty etc)Application servers (Jboss, WebSphere etc)Enterprise servers (Oracle Fusion etc)SQL databases (Oracle, MSSQL, MySQL etc)NoSQL databases (MongoDB, CouchDB, Redis etc)External storageFiles systemsOS services

Page 37: L12 Visualizing Architecture

For each container

NameLogical name (“web server”, “database” etc)

TechnologyChoice of technology (Apache, Tomcat, Oracle 11g etc)

ResponsibilitiesHigh-level statement of the containers responsibilites

Page 38: L12 Visualizing Architecture

Interactions and Boundaries

The lines show interactions within the system

Useful information:Purpose: “reads data from”, “sends reports to” etcCommunication method: Web Service, REST, RMI, JMS etcCommunication style: synchronous, asynchronous etcProtocols and port: HTTP, HTTPS, SOAP, SMTP etc

BoundariesIT systems and users that are outside the boundaries of the system

Page 39: L12 Visualizing Architecture

Example Containers

MotivationContainer diagram shows inside the boxShows high-level technology choicesRelationships and methods for communications

AudienceTechnical people

Page 40: L12 Visualizing Architecture
Page 41: L12 Visualizing Architecture

Component Diagram

Looking into the container with logical view of major components and their interactions

IntentHelps identify what components/services that makes up the system, how the system works at high-level, where components live

Page 42: L12 Visualizing Architecture
Page 43: L12 Visualizing Architecture

Component Diagram

StructureDraw the components/services that are in a single containerIf there are many services, it might be broken into some logical sections

Page 44: L12 Visualizing Architecture

Component Diagram

What is a component or serviceSingle responsibilityExamples: Trade data system importer, risk calculator, authentication service, audit component etcCourse grained building blocks

For each component specify:Name: “Risk Calculator”, “Audit Component”Technology: Java, C#, Ruby, EJB, WFCResponsibilities: statement of purpose

Page 45: L12 Visualizing Architecture

Component Diagram

InteractionsAnnotation of the lines between componentsPurpose (“uses”, “persist data” etc)Communication style (synchronous, asynchronous, batched etc)

Page 46: L12 Visualizing Architecture

Component Diagram

MotivationCommunicate logical structure within container, higher-level than class diagram, finer than container diagramGood way to understand how the system works and what it doesShows dependencies and deployable units

AudienceDevs

Page 47: L12 Visualizing Architecture
Page 48: L12 Visualizing Architecture

Technology Choices

Should technology be includedShould diagram be conceptual?Is it important not to include technology?

Rules to followIf you know the technology, state it explicitly in the diagram: servers, languages, protocols, message format, communication stylesThen answer the “why” questionsDraw it like you code it

Page 49: L12 Visualizing Architecture

Draw it like you code itShared components

If multiple services use the same component (JAR) there should be box in each

LayeringDraw the communication paths as they are coded

Page 50: L12 Visualizing Architecture

Packaging

Most architecture favour some level of layeringPresentation LayerDomain LayerData Source Layer

How do you package code?Package by layerPackage by featurePackage by component

Page 51: L12 Visualizing Architecture

Package by layer

All components in a layer are packaged together

Simple to understandSimilar components are grouped together

Can impact the team structureAre multiple teams working on the same package?What about communication paths?

Page 52: L12 Visualizing Architecture

Package by feature/component

By featureAll components in that implement a feature are packaged togetherVertical sliceCan reflect team organization better

By componentPackage each component separatelyMicroservices model

Page 53: L12 Visualizing Architecture

Summary

Diagrams are importantOften ignored

Usually some boxes and linesWithout technical detailsWhat are you trying to say?

Diagrams levelsContextContainerComponents