l12 visualizing architecture

50
Lecture 12 Visualizing Architecture

Upload: olafur-andri-ragnarsson

Post on 06-Feb-2015

226 views

Category:

Technology


0 download

DESCRIPTION

Arkítektúr fjallar um "structure" og "vision" og ef við ætlum að lýsa kerfinu okkar fyrir öðrum verðum við að teikna það upp. Vandinn er þá hvað skal teikna, hvernig og af hverju. Flestir sem vinna í hugbúnaðargerð hafa alls ekki lært að teikna myndir af kerfinu sínu og búa yfirleitt til stórar, flóknar óskiljanlega myndir sem eru langt frá því vera eins og kerfið sjálft. Betra er að teikna margar hnitmiðarar myndir sem sýna kerfið með mismunandi flækjustigi, frá því að sýna notendur og niður í klasarit. Í þessu fyrirlestri skoðum við þrjár tegundir af myndum, context, container og component diagrams.

TRANSCRIPT

Page 1: L12 Visualizing Architecture

Lecture 12Visualizing Architecture

Page 2: L12 Visualizing Architecture

Agenda Why diagrams? Boxes and lines– What are you trying to say?

Diagrams– Context– Container– Components

Page 3: L12 Visualizing Architecture

Reading Simon Brown’s book– Part IV, Chapters 32-41

Page 4: L12 Visualizing Architecture

Why Diagrams?

Page 5: L12 Visualizing Architecture

Visualizing Software Development

Page 6: L12 Visualizing Architecture

Why Diagrams? Diagrams are communication tools Architecture is about Structure and Vision– How do you communicate this?

Visualization of architecture is very important– And easy to get wrong – a rare skill– Diagrams tend to be vague and easy to

misunderstand– Boxes 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 Modeling Language (UML)

In today’s agile world these formal process and strict languages are not favored

Still, there is need to communicated

Page 8: L12 Visualizing Architecture

Boxes and lines

Page 9: L12 Visualizing Architecture
Page 10: L12 Visualizing Architecture
Page 11: L12 Visualizing Architecture
Page 12: L12 Visualizing Architecture
Page 13: L12 Visualizing Architecture

Problems with Boxes and Lines Color coding is unexplained Purpose is not explained Key relationships are missing or

ambiguous Generic terms such as “business logic” Technology choices omitted Levels of abstractions mixed Diagrams often try to show too much

details Lack context or logical starting point

Page 14: L12 Visualizing Architecture

The Need for Sketches Some developers favor TDD over diagrams After all, UML “isn’t cool” But still, agile practices still need

communication and diagrams are very important tool for that

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 how Helps technical conversations about how

new features fit in Map that can be used to navigate the

source code Helps explain to others what the teams

are building Helps new employees get on track

Page 16: L12 Visualizing Architecture

Why Diagrams? Focus on high-level structure Create 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 favor of agile– They don’t like UML but favor creating their

own way (often ineffective)– Training is lacking

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

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 system– Java 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 Intent– Helps identify what the system is,

who is using it and how it fits into the existing IT environment

Page 27: L12 Visualizing Architecture

Context Diagram Structure– Your system is a block in the middle– Surrounded by users and other systems– Detail is not important– Focus on people and systems, not technology

and protocols

Page 28: L12 Visualizing Architecture

Context Diagram Users, actors, roles, personas etc– Normal user, customers– Admins– Back-office staff

IT systems– Active Directory– User database– Relocation servers– External vs. internal

Page 29: L12 Visualizing Architecture

Context Diagram Interactions– Annotate the interactions (the lines) with

useful information about the purpose– For example, list of most likely user stories

Page 30: L12 Visualizing Architecture

Context Diagram Motivation– Why this diagram?– It makes the context explicit so there are no

assumptions– It shows what is being added into the IT

environment– High-level for technical and non-technical

people– Good starting point for discussions

Audience– Technical and non-technical people

Page 31: L12 Visualizing Architecture
Page 32: L12 Visualizing Architecture

Container Diagram High-level technology choices Intent– Helps identify overall shape,

high-level technology decisions,responsibilities,container communications andfor developers, where the code is

Page 33: L12 Visualizing Architecture

Container Diagram Structure– Simple 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 34: 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 storage Files systems OS services

Page 35: L12 Visualizing Architecture

For each container Name– Logical name (“web server”, “database” etc)

Technology– Choice of technology (Apache, Tomcat, Oracle

11g etc) Responsibilities– High-level statement of the containers

responsibilites

Page 36: L12 Visualizing Architecture

Interactions and Boundaries The lines show interactions within the

system Useful information:– Purpose: “reads data from”, “sends reports to”

etc– Communication method: Web Service, REST,

RMI, JMS etc– Communication style: synchronous,

asynchronous etc– Protocols and port: HTTP, HTTPS, SOAP, SMTP

etc Boundaries– IT systems and users that are outside the

boundaries of the system

Page 37: L12 Visualizing Architecture

Container Diagram Motivation– Container diagram shows inside the box– Shows high-level technology choices– Relationships and methods for communications

Audience– Technical people

Page 38: L12 Visualizing Architecture
Page 39: L12 Visualizing Architecture

Component Diagram Looking into the container with logical

view of major components and their interactions

Intent– Helps identify what components/services that

makes up the system, how the system works at high-level, where components live

Page 40: L12 Visualizing Architecture

Component Diagram Structure– Draw the components/services that are in a

single container– If there are many services, it might be broken

into some logical sections

Page 41: L12 Visualizing Architecture

Component Diagram What is a component or service– Single responsibility– Examples: Trade data system importer, risk

calculator, authentication service, audit component etc

– Course grained building blocks For each component specify:– Name: “Risk Calculator”, “Audit Component”– Technology: Java, C#, Ruby, EJB, WCF– Responsibilities: statement of purpose

Page 42: L12 Visualizing Architecture

Component Diagram Interactions– Annotation of the lines between components– Purpose (“uses”, “persist data” etc)– Communication style (synchronous,

asynchronous, batched etc)

Page 43: L12 Visualizing Architecture

Component Diagram Motivation– Communicate logical structure within

container, higher-level than class diagram, finer than container diagram

– Good way to understand how the system works and what it does

– Shows dependencies and deployable units Audience– Devs

Page 44: L12 Visualizing Architecture
Page 45: L12 Visualizing Architecture

Technology Choices Should technology be included– Should diagram be conceptual?– Is it important not to include technology?

Rules to follow– If you know the technology, state it explicitly in

the diagram: servers, languages, protocols, message format, communication styles

– Then answer the “why” questions– Draw it like you code it

Page 46: L12 Visualizing Architecture

Draw it like you code it Shared components– If multiple services use the same component

(JAR) there should be box in each Layering– Draw the communication paths as they are

coded

Page 47: L12 Visualizing Architecture

Packaging Most architecture favor some level of

layering– Presentation Layer– Domain Layer– Data Source Layer

How do you package code?– Package by layer– Package by feature– Package by component

Page 48: L12 Visualizing Architecture

Package by layer All components in a

layer are packaged together– Simple to

understand– Similar components

are grouped together

Can impact the team structure– Are multiple teams

working on the same package?

– What about communication paths?

Page 49: L12 Visualizing Architecture

Package by feature/component By feature: All

components in that implement a feature are packaged together– Vertical slice– Can reflect team

organization better By component– Package each

component separately– Microservices model

Page 50: L12 Visualizing Architecture

Summary Diagrams are important– Often ignored

Usually some boxes and lines– Without technical details– What are you trying to say?

Diagrams levels– Context– Container– Components