Slide 1

Slide 1 text

Whoops! Where did my architecture go? Architecture management for Java applications ! Oliver Gierke

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Background 5 years of consulting Lots of code reviews Eoin Woods‘ talk on InfoQ Lot of input from fellows

Slide 7

Slide 7 text

"If you think architecture is expensive, try no architecture.

Slide 8

Slide 8 text

"Architecture is like weather: you can’t have none.

Slide 9

Slide 9 text

Macro VS. Micro Architecture

Slide 10

Slide 10 text

Orders Inventory Billing Macro-Architecture Micro-Architecture JMS REST AMQP

Slide 11

Slide 11 text

JRuby Java Scala Macro-Architecture Micro-Architecture AMQP JMS REST

Slide 12

Slide 12 text

Neo4j RDBMS MongoDB Macro-Architecture Micro-Architecture JMS REST AMQP

Slide 13

Slide 13 text

Neo4j RDBMS MongoDB Macro-Architecture Micro-Architecture from Stefan Tilkov -
 Breaking the Monolith JMS REST AMQP

Slide 14

Slide 14 text

Roadmap Divide and conquer Of layers and slices A plain Java based approach

Slide 15

Slide 15 text

Architecture 101

Slide 16

Slide 16 text

Know your dependencies

Slide 17

Slide 17 text

Explicit / Visible dependencies

Slide 18

Slide 18 text

Granularity Modules Layers Vertical slices Subsystems

Slide 19

Slide 19 text

Granularity Java ARchive Package Class

Slide 20

Slide 20 text

Divide and conquer

Slide 21

Slide 21 text

Component Single unit to understand

Slide 22

Slide 22 text

Component Single unit to change

Slide 23

Slide 23 text

Component Scope of risk of change

Slide 24

Slide 24 text

B Smaller unit to understand A

Slide 25

Slide 25 text

B Reduced risk of change A

Slide 26

Slide 26 text

B Cost of separation A

Slide 27

Slide 27 text

B Definition and maintenance of dependencies A

Slide 28

Slide 28 text

"Meanwhile, in my friend’s project…

Slide 29

Slide 29 text

How do I add a feature?

Slide 30

Slide 30 text

How do I add a feature? New
 Feature © Eberhard Wolff

Slide 31

Slide 31 text

Of layers and slices…

Slide 32

Slide 32 text

Presentation Service Data Access Account Customer Core

Slide 33

Slide 33 text

Layers Well understood Known to developers Less important to business

Slide 34

Slide 34 text

Slices Hardly understood New to developers Key for business requirements

Slide 35

Slide 35 text

Presentation Service Data Access Account Customer Core

Slide 36

Slide 36 text

"How to implement an architecture inside a codebase?

Slide 37

Slide 37 text

Architecture VS. Codebase

Slide 38

Slide 38 text

"How to implement an architecture inside a codebase?

Slide 39

Slide 39 text

"How to maintain an architecture inside a codebase?

Slide 40

Slide 40 text

Code analysis JDepend Sonarcube

Slide 41

Slide 41 text

Sonargraph Formerly known as SonarJ

Slide 42

Slide 42 text

Demo

Slide 43

Slide 43 text

A plain Java based approach

Slide 44

Slide 44 text

"How far can we get with plain Java means only?

Slide 45

Slide 45 text

Presentation Service Data Access Account Customer Core

Slide 46

Slide 46 text

Packages

Slide 47

Slide 47 text

….layer.slice ….slice.layer ….slice

Slide 48

Slide 48 text

….web.core ….service.core ….repository.core

Slide 49

Slide 49 text

….core.web ….core.service ….core.repository

Slide 50

Slide 50 text

….core ….customer ….account

Slide 51

Slide 51 text

"Why the f#$k should I even care?

Slide 52

Slide 52 text

"Does it make a difference?

Slide 53

Slide 53 text

Dependency management

Slide 54

Slide 54 text

"You only need to manage, what you can refer to…

Slide 55

Slide 55 text

Layers first Leaks slice internals Lower layers visible to everyone

Slide 56

Slide 56 text

Slices first/only Start with package per slice Expose interfaces and domain types Keep implementations private

Slide 57

Slide 57 text

Slices first/only Encapsulates business module Internals understood anyway

Slide 58

Slide 58 text

"Start with less packages and the least visibility possible…

Slide 59

Slide 59 text

Presentation Service Data Access Account Customer Core

Slide 60

Slide 60 text

Presentation Service Data Access Account Customer Core

Slide 61

Slide 61 text

Demo

Slide 62

Slide 62 text

Take-aways Know your dependencies On every granularity Start as strict as possible Get lenient where necessary

Slide 63

Slide 63 text

Resources Spring Data JPA @ GitHub Sonargraph jQAssistant Blogpost

Slide 64

Slide 64 text

Sample Code http://github.com/olivergierke/
 whoops-architecture

Slide 65

Slide 65 text

Oliver Gierke Spring Data Project Lead ! ogierke@pivotal.io olivergierke www.olivergierke.de

Slide 66

Slide 66 text

Thanks & Credits Eoin Woods - Talk @ InfoQ Stefan Tilkov - Talk @ InfoQ Eberhard Wolff - Slides @ Slideshare