November 2, 2006

PHP - Where exactly do you sit?

You will find other articles relevant to this document in these sections:
Cameron Manderson @ 11:43 pm

I read an article recently about more on the Zend and IBM partnership, which I have been aware of for some time, but hadn’t quite seen it phrased this way - PHP is to compete against .NET for SME web applications. For me that was a big ‘wow’ statement.

When researching technologies for enterprise application development I have seen often a lot of Java technologies such as JSF, Spring/Hibernate, Struts and Tapestry - yet I rarely see in the same article the emerging structures from PHP or .NET. It is like there is a bottom teir that  PHP, .NET and RoR falls into, great for lower level projects or specific implementations (such as rapid development with RoR and .NET, and speed and simplicity of PHP) . It has made me really think about how PHP lacks against the other technologies, and also trying to identify the best use for PHP - where does it end and others begin? If at all?
For me PHP has clearly been always a light-weight development tool that performs well. But it does lack a lot of enterprise level functionality, such as persistence layers and MVC frameworks and a useful class API (not just functions, but well structured classes/interfaces). This has sparked a lot of additional projects such as PEAR/Pecl which has aimed at providing additional class functionality. As a comparison I have seen .NET to have those parts of the application framework solved as part of its standard offer, and C# is great, but if you were to step up to that level you would be better off stepping into the JEE realm, as there is much more richness, developer focus, resources and technologies (personal preference) - and “it isn’t evil” as my old boss would say.

As a result taking the leap from PHP to JEE has been in the past quite large, and there is often debate in my mind where the line is between the projects. If you step up from PHP not only do you need a dedicated production environment (no adequate shared hosting in Australia) but you need to step the whole infrastructure of your applications up in their configuration. This has lead me down the path of introducing and leveraging off contributed frameworks for PHP, which have almost always been modeled off Java. Persistence layering homegrown, database abstraction ADOdb, MVC with php.MVC etc.

But once you start to build your aps and really press into these different packages you start to feel that you are just trying to implement concepts that have been around for 5+years in Java anyway, and hunders of developers are contributing to its stable releases and documentation. Also you then start to encounter overheads in loading of packages of PHP and then find you have to use cut down versions (such as ADOdb_lite etc) to try and pick up the performance back for your requests (as every request builds up and tears down). It feels like you are always trying to port framework ideas into PHP, when if you just took the next step up to JEE all your problems will be gone. But remember, dedicated production environment, bogus configurations, argh!

So I am interested to see what Zend and IBM start to introduce to make working for small to medium enterprise applications easier, without ending up creating a mix and match purpose driven dribble snippets of code, like a API to work with google, instead of dealing with creating a real set of structure that you can build off. Real sets of interfaces and classes to deal with first, then the nicer tricks built off the top.

So what things do I dig at the moment that are going on in the PHP world that will really excite where it is going?

- PDO - Formalising some structure behind database connectivity
- SDO - Single API for data, introducing concepts of Persistence and Object Relational Mapping
- XML - PHP5 with various additions of DOM, simpleXML etc - XML is great for almost everything
- Web Services - Ensuring future interoperability with larger parts of the application
Hopefully with the Zend Framework being developed on we will see more core structure and packages coming out dealing with collections, HTTP request objects and database etc, and then eventually see more application frameworks (MVC’s etc) being introduced. This may lead to a scenario where PHP can really sit into that small-medium project size, being able to be as simple as a Hello World web application in 1 line but still having the ability to scale into a medium app with MVC, abstraction and persistence. And, due to the XML and Webservices functionality provided in the newer PHP versions we will see PHP sit more and more definatively into its position in the industry.

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Furl
  • Reddit
  • YahooMyWeb

