beyond frameworks

Post on 20-Nov-2014

8.615 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

The slides from my PHPUK 2011 conference talk on how to use an application framework without becoming a hostage to it.

TRANSCRIPT

stuart@stuartherbert.com - http://blog.stuartherbert.com/php/

Stuart Herbert

Beyond Frameworks

Using Frameworks WithoutBecoming A Hostage To Them

Stuart Herbert

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

About Stuart

• Head of Engineering, Gradwell.com

• Co-author, Zend Certification Study Guide for PHP 4

• Open-source Contributor Since 1994

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

About Stuart

• Head of Engineering, Gradwell.com

• Co-author, Zend Certification Study Guide for PHP 4

• Open-source Contributor Since 1994

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

About Stuart

• Head of Engineering, Gradwell.com

• Co-author, Zend Certification Study Guide for PHP 4

• Open-source Contributor Since 1994

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Contents

1

How Frameworks Have Held Us Hostage

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Contents

2

Our Layered Architecture For PHP Applications

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Contents

3What Makes A Good Component?

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Contents

4

How Components Are Helping Gradwell

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Questions

At The End, Please

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Questions

For The Audience ...

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/R33dr

Beyond Frameworks

Who Uses A Framework?

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/qq6F1

Beyond Frameworks

Who Develops Software Products?

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

1: HostagesTo Frameworks

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Stop Me If You’ve Heard This One Before ...

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/7MmEiv

Beyond Frameworks

First generation apps are highly-coupled

Neat until you attempt to untangle them!

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/7MmEiv

Beyond Frameworks

First generation apps are highly-coupled

Neat until you attempt to untangle them!

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/4sK29V

Beyond Frameworks

Second generation app built on top of own framework

Developers enjoyed building it

But they hated completing it or maintaining it

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/4sK29V

Beyond Frameworks

Second generation app built on top of own framework

Developers enjoyed building it

But they hated completing it or maintaining it

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/4sK29V

Beyond Frameworks

Second generation app built on top of own framework

Developers enjoyed building it

But they hated completing it or maintaining it

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

So We Used A Popular Framework ...

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

... Or Two ...

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/2k87DM

Beyond Frameworks

Third generation app easy to extend

... after the steep learning curve

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/2k87DM

Beyond Frameworks

Third generation app easy to extend

... after the steep learning curve

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/7132Wm

Beyond Frameworks

We couldn’t get the code out to re-use in other apps

