• No results found

Seven Secrets Every Architect Should Know

N/A
N/A
Protected

Academic year: 2021

Share "Seven Secrets Every Architect Should Know"

Copied!
32
0
0

Loading.... (view fulltext now)

Full text

(1)

Seven Secrets

Every Architect Should Know

Frank Buschmann

(2)

Page 2 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

A challenging question!

What makes architects a

master of their craft?

Observation

ƒ

Many architects have a sound knowledge in software engineering methods

and concrete design and programming technologies, both broad and deep

ƒ

Yet time and again architectures and their realizations suffer from insufficient

quality, regarding modularization, interactions, or non-functional quality

… even if scope and requirements are sufficiently known!

(3)

The Seven Secrets

ƒ

Drive Design Through User Tasks

ƒ

Be Minimalist

ƒ

Ensure Visibility of Domain Concepts

ƒ

Use Uncertainty as a Driver

ƒ

Design Between Things

ƒ

Pay Attention To Implicit Assumptions

ƒ

Eat Your Own Dog Food

(4)

Page 4 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Secret One

(5)

Unusable architectures are useless

An architecture is more than a set of interacting parts,

technical infrastructure, and smart design concepts!

The two key questions are:

ƒ

How well does it support

operators

in their daily work?

ƒ

Those who live with the system?

ƒ

How well does it support

developers

in its use, realization,

test, maintenance and evolution?

ƒ

Those who live within the system?

Many projects fail due to missing or balancing the two aspects!

Plant UI Alarm Client Network View Diagnostic Client

Northbound Gateway (s) EAI (SAP ) OPC SNMP Common Services License Security Tracing Language Availability System Mgmt Color Time HLV- 060608 - UB. vsd: NM& CS Southbound Gateway (s) OPC BACnet Application Services Information Repository Configuration & Activation Managed Object Common Nam e Archiving Services Trend Logging Audit Trail Alarm Logging Operational and Maintenance Services Monitor & Control Alarm

Report Workflow Scripting Communication Framework Key Service Service Category Communication Framework Communication Application Clients Entities (Field Devices , Network Elements ) Miscellaneous Services SNMP

(6)

Page 6 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Task-oriented design

ƒ

Select essential user scenarios

ƒ

Operational scenarios

: user

tasks and workflows; including

their quality attributes

ƒ

Developmental scenarios

:

realization, adaptation, configuration, evolution, …

ƒ

Define the architecture along

the selected scenarios

ƒ

Components, workflows, interfaces, interactions,

infrastructure, guiding principles

ƒ

Focus is on the tasks, not on single functions

ƒ

Pay attention to sensitivity and trade-off points

ƒ

Address non-functional quality

Design software systems with explicit consideration of how they will be

used and how they can best support the work their users will be doing

(7)

Walking skeletons

ƒ

A set of end-to-end slices through the system that correspond to architecturally

significant user tasks – with users being end users and developers

ƒ

Implemented in product quality: functionality with associated quality

Goal of a task-driven architecture specification is to create a

walking skeleton …

Authorization Policy Engine

Prototype only

(based on portlet technology)

Domain

Service

OEM Comp. Container (Servlet, Portlet, EJB, OSGi)

Persistence

Framework

Presence

Service

Assistant

Application

Registr. Service / Discovery

SyMOM

Event Model Messaging

Logging

Application

User

interface

Business

logic

Common

service

Infrastructure

Runtime

environment

Contact List

Web UI

Find User

Web UI

Logon

Web UI

Buddy List

Management

Call Control and Media Service

Basic Comm.

Web UI

Symphonia

Runtime Env.

Authenticatio n and Privilege Service

Presence

Aggregator

Database Client Event Push Service

System

Management

Fault

Management

Sys Mgmt UI

Web Portal

Framework

Fault Mgmt UI

(8)

Page 8 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Secret Two

(9)

On minimalism

A designer knows he has achieved perfection not when there is

nothing left to add, but when there is nothing left to take away

(10)

Page 10 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Maximalism

interface Iterator