4 Comments »

  1. Thanks Cam that’s a real informative article ;)

    The fact is PHP was designed to be a simple scripted programming language much like ASP (but better). It wasn’t designed with OOP in mind and it doesn’t come with a nice cosy framework like .Net. These things have only come about in recent years in an attempt to make PHP a viable open-source alternative to .Net and similar serverside technologies.

    IMHO you are kidding yourself if you ever thought of using PHP for enterprise development. From what I’ve seen big enterprise look after big enterprise - which is why open-source will always struggle in the corporate market.

    Comment by Richard Lee — November 3, 2006 @ 11:09 am

  2. Here’s another interesting article on this debate

    http://blogs.techrepublic.com.com/programming-and-development/?p=85

    Comment by Richard Lee — November 3, 2006 @ 11:14 am

  3. His main argument was simply PHP’s lack of multi-threading languages and talking about stepping up to .NET/JEE. But as this article talks about, we are looking at small-medium applications. Often the speeds are affected through the slowest parts of the system, hard-disk calls and DB calls, as well as the quality of your coding (with datastructures and algorithms, such as iterators vs hashmaps etc) and your network.

    Having multi-threading means that you need to have an extremely good knowledge of threads to make a useful increase in speed, having dual core does not mean that you get double the speed, you have to be able to break apart processes and manage the memory (eg, process one processes, waits for process 2 to finish its bit for the next part of memory anyway). Plus scaling applications involves not only software BUT hardware. Pick up a book on the Google story and you will learn quickly that you can see dramatic ‘performance’ increases with cheaper hardware through a load balanced scenario. Google may only be able to perform 30 queries a second per box, but because of the network and load balanced performance we see lightning fast queries.

    The comment that PHP is just a simple scripting language with no OOP in mind - has - changed in PHP5 and will evolve in PHP6. Due to the uptake of PHP4 and the amount of users still relying on extremely poorly written PHP4 apps (namely OSCommerce) it has caused slow uptake of PHP5.

    Also there is a lot of talk that you are NOT kidding yourself for enterprise development - There is a lot of people getting behind it, like oracle etc for development.

    Also view this article written many years ago:
    http://articles.techrepublic.com.com/5100-22-1058656.html

    Enterprise applications involve many aspects of an application, choosing your tools is vital.

    Obviously the lack of Frameworks is something that I have highlighted as what I see as some of the main reasons why it hasn’t gone further towards Enterprise. All signs are pointing towards stable formation of frameworks and partnerships with top players of IT.

    Comment by Cameron Manderson — November 3, 2006 @ 2:18 pm

  4. […] PHP as a thin layer provides great database layering, with a nice framework AMF-PHP which could handle basic output to flex. This framework works great, but still has around 40-50ms class instantiation cost per request (which may be considered pretty low, and can be tuned with APC). Making the move to a JEE environment means that we can handle database queries through a JDBC environment, bringing JDBC equivalent database into PHP means more overhead, and unless you go that path it makes it more difficult to make your whole project scalable. But discussing PHP and JEE performance is not the point of this article, we are talking about alternatives. OpenAMF is a JEE alternate to the Flash Data Services offered by Adobe. I found a nice little introduction to openAMF with this article. Although a slightly bloated introduction regarding JEE, PHP and ActionScript it is still relevant to conversations we have been starting on this blog, such as “Where does PHP really sit?” One of the cumbersome of using Java is the relatively complex setup of Java applications, with different steps based on the container. J2EE helps on this, exposing a more standard framework to follow for web developers. Also Java is not a common shared hosting offer, and this make sense because the power of java and his multithread run shines in big applications or when a lot of traffic is expected, due also to the live of servlets in memory. Usually little-medium applications fits fine in more straightforward languages like PHP. So freelancers developers not involved in big corporations are not usually faced to Java, and it’s a shame, because it’s a great language. But the grow of ActionScript from AS1 to AS2 force coders to write in a more Java-like (or should say OOP-like) way, so Java seems more familiar to them. And AS3 will reinforce this being a really truly class based language (in fact, not compatible with previous versions of the Flash Player) All of this make the jump to Java less heavy for actionscript coders, at least with Java in relationship with Flash. […]

    Pingback by melbourne chapter » Adobe FDS2 - US$20K — November 8, 2006 @ 10:18 am

RSS feed for comments on this post. TrackBack URI

Leave a comment