how frameworks can kill your projects at xp days ukraine 2013 in kiev

Post on 15-May-2015

1.752 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Here's the slide deck for my closing keynote at XP Days Ukraine 2013 in Kiev.

TRANSCRIPT

Sander HoogendoornPrincipal Technology Officer

& Global Agile Thouhtleader Capgemini

www.sanderhoogendoorn.com

www.speedbird9.com

@aahoogendoorn

How frameworks

can kill your

projects

And some patterns

to prevent you from getting killed

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

2Sander Hoogendoorn

Capgemini

Principal technology officer

Global agile thought leader

Chief architect Accelerated Delivery Platform

Other

Author books on UML, agile (2)

Author +200 articles

Speaker +100 international conferences

Microsoft Partner Advisory Council .NET

Editorial boards & Advisory boards

Web

www.sanderhoogendoorn.com

www.speedbird9.com | www.smartusecase.com

@aahoogendoorn

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

4On being a developer...

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

5A small rectification …

Ukrainian

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

6Agenda

An short story

about frameworks

How frameworks can

get you in trouble

Software architecture

versus frameworks

The layer

supertype

Introducing the

descriptor pattern

The

manager-provider

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

7Agenda

An short story

about frameworks

How frameworks can

get you in trouble

Software architecture

versus frameworks

The layer

supertype

Introducing the

descriptor pattern

The

manager-provider

It always takes longer than you expect, even when you take into account Hofstadter’s Law

Hofstadter’s Law

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

9MyFirstSurvey

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

10MyFirstSurvey

Frameworks, like pizzas, come in only two sizes: too big and too small.

Life is never easy

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

12MyFirstSurvey

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

13What’s it gonna be punk?General purpose frameworks

Enterprise Library, Spring.Net, Castle,

NakedObjects, Accelerated Delivery Framework

(ADF), SubSonic

Single goaled frameworks – verticals

Dependency injection: ObjectBuilder, Unity,

Castle Windsor

Logging: Log4Net, Logging Block,

Common.Logging

Exception handling: Exception Handling Block

Apect orientation: PostSharp, SetPoint

Search: Lucene.net, NLucene

Portals: DotNetNukeSpatial, Umbraco

Single goaled frameworks – architectural

User interface: Silverlight, ASP.NET MVC, WPF,

ASP.NET Ajax, Spring MVC

Process: UI Process Application Block, WF

Domain: Entity Framework, Hibernate, NEO

Data: Entity Framework, Hibernate, Castle

ActiveRecord, CSLA

Service s: WCF, WCF RIA

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

14Frameworks. CodePlex

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

15Frameworks. www.csharpopensource.com

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

16Frameworks. Microsoft Enterprise Library

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

17Frameworks. Project Castle

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

18Don’t believe the hype. It’s a SQL

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

19Convincing the management to apply the framework (25.5 %)

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

20Understanding the framework (56.4 %)

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

21Convincing other developers to use the framework (23.6 %)

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

22Convincing other developers to use the framework (23.6 %)

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

23Training the developers (20 %)

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

24The eye of the tiger

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

25Agenda

An short story

about frameworks

How frameworks can

get you in trouble

Software architecture

versus frameworks

The layer

supertype

Introducing the

descriptor pattern

The

manager-provider

My software never has bugs. It just develops random features

Applying

Frameworks

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

27So glad you made it!

What if we require

additional features that

aren’t covered by our

framework?

What if we decide that

another framework

might be better than the

one we’re using now?

What if the author of our

favorite framework suddenly

stops developing it?

What if the framework

contains bugs?

And what if the new

version of our framework

is implemented totally

different?

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

28More than anything, dependencies will kill your project

A short story about framework developers and application developers

Kentucky Fried

Architecture

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

30Pigs & Chickens

The

application

developer

The framework

developer

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

31The customer is not always right

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

32KFC Architecture. Entity Framework

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

33KFC Architecture. Entity Framework

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

34KFC Architecture. Entity Framework

I don’t care if it works on your machine! We are not shipping your machine!

Letting

the lunatics

run the asylum

Here’s …

