[email protected] - http://blog.stuartherbert.com/php/
Stuart Herbert
Beyond Frameworks
Using Frameworks Without
Becoming A Hostage To Them
Stuart Herbert
Slide 2
Slide 2 text
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
Slide 3
Slide 3 text
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
Slide 4
Slide 4 text
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
Slide 5
Slide 5 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Contents
1
How
Frameworks
Have Held Us
Hostage
Slide 6
Slide 6 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Contents
2
Our Layered
Architecture
For PHP
Applications
Slide 7
Slide 7 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Contents
3
What Makes
A Good
Component?
Slide 8
Slide 8 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Contents
4
How
Components
Are Helping
Gradwell
Slide 9
Slide 9 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Questions
At The End, Please
Slide 10
Slide 10 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Questions
For The Audience ...
Slide 11
Slide 11 text
Stuart Herbert - http://blog.stuartherbert.com/php/
http://flic.kr/p/R33dr
Beyond Frameworks
Who Uses A Framework?
Slide 12
Slide 12 text
Stuart Herbert - http://blog.stuartherbert.com/php/
http://flic.kr/p/qq6F1
Beyond Frameworks
Who Develops Software Products?
Slide 13
Slide 13 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
1: Hostages
To Frameworks
Slide 14
Slide 14 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Stop Me If You’ve Heard
This One Before ...
Slide 15
Slide 15 text
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!
Slide 16
Slide 16 text
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!
Slide 17
Slide 17 text
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
Slide 18
Slide 18 text
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
Slide 19
Slide 19 text
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
Slide 20
Slide 20 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
So We Used
A Popular Framework ...
Slide 21
Slide 21 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
... Or Two ...
Slide 22
Slide 22 text
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
Slide 23
Slide 23 text
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
Slide 24
Slide 24 text
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
:(
Slide 25
Slide 25 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Framework
Your Code Plugins
What The Architecture Should Look Like
Slide 26
Slide 26 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Your Code Plugins
Framework
What Happened In Reality :(
Slide 27
Slide 27 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
What Practical Challenges
Does This Create?
Slide 28
Slide 28 text
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?
Slide 29
Slide 29 text
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?
Slide 30
Slide 30 text
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?
Slide 31
Slide 31 text
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?
Slide 32
Slide 32 text
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?
Slide 33
Slide 33 text
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?
Slide 34
Slide 34 text
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?
Slide 35
Slide 35 text
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?
Slide 36
Slide 36 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Your Code Plugins
Framework
We Need To Change This ...
Slide 37
Slide 37 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
To What ...?
Slide 38
Slide 38 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
2: Layered Approach
Slide 39
Slide 39 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Frameworks Your Code Plugins
Application
Let’s Take The Original Architecture ...
Slide 40
Slide 40 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Frameworks App Code Plugins
Application
... And Make The App As Thin As Possible
Slide 41
Slide 41 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Frameworks
Business Logic
App Code Plugins
Application
By Extracting Out ...
Slide 42
Slide 42 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Frameworks
Business Logic Data Model
App Code Plugins
Application
By Extracting Out ...
Slide 43
Slide 43 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Frameworks
Business Logic Data Model Utilities
App Code Plugins
Application
By Extracting Out ...
Slide 44
Slide 44 text
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
Slide 45
Slide 45 text
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
Slide 46
Slide 46 text
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
Slide 47
Slide 47 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
The Frameworked App
Becomes A Thin Layer
On Top Of
Framework-agnostic
Reusable Components
Slide 48
Slide 48 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Layered Architecture
Frameworks
Business Logic Data Model Utilities
App Code Plugins
Autoloader
Application
Components
Slide 49
Slide 49 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Layered Architecture
Application
Components
Slide 50
Slide 50 text
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
Slide 51
Slide 51 text
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
Slide 52
Slide 52 text
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
Slide 53
Slide 53 text
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
Slide 54
Slide 54 text
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
Slide 55
Slide 55 text
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
Slide 56
Slide 56 text
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
Slide 57
Slide 57 text
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
Slide 58
Slide 58 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Others Already Do This
Slide 59
Slide 59 text
Stuart Herbert - http://blog.stuartherbert.com/php/
http://flic.kr/p/5oewwy
Beyond Frameworks
Perl Has CPAN Modules
Slide 60
Slide 60 text
Stuart Herbert - http://blog.stuartherbert.com/php/
http://flic.kr/p/uyMuU
Beyond Frameworks
Ruby Has Gems
Slide 61
Slide 61 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
What Makes
A Good Component?
Slide 62
Slide 62 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
3: Good Components
Slide 63
Slide 63 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Component Standards
• Common standards
• Reusable by many
• Interoperable
• Trustable
Slide 64
Slide 64 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Component Standards
• Common standards
• Reusable by many
• Interoperable
• Trustable
Slide 65
Slide 65 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Component Standards
• Common standards
• Reusable by many
• Interoperable
• Trustable
Slide 66
Slide 66 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Component Standards
• Common standards
• Reusable by many
• Interoperable
• Trustable
Slide 67
Slide 67 text
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
Slide 68
Slide 68 text
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
Slide 69
Slide 69 text
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
Slide 70
Slide 70 text
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
Slide 71
Slide 71 text
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
Slide 72
Slide 72 text
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
Slide 73
Slide 73 text
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
Slide 74
Slide 74 text
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?
Slide 75
Slide 75 text
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!
Slide 76
Slide 76 text
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
Slide 77
Slide 77 text
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
Slide 78
Slide 78 text
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
Slide 79
Slide 79 text
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
Slide 80
Slide 80 text
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
Slide 81
Slide 81 text
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
Slide 82
Slide 82 text
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
Slide 83
Slide 83 text
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
Slide 84
Slide 84 text
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
Slide 85
Slide 85 text
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
Slide 86
Slide 86 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Autoloader Component
• pear channel-discover pear.gradwell.com
• pear install Gradwell/Autoloader
Slide 87
Slide 87 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Autoloader Component
• pear channel-discover pear.gradwell.com
• pear install Gradwell/Autoloader
Slide 88
Slide 88 text
Stuart Herbert - http://blog.stuartherbert.com/php/
http://flic.kr/p/3c2W8q
Beyond Frameworks
Testing
Slide 89
Slide 89 text
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
Slide 90
Slide 90 text
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
Slide 91
Slide 91 text
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
Slide 92
Slide 92 text
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
Slide 93
Slide 93 text
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
Slide 94
Slide 94 text
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
Slide 95
Slide 95 text
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
Slide 96
Slide 96 text
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
Slide 97
Slide 97 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Getting PHPUnit
• Visit www.phpunit.de
Slide 98
Slide 98 text
Stuart Herbert - http://blog.stuartherbert.com/php/
http://flic.kr/p/6wuB99
Beyond Frameworks
Documentation
Slide 99
Slide 99 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
The PHP Manual
Is One Of
PHP’s Killer Features
Slide 100
Slide 100 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Make Your Documentation
At Least As Good!
Slide 101
Slide 101 text
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
Slide 102
Slide 102 text
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
Slide 103
Slide 103 text
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
Slide 104
Slide 104 text
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
Slide 105
Slide 105 text
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
Slide 106
Slide 106 text
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
Slide 107
Slide 107 text
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
Slide 108
Slide 108 text
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
Slide 109
Slide 109 text
Stuart Herbert - http://blog.stuartherbert.com/php/
www.phpunit.de/manual/3.5/en/
Beyond Frameworks
Docbook a la PHPUnit
Slide 110
Slide 110 text
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
Slide 111
Slide 111 text
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
Slide 112
Slide 112 text
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
Slide 113
Slide 113 text
Stuart Herbert - http://blog.stuartherbert.com/php/
http://flic.kr/p/41vMUJ
Beyond Frameworks
Packaging & Installation
Slide 114
Slide 114 text
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
Slide 115
Slide 115 text
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
Slide 116
Slide 116 text
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
Slide 117
Slide 117 text
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
Slide 118
Slide 118 text
Stuart Herbert - http://blog.stuartherbert.com/php/
http://www.pirum-project.org/
Beyond Frameworks
Pirum
Slide 119
Slide 119 text
Stuart Herbert - http://blog.stuartherbert.com/php/
pear channel-discover pear.gradwell.com
Beyond Frameworks
Your Own PEAR Channel
Slide 120
Slide 120 text
Stuart Herbert - http://blog.stuartherbert.com/php/
github.com/Gradwell/phix
Beyond Frameworks
Phix For Making Components
Slide 121
Slide 121 text
Stuart Herbert - http://blog.stuartherbert.com/php/
http://flic.kr/p/5aK8jA
Beyond Frameworks
Backwards Compatible
Slide 122
Slide 122 text
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
Slide 123
Slide 123 text
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
Slide 124
Slide 124 text
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
Slide 125
Slide 125 text
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
Slide 126
Slide 126 text
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
Slide 127
Slide 127 text
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
Slide 128
Slide 128 text
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
Slide 129
Slide 129 text
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
Slide 130
Slide 130 text
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
Slide 131
Slide 131 text
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
Slide 132
Slide 132 text
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
Slide 133
Slide 133 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
To Recap ...
Slide 134
Slide 134 text
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
Slide 135
Slide 135 text
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
Slide 136
Slide 136 text
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
Slide 137
Slide 137 text
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
Slide 138
Slide 138 text
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
Slide 139
Slide 139 text
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
Slide 140
Slide 140 text
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
Slide 141
Slide 141 text
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
Slide 142
Slide 142 text
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
Slide 143
Slide 143 text
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
Slide 144
Slide 144 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
4: An Example
Slide 145
Slide 145 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
We Sell Broadband Via Our Sales Website ...
Slide 146
Slide 146 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Customer
Account
Control Panel
Invoicing
Availability
Checker
And Our Customer Control Panel
Slide 147
Slide 147 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Customer
Account
Control Panel
Invoicing
Availability
Checker
iFrame
The Control Panel Holds The Code Hostage
The Sales Site Relies On An iFrame
Slide 148
Slide 148 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Customer
Account
Control Panel
Invoicing
Availability
Checker
Provisioning
Third Party
Faults
Availability
Checker
... And The Control Panel Talks
To The Third Party Who Provides Our Broadband
SOAP
iFrame
Slide 149
Slide 149 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Customer
Account
Control Panel
Invoicing
Availability
Checker
Provisioning
Third Party
Faults
Availability
Checker
We Wanted To Sell Exciting New Broadband Products
From An Alternative Third Party As Well
SOAP
iFrame
Slide 150
Slide 150 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Customer
Account
Control Panel
Invoicing
Availability
Checker
Provisioning
Third Party
Faults
Availability
Checker
Changing The Control Panel
Was Going To Be Expensive ...
SOAP
iFrame
Slide 151
Slide 151 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Customer
Account
Control Panel
Invoicing
Availability
Checker
Provisioning
Third Party
Faults
Availability
Checker
... But Was The Only Way
To Change The Sales Website
SOAP
iFrame
Slide 152
Slide 152 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Customer
Account
Control Panel
Invoicing
Availability
Checker
Provisioning
Third Party
Faults
Availability
Checker
Problem Is ...
We Are Due To Retire This Control Panel
Slide 153
Slide 153 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Availability
Checker
Provisioning
Third Party
Faults
Availability
Checker
We Separated Out The Business Logic
Of The Availability Checker
SOAP
Slide 154
Slide 154 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Customer
Account
Control Panel
Invoicing
Availability
Checker
Provisioning
Third Party
Faults
Availability
Checker
Sales Can Now Improve Their Website
Without Having To Rely On Control Panel’s Roadmap
SOAP
Slide 155
Slide 155 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Customer
Account
Control Panel
Invoicing
Availability
Checker
Provisioning
Third Party
Faults
Availability
Checker
Allowing Engineering To Retire
This Version Of The Control Panel
Slide 156
Slide 156 text
Stuart Herbert - http://blog.stuartherbert.com/php/
Beyond Frameworks
Sales Pitch
Sales Website
Product Specs
Availability
Checker
Customer
Account
Control Panel 2
Invoicing
Availability
Checker
Provisioning
Third Party
Faults
Availability
Checker
And The New Control Panel
Will Simply Re-use The Component Before Launch
Slide 157
Slide 157 text
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
Slide 158
Slide 158 text
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
Slide 159
Slide 159 text
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
Slide 160
Slide 160 text
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
Slide 161
Slide 161 text
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
Slide 162
Slide 162 text
[email protected] - http://blog.stuartherbert.com/php/
Stuart Herbert
Thanks For Your Time
Feedback welcome!
I’d love to hear your stories
Slide 163
Slide 163 text
[email protected] - http://blog.stuartherbert.com/php/
Stuart Herbert
This photo: http://flic.kr/p/3PU451