software architecture anti-patterns by eduards sizovs

100
Software Architecture Anti-Patterns Eduards Sizovs hello (at) sizovs.net @eduardsi

Upload: javadayua

Post on 06-Jan-2017

161 views

Category:

Technology


2 download

TRANSCRIPT

Software ArchitectureAnti-Patterns

Eduards Sizovshello (at) sizovs.net

@eduardsi

YAGNI Architecture

YAGNI Architecture

Story time

Some software is never intended to stand out from the crowd.

YAGNI KIND ASS Architecture

KEEP IT NEED DRIVEN AND SIMPLE, SIR

NEED-DRIVEN ?

NEED-DRIVEN ?

REQUIREMENTS

NEED-DRIVEN ?

REQUIREMENTS • RISKS

NEED-DRIVEN ?

REQUIREMENTS • RISKS • CONSTRAINTS

Maslow's Hierarchy of Needs (of Software Development)

http://gojko.net/2012/05/08/redefining-software-quality/

SIMPLE ?

Tiny by Chad Fowler

http://www.infoq.com/presentations/small-iteration-method-team

Making Badass Developer by Kathy Sierra

https://www.youtube.com/watch?v=FKTxC9pl-WM

Pick the tool you know well and ship the simplest possiblesolution.

Optimize for CHANGE.

Nano-Service Architecture

When SOA goes wild.

You think that because you understand “one” that you must thereforeunderstand “two” because one and one make two. But you forget that you

must also understand “and.”

— Sufi teaching story

By blindly splitting a system into "micro" services, you get all negativeconsequences with questionable benefits.

Micro Service-Oriented Architecture

SIZE DOESN'T MATTER

Driving factors for decomposition

Driving factors for decomposition

- Team boundaries

Driving factors for decomposition

- Team boundaries

- Frequency of change

Driving factors for decomposition

- Team boundaries

- Frequency of change

- Different responsibilities

Driving factors for decomposition

- Team boundaries

- Frequency of change

- Different responsibilities

- Different (cross-functional) requirements

Driving factors for decomposition

- Team boundaries

- Frequency of change

- Different responsibilities

- Different (cross-functional) requirements

- Different technical stack

Driving factors for decomposition

- Team boundaries

- Frequency of change

- Different responsibilities

- Different (cross-functional) requirements

- Different technical stack

- Prototyping / Experiments

Staying BIG is OK.

Structureless Architecture

Looks familiar?

Looks familiar?✗ reveal high-level components

Looks familiar?✗ reveal high-level components

✗ reduce discovery cost

Looks familiar?✗ reveal high-level components

✗ reduce discovery cost

✗ improve comprehensibility

Looks familiar?✗ reveal high-level components

✗ reduce discovery cost

✗ improve comprehensibility

✗ enable poka-yoke

What about this?

What about this?✔ reveal high-level components

What about this?✔ reveal high-level components

✔ reduce discovery cost

What about this?✔ reveal high-level components

✔ reduce discovery cost

✔ improve comprehensibility

What about this?✔ reveal high-level components

✔ reduce discovery cost

✔ improve comprehensibility

✔ enable poka-yoke

Apply micro service-oriented mindset to software structure. Keep servicesdecoupled as if they were remote.

WHERE IS LAYERING?

Lasagna Architecture

Expected (doubtful) benefits from layering

Expected (doubtful) benefits from layering

- Ability to distribute your layers over multiple physical tiers (ha-ha)

Expected (doubtful) benefits from layering

- Ability to distribute your layers over multiple physical tiers (ha-ha)

- Decoupling / abstracting for exhangeability (ha-ha)

Expected (doubtful) benefits from layering

- Ability to distribute your layers over multiple physical tiers (ha-ha)

- Decoupling / abstracting for exhangeability (ha-ha)

- Decoupling / abstracting for independent evolution (ha-ha)

Expected (doubtful) benefits from layering

- Ability to distribute your layers over multiple physical tiers (ha-ha)

- Decoupling / abstracting for exhangeability (ha-ha)

- Decoupling / abstracting for independent evolution (ha-ha)

- Decoupling for reuse (ha-ha)

Expected (doubtful) benefits from layering

- Ability to distribute your layers over multiple physical tiers (ha-ha)

- Decoupling / abstracting for exhangeability (ha-ha)

- Decoupling / abstracting for independent evolution (ha-ha)

- Decoupling for reuse (ha-ha)

- Separation of concerns (is particular layer our concern?)

Expected (doubtful) benefits from layering

- Ability to distribute your layers over multiple physical tiers (ha-ha)

- Decoupling / abstracting for exhangeability (ha-ha)