beta!

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

37Hot or not?

Hot? From hot to not? Not?

WindowsRT

PCL

HTML5

LightSwitch

WCF RIA Services

Silverlight 4.0?

ASP.NET MVC 3

MEF

jQuery

NService Bus

Entity Framework -

Code First

Xamarin

TypeScript

Expression Blend

ASP.NET Ajax

REST

Unity

BizTalk

Surface

Duet

SketchFlow

Azure Services

ADO.NET Data

Services

ASP.NET Dynamic

Data

WPF

Entity Framework 2.0

LINQ2SQL

LINQ2Entities

Entity Data Model

Dublin

DSL’s

Silverlight 2.0

F#

ASP.NET

PopFly

M

Oslo

MGrammar

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

38Be a genius

Metro?

WTF? I just figured

out ASP.NET MVC

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

39Here’s Johnny! ASP.NET MVC

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

40Here’s Johnny! ASP.NET MVC

It’s only in theory that practice and theory are the same

No strings

attached

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

42MyFirstSurvey

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

43Changing base classes. NHibernate / Log4Net

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

44Changing base classes. NHibernate / Log4Net

Programming is like sex. One mistake and you

have to support it for the rest of your life

Yes, your

frameworks

version too

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

46It ain’t over till it’s over

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

47Missing base classes. Workflow Foundation 4.0

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

48Missing base classes. Workflow Foundation 4.0

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

49Enterprise Library & Retirement

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

50“Evolving” the Reflection API

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

51“Evolving” the Reflection API

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

52“Evolving” the Reflection API

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

54Agenda

An short story

about frameworks

How frameworks can

get you in trouble

Software architecture

versus frameworks

The layer

supertype

Introducing the

descriptor pattern

The

manager-provider

Architecture starts when you carefully put two bricks together. There it begins.

Sound

architecture

(Software.Architecture != List<Framework>)

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

57A software architecture

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

58Creating your architecture

What to do?

Identify your architectural requirements

Set up a (layered) architecture

Identify layers and layer elements

List the elements responsibilities

List the elements collaborations

And only then map to frameworks

Create a thin “umbrella” of independence responsible for

managing dependencies

“Wrap” frameworks to avoid too many dependencies

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

Presentation

Process

Domain

Data / Services

Outside world

Pages

UserControls

Panels

Use cases

Workflow

Domain objects / Entities

Factories / Repositories

Enums / Value objects / Smart references

[Mapping]

Service gateways

Service locators

[Mapping]

Databases

Services / ESB

COBOL SAP BizTalk Java

Silverlight

XAML

ASPX

Entities

(from EF)

Domain

Services

Metadata

Entity Framework

LINQ

Nhibernate?

WCF?

MVVM?

MVP?

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

61Agenda

An short story

about frameworks

How frameworks can

get you in trouble

Software architecture

versus frameworks

The layer

supertype

Introducing the

descriptor pattern

The

manager-provider

From a developers point of view

the user is a peripheral that types

when you issue a read request.

Layer supertype

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

63Layer Supertype

What’s a layer supertype Ollie?

Acts as a supertype for all types in

its layer

All types inherit from the layer

supertype

Well Stan, it’s characteristics are

Name expresses common behaviour

Forces common features on all inherited types

Ideal starting point for services

Initially the layer supertype is empty

Reserve layer supertype for future additions

Extension methods don’t (always) help, youknow

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

64Layer Supertype. ASP.NET MVC

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

65Layer Supertype. ASP.NET MVC

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

Presentation

Process

Domain

Data / Services

Outside world

Pages

UserControls

Panels

Use cases

Workflow

Domain objects / Entities

Factories / Repositories

Enums / Value objects / Smart references

[Mapping]

Service gateways

Service locators

[Mapping]

Databases

Services / ESB

Exact SAP BizTalk Java

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

67Layer Supertype. Using a layer supertype

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

68Layer Supertype. Reasoning about layer supertypes

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

69Layer Supertype. Extension methods on layer supertypes

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

70Agenda

An short story

about frameworks

How frameworks can

get you in trouble

