patterns for organic architecture codedive

91
Patterns of Organic Architecture Madman's diary By Jarosław Pałka

Upload: magda3695

Post on 01-Jul-2015

142 views

Category:

Technology


1 download

DESCRIPTION

.

TRANSCRIPT

Page 1: Patterns for organic architecture codedive

Patterns of Organic Architecture

Madman's diary

By

Jarosław Pałka

Page 2: Patterns for organic architecture codedive

… A word of warning …

It is not may intention to make you feel offended,

this talk is

my view of the world,my experience,

my life,my twisted sens of humor

Respect it!!!

Page 3: Patterns for organic architecture codedive

and remember

you can always leave the room

you can always talk to me

and whatever people say

I am just a human being

Page 4: Patterns for organic architecture codedive

About me

work://chief_architect@lumesse

owner://symentis.pl

twitter://j_palka

blog://geekyprimitives.wordpress.com

scm:bitbucket://kcrimson

scm:github://kcrimson

Page 5: Patterns for organic architecture codedive

What does society think I do?

Page 6: Patterns for organic architecture codedive
Page 7: Patterns for organic architecture codedive

What does my wife think I do?

Page 8: Patterns for organic architecture codedive
Page 9: Patterns for organic architecture codedive

What do I really do?

Page 10: Patterns for organic architecture codedive
Page 11: Patterns for organic architecture codedive

~ 8 companies in 16 years~ 26 projects

Page 12: Patterns for organic architecture codedive

and just ...ONE...

project built from ...scratch...

Page 13: Patterns for organic architecture codedive

How do I feel about it?

Page 14: Patterns for organic architecture codedive

I am feeling lucky!

Page 15: Patterns for organic architecture codedive

What I will not learn today from this talk?

Which mixture of patterns, xDD,

languages, frameworks And paradigms

will lead me to success

Page 16: Patterns for organic architecture codedive

But you will learn how to live with...

Monolithic, legacy code base, which gets closer and closer with

each line to borders of human capabilities,

and is about to colapse into a black hole,

which is going to suck all living developers within its reach

Page 17: Patterns for organic architecture codedive
Page 18: Patterns for organic architecture codedive

We are living in a

...Big Ball of Mud...

Page 19: Patterns for organic architecture codedive

Autogenerated StovepipeStovepipe Enterprise

JumbleStovepipe System

Cover Your AssetsVendor Lock-In

Wolf TicketArchitecture by Implication

Warm BodiesDesign by Committee

Swiss Army KnifeReinvent the Wheel

The Grand Old Duke of York

Page 20: Patterns for organic architecture codedive

What is common to all these cases?

Page 21: Patterns for organic architecture codedive

Complexity

Page 22: Patterns for organic architecture codedive

Do you need proof?

Page 23: Patterns for organic architecture codedive

Let me give you the proof!!!

Page 24: Patterns for organic architecture codedive

„I fucking love science”

Page 25: Patterns for organic architecture codedive

System's thinking

System dynamics

Complexity theory

Strange Attractor

Page 26: Patterns for organic architecture codedive
Page 27: Patterns for organic architecture codedive
Page 28: Patterns for organic architecture codedive
Page 29: Patterns for organic architecture codedive

The Gap

Page 30: Patterns for organic architecture codedive

How do organizations work around it?

Page 31: Patterns for organic architecture codedive

Let's hire more students!!!

Page 32: Patterns for organic architecture codedive

Let rewrite it from ...scratch...

(of course in newest, coolest technology we know shit about)

Page 33: Patterns for organic architecture codedive
Page 34: Patterns for organic architecture codedive

You may ask, why?

Page 35: Patterns for organic architecture codedive

Time is not on our side

Few „extra features” everybody is waiting for?

Too much faith in technology?

Too often these projects are seen as purely technical?

Ignorance?

Arogance?

Page 36: Patterns for organic architecture codedive

If it all doesn't work, why not to try something

different?

Page 37: Patterns for organic architecture codedive

The Gap

Page 38: Patterns for organic architecture codedive

Patterns of organic architecture