- Decoupling / abstracting for independent evolution (ha-ha)

- Decoupling for reuse (ha-ha)

- Separation of concerns (is particular layer our concern?)

- Related stuff co-location (are DAOs really related?)

Expected (doubtful) benefits from layering

- Ability to distribute your layers over multiple physical tiers (ha-ha)

- Decoupling / abstracting for exhangeability (ha-ha)

- Decoupling / abstracting for independent evolution (ha-ha)

- Decoupling for reuse (ha-ha)

- Separation of concerns (is particular layer our concern?)

- Related stuff co-location (are DAOs really related?)

- Constraint enforcement (is there a better way?)

Layering is your service's detail and is internal to the service.

Keep services mind-sized so there is no need for internallayering. Break services into tiny modules.

(and consider keeping modules in separate VCS tree)

Undocumented Architecture

Working software over comprehensive documentation.

(c) Agile Manifesto

Architecture is code!

...but level of abstraction of code is negligible

I remember everything!

Code has hard time telling you about

Code has hard time telling you about

- Backups, Disaster Recovery, Redundancy, Failover, ETL, SLA, etc.

Code has hard time telling you about

- Backups, Disaster Recovery, Redundancy, Failover, ETL, SLA, etc.

- Significant Decisions and Agreements (e.g. rejected frameworks)

Code has hard time telling you about

- Backups, Disaster Recovery, Redundancy, Failover, ETL, SLA, etc.

- Significant Decisions and Agreements (e.g. rejected frameworks)

- Surroundings (Dependencies, Service Consumers)

Code has hard time telling you about

- Backups, Disaster Recovery, Redundancy, Failover, ETL, SLA, etc.

- Significant Decisions and Agreements (e.g. rejected frameworks)

- Surroundings (Dependencies, Service Consumers)

- Onboarding (Source Repository, Building, QC, Deployment)

Code has hard time telling you about

- Backups, Disaster Recovery, Redundancy, Failover, ETL, SLA, etc.

- Significant Decisions and Agreements (e.g. rejected frameworks)

- Surroundings (Dependencies, Service Consumers)

- Onboarding (Source Repository, Building, QC, Deployment)

- Birdseye Technical View

"That’s the page I read that made the difference"

is a great sanity check

UML vs C4

Context, Containers, Components, Classes

http://static.codingthearchitecture.com/c4.pdf

Optimistic Architecture

Fault tolerance is a lesson best learned offline.

Raise and keep your hand if you know ->

Raise and keep your hand if you know ->

What connection and thread pools does your application have

Raise and keep your hand if you know ->

What connection and thread pools does your application have

Approximate size

Raise and keep your hand if you know ->

What connection and thread pools does your application have

Approximate size

Utilization during peak load

Raise and keep your hand if you know ->

What connection and thread pools does your application have

Approximate size

Utilization during peak load

When pools will approach the size limit

Raise and keep your hand if you know ->

What connection and thread pools does your application have

Approximate size

Utilization during peak load

When pools will approach the size limit

How does your app behave when pools become full

Raise and keep your hand if you know ->

What connection and thread pools does your application have

Approximate size

Utilization during peak load

When pools will approach the size limit

How does your app behave when pools become full

How to timely react on it

What if an integration point will start to fail?

What if an integration point will start to fail?

What if it will send slow response for 5+ minutes without failing?

What if an integration point will start to fail?

What if it will send slow response for 5+ minutes without failing?

What if it will send back huge 1GB result set?

What if an integration point will start to fail?

What if it will send slow response for 5+ minutes without failing?

What if it will send back huge 1GB result set?

If your service fails, can others handle additional load they take?

What if an integration point will start to fail?

What if it will send slow response for 5+ minutes without failing?

What if it will send back huge 1GB result set?

If your service fails, can others handle additional load they take?

If your service fails, how far that failure reaches into app landscape?

What if an integration point will start to fail?

What if it will send slow response for 5+ minutes without failing?

What if it will send back huge 1GB result set?

If your service fails, can others handle additional load they take?

If your service fails, how far that failure reaches into app landscape?

Can you switch off functionality that produces unexpectedly high load?

Timeouts

Timeouts

Retries

Timeouts

Retries

Circuit Breakers

Timeouts

Retries

Circuit Breakers

Bulkheads

Timeouts

Retries

Circuit Breakers

Bulkheads

Handshaking

Timeouts

Retries

Circuit Breakers

Bulkheads

Handshaking

Leaky Bucket

...

Alchemy Architecture

Make sure architecture is VISIBLE for everyone.

Make sure everyone is involved in decision making andmaintain doc for those who were not.

Architectural pitch