{

boolean set_to_first_element();

boolean set_to_next_element();

boolean set_to_next_nth_element(in unsigned long n) raises(…);

boolean retrieve_element(out any element) raises(…);

boolean retrieve_element_set_to_next(out any element, out boolean more) raises(…);

boolean retrieve_next_n_elements

(in unsigned long n, out AnySequence result, out boolean more) raises(…);

boolean not_equal_retrieve_element_set_to_next(in Iterator test, out any element) raises(…);

void remove_element() raises(…);

boolean remove_element_set_to_next() raises(…);

boolean remove_next_n_elements(in unsigned long n, out unsigned long actual_number) raises(…);

boolean not_equal_remove_element_set_to_next(in Iterator test) raises(…);

void replace_element(in any element) raises(…);

boolean replace_element_set_to_next(in any element) raises(…);

boolean replace_next_n_elements

(in AnySequence elements, out unsigned long actual_number) raises(…);

boolean not_equal_replace_element_set_to_next(in Iterator test, in any element) raises(…);

boolean add_element_set_iterator(in any element) raises(…);

boolean add_n_elements_set_iterator

(in AnySequence elements, out unsigned long actual_number) raises(…);

void invalidate();

boolean is_valid();

boolean is_in_between();

boolean is_for(in Collection collector);

boolean is_const();

boolean is_equal(in Iterator test) raises(…);

Iterator clone();

void assign(in Iterator from_where) raises(…);

void destroy();

(11)

Minimalism

interface BindingIterator

{

boolean next_one(out Binding result);

boolean next_n(in unsigned long how_many, out BindingList result);

void destroy();

};

ƒ

Clarity is often achieved by reducing clutter

ƒ

Simpler to understand, communicate, and

test

ƒ

But don't encode the design or code

ƒ

Compression can come from careful abstraction

ƒ

Compression relates to

directness

of expression

ƒ

Abstraction concerns the

removal

of specific detail

ƒ

Abstraction is a matter of choice: the quality of abstraction relates to

compression and clarity

ƒ

Encapsulation is a vehicle for abstraction

(12)

Page 12 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Secret Three

(13)

Information hiding

string

int

The two predominant concepts in our software

ƒ

What are the implied application concepts

behind

string

and

int

?

ƒ

What is their intended usage contract?

ƒ

How can we ensure intention and contract are

visible and enforced?

(14)

Page 14 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Why visibility matters – the Ariane V crash

ƒ

Velocity was

represented as a 64 bit

float

ƒ

A conversion into a 16

bit signed

integer

caused an overflow

ƒ

The current velocity of

Ariane 5 was too high

to be represented as a

16 bit

integer

ƒ

Error handling was

suppressed for

performance reasons

ƒ

Damage 370 Mio. USD

-- Vertical velocity bias as measured by sensor

L_M_BV_32 :=

TBD.T_ENTIER_32S ((1.0/C_M_LSB_BV) *

G_M_INFO_DERIVE(T_ALG.E_BV));

-- Check, if measured vertical velocity bias can be

-- converted to a 16 bit int. If so, then convert

if L_M_BV_32 > 32767 then

P_M_DERIVE(T_ALG.E_BV) := 16#7FFF#;

elsif L_M_BV_32 < -32768 then

P_M_DERIVE(T_ALG.E_BV) := 16#8000#;

else

P_M_DERIVE(T_ALG.E_BV) :=

UC_16S_EN_16NS(TDB.T_ENTIER_16S(L_M_BV_32));

end if;

-- Horizontal velocity bias as measured by sensor

-- is converted to a 16 bit int without checking

P_M_DERIVE(T_ALG.E_BH) :=

UC_16S_EN_16NS (TDB.T_ENTIER_16S ((1.0/C_M_LSB_BH) *

G_M_INFO_DERIVE(T_ALG.E_BH)));

Original code fragment*

(commented and reformatted)

(15)

Concretion of implied concepts

ƒ

Discovery of types for values, management and control, collectives,

domains, and so on

ƒ

Implied concepts or collocated capabilities can be made more visible by

recognizing these as distinct and explicit types – usage becomes type

ƒ

Explicit types support

testability

and

design by contract

ƒ

For example …

ƒ

Strings for keys and codes become types in their own right, for example

ISBNs, SQL statements, URLs

ƒ

Recurring value groupings become whole objects, for example date,

address, access rights

Date

String getDate()

Integer getDayInMonth()

Integer getMonth()

Integer day, month, year

ISBN

String asString()

String isbn

(16)

Page 16 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Page 16

Expressive architecture

Visibility in a software architecture amounts to expressiveness

ƒ

Components and their relationships

should be related by names that

reflect their nature

ƒ

Components should have cohesive

responsibilities, contractual

interfaces and explicit relationships

ƒ

By looking through the artifacts,

both the essence and detail

should be apparent

Expressive designs are easier to

understand, communicate, realize,

test, and review

A (simplified) design for a telegram handler

in a factory automation system

Pick

Workpiece

Log

Alarms

Telegram

Forwarder

Telegram

Receiver

Telegram

Converter

SetPoint

Calculation

Command

Logging

Strategy

Command

Processor

Logger

The network

creates;

retrieves

results

executes

applies

passes

commands to

passes telegrams to

passes

telegrams to

(17)

Secret Four

(18)

Page 18 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

The indecisive architect

Abstract

X Strategy

Concrete

X Strategy

Abstract

Y Strategy

Concrete

Y Strategy

Abstract

Z Visitor

Concrete

Z Visitor

Property

Class A

Network

Element

Property

Class B

Property

Class C

Uncertainty is no excuse for indecisiveness and escape!

When architects cannot agree on an

explicit domain model …

… and escape in genericity

Mix-ins for property

definition and acquisition

Strategy to allow

instance-specific

overriding of all

inherited behavior

Strategy for

algorithmic variation

Visitor for generic

data handling

// Hard-coded enumeration of domain types

enum Node_Type {A, B, C, D, E}; // Anonymized

...

// Hard-coded instance configuration

switch (node->type()) {

case A:

node->add_property

(new Persistance(new Data_Visitor_A));

node->add_property

(new Network_Connectivity());

...

Someone else will decide

and make it concrete!!

(19)

Use uncertainty as a driver

Localize, isolate, and encapsulate

the fact there is a choice

ƒ

To avoid rippling effects on other system parts

ƒ

Works well for structural, algorithmic, implementation,

and many technology choices; difficult for cross-cutting concerns

Decide explicitly (!) to not decide now (!!)

Take concrete action to (iteratively) drive decision

ƒ

Spikes

to sharpen requirements and technology understanding

ƒ

Spikes

to get feedback on each option’s sustainability

ƒ

Scenarios in a

walking skeleton

to stress operational

consequences of the most promising option

ƒ

Active Design Reviews

to explore the developmental

consequences of the most promising option

The most interesting thing is not actually the choice between A and B, but

the fact that there is a choice between A and B

[Kevlin Henney]

Limit

uncertainty

scope

Make

uncertainty

explicit

Drive

uncertainty

resolution

Decide

(20)

Page 20 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Secret Five

(21)

An all to common interface tale

The interface signature when released

/// Manage business object metadata (tags) in a key value map

class TagManager {

...

/// Assign a string "value" to the identifier "tagName"

public void set(string tagName, string value);

...

}

Tag management

did not include tag

removal

Developers discovered need for tag removal …

… but changing a released interface is difficult

1

Change

set()

implementation to

handle both

set()

and

remove()

2

Convention to use a prefix

"r:"

in

tagName

to indicate removal

/// Call to set a tag

tag.set(tagName, value);

/// Call to remove a tag

tag.set("r:" + tagName, new string());

Tag removal

added without

interface

modification …

The solution

(22)

Page 22 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Be where things meet

ƒ

Complete, meaningful

ƒ

Role-specific, expressive, usable

ƒ

Defined contract, stability

The architect’s main territory is between things, where they meet and

hurt: Interfaces, Interactions, Integration.

Interfaces

ƒ

Simple, meaningful, direct, efficient

ƒ

Quality of Service (reliable, fast, scalable, secure, configurable, …)

ƒ

Task-oriented, end-to-end quality

ƒ

Systems integration, plant integration, HW / SW integration

ƒ

Application integration, service integration, process-level integration, data

integration, UI integration, device integration

Deficiencies in interfaces, interactions, and integration tend to show up later in

the SW lifecycle than modularization and implementation issues: during system

integration, system test, roll out, operation – thus their resolution is costly!

Interaction

(23)

Secret Six

(24)

Page 24 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

The cost of the unspecified (1)

Imagine you are asked to maintain this code …

ƒ

Where do you likely feel comfortable?

ƒ

Where is the code smelling badly?

(25)

The cost of the unspecified (2)

The business success or acceptance of software often

depends on qualities that are rarely explicitly stated

85% of SW Lifecycle

costs

are devoted to

maintenance

and evolution

Koskinen,

University of Jyväskylä, Finland

Developers spend

50% of their time

in the process of

understanding code

(26)

Page 26 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Watch out for dissatisfiers

Pay attention to implicit assumptions: features or qualities that are

expected and create trouble if not present, but rarely expressed explicitly!

ƒ

Functionality of competitor or previous generation systems

ƒ

Performance

ƒ

Robustness

ƒ

Maintainability

ƒ

… [check your spec]

Address expected features prominently,

constantly, and from the very beginning

ƒ

To make them visible and explicit in your

architecture

ƒ

To avoid costly late changes and

non-conformance costs

ƒ

To avoid customer dissatisfaction

A KANO helps identifying expected

requirements – which tend to

(27)

Secret Seven

(28)

Page 28 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Theory and practice can differ!

Even the smartest design concepts can create trouble!

ƒ

Introduced with care and intention; well understood by architect

ƒ

Misunderstood by all others; or hard to implement

Business Logic

Data Logic

Problem

General data handling

logic, e.g., copy, move,

needs

application-specific extensions

Solution

ƒ

Interceptor framework in

data handling logic;

ƒ

Self-contained

interceptors provide local

extension logic

Architect intention

Actual use

Interceptors

ƒ

Were not closed but

called back “normal”

application logic

ƒ

Application logic issued

nested calls to data logic

Effect

ƒ

Oscillating control flow

between business logic

and data logic

ƒ

Circular, uncontrollable,

unstable call chains

(29)

Architect also implements!

ƒ

To experience the consequences of your own designs!

ƒ

To communicate your intention, and minimize misunderstanding

ƒ

To discover the devil in the detail

Eat your own dog food! Actively participate in implementation!

But, don’t loose yourself in code!

ƒ

Prefer pair programming over lone coding

ƒ

To cover all system parts

ƒ

To reach all developers

ƒ

To avoid being overloaded or on a critical path

ƒ

Focus on essential aspects or scenarios

ƒ

To ensure developer habitability

ƒ

To ensure concept sustainability

ƒ

Write tests and conduct active design reviews

(30)

Page 30 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Seven Secrets Every Architect Should Know

(31)

In retrospect

The seven practices complement an architect’s knowledge,

technical experience, and design skills regarding

ƒ

Communication to stakeholders

ƒ

Key measures: explicit attention to their interests, making interests visible

and tangible, e.g., through walking skeletons or attention to uncertainty

ƒ

Economic architecture

ƒ

Key measure: strict adherence to KISS principle

ƒ

Understanding that code matters

ƒ

Key measure: explicit consideration of developer needs, early coding,

presence and participation in coding

ƒ

Seek for feedback

ƒ

Key measure: visibility and explicit attention to challenges, both known

(32)

Page 32 The Craft of Software Architecture – Seven Secrets Every Architect Should Know © Frank Buschmann, all rights reserved

Page 32

A departing thought

Structural engineering is the science and

art of designing and making,

with economy

and elegance

, buildings, bridges,

frameworks, and other similar structures so

that they can safely resist the forces to

which they may be subjected.

References

Related documents

This paper applies a method of drawing samples from the posterior distribution of land cover proportions implied by the GlobCover 2009 global land cover data set and an

A comparative study between trajectory data warehouse conceptual models TrDW Conceptual Model Graphical Representation Trajectory’ Geometric Modeling Trajectory’ Semantic

Keywords: indoor, room layout, floor plan, 3D reconstruction, mobile, smartphone, tablet, depth sensor, vanishing point, point cloud, user interaction.. Room layout generation is

RESOLVED, That the Chair of the Genesee County Legislature is hereby authorized and directed to execute an agreement between the Genesee Veterans Support Network and the County

d.) All proposals shall provide stormwater detention storage, channel improvement or other mitigating measures. If stormwater detention storage is included, owner must provide

Source: Ministry of Labour and Social Security, China; State Council, China; National Bureau of Statistics, China; Oanda; Press Release; Grail Analysis. Shanghai and Beijing are

Review sensory and mental status completed in health perception-health management pattern 2.. Decision making is: Easy__ Moderately easy__ Moderately