Page 39: Patterns for organic architecture codedive
Page 40: Patterns for organic architecture codedive

Architecture is a process which goal is to

transform your system from one design to

another design

Page 41: Patterns for organic architecture codedive

Architecture is a process which goal is to

transform your system from one design to

another design

Page 42: Patterns for organic architecture codedive

Architecture is a process which goal is to

transform your system from one design to

another design

Page 43: Patterns for organic architecture codedive

Understand the Gap

Understand Context

Identify Constraints

Page 44: Patterns for organic architecture codedive

You can't control what you can't measure

Tom DeMarco,Controlling Software Projects,

Page 45: Patterns for organic architecture codedive

You can't reason about what you can't measure

@j_palkafrom a book which will never be written

Page 46: Patterns for organic architecture codedive

You can't reason about what you can't measure

@j_palkafrom a book which will never be written

Page 47: Patterns for organic architecture codedive

So, how to measure your architecture?

Page 48: Patterns for organic architecture codedive

Complexity Resilience

Page 49: Patterns for organic architecture codedive

Source code the truth will

tell you

Page 50: Patterns for organic architecture codedive

Listen to the system

you must

Page 51: Patterns for organic architecture codedive

SCM

Bug tracker

Continous integration

Static code analisys

Page 52: Patterns for organic architecture codedive

Let's find stable parts of the system

Page 53: Patterns for organic architecture codedive

# count complexity per each filefind . -iname jacoco.csv | xargs tail -q -n +2 | awk -F , '{gsub("\.","/",$2);print ($1"/src/main/java/"$2"/"$3".java"),$10+$11}' | sort > coverage.txt

# count number of changesecho 'changeset="{files}"' > files.style; echo 'file="\n{file}"' >> files.style

hg log --style files.style | sort | uniq -c | awk '{print $2,$1}' > changes.txt

# merge changes join coverage.txt changes.txt

Page 54: Patterns for organic architecture codedive
Page 55: Patterns for organic architecture codedive

Michael Feathers Quadrant

Page 56: Patterns for organic architecture codedive

tools

uglystables designflaw

breedinggrounds

Page 57: Patterns for organic architecture codedive

Let's find fragile parts of the system

Page 58: Patterns for organic architecture codedive

#fetch all jobsjobs_rsp = requests.get("https://primitive.ci.cloudbees.com/job/roadrunner/api/python")#all builds urlsbuild_urls = [x['url'] for x in eval(jobs_rsp.content)['builds']]

pairs = []for build_url in build_urls: build = eval(requests.get("%sapi/python" % (build_url)).content) result = build['result']

changeSetItems = build['changeSet']['items'] if changeSetItems and not result == 'SUCCESS': affectedPaths = build['changeSet']['items'][0]['affectedPaths']

for i in itertools.permutations(affectedPaths,2): pairs.append(i)

counter = collections.Counter(pairs).most_common(5)for pair in counter: print pair

Page 59: Patterns for organic architecture codedive

(('.../cli/CliConfigurationBuilderTest.java', '.../cli/RunTest.java'), 3)

(('.../cli/RunTest.java', ' .../cli/CliConfigurationBuilderTest.java'), 3)

(('.../cli/CliConfigurationBuilderTest.java', '.../cli/BenchTest.java'), 3)

(('.../cli/BenchTest.java', '.../cli/RunTest.java'), 3)

(('.../cli/RunTest.java', '.../cli/BenchTest.java'), 3)

Page 60: Patterns for organic architecture codedive

Package principles

aka

Are my classes in a right place?

Page 61: Patterns for organic architecture codedive

(echo "<changes>" && hg log --template "<changeset>

{files % '<file>{file}</file>\n'}</changeset>\n"

&& echo "</changes>") > out.xml

Page 62: Patterns for organic architecture codedive

+Neo4j

(jqassistant)

Page 63: Patterns for organic architecture codedive

