51
How to Manage Software Complexity with OSGi Peter Kriens & David Savage donderdag 24 maart 2011

How to manage software complexity with OSGi

Embed Size (px)

DESCRIPTION

EclipseCon presentation from David Savage (Paremus) and Peter Kriens (OSGi)

Citation preview

Page 1: How to manage software complexity with OSGi

How to Manage Software Complexity

with OSGiPeter Kriens & David Savage

donderdag 24 maart 2011

Page 2: How to manage software complexity with OSGi

What is Complexity?

donderdag 24 maart 2011

Page 3: How to manage software complexity with OSGi

Complex?

donderdag 24 maart 2011

Page 4: How to manage software complexity with OSGi

The puzzle looks very simple, contrary to many other wire puzzles, that look scary and complex right from the start. Nevertheless, its looks are

deceiving, as it can prove to be frustratingly difficult to

solve.

donderdag 24 maart 2011

Page 5: How to manage software complexity with OSGi

Complex?

donderdag 24 maart 2011

Page 6: How to manage software complexity with OSGi

Worlds Largest Jigsaw Puzzle24.000 pieces

(4.28m x 1.57m)

Complex?

donderdag 24 maart 2011

Page 7: How to manage software complexity with OSGi

The Eye Of The Beholder

• Complexity of a task is the energy you use to complete that task

c = √E/m

donderdag 24 maart 2011

Page 8: How to manage software complexity with OSGi

The Eye Of The Beholder

• Complexity of a task is the energy you use to complete that task

c = √E/m

donderdag 24 maart 2011

Page 9: How to manage software complexity with OSGi

Energy?

• Understanding the problem

• Learning the solution

• Accidental complexity

• Size matters!

donderdag 24 maart 2011

Page 10: How to manage software complexity with OSGi

Energy?

• Understanding the problem

• Learning the solution

• Accidental complexity

• Size matters!

Subjective Complexity

donderdag 24 maart 2011

Page 11: How to manage software complexity with OSGi

Energy?

• Understanding the problem

• Learning the solution

• Accidental complexity

• Size matters!

Subjective Complexity

Absolute Complexitysize related

donderdag 24 maart 2011

Page 12: How to manage software complexity with OSGi

What’s Modularity Got to do With Size???

donderdag 24 maart 2011

Page 13: How to manage software complexity with OSGi

Modularity• Functions

• local variables

• Object Oriented

• fields, methods, inheritance,polymorphism

• instances

• Bundles

• implementations, services

• componentsdonderdag 24 maart 2011

Page 14: How to manage software complexity with OSGi

Modularity• Functions

• local variables

• Object Oriented

• fields, methods, inheritance,polymorphism

• instances

• Bundles

• implementations, services

• componentsdonderdag 24 maart 2011

Page 15: How to manage software complexity with OSGi

Modularity• Modularity is about

creating a difference between an inside and an outside

• Chunking - having an anchor for an aggregation

• Visibility - is reduced, reducing the scope to attend for changes

A B

C D

ABCD

donderdag 24 maart 2011

Page 16: How to manage software complexity with OSGi

Modularity• Modularity is about

creating a difference between an inside and an outside

• Chunking - having an anchor for an aggregation

• Visibility - is reduced, reducing the scope to attend for changes

A B

C DABCD

donderdag 24 maart 2011

Page 17: How to manage software complexity with OSGi

A B

C D

• modules have a private space and share a public space

• modules limit their visibility and exposure

• Reduces geometric to linear complexity

Modularity

donderdag 24 maart 2011

Page 18: How to manage software complexity with OSGi

A B

C D

• modules have a private space and share a public space

• modules limit their visibility and exposure

• Reduces geometric to linear complexity

Modularity

Pub

donderdag 24 maart 2011

Page 19: How to manage software complexity with OSGi

A B

C D

• modules have a private space and share a public space

• modules limit their visibility and exposure

• Reduces geometric to linear complexity

Modularity

Pub

donderdag 24 maart 2011

Page 20: How to manage software complexity with OSGi

EntropyE

func

tiona

lity

Emodularizationdonderdag 24 maart 2011

Page 21: How to manage software complexity with OSGi

EntropyE

func

tiona

lity

Emodularizationdonderdag 24 maart 2011

Page 22: How to manage software complexity with OSGi

EntropyE

func

tiona

lity

Emodularizationdonderdag 24 maart 2011

Page 23: How to manage software complexity with OSGi

EntropyE

func

tiona

lity

Emodularizationdonderdag 24 maart 2011

Page 24: How to manage software complexity with OSGi

EntropyE

func

tiona

lity

Emodularizationdonderdag 24 maart 2011

Page 25: How to manage software complexity with OSGi

EntropyE

func

tiona

lity

Emodularizationdonderdag 24 maart 2011

Page 26: How to manage software complexity with OSGi

