Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"

Elizabeth M Smith (17.Sep.2008 at 09:45)
Talk at Zend/PHP Conference & Expo 2008 (English - US)

Rating: 0 of 5

Optimizing your code for PHP5 is better for performance and maintainability reasons, and makes your code more flexible and useful. But moving code from the "Runs on PHP5" to the "Written for PHP5" designation can be a confusing process, and a rewrite is seldom a good option. However you can "cut out the cruft" without throwing out the codebase. And designing a new project means you need to know what PHP5 can do for you and think about how to use "built-in tools" from the very beginning.

You can't get your application up to speed for PHP5 without knowing the cool things that can make your life easier. Most books and talks focus on the differences between PHP5 and PHP4 and how to migrate the code, make it run. Few focus on the new tools available. This is a rundown of new tools in PHP5 that can help you have better code. The highlights are the new object model, SPL tools, Streams and filter enhancements, reflection, datetime, filter, json, lots of xml tools, and new array goodies. Not to mention sapi improvements.

After your toolbox is ready we can move on to architecting a project. Now there are two types of projects, shiny new stuff and old legacy code. Although they seem they'd require very different approaches instead the ideas to keep in mind are very similiar. Start by deciding what technologies you'll be using and what you'll need to support. Take that information and decide what can leverage "built-in" functionality. If it is a new project, decisions can be made to use things that were never available on PHP4, for existing projects, you may find hundreds of lines of items like xml parsers can be scrapped. Then pay attention to what PHP5 strengths can be exploited, and what legacy hacks for bugs and limitations in PHP4 can be thrown out the window.

Your finished product is an application that isn't just PHP4 code on life support, but rather a shiny, fast,
efficient project that is "Written for PHP5"

Who are you?

Claim talk

By clicking this button you are declaring that you are the speaker responsible for it and a claim request will be sent to the administrator of the event.

If the claim is approved you will be able to edit the information for this talk.

Are you sure?

 
Comments closed.
 
No comments yet.
Cloud server hosting by Combell Combell      © Joind.in 2012