neo4j-sh (?)$ MATCH (a)-[c:`changeset`]->(b) RETURN labels(a),c.times,labels(b) order by c.times desc limit 5; +-----------------------------------------------------------------------------------------------------------+ | labels(a) | c.times | labels(b) | +-----------------------------------------------------------------------------------------------------------+ | [".../listeners/SummaryScenarioListener.java"] | 13 | [".../listeners/LoggingScenarioListener.java"] | | [".../listeners/LoggingScenarioListener.java"] | 13 | [".../listeners/SummaryScenarioListener.java"] | | ["pom.xml"] | 12 | ["roadrunner-core/pom.xml] | | [".../cli/BenchTest.java"] | 12 | [".../cli/RunTest.java"] | | [".../cli/RunTest.java"] | 12 | [".../cli/BenchTest.java"] | +-----------------------------------------------------------------------------------------------------------+

Page 64: Patterns for organic architecture codedive

Can you please show me these patterns of

organic architecture?

Page 65: Patterns for organic architecture codedive

Sow and Grow

Page 66: Patterns for organic architecture codedive

„aka” refactoring

compulsive „refactoring” is evil

no user stories „refactor X”

before you start, think, is it worth it?

don't ask for permissions, it is better to ask for forgivness

give „technical debt” meaning

Page 67: Patterns for organic architecture codedive

„visual management”

Define limited number of metrics

Use only these metrics which support your goals

because

„You get what you measure”

Page 68: Patterns for organic architecture codedive

Sow and harvestSow and harvest

Page 69: Patterns for organic architecture codedive

„aka” modularization

Modularize to stable parts of the system

otherwise you will make your system even more unstable

but before you start ...

Page 70: Patterns for organic architecture codedive

let's build some ...„framework” ...

Page 71: Patterns for organic architecture codedive
Page 72: Patterns for organic architecture codedive

Architecture is a process which goal is to

transform your system from one design to

another design

Page 73: Patterns for organic architecture codedive

… clearly define goals …

… strategy adjusted to needs and capabilties …

… give yourself some design space …

Don't get paralized by „big design (tm)”

You don't need to know answers to all questions

… because your goal is a moving target ...

Page 74: Patterns for organic architecture codedive
Page 75: Patterns for organic architecture codedive

What if your architecture would look like this?

Page 76: Patterns for organic architecture codedive

Batch processing separated from online

Modules communicate asynchronously

Users see system as one

And communicate with system synchronously

The only thing we share is a model of our system

mvn clean install < 60 sec

Page 77: Patterns for organic architecture codedive

Every module has to inherit these principles

And can introduce new one which makes these system

wide principles more specific

Page 78: Patterns for organic architecture codedive

Composting

Page 79: Patterns for organic architecture codedive

But sometimes, despite our hard work,

knowledge and experience

Page 80: Patterns for organic architecture codedive

Complex

ity

Page 81: Patterns for organic architecture codedive

Do you know how your users use your application?

Do you know that your biggest customer is no longer using your

system?

Do you know that some „killer feature” is not sooo „killer”?

Page 82: Patterns for organic architecture codedive

How can I know it all?

Page 83: Patterns for organic architecture codedive

/var/log/httpd/access.log

Instrument your code?

Aspects?

Byteman?

Bug tracker?

People from support?

Page 84: Patterns for organic architecture codedive

Don't buy expensive tools

Invest in your creativity

You know your system better, then some third party provider

Page 85: Patterns for organic architecture codedive

But please don't comment out code

Use your SCM

… throw this shit out...

Page 86: Patterns for organic architecture codedive

What's next?

Page 87: Patterns for organic architecture codedive

Hierarchy

Self-Organization

Resilience

Page 88: Patterns for organic architecture codedive

System's resilience is often sacrificed for purposes ofshort-term productivity

and stability.

Page 89: Patterns for organic architecture codedive

Productivity and stability are the

usual excuses for turning creative human beings into

mechanical adjunctsto production processes.

Page 90: Patterns for organic architecture codedive

Or for establishing bureaucracies and theories

of knowledge thattreat people as if they were

only numbers.Donella Meadows, thinking in systems a primer

Page 91: Patterns for organic architecture codedive

Thank you!!!