Tapping millions of non-PHP PHP developers. (A manager’s short guide for migrating from Java to PHP)

I was getting ready to post the Powerpoint presentations from my last two user group meetings when I fat-fingered my "My Documents" folder and accidentally opened up a Word doc that had an old article that I had written for a Zend newsletter a while ago.  So for this case of serendipity I decided that I would repost this article, which I had written long before I had a blog.  The basic premise is that once you get past a few minor differences, an organization can move from Java development to PHP development in a very short amount of time, saving time, money and headaches.

The Article

Every once in a while you are asked to write an article for a Zend newsletter. You come up with a couple of good ideas (all of which require a lot of work) and then one comes to you that is rather simple.  Then, to top it off, one of your customers sends you an email that confirms everything you were thinking. 

I have had the benefit of being able to program in many different languages for many different environments over the years.  Throughout that experience there are 2 languages that have risen to the top of my favorites list.  PHP is one, obviously.  But Java is the other.  Sometimes, though by no means always, there is some degree of derision towards Java in the PHP community among others. The usually points are made about Java performance, resource utilization and complexity.  And usually the points are true.  But Java, in my personal experience, is still an interesting language to write code in and it has an extremely diverse range of abilities that are not matched in most other languages.

But this is also a bit of a problem.  To access all of the functionality in Java, there is a tradeoff with simplicity.  To access all of the functionality for the web in Java, there is a massive tradeoff with simplicity.

In most cases, complexity costs more money and is more difficult to manage than simplicity.  That is not to say that complexity is a bad thing, or that maintaining software shouldn’t cost money.  But the more complexity you have in your application, the more complexity you have to maintain, which is in turn managed by complex tools that manage the complexity of your complex application.  This prompts me to ask 2 questions

  1. How much complexity (cost) your organization can absorb. 
  2. How much complexity (cost) your organization wants to absorb.

For a web-based environment, PHP is simply less complex and less costly than Java.  Java was never sold on the basis of cost of development and deployment, but in its write-once-run-anywhere nature and its vast array of abilities.  Moreso the latter.

At this point, you may be wondering how this fits in with the topic of non-PHP PHP developers.  And why should the manager of a Java shop even be considering PHP in the first place?  It is because if you have web-based applications and have Java developers, you already have PHP developers.  This is because there are a lot of similarities in terms of syntax between Java and PHP code.  Yes, there are differences, but not the sort of differences that stop your Java developers from writing PHP code.

This takes me to the customer whose comment I received.  The customer was a Java developer for 10 years, and in his words, took 2 days to get familiar with PHP.

2 days.

Let that sink in for a little.  In order for you to take advantage of the primary programming language of the World Wide Web, your Java developers could be writing usable PHP code in a matter of a few days (though probably a few more than just 2).  There are only a few important differences that your Java developers would need to take into consideration.  So let’s look at a few.

  1. The entry point is a script file, not a main(String[] args) definition or another kind of method call.  It is embedded in an HTML file, typically with the extension .php and starts with the delimiter
    // Now I write code
  2. Variables start with a dollar sign.

    $ar = new ArrayObject();

  3. Variables are loosely typed, though not un-typed.

This means that unlike variable types can be acted upon as if they were like variable types.  For example, an array can be acted upon as a Boolean.

$ar = array(1,2,3,4,5);
if ($ar) {
            // The array was evaluated as a boolean

  1. Class methods are defined using the function keyword, not the return type.  There is no defined return type for PHP functions/methods.

    class User {
         public static function getUser($id) // no return type
              return new User($id);

  2. Arrays are primitive PHP types which can contain ANY type of variable

You will typically not have different types of arrays like you would have LinkedList, ArrayList, etc.  An array (keyed or not) is an array.  However, if you wanted use arrays in an OO fashion you can use the ArrayObject class from the SPL library.

In terms of the bare minimum of differences, these 5 items are primary for Java developers.  There are definitely other differences, but to get started, this is virtually a complete list.  And it is reasonable to state that it is likely that your Java developers already know about points 1-3.  Most of the other rules of object oriented programming and web-based design that they have already been taught still apply.

Another way of saying it is that by moving to PHP, you retain all of the training and knowledge that you have invested in your developers while at the same time gaining the tremendous productivity and cost benefits of building your web-based applications in PHP. 

We can also take this a step further, which is the point of this entire article.  Say you have rebuilt your application in PHP and the CEO is inviting you to weekend trips to Pebble Beach because of all of the money you have saved the company and the reduced turn-around time of application development and deployment.  The CEO asks you to start moving other company applications onto PHP as well because it has been working so well.  Your peers may start questioning your decision to move to PHP because now you have to find more PHP developers.  But you have an edge.  You can hire any number of the millions of talented Java developers out there and, with a little guidance, have them writing PHP code in a matter of days.

6 Thoughts to “Tapping millions of non-PHP PHP developers. (A manager’s short guide for migrating from Java to PHP)”

  1. I’ve been doing software development since the late 70’s. PHP has to be one of the most versitile scripting languages around. It’s a great CGI, and a good command line tool for one-offs. This is a great tool to have in your skill set.

  2. come on… this is simply ridiculous! php is a toy compared to the jvm.

    if you don´t like java as a language simply use one of the scripting-languages available such as scala, groovy, jruby, clojure or anything else you can choose between hundreds of languages. That way no one must leave the jvm as plattform and you can still use EVERY java library.

    I´ve been a php coder for about 9 years and switched to the jvm lately to java/scala and ruby. I never looked back!

  3. Simply ridiculous? I guess GE, Disney/ABC, IGN, Northrop Grumman, BNP Paribas, Lufthansa and the NYSE use PHP because they like using toy languages. This idea that PHP is a “toy language” is often made when one looks at the language via a very narrow view. Who cares if you the worlds best, most feature-rich, programming language/environment if it costs you 5 times what it would cost to do with PHP.

    Rather than complaining that PHP is a toy language, one needs to look at the cost of using a particular environment. A simple feature list comparison between programming languages is a poor way of making a determination of the value of the language. Value should be determined by looking at a combination of development time, developer cost, language features, operational costs and a host of other things. When you look at the whole of the ecosystem PHP becomes a contender because it does what you need it to do, quicker. Just because Java costs an organization more does not mean that it’s better.

    And BTW, you can access all of the functionality of the JVM in PHP by using the Java Bridge if you must.

  4. I do not agree entirely.

    There are several things that make a good programmer. Some of them are language independent (e.g. object oriented design), some not. Of the language dependent knowledge, only a small part concerns the syntax. That is indeed easy to pick up, and I would contend that an experienced programmer should be able to pick up the syntax of any modern programming language in a few days.

    What is not easily learned from books but comes from experience is mastering the language environment, i.e. the standard libraries and programming frameworks. What makes an experienced programmer most productive is knowing without thinking what classes and functions to use in what situation. It is like driving a car – you can learn it relatively quickly, but it takes some practice to not have to think about it anymore.

    Without mastering the environment your mind will not be free to do the really hard part: making good design decisions as you go.

    To come back to your article: yes, a Java programmer can learn to program in PHP (or vice versa, for that matter) in a few days, but that does not make him a good PHP programmer. Sure, the language independent programming experience still makes him better than a total novice, but I would argue against hiring Java developers and converting them into PHP developers, when there is any chance of hiring experienced PHP developers instead.

  5. Yep, agreed. There are some intricacies about PHP that a Java developer would need to learn. Lazy-loading is one example. So taking a Java programmer and telling them they need to learn PHP will not automatically make them a good PHP programmer.

    The purpose for me writing this article was for a manager who is contemplating the cost of moving a Java environment to a PHP environment. Despite the high costs of enterprise software the larger cost is usually the human cost. Salaries, training, etc. My point here is that the cost involved in moving a Java programmer to doing PHP programming is actually relatively soft.

    Thanks, definitely, for the comment, Arno.

  6. Migrating from JAVA to PHP is really changing. PHP is no longer just a language for the computer science underperformers as some people might have believed once.

Leave a Reply

Your email address will not be published.