#1 OSGi Complaint:Class Loaders!

donderdag 24 maart 2011

Page 27: How to manage software complexity with OSGi

Classloaders & Modularity

donderdag 24 maart 2011

Page 28: How to manage software complexity with OSGi

Class Loading Revisited

• Class.forName

• Class path Scanning

• Service Loader

• Thread Context Class Loaders

• Factory, and FactoryBuilders

donderdag 24 maart 2011

Page 29: How to manage software complexity with OSGi

A B

C D

• Class loaders are used to provide extensibility and decoupling

• They were not designed for this purpose,

• And class loaders break module boundaries

Class Loading Revisited

Pub

donderdag 24 maart 2011

Page 30: How to manage software complexity with OSGi

A B

Class Loading Revisited

Public

donderdag 24 maart 2011

Page 31: How to manage software complexity with OSGi

A B

Class Loading Revisited

Public

C

donderdag 24 maart 2011

Page 32: How to manage software complexity with OSGi

A B

Class Loading Revisited

Public

IC

donderdag 24 maart 2011

Page 33: How to manage software complexity with OSGi

A B

Class Loading Revisited

Public

IC X

donderdag 24 maart 2011

Page 34: How to manage software complexity with OSGi

A B

Class Loading Revisited

Public

I

C P

donderdag 24 maart 2011

Page 35: How to manage software complexity with OSGi

µServicesWould be nice to mentionhow µServices reduce surface area of design

efficiency of packet based approaches?

but cost of packet based system is congestion - leads into dependency hell?

donderdag 24 maart 2011

Page 36: How to manage software complexity with OSGi

#2 OSGi Complaint: Dependency Hell

donderdag 24 maart 2011

Page 37: How to manage software complexity with OSGi

Metadata Hell?

donderdag 24 maart 2011

Page 38: How to manage software complexity with OSGi

Transitive Hell?

donderdag 24 maart 2011

Page 39: How to manage software complexity with OSGi

A B

C D

• Modules require other modules

• Dependencies are transitive

• A → C → D

Coupling

Pub

donderdag 24 maart 2011

Page 40: How to manage software complexity with OSGi

A B

C D

• Modules require other modules

• Dependencies are transitive

• A → C → D

Coupling

Pub

donderdag 24 maart 2011

Page 41: How to manage software complexity with OSGi

C

A

D

• Fan out is a problem

• A does not transitively depend on D!

• The dependency is caused by (unnecessarily) packing 1 and 2 in the same module

Cohesion

B

donderdag 24 maart 2011

Page 42: How to manage software complexity with OSGi

C

A

D

• Fan out is a problem

• A does not transitively depend on D!

• The dependency is caused by (unnecessarily) packing 1 and 2 in the same module

Cohesion

B

2

A

1

donderdag 24 maart 2011

Page 43: How to manage software complexity with OSGi

C CC D

• Refactoring can increase the cohesion and reduce coupling

• But now A depends on C1 and B depends on C2

• Package dependencies are more robust to changes

Cohesion

B

2

A

1

donderdag 24 maart 2011

Page 44: How to manage software complexity with OSGi

C C D

• Refactoring can increase the cohesion and reduce coupling

• But now A depends on C1 and B depends on C2

• Package dependencies are more robust to changes

Cohesion

B

2

A

1

donderdag 24 maart 2011

Page 45: How to manage software complexity with OSGi

Metadata Heaven?

donderdag 24 maart 2011

Page 46: How to manage software complexity with OSGi

Requires Tools

donderdag 24 maart 2011

Page 47: How to manage software complexity with OSGi

Tools

Refer to

Application

Policy Resolver

Request deployment of a

component, e.g. a Bundle,

WAR, WAB or EAR

App

Policy

Repository

Resolve

Dependencies

according to

Policy

Provision

component and

dependencies

1

3

4

Nimble

2

donderdag 24 maart 2011

Page 48: How to manage software complexity with OSGi

Tools

Refer to

Application

Policy Resolver

Request deployment of a

component, e.g. a Bundle,

WAR, WAB or EAR

App

Policy

Repository

Resolve

Dependencies

according to

Policy

Provision

component and

dependencies

1

3

4

Nimble

2

donderdag 24 maart 2011

Page 49: How to manage software complexity with OSGi

OSGiBuild Tools

OSGiRuntime Tools

OSGiCloud Tools

...

donderdag 24 maart 2011

Page 50: How to manage software complexity with OSGi

OSGiBuild Tools

OSGiRuntime Tools

OSGiCloud Tools

...

donderdag 24 maart 2011

Page 51: How to manage software complexity with OSGi

How to Manage Complexity?

• Prepare to spend energy!

• Architecture = µservice model

• Use tools to manage Metadata and Dependencies

• Small increments

• One test is worth a thousand opinions.

donderdag 24 maart 2011