2. Whatâs an Enterprise?
âAny of several ships by that name
in the Star Trek universeâ â Wikipedia
Enterprise PHP
3. Whatâs an Enterprise?
âAny of several ships by that name
in the Star Trek universeâ â Wikipedia
Enterprise PHP
4. Whatâs an Enterprise?
âAny of several ships by that name
in the Star Trek universeâ â Wikipedia
âA business, company or comparable organizationâ
Enterprise PHP
17. Step 1 â The Team
âI have read about your plans to build a new
skyscraper and I am applying for a job.
I have a lot of experience with Bricks. I taught myself
how to use them and have been maintaining our
family shed for a few years now.â
Enterprise PHP
18. Step 1 â The Team
⢠Be a Software Engineer
⢠Train your skills
⢠Study OO principles
⢠Consider Zend CertiďŹcation
Enterprise PHP
19. Step 2 - Requirements
⢠What does the customer want?
⢠What will visitors want?
⢠What does the customer really need?
Enterprise PHP
35. Step 5 - Foundation
Start stacking bricks?
⢠How many bricks does it take?
⢠What about stability?
Enterprise PHP
36. Step 5 - Foundation
Start stacking bricks?
⢠How many bricks does it take?
⢠What about stability?
Start with a foundation
Enterprise PHP
37. Step 5 - Foundation
Use a framework
⢠Provides guidelines (frame)
⢠Off the shelf components
Examples
⢠Zend Framework â http://framework.zend.com
⢠ezComponents â http://ez.no/ezcomponents
⢠Symfony â http://www.symfony-project.org
⢠ATK â http://www.atk-framework.com
Enterprise PHP
38. Step 5 - Foundation
The âNot Invented Hereâ Syndrome:
⢠âThe existing frameworks are no good.
I can do this better.â
⢠âThis framework is no good.
It can do A through Y but I need Z.â
⢠âThis framework is too big.
It provides A-Z but we only need A and B.â
⢠âI know there's a good framework.
But I would like to learn.â
Enterprise PHP
39. Step 6 - Design Patterns
Requirement 1056.4:
We need to be able to look outside,
but we can't make holes in the wall
(rain should be kept outside).
When it's sunny, a hole is ok.
Enterprise PHP
41. Step 6 - Design Patterns
⢠A âwindowâ is a concept
⢠Best practice way of solving a particular problem
Enterprise PHP
42. Step 6 - Design Patterns
⢠A âwindowâ is a concept
⢠Best practice way of solving a particular problem
⢠In IT, we call this a âdesign patternâ
Enterprise PHP
43. Step 6 - Design Patterns
⢠A âwindowâ is a concept
⢠Best practice way of solving a particular problem
⢠In IT, we call this a âdesign patternâ
⢠Popular patterns in PHP:
⢠MVC, Factory, Singleton, Registry, Decorator
Enterprise PHP
44. Step 6 - Design Patterns
⢠A âwindowâ is a concept
⢠Best practice way of solving a particular problem
⢠In IT, we call this a âdesign patternâ
⢠Popular patterns in PHP:
⢠MVC, Factory, Singleton, Registry, Decorator
⢠Good read:
⢠php|architect's Guide to PHP Design Patterns
- Jason E. Sweat
Enterprise PHP
45. Step 7 - Testing
Is your software tested after it has gone live?
Enterprise PHP
52. Step 7 - Testing
⢠Solution: Unit Tests
⢠Automated testing after each change
⢠Prevents regressions
Enterprise PHP
53. Step 7 - Testing
⢠Solution: Unit Tests
⢠Automated testing after each change
⢠Prevents regressions
⢠Testing for PHP applications:
⢠PHPUnit
http://www.phpunit.de/
⢠SimpleTest
http://www.lastcraft.com/simple_test.php
Enterprise PHP
54. Step 7 - Testing
⢠Solution: Unit Tests
⢠Automated testing after each change
⢠Prevents regressions
⢠Testing for PHP applications:
⢠PHPUnit
http://www.phpunit.de/
⢠SimpleTest
http://www.lastcraft.com/simple_test.php
⢠Continuous Integration:
â˘CruiseControl
http://cruisecontrol.sourceforge.net/
⢠phpUnderControl
http://www.phpundercontrol.org/
Enterprise PHP
55. Step 7 - Testing
⢠Test Driven Development
1. DeďŹne functionality
2. Create testcase
3. Run test => test fails
4. Implement functionality
⢠Test succeeds? Done
⢠Test fails? Refactor
Repeat step 4 until ďŹnished
Enterprise PHP
56. Step 8 - Optimization
Users are reporting:
quot;I work on the 197th ďŹoor. Every day I
have to walk the stairs for 2 hours, then I
have only 4 hours left to do my job.quot;
Enterprise PHP
57. Step 8 - Optimization
Solution: Elevator
Enterprise PHP
59. Step 8 - Optimization
In PHP, this âelevatorâ is called an âacceleratorâ
Enterprise PHP
60. Step 8 - Optimization
In PHP, this âelevatorâ is called an âacceleratorâ
⢠This is how PHP works (pseudo-ish code):
read index.php; // enter the building
compile index.php; // go to floor 197
echo âHello Worldâ; // get the job done
Enterprise PHP
61. Step 8 - Optimization
In PHP, this âelevatorâ is called an âacceleratorâ
⢠This is how PHP works (pseudo-ish code):
read index.php; // enter the building
compile index.php; // go to floor 197
echo âHello Worldâ; // get the job done
⢠An accelerator improves the ďŹrst 2 steps
Enterprise PHP
62. Step 8 - Optimization
In PHP, this âelevatorâ is called an âacceleratorâ
⢠This is how PHP works (pseudo-ish code):
read index.php; // enter the building
compile index.php; // go to floor 197
echo âHello Worldâ; // get the job done
⢠An accelerator improves the ďŹrst 2 steps
⢠Accelerators for PHP:
⢠APC
http://pecl.php.net/package/APC
⢠eAccelerator
http://eaccelerator.net/
⢠Zend Platform
http://www.zend.com/products/zend_platform
Enterprise PHP
63. Step 8 - Optimization
Users complain:
âEvery time I want coffee I have to go
to the top ďŹoor to get some.â
Enterprise PHP
65. Step 8 - Optimization
⢠Solution:
⢠Create small coffee corners on every ďŹoor so people donât
have to go to the main restaurant every time.
Enterprise PHP
66. Step 8 - Optimization
⢠Solution:
⢠Create small coffee corners on every ďŹoor so people donât
have to go to the main restaurant every time.
⢠In PHP we call this caching
⢠Donât query the database everytime you need data
⢠Use locally stored copy (ďŹle or memory)
Enterprise PHP
67. Step 8 - Optimization
⢠Solution:
⢠Create small coffee corners on every ďŹoor so people donât
have to go to the main restaurant every time.
⢠In PHP we call this caching
⢠Donât query the database everytime you need data
⢠Use locally stored copy (ďŹle or memory)
⢠PHP Caching solutions:
â˘Zend_Cache
http://framework.zend.com
⢠Zend Platform
http://www.zend.com/products/zend_platform
⢠Memcached
http://danga.com/memcached/
Enterprise PHP
68. Step 9 - Deployment
⢠Lifecycle:
⢠Develop
⢠Test
⢠Deploy to staging environment
⢠Deploy to live
⢠Use SVN
⢠Code is just a part, don't forget the database
⢠Create a 'Deployment & Release ProďŹle'
Enterprise PHP
69. Step 9 - Deployment
System Architecture
PHP
MySQL
Apache
Linux
From a simple single machine LAMP stackâŚ
Enterprise PHP
70. Step 9 - Deployment
⌠to a High Availability, Scalable Architecture
Enterprise PHP
71. Step 10 - Operations
Monitoring:
⢠LogďŹles
⢠Monitor infrastructure (tools such as Nagios)
⢠Monitor application (tools such as Zend Platform)
⢠Monitor business (is the money still pouring in?)
Enterprise PHP
72. Step 10 - Operations
Debugging
⢠Ideal:
âI had error x when I selected y after I clicked zâ
⢠Reality:
âIt doesn't work!â
âWhat exactly doesn't work, and what did you do?â
âIt just ******** didn't work, FIX IT.â
Enterprise PHP
74. Step 10 - Operations
Change management:
⢠Ticket system
⢠Stick to your deployment - use the DRP
⢠DON'T TOUCH THE LIVE ENVIRONMENT. EVAH!
Enterprise PHP
77. The Big Picture
⢠No âcowboy codingâ, but structured steps
⢠Higher quality
⢠Software will be easier to maintain (and cheaper)
Enterprise PHP
78. The Big Picture
⢠No âcowboy codingâ, but structured steps
⢠Higher quality
⢠Software will be easier to maintain (and cheaper)
⢠Development methodology
⢠Waterfall
⢠Agile (DSDM, XP, Scrum)
Enterprise PHP
79. The Big Picture
⢠No âcowboy codingâ, but structured steps
⢠Higher quality
⢠Software will be easier to maintain (and cheaper)
⢠Development methodology
⢠Waterfall
⢠Agile (DSDM, XP, Scrum)
⢠Software Development Life Cycle (SDLC)
⢠Adapt from existing methods, learn from experts
⢠Document it properly
⢠Make it the cornerstone of your development efforts
Enterprise PHP
80. More things to think about
⢠Planning
⢠Coding
⢠Implementation
⢠Security
Enterprise PHP
81. Shameless Plug
Book about this all:
⢠php|architectâs Guide to
Enterprise PHP Development
⢠ISBN: 978-0-9738621-8-8
⢠Order at phparch.com
or amazon.com
⢠http://www.enterprisephp.nl
Enterprise PHP