Software architecture

versus frameworks

The layer

supertype

Introducing the

descriptor pattern

The

manager-provider

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Descriptor

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

72I know nothing. I’m from Barcelona

What is the matter

Mister Fawlty?

The problem Manuel, is that

I want to use constants in my

application

But I want to define them in my

framework and extend them in

my application

Enumeration won’t do – there’s

no inheritance

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

73Descriptor. The problem

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

74Descriptor. The problem

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

75Enum?

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

76String Collection?

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

77String Collection

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

78I know nothing. I’m from Barcelona

Descriptor

Defines a restricted but

application specific

extendible list of

definitions

Useful when

Enums can not be inherited

Framework defines enumerationtypes that need to be extended in application code

Define layer supertype usingreflection

Pre-define frequently usedinstances

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

79Descriptor Pattern

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

80Descriptor Pattern. Definition

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

81Descriptor Pattern. Extending the definition

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

82Descriptor Pattern. Use in framework

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

83Descriptor Pattern. Use in application

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

84MyFirstSurvey

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

85Descriptor Pattern. Use in ASP.NET MVC

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

86Descriptor Pattern. Use in ASP.NET MVC

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

87Agenda

An short story

about frameworks

How frameworks can

get you in trouble

Software architecture

versus frameworks

The layer

supertype

Introducing the

descriptor pattern

The

manager-provider

XML is like violence.

If it doesn’t solve your problems,

you are not using enough of it.

Dependency

injection

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

89Dependency Injection. A contagious disease?

What do you think it is?

Create true separation between

definition and implementation, so that

the two can vary independently and can

be replaced easily

Looks like a typical case

of dependency injection to me

Call functionality without having to know

the actual implementation

Implement replaceable services

Apply implementations in different contexts

Plug-in services at run-time

So …

Single topic services

Single or multiple implemenations need

to be handled, which differs dependant

on context, like with Windows API,

logging or error handling

Unit testing

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

90Different variations?Did you know that there

are different types

of this dependency injection?

Arggh…

Yeah, sure. There’s

Constructor injection

Property (setter) injection

And even manual injection

Who cares doc?

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

92Dependency injection. Manual injection

c

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

93Dependency injection. what to plug in

"Teamwork is a lot of people doing what I say“

Marketing executive, Citrix Corporation

Manager –

Provider

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

95Manager-Provider Pattern

Definition

Create a simple static facade (manager) for a (set of)

interfaced implementations (providers)

In practice

Manager holds one or a collection of providers

Provider implement a particular interface

Manager has methods to call methods from interface

At run-time, using dependency injection, actual providers

are injected

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

96Manager. ValidationManager

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

97Interface

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

98Manager. Initialization (using dependency injection)

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

99Configuration of implementation

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

100Configuration of implementation

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

101Manager. Executing methods

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

102Client. Calling methods

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

103Client. Extending

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

104Manager-Provider pattern

Useful when

Generic services need to be called, which may have

different implementations

Manager prevents having to loop through each of a list of

providers

Flexibility to add or remove providers without changing

application code

Providers differ e.g. in development code, test code or

deployed code

Writing platform independent code

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

105Manager-Provider pattern

Use for

Task Management

View Management

Binding and Persisting

Resource Management

State Management

Logging

Datasource interaction

Encryption

Authorization

Testing!

Software architecture is like deodorant.Those who need it the most don’t use it.

Creating your

architecture

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

107Creating your architecture

What to do?

Identify your architectural requirements

Set up a (layered) architecture

Identify layers and layer elements

List the elements responsibilities

List the elements collaborations

And only then map to frameworks

Create a thin “umbrella” of independence responsible for

managing dependencies

“Wrap” frameworks to avoid too many dependencies

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

108Too many layers

HOW FRAMEWORKS CAN KILL YOUR PROJECTS©2012 Sander Hoogendoorn All Rights Reserved

www.sanderhoogendoorn.comwww.smartusecase.comwww.speedbird9.com

sander.hoogendoorn@capgemini.com sander@ditisagile.nl

@aahoogendoorn

References

and questions

top related