:(

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Framework

Your Code Plugins

What The Architecture Should Look Like

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Your Code Plugins

Framework

What Happened In Reality :(

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

What Practical Challenges Does This Create?

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/5Z6Arf

Beyond Frameworks

How long would it take to upgrade your app to the next major version of the framework?

Would you do the upgrade, or stick with the current framework version?

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/5Z6Arf

Beyond Frameworks

How long would it take to upgrade your app to the next major version of the framework?

Would you do the upgrade, or stick with the current framework version?

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/4Z8oZE

Beyond Frameworks

What would it take to switch your app to a different framework?

Could you port your code, or would you be forced to rewrite all or most of it?

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/4Z8oZE

Beyond Frameworks

What would it take to switch your app to a different framework?

Could you port your code, or would you be forced to rewrite all or most of it?

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/85jzRA

Beyond Frameworks

How would you re-use some of your app’s code in a different app?

Especially if the other app doesn’t use the same framework?

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/85jzRA

Beyond Frameworks

How would you re-use some of your app’s code in a different app?

Especially if the other app doesn’t use the same framework?

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/6GMfQc

Beyond Frameworks

How would you outsource some of your app development to teams around the world?

How would you accept the work delivered back to you?

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/6GMfQc

Beyond Frameworks

How would you outsource some of your app development to teams around the world?

How would you accept the work delivered back to you?

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Your Code Plugins

Framework

We Need To Change This ...

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

To What ...?

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

2: Layered Approach

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks Your Code Plugins

Application

Let’s Take The Original Architecture ...

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks App Code Plugins

Application

... And Make The App As Thin As Possible

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks

Business Logic

App Code Plugins

Application

By Extracting Out ...

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks

Business Logic Data Model

App Code Plugins

Application

By Extracting Out ...

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks

Business Logic Data Model Utilities

App Code Plugins

Application

By Extracting Out ...

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks

Business Logic Data Model Utilities

App Code Plugins

Application

Components

... Into Independent Libraries Of Code

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks

Business Logic Data Model Utilities

App Code Plugins

Autoloader

Application

Components

Use An Autoloader To Pull In These New Components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks

Business Logic Data Model Utilities

App Code Plugins

Autoloader

Application

Components

This Gives You A Larger Set Of Reusable Code

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

The Frameworked AppBecomes A Thin Layer

On Top Of Framework-agnostic

Reusable Components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Layered Architecture

Frameworks

Business Logic Data Model Utilities

App Code Plugins

Autoloader

Application

Components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Layered ArchitectureApplication

Components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why Components?

Business Logic

Data Model

Utilities

• Completely independent of the framework

• Built & tested in isolation of your app code

• Can be built by different teams

• Don’t have to change when the framework changes

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why Components?

Business Logic

Data Model

Utilities

• Completely independent of the framework

• Built & tested in isolation of your app code

• Can be built by different teams

• Don’t have to change when the framework changes

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why Components?

Business Logic

Data Model

Utilities

• Completely independent of the framework

• Built & tested in isolation of your app code

• Can be built by different teams

• Don’t have to change when the framework changes

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why Components?

Business Logic

Data Model

Utilities

• Completely independent of the framework

• Built & tested in isolation of your app code

• Can be built by different teams

• Don’t have to change when the framework changes

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why Components?

Business Logic

Data Model

Utilities

• Reduces the Big Ball of String Syndrome

• Mindset change to light apps on top of rich service layer

• Improves development in parallel of apps & services

• Injects additional discipline into development teams

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why Components?

Business Logic

Data Model

Utilities

• Reduces the Big Ball of String Syndrome

• Mindset change to light apps on top of rich service layer

• Improves development in parallel of apps & services

• Injects additional discipline into development teams

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why Components?

Business Logic

Data Model

Utilities

• Reduces the Big Ball of String Syndrome

• Mindset change to light apps on top of rich service layer

• Improves development in parallel of apps & services

• Injects additional discipline into development teams

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why Components?

Business Logic

Data Model

Utilities

• Reduces the Big Ball of String Syndrome

• Mindset change to light apps on top of rich service layer

• Improves development in parallel of apps & services

• Injects additional discipline into development teams

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Others Already Do This

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/5oewwy

Beyond Frameworks

Perl Has CPAN Modules

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/uyMuU

Beyond Frameworks

Ruby Has Gems

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

What MakesA Good Component?

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

3: Good Components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Component Standards

• Common standards

• Reusable by many

• Interoperable

• Trustable

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Component Standards

• Common standards

• Reusable by many

• Interoperable

• Trustable

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Component Standards

• Common standards

• Reusable by many

• Interoperable

• Trustable

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Component Standards

• Common standards

• Reusable by many

• Interoperable

• Trustable

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Components ...

• Autoload

• Are well tested

• Are well documented

• Are easy to install

• Don’t break backwards compatibility by surprise

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Components ...

• Autoload

• Are well tested

• Are well documented

• Are easy to install

• Don’t break backwards compatibility by surprise

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Components ...

• Autoload

• Are well tested

• Are well documented

• Are easy to install

• Don’t break backwards compatibility by surprise

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Components ...

• Autoload

• Are well tested

• Are well documented

• Are easy to install

• Don’t break backwards compatibility by surprise

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Components ...

• Autoload

• Are well tested

• Are well documented

• Are easy to install

• Don’t break backwards compatibility by surprise

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks

Business Logic Data Model Utilities

App Code Plugins

Application

Components

Keep Components Outside Of Your App

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks

Business Logic Data Model Utilities

App Code Plugins

Autoloader

Application

Components

Use An Autoloader To Pull In Components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks

Business Logic Data Model Utilities

App Code Plugins

Autoloader

Application

Components

Why Use An Autoloader?

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Frameworks

Business Logic Data Model Utilities

App Code Plugins

Autoloader

Application

Components

Autoloading Makes Life Easy!

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Who has heard of PSR0?

• http://groups.google.com/group/php-standards/web/psr-0-final-proposal

• Backed by leading names in the community

• Perfect for a component approach

One True Autoloader

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Who has heard of PSR0?

• http://groups.google.com/group/php-standards/web/psr-0-final-proposal

• Backed by leading names in the community

• Perfect for a component approach

One True Autoloader

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Who has heard of PSR0?

• http://groups.google.com/group/php-standards/web/psr-0-final-proposal

• Backed by leading names in the community

• Perfect for a component approach

One True Autoloader

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Who has heard of PSR0?

• http://groups.google.com/group/php-standards/web/psr-0-final-proposal

• Backed by leading names in the community

• Perfect for a component approach

One True Autoloader

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Namespace separators ‘\’ become DIRECTORY_SEPARATOR

• Underscore in class names ‘_’ become DIRECTORY_SEPARATOR

• Top namespace is your organisation

• Achieves 1:1 mapping from classname to filename on disk

PSR0 Autoloader

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Namespace separators ‘\’ become DIRECTORY_SEPARATOR

• Underscore in class names ‘_’ become DIRECTORY_SEPARATOR

• Top namespace is your organisation

• Achieves 1:1 mapping from classname to filename on disk

PSR0 Autoloader

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Namespace separators ‘\’ become DIRECTORY_SEPARATOR

• Underscore in class names ‘_’ become DIRECTORY_SEPARATOR

• Top namespace is your organisation

• Achieves 1:1 mapping from classname to filename on disk

PSR0 Autoloader

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Namespace separators ‘\’ become DIRECTORY_SEPARATOR

• Underscore in class names ‘_’ become DIRECTORY_SEPARATOR

• Top namespace is your organisation

• Achieves 1:1 mapping from classname to filename on disk

PSR0 Autoloader

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Autoloader Examples

• Phin_Project\ExtenderLib\FileLoader ->Phin_Project/ExtenderLib/FileLoader.php

• Phin_Project\Console\Std_Out ->Phin_Project/Console/Std/Out.php

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Autoloader Examples

• Phin_Project\ExtenderLib\FileLoader ->Phin_Project/ExtenderLib/FileLoader.php

• Phin_Project\Console\Std_Out ->Phin_Project/Console/Std/Out.php

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Autoloader Component

• pear channel-discover pear.gradwell.com

• pear install Gradwell/Autoloader

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Autoloader Component

• pear channel-discover pear.gradwell.com

• pear install Gradwell/Autoloader

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/3c2W8q

Beyond Frameworks

Testing

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

PHPUnit

• De-facto standard for unit-testing PHP code

• Supported by leading IDEs

• Supported by CI environments

• Perfect for use with components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

PHPUnit

• De-facto standard for unit-testing PHP code

• Supported by leading IDEs

• Supported by CI environments

• Perfect for use with components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

PHPUnit

• De-facto standard for unit-testing PHP code

• Supported by leading IDEs

• Supported by CI environments

• Perfect for use with components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

PHPUnit

• De-facto standard for unit-testing PHP code

• Supported by leading IDEs

• Supported by CI environments

• Perfect for use with components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Tests ...

• Document supported behaviour

• Have separate tests for reported bugs

• Cover 100% of the component’s code

• Ship with the component

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Tests ...

• Document supported behaviour

• Have separate tests for reported bugs

• Cover 100% of the component’s code

• Ship with the component

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Tests ...

• Document supported behaviour

• Have separate tests for reported bugs

• Cover 100% of the component’s code

• Ship with the component

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Tests ...

• Document supported behaviour

• Have separate tests for reported bugs

• Cover 100% of the component’s code

• Ship with the component

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Getting PHPUnit

• Visit www.phpunit.de

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/6wuB99

Beyond Frameworks

Documentation

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

The PHP ManualIs One Of

PHP’s Killer Features

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Make Your Documentation At Least As Good!

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Explain how to load the component

• Describe how you intend it to be used

• Give several (non-trivial!) examples

• Capture notes / FAQs

Good Documentation

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Explain how to load the component

• Describe how you intend it to be used

• Give several (non-trivial!) examples

• Capture notes / FAQs

Good Documentation

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Explain how to load the component

• Describe how you intend it to be used

• Give several (non-trivial!) examples

• Capture notes / FAQs

Good Documentation

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Explain how to load the component

• Describe how you intend it to be used

• Give several (non-trivial!) examples

• Capture notes / FAQs

Good Documentation

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Write It Down ...

• ... so you don’t have to remember

• ... so you don’t have to keep explaining it to others

• ... so you don’t have to read the source

• ... so that others are more likely to reuse your efforts

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Write It Down ...

• ... so you don’t have to remember

• ... so you don’t have to keep explaining it to others

• ... so you don’t have to read the source

• ... so that others are more likely to reuse your efforts

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Write It Down ...

• ... so you don’t have to remember

• ... so you don’t have to keep explaining it to others

• ... so you don’t have to read the source

• ... so that others are more likely to reuse your efforts

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Write It Down ...

• ... so you don’t have to remember

• ... so you don’t have to keep explaining it to others

• ... so you don’t have to read the source

• ... so that others are more likely to reuse your efforts

Stuart Herbert - http://blog.stuartherbert.com/php/

www.phpunit.de/manual/3.5/en/

Beyond Frameworks

Docbook a la PHPUnit

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

What About phpDoc?

• Useful for IDE code auto-completion

• Useful as a summary of a method’s purpose

• Reference documentation, not a manual

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

What About phpDoc?

• Useful for IDE code auto-completion

• Useful as a summary of a method’s purpose

• Reference documentation, not a manual

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

What About phpDoc?

• Useful for IDE code auto-completion

• Useful as a summary of a method’s purpose

• Reference documentation, not a manual

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/41vMUJ

Beyond Frameworks

Packaging & Installation

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

PEAR Installer

• Love it or hate it, PEAR package format is a community-created solution

• PEAR installer found on most computers

• Supports installing both system-wide and into a sandbox

• Simple to publish your own package repo

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

PEAR Installer

• Love it or hate it, PEAR package format is a community-created solution

• PEAR installer found on most computers

• Supports installing both system-wide and into a sandbox

• Simple to publish your own package repo

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

PEAR Installer

• Love it or hate it, PEAR package format is a community-created solution

• PEAR installer found on most computers

• Supports installing both system-wide and into a sandbox

• Simple to publish your own package repo

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

PEAR Installer

• Love it or hate it, PEAR package format is a community-created solution

• PEAR installer found on most computers

• Supports installing both system-wide and into a sandbox

• Simple to publish your own package repo

Stuart Herbert - http://blog.stuartherbert.com/php/

http://www.pirum-project.org/

Beyond Frameworks

Pirum

Stuart Herbert - http://blog.stuartherbert.com/php/

pear channel-discover pear.gradwell.com

Beyond Frameworks

Your Own PEAR Channel

Stuart Herbert - http://blog.stuartherbert.com/php/

github.com/Gradwell/phix

Beyond Frameworks

Phix For Making Components

Stuart Herbert - http://blog.stuartherbert.com/php/

http://flic.kr/p/5aK8jA

Beyond Frameworks

Backwards Compatible

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why It Matters

• Isolating code into components reduces amount of code that is affected by change

• Backwards-compatibility breaks immediately negate that advantage

• The more apps use a component, the worse the b/c breakage cost scales

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why It Matters

• Isolating code into components reduces amount of code that is affected by change

• Backwards-compatibility breaks immediately negate that advantage

• The more apps use a component, the worse the b/c breakage cost scales

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Why It Matters

• Isolating code into components reduces amount of code that is affected by change

• Backwards-compatibility breaks immediately negate that advantage

• The more apps use a component, the worse the b/c breakage cost scales

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Transparent Versions

• X.Y.Z scheme

• X == Major version / API / ABI version

• Y == Minor new features

• Z == Bug fixes

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Transparent Versions

• X.Y.Z scheme

• X == Major version / API / ABI version

• Y == Minor new features

• Z == Bug fixes

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Transparent Versions

• X.Y.Z scheme

• X == Major version / API / ABI version

• Y == Minor new features

• Z == Bug fixes

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Transparent Versions

• X.Y.Z scheme

• X == Major version / API / ABI version

• Y == Minor new features

• Z == Bug fixes

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

You Can Break B/C

• Just don’t do it by surprise!

• Don’t be afraid to increment X in X.Y.Z

• Google Chrome is already on 10.y.z ...

• ... and it hasn’t done it any harm

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

You Can Break B/C

• Just don’t do it by surprise!

• Don’t be afraid to increment X in X.Y.Z

• Google Chrome is already on 10.y.z ...

• ... and it hasn’t done it any harm

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

You Can Break B/C

• Just don’t do it by surprise!

• Don’t be afraid to increment X in X.Y.Z

• Google Chrome is already on 10.y.z ...

• ... and it hasn’t done it any harm

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

You Can Break B/C

• Just don’t do it by surprise!

• Don’t be afraid to increment X in X.Y.Z

• Google Chrome is already on 10.y.z ...

• ... and it hasn’t done it any harm

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

To Recap ...

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Components ...

• Autoload

• Are well tested

• Are well documented

• Are easy to install

• Don’t break backwards compatibility by surprise

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Components ...

• Autoload

• Are well tested

• Are well documented

• Are easy to install

• Don’t break backwards compatibility by surprise

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Components ...

• Autoload

• Are well tested

• Are well documented

• Are easy to install

• Don’t break backwards compatibility by surprise

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Components ...

• Autoload

• Are well tested

• Are well documented

• Are easy to install

• Don’t break backwards compatibility by surprise

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Good Components ...

• Autoload

• Are well tested

• Are well documented

• Are easy to install

• Don’t break backwards compatibility by surprise

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

... If They ...

• PSR0 - compliant autoloading

• PHPUnit tests

• Docbook manual

• Packages installed via PEAR installer

• Transparent version numbers

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

... If They ...

• PSR0 - compliant autoloading

• PHPUnit tests

• Docbook manual

• Packages installed via PEAR installer

• Transparent version numbers

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

... If They ...

• PSR0 - compliant autoloading

• PHPUnit tests

• Docbook manual

• Packages installed via PEAR installer

• Transparent version numbers

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

... If They ...

• PSR0 - compliant autoloading

• PHPUnit tests

• Docbook manual

• Packages installed via PEAR installer

• Transparent version numbers

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

... If They ...

• PSR0 - compliant autoloading

• PHPUnit tests

• Docbook manual

• Packages installed via PEAR installer

• Transparent version numbers

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

4: An Example

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

We Sell Broadband Via Our Sales Website ...

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

Customer Account

Control Panel

Invoicing

AvailabilityChecker

And Our Customer Control Panel

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

Customer Account

Control Panel

Invoicing

AvailabilityChecker

iFrame

The Control Panel Holds The Code HostageThe Sales Site Relies On An iFrame

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

Customer Account

Control Panel

Invoicing

AvailabilityChecker

Provisioning

Third Party

Faults

AvailabilityChecker

... And The Control Panel TalksTo The Third Party Who Provides Our Broadband

SOAPiFrame

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

Customer Account

Control Panel

Invoicing

AvailabilityChecker

Provisioning

Third Party

Faults

AvailabilityChecker

We Wanted To Sell Exciting New Broadband ProductsFrom An Alternative Third Party As Well

SOAPiFrame

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

Customer Account

Control Panel

Invoicing

AvailabilityChecker

Provisioning

Third Party

Faults

AvailabilityChecker

Changing The Control PanelWas Going To Be Expensive ...

SOAPiFrame

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

Customer Account

Control Panel

Invoicing

AvailabilityChecker

Provisioning

Third Party

Faults

AvailabilityChecker

... But Was The Only WayTo Change The Sales Website

SOAPiFrame

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

Customer Account

Control Panel

Invoicing

AvailabilityChecker

Provisioning

Third Party

Faults

AvailabilityChecker

Problem Is ...We Are Due To Retire This Control Panel

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

AvailabilityChecker

Provisioning

Third Party

Faults

AvailabilityChecker

We Separated Out The Business LogicOf The Availability Checker

SOAP

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

Customer Account

Control Panel

Invoicing

AvailabilityChecker

Provisioning

Third Party

Faults

AvailabilityChecker

Sales Can Now Improve Their WebsiteWithout Having To Rely On Control Panel’s Roadmap

SOAP

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

Customer Account

Control Panel

Invoicing

AvailabilityChecker

Provisioning

Third Party

Faults

AvailabilityChecker

Allowing Engineering To RetireThis Version Of The Control Panel

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

Sales Pitch

Sales Website

Product Specs

AvailabilityChecker

Customer Account

Control Panel 2

Invoicing

AvailabilityChecker

Provisioning

Third Party

Faults

AvailabilityChecker

And The New Control PanelWill Simply Re-use The Component Before Launch

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Our customer profile has changed

• We have outgrown our old applications

• We are refactoring all of the needed logic from our old applications

• Allows Sales and Engineering roadmaps to move without major log jams

• Allows more features (especially internal ones)to be shared across more of our apps

Moving To Components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Our customer profile has changed

• We have outgrown our old applications

• We are refactoring all of the needed logic from our old applications

• Allows Sales and Engineering roadmaps to move without major log jams

• Allows more features (especially internal ones)to be shared across more of our apps

Moving To Components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Our customer profile has changed

• We have outgrown our old applications

• We are refactoring all of the needed logic from our old applications

• Allows Sales and Engineering roadmaps to move without major log jams

• Allows more features (especially internal ones)to be shared across more of our apps

Moving To Components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Our customer profile has changed

• We have outgrown our old applications

• We are refactoring all of the needed logic from our old applications

• Allows Sales and Engineering roadmaps to move without major log jams

• Allows more features (especially internal ones)to be shared across more of our apps

Moving To Components

Stuart Herbert - http://blog.stuartherbert.com/php/Beyond Frameworks

• Our customer profile has changed

• We have outgrown our old applications

• We are refactoring all of the needed logic from our old applications

• Allows Sales and Engineering roadmaps to move without major log jams

• Allows more features (especially internal ones)to be shared across more of our apps

Moving To Components

stuart@stuartherbert.com - http://blog.stuartherbert.com/php/

Stuart Herbert

Thanks For Your Time

Feedback welcome!

I’d love to hear your stories

stuart@stuartherbert.com - http://blog.stuartherbert.com/php/

Stuart Herbert

This photo: http://flic.kr/p/3PU451

top related