enterprise php (php|works 2008)

Download Enterprise PHP (php|works 2008)

Post on 18-May-2015

11.450 views

Category:

Technology

2 download

Embed Size (px)

DESCRIPTION

Enterprise PHP presentation at the php|works conference in november 2008 in Atlanta.

TRANSCRIPT

  • 1. Enterprise PHP Development Ivo Jansch - ivo@ibuildings.com php|works 2008Enterprise PHP

2. Whats an Enterprise? Any of several ships by that name in the Star Trek universe Wikipedia Enterprise PHP 3. Whats an Enterprise? Any of several ships by that name in the Star Trek universe Wikipedia Enterprise PHP 4. Whats an Enterprise?Any of several ships by that namein the Star Trek universe Wikipedia A business, company or comparable organizationEnterprise PHP 5. PHP usage is changing Enterprise PHP 6. PHP usage is changing 1998 Personal stuff Enterprise PHP 7. PHP usage is changing 1998 Personal stuff2003 Simple websites Content management Blogs Enterprise PHP 8. PHP usage is changing 1998 Personal stuff2003 Simple websites Content management Blogs2008 Big websites Banks Insurance CompaniesEnterprise PHP 9. PHPs Quest so far Enterprise SMESOHOEnterprise PHP 10. Is PHP enterprise ready? Enterprise PHP 11. Is PHP enterprise ready? Big Small Enterprise friendly Lightweight enterpriCe Inexpensive CS required Easy to learn Enterprise PHP 12. A word from my girlfriend It's not the SIZE of the tool... It's how you USE it. Enterprise PHP 13. Traditional PHP metaphor PHP is like LEGO bricks Enterprise PHP 14. Improved metaphorPHP is no longer a toyLets use the metaphor of actual bricks Enterprise PHP 15. About Bricks Extreme Simplicity Easy to learn Versatile Inexpensive Enterprise PHP 16. Enterprise DevelopmentIn 10 steps Enterprise PHP 17. Step 1 The TeamI have read about your plans to build a newskyscraper and I am applying for a job.I have a lot of experience with Bricks. I taught myselfhow to use them and have been maintaining ourfamily 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 Certication Enterprise PHP 19. Step 2 - Requirements What does the customer want? What will visitors want? What does the customer really need?Enterprise PHP 20. Step 2 - Requirements Functional Design Requirements Denition Interaction Design / Wireframes Flow Diagrams Tip: AxureEnterprise PHP 21. Step 3 - Architecture Enterprise PHP 22. Step 3 - Architecture Dont just start stacking bricks Enterprise PHP 23. Step 3 - Architecture Dont just start stacking bricksCreate an architecture rstEnterprise PHP 24. Step 3 - Architecture Technical Design Modeling Class Diagrams ER Diagrams (data model) Collaboration Diagrams Use Cases etc. Tools: UML WhiteboardsEnterprise PHP 25. Step 3 - Architecture High Level Architectures: MVC (Model, View, Controller) SOA (Service Oriented Architecture) Multi-tier development (Frontend, Application, BL, Data) CBD (Component Based Development) Enterprise PHP 26. Step 4 - Tools Enterprise PHP 27. Step 4 - Tools You dont need tools Enterprise PHP 28. Step 4 - Tools You dont need toolsBut they make you productive Enterprise PHP 29. Step 4 - Tools Development: Eclipse PDT Zend Studio PhpEd Vim KomodoIDEs versus Editors Debugging & Proling Syntax Check Cross-Referencing / NavigationEnterprise PHP 30. Step 4 - Tools Development: Eclipse PDT Zend Studio PhpEd Vim KomodoIDEs versus Editors Debugging & Proling Syntax Check Cross-Referencing / NavigationEnterprise PHP 31. Step 4 - Tools Enterprise PHP 32. Step 4 - Tools Source Control CVS / SVN / MS VSS Bitkeeper / GITEnterprise PHP 33. Step 4 - Tools Source Control CVS / SVN / MS VSS Bitkeeper / GIT Documentation phpDocumentorhttp://phpdoc.org PHPXRefhttp://phpxref.sourceforge.net Wiki http://en.wikipedia.org/wiki/List_of_wiki_softwareEnterprise PHP 34. Step 5 - Foundation 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 componentsExamples Zend Framework http://framework.zend.com ezComponents http://ez.no/ezcomponents Symfony http://www.symfony-project.org ATK http://www.atk-framework.comEnterprise 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 40. Step 6 - Design Patterns Enterprise PHP 41. Step 6 - Design Patterns A window is a concept Best practice way of solving a particular problemEnterprise 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 patternEnterprise 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, DecoratorEnterprise 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 46. Step 7 - Testing Various types of testing: Developer testing Functional testing Environment testing Performance testing Usability testing Enterprise PHP 47. Step 7 - TestingA common scenario Enterprise PHP 48. Step 7 - TestingThe user complainsMWOEHA! BUG! Enterprise PHP 49. Step 7 - TestingDeveloper attacks the problemx_bug(); Enterprise PHP 50. Step 7 - TestingProblem Solved! Enterprise PHP 51. Step 7 - Testing Enterprise PHP 52. Step 7 - Testing Solution: Unit TestsAutomated testing after each changePrevents regressions Enterprise PHP 53. Step 7 - Testing Solution: Unit TestsAutomated testing after each changePrevents regressions Testing for PHP applications:PHPUnit http://www.phpunit.de/SimpleTesthttp://www.lastcraft.com/simple_test.php Enterprise PHP 54. Step 7 - Testing Solution: Unit TestsAutomated testing after each changePrevents regressions Testing for PHP applications:PHPUnit http://www.phpunit.de/SimpleTesthttp://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. Dene functionality 2. Create testcase 3. Run test => test fails 4. Implement functionality Test succeeds? Done Test fails? RefactorRepeat step 4 until nishedEnterprise PHP 56. Step 8 - Optimization Users are reporting: quot;I work on the 197th oor. Every day Ihave to walk the stairs for 2 hours, then Ihave only 4 hours left to do my job.quot; Enterprise PHP 57. Step 8 - Optimization Solution: Elevator Enterprise PHP 58. Step 8 - Optimization 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 buildingcompile index.php; // go to floor 197echo 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 buildingcompile index.php;// go to floor 197echo 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 buildingcompile index.php;// go to floor 197echo Hello World; // get the job done An accelerator improves the rst 2 steps Accelerators for PHP: APC http://pecl.php.net/package/APC eAcceleratorhttp://eaccelerator.net/ Zend Platform http://www.zend.com/products/zend_platform Enterprise PHP 63. Step 8 - OptimizationUsers complain: Every time I want coffee I have to go to the top oor to get some. Enterprise PHP 64. Step 8 - Optimization Enterprise PHP 65. Step 8 - Optimization Solution: Create small coffee corners on every oor so people donthave to go to the main restaurant every time.Enterprise PHP 66. Step 8 - Optimization Solution:Create small coffee corners on every oor so people dont have to go to the main restaurant every time. In PHP we call this cachingDont query the database everytime you need dataUse locally stored copy (le or memory) Enterprise PHP 67. Step 8 - Optimization Solution:Create small coffee corners on every oor so people dont have to go to the main restaurant every time. In PHP we call this cachingDont query the database everytime you need dataUse locally stored copy (le or memory) PHP Caching solutions:Zend_Cache http://framework.zend.com Zend Platformhttp://www.zend.com/products/zend_platform Memcachedhttp://danga.com/memcached/Enterprise PHP 68. Step 9 - Deployment Lifecycle:DevelopTestDeploy to staging environmentDeploy to live Use SVN Code is just a part, don't forget the database Create a 'Deployment & Release Prole'Enterprise PHP 69. Step 9 - Deployment System ArchitecturePHPMySQLApacheLinux From a simple single machine LAMP stack Enterprise PHP 70. Step 9 - Deployment to a High Availability, Scalable Architecture Enterprise PHP 71. Step 10 - OperationsMonitor