Barrier to entry for PHP and Java web applications

Jeff Atwood’s latest post on PHP sucking hard, while powering a very decent amount of the internet, got my attention. Not so much by the content itself, but rather because I was thinking about PHP and Java web applications a lot lately anyway.

This blog is powered by PHP and I write little PHP scripts once in a while to mock a server for testing my jQuery plugins. On the other hand, I’m designing, architecting and writing a web application in Java. In the case of testing jQuery plugins and the application, the tool is the right one for the job. I’m not so sure about this blog, WordPress and PHP. Jeff’s post links to more than enough arguments why PHP isn’t the right tool…

But the quality of the programming language is a too small part of the picture. I consider the barrier to entry an important part. Its a hell of a lot easier to get started writing a PHP application. Just create a new file. Finding a hoster for that application is easy, too, and can be as cheap as a few bucks per year, literally. Setting up a shared-hosting enviroment is rather easy, too, as each PHP request runs in its own shared-nothing process.

Installing WordPress is frickin’ easy, too. Download the current release, upload it via FTP, enter DB info into a plain text file (“plain text” in contrast to verbose xml configuration buried within JNDI datesource defintions), and done!

The barrier to entry for writing and deploying Java web applications is a bit higher. Java hosting is rare and expensive. Writing a Java web application requires at least two files and one folder, one file being an XML configuration file placed inside that folder. Deploying applications heavily depends on the hosting enviroment. Usually it involves uploading a war-file via FTP or webinterface, I don’t even know how it works in shared-hosting enviroments.

A few hosters support JSPs: Just upload a .jsp file and point the URL. Pretty close to the PHP model, arguably much worse. JSPs invite you to mix HTML and Java, which is much worse then mixing HTML and PHP. A JSP has extra tags to import classes, and of course tags for SQL queries, if you are really desperate. You loose the benefits of static styping while still bearing the cost, unit-testing is somewhere between extremely hard and impossible, certainly not worth it anymore. In other words: JSPs provide no reasonable benefits over PHP.

That leaves us with a lot of work ahead to lower the barrier to entry for Java web applications. The most potential is creating applications. The create-a-file-to-create-an-application mode is as easy as it gets, so we’d need some abstraction that allow you to create a servlet application with just one file, and no xml configuration, please.

Once creation is a matter of creating a file, deploying should boil down to uploading that file. Once that is possible, hosting will improve – its than a matter of supply and demand.

I hava few ideas for the necessary abstractions and will post about them. Thoughts and ideas are very welcome – maybe I’m looking in the wrong direction here.

-Jörn

No more comments.
  1. I have to agree – the simplicity to start a project is key. I hate the fact if a programming language wants to limit my freedom of creating the file structure I want.

  2. Holy crap, I’m adding your feed to my reader 🙂 I didn’t realize you work in Java, and this post really hit a sweet spot for me.

    Current, I work at Liferay, which is a Java company (the leading open source Java portal :D), and one of the things we’re constantly trying to do is ease development across the spectrum.

    Traditionally, Java has really left a lot of other people out in the cold, and luckily Liferay sees that as an opportunity.
    Why does it require so much just to make a webapp? Why do I need to compile my code just to make sure it actually does what I think it’s supposed to?

    I understand that for traditional CS grads, there is the right way, and the wrong way. But the “right” way, if it requires 4 years of schooling, won’t actually get used.

    So I’m beginning to find that Java is in a very odd situation: accept reality, or continue to only be used by 0.01% of the population.

    jQuery is the most popular JS library because of this. It knows it’s audience and helps them do the tasks they are actually doing (interacting with the dom, effects, ajax, manipulating data). It doesn’t try to solve problems nobody cares about, and John has been great at avoiding feature creep, and he thought out the plugin architecture early on, which allows users to extend it to more specific requirements that they need.

    PHP is very similar. While I know that Java has it’s place, and for those areas where it excels, kudos to them. But there is a huge (the other 99%) of us who want to build cool things, and get stuff working.
    I just want to hook into a database, save information, maintain state, and present information to the user.
    I don’t want to have to care about all the other stuff.

    I do have to slightly disagree with Paul (who also works with me at Liferay), that I used to think that file structure freedom was important.
    But after playing with some of the MVC frameworks out there, including Rails, Grails, CodeIgniter, etc, that the constraints can actually be liberating. However, they must be clear, consistent, and NOT deeply nested.

    In the end, I think people care infinitely more about the final product rather than how it got done. That doesn’t mean tool makers can provide crap under the hood, but it means that if the choice is between a tool that gets the job done, but wouldn’t impress a cs architect, and a tool that follows all of the abstract concepts and ideologies, but is really hard to actually get working, I think we can guess which one will actually be used by most people.

    Sorry Jörn, I didn’t mean to make such a long rant, but this is an issue I’m really passionate about 🙂

  3. Hi Nate,

    thanks for the comment! You hit several interesting points, worth more posts.

    Mentioning jQuery here is a good example: It has an extremely low barrier to entry – I don’t know any other programming enviroment where non-programmers can actually get useful stuff working.

    Of course there are many more things than just the barrier to entry that are relevant for languages or frameworks to be succesful.

    On a framework level the programming model is extremely important. jQuery has a very simple and powerful one (Select and Interact). It scales well from simple user interactions (bind a click event and do something) to highlevel widgets (ala jQuery UI).

    Its such a sad story that the most pushed Java web frameworks, JSF, basically has two completely different programming models: One for writing applications, which works well, and a completely different one for writing components, which has nothing in common with the first one and is mostly broken.

    Ah, I need to write an actual post about that…

  4. Hi,

    I have a similiar opnion. But I found a light on the end of this way… Quercus!

    I’m developing a project that only works with java, but for the client side I’m not using jsp, or faces, or something else, just PHP running inside a Glassfish container!

    Cya and Good luck!

  5. Hello from the Ruby/Rails world!

    My apologies in advance for sounding pretentious; we don’t have those problems with ruby/rails.

    We have our own problems, but they’re pretty minimal. There’s no sense of “restriction” with rails apps; you just extend whatever you want.

    jQuery has been a great compliment to rails, and there are so many integration methods.

    I highly suggest that you give rails a whirl. You may be surprised by how fast you can make something “just work”, and even more surprised at how fast you can make it “just work” while being fully tested.

  6. Jörn,
    I rarely package up my sites into WARs. I keep everything in SVN and once it’s ready I just “svn up” on the server to get the latest version. If there are no jar or class changes then the context won’t be redeployed. It’s also nice to be able to do quick fixes on the server in vim and check the changes back into svn.

    Have you heard of the Stripes java web framework? IMO it is similar to jQuery in that it does the dirty work for you but otherwise stays out of your way.

  7. Ian

    Well I think, for what it’s worth, Java merely follows the long history of Unix type failed ideas. It’s web development, like Unix itself, is focused on the last really really high end bits of the industry. Meanwhile the rest of the world gets on just fine with php, asp or whatever.
    As the ever diminishing pack of Unix vendors, fight over the remnants of the market, that left by Microsoft, a vendor who’s products are so crap that everybody uses them, so it is with web development in java. The very fact that it will not just work under apache, but you have to download and learn an xml riddled bastard off shoot says it all. To create a simple web page with a bit of functionality you have to learn something different from the rest of the planet. Guess what, most people don’t bother.
    As Tomcat, Servlets, JSPs = php, asp, anything else, so Samba, Openldap = Active Directory for the average user.
    The best thing Sun can do is go to the wall, it’s all they deserve.