Why did I Drop Java for PHP?

April 25, 2012
Posted in Editorial

Hi,

I got a pretty good question today, something I may have never talked about before: why did I drop Java?

Short answer:

Speed.

… It is just so much faster to develop in PHP vs Java. Same can be said for Ruby, and in fact, many of those in the Ruby ranks, are disaffected Java programmers.

Also, Java web hosting on a shared server can be problematic because the JVM requires a lot of server resources and so if you are creating Java web apps, it is best to have a dedicated server to deploy too.

So does that mean Java is useless?

No. But it is something that you DON’T use for small and even medium size web application development. Best to use Java for larger systems and Android programming.

I did love Java once, but like a fat old girlfriend, you just have to give em’ the boot if they get too fat and too old.

😉

Stefan Mischook
www.killerphp.com

8 Responses

  1. Akiii Author April 28, 2012 at 6:57 am Reply

    Php is better Stefan !

  2. ittrainingnepal Author May 2, 2012 at 4:04 am Reply

    Well I agree with you. In PHP we can rapidly develop applications and it is easy to deploy.

    Also frameworks in php has made web applications development lot easier.

  3. Fadi (itoctopus) Author May 2, 2012 at 10:52 am Reply

    I totally agree.

    If we want to write a string in PHP, then we just use:

    echo(‘hello world’);

    Try doing this in Java and see how many lines you need to write, and how many files to include in your main file.

    What’s reviving Java right now is Android – and that’s it! Oracle should be thanking Google, and not suing them…

  4. Stefan Mischook Author May 2, 2012 at 11:11 am Reply

    I should point out though, Java’s logo is much nicer than PHP’s.

    Stef

  5. kevin Author May 2, 2012 at 11:45 pm Reply

    I would love for once when someone posts that php, ruby, python, grails, groovy, etc etc is better than Java, faster to develop in, etc etc you include the details as to why. What is faster? Is it cleaner code, easier to maintain, debug? What about the setup.. configuration of database? How well does it scale comparatively.

    But honestly, your comparing php to java, when really it should be php vs jsp. Java is a much bigger beast than php. php pages are God awful. It reminds me of the old days of JSP before java web frameworks.. where we put code, looping syntax, and more inside the JSP pages with html. It was horrendous, and much better models came along to help alleviate the nightmare of maintaining. I’ve done a little php, and a bit of ruby, and I must be one of the few that will reply here that I actually prefer java much more than all the others. If you were to start from scratch, I suppose learning php would be faster than java because of the lack of a JVM and all the issues like class loading, dependencies and such. But then, Java can be used for far more than php (as you stated).

    Still, I can rapidly build SOAs (rest) and web sites with various frameworks, be it Wicket, JSP/Struts, JSF, Velocity, etc. I personally have a cookie cutter template that I can rename into a new project and deploy in under one minute, then add a few pages, server side, and have a db configured, login page working, protected resources and more in a matter of minutes. The same could be done with php no doubt, my point is, I don’t think it’s much faster doing that with php than any other language.

    So please, fill me in as to why php (and ruby) are just so much better? And when you say small to medium sized sites, what are we talking.. 500,000 simultaneous people on the site? A large site to me is like banking sites with millions of clients or facebook, yahoo, etc. While any site can be made to any scale with any of this technology, to what pain will you go if you start something in php and it takes off and scales rapidly. How do you handle that sort of scaling, will php handle the load as well as java can? Yes, I know there are some big ruby and php sites out there. But never is it discussed how hard it was to scale out and handle those loads.

    My boss is a fan of ruby, mind you. He loves the idea of rapid prototyping in ruby. I don’t get it though. Why would I rapidly (say over the course of a month or two) write a bunch of ruby code to show a demo of something, only to throw it all away and do it in Java to handle the scale we’ll be needing? Why not just do it in Java to being with?

    If I ever become rich, I really really plan to learn php and ruby to the full extent to truly understand why so many java developers say its much easier/faster. Cause my feeble attempts at both (a month or so of php and 3 months of ruby) and I don’t have one ounce in me that wants to use these even for a hello world app. I just don’t find it nearly as capable or fast to do anything in as Java with all it’s libraries, open source, frameworks, and then some.

  6. Stefan Mischook Author May 3, 2012 at 2:21 am Reply

    Hi Kevin,

    You said:

    “But honestly, your comparing php to java, when really it should be php vs jsp. Java is a much bigger beast than php. php pages are God awful.”

    That is really old-school PHP. Today there are a few MVC frameworks that are mature: PHP ZEND, Code Igniter, CakePHP .. to name a few.

    PHP can scale: Facebook is PHP based as far as I understand as are parts of Yahoo.

    Training is a big issue: you can get PHP programmer up in running far faster than a Java developer. That has an impact on choices companies make.

    Both languages have their place, but for 99% of websites, I believe PHP is the way to go with Ruby a close 2nd.

    … And this is the opinion of someone who used Java for years. I was around when Rod Johnson was just putting together the early iterations of what was to become the Spring framework. Heck, I was deep into Java before there were any frameworks! I’ve used Velocity, Spring, Web Objects, Struts …. but ended up creating my own MVC/pojo framework. J2EE became such a mess that I started looking elsewhere.

    I would suggest to you that you might consider looking at other languages, this will improve your overall abilities as a Java programmer in the end.

    Thanks for the great comment.

    Stefan

  7. Mark Author May 22, 2012 at 10:59 am Reply

    Hey Stefan. Which PHP framework do you like better and why?

    Kevin, I am totally with you about Ruby not being scalable, however, knowing how many big PHP sites there are out there, I know you can scale PHP very easily. But I shied away from PHP because I saw the same thing with PHP code with the HTMl and that is extremely scary. I still see it today when I do WordPress. But I wasn’t aware of the PHP frameworks, which I will go check out.

    The main problem I have always had with generated web applications, is that it never generates correct web applications. Only once did I actually have a website that was strictly CRUD pages. All other website required complex RIA, good looking webpages. So anything that was generated always had to be trashed and you had to start those pages from scratch.

    But I am working on a site using Spring REST and HTML5, CSS3 and JQuery on the front end and it is very slick, the toughest issue is being new to JQuery, so all client side. OH, I also have only 1 JSP page, and it has no data on it, and is downloaded just once so all my JS and html is on the client side now for the remainder of the entire website. I hate JSPs now. That is why I am now more interested in learning about PHP, and think that it might be a better solution.

    Mark

  8. Stefan Mischook Author May 22, 2012 at 2:07 pm Reply

    @Mark,

    I would suggest just trying each of the big PHP frameworks yourself and see what you prefer. We have used Zend and CodeIgniter here … and different people will complain about each, for just different reasons.

    I hear Symfony (http://www.symfony-project.org/) could be the way to go … but I personally have no experience with that one. BTW, we teach basic MVC and PHP application structure with our PHP projects video course (http://www.killervideostore.com/video-courses/php-projects.php).

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top