4 replies
Folks,
I have done extensive J2EE (Java 2 Enterprise Edition) but not PHP. Looking around here, most IM sites seem to do very well with PHP or ASP.

Is it because PHP is very common supported by hosting companies?

Is PHP lighter than J2EE? As you may know J2EE has lot of moving parts and it may not be suitable for smaller web apps that don't need all that extra functionality that it provides.

What do you think? Or am I comparing apples to oranges here?
#asp #j2ee #php
  • Profile picture of the author Darren Mothersele
    you are certainly comparing apples and oranges here.

    I had a background in Java programming, it was the first "real" language I learned. Having this kind of background should certainly help with getting up to speed with PHP.

    One benefit of using PHP, as you mention, is that it is widely supported - scripts can be as basic or complex as you need, and will usually run on anything from the cheapest of shared hosting packages through to VPS, or your own dedicated servers if you need the performance.

    The main benefit for me with PHP is not having to re-invent the wheel every time you create a web app. There are advanced APIs and Libraries available that simplify almost every task you are likely to want to do when creating your web app.

    If you know J2EE then you should feel at home with PHP5's new object-oriented features. Check out the PHP5 API docs for info on all the functionality that is available, from dealing with XML data, fetching and parsing pages, or dealing with Databases. For simple database needs you can use the built in SQLite database engine, or for more advanced the MySQL support.

    Taking things a step further look at some frameworks that provide even more functionality building blocks for you to work with. The ZEND Framework is a good one, and Drupal (actually a CMS) provides excellent features as a Framework to build on - the Forms API for example provides a secure and robust way of working with HTML Forms without having to write a lot of PHP yourself.
    {{ DiscussionBoard.errors[350465].message }}
    • Profile picture of the author learnmore
      I also find that PHP seems to be used more commonly for IM type of sites where you don't really have complex database needs. WordPress being a very popular platform also runs on PHP so it would definitely pay to learn little bit of PHP in order to customize WordPress blogs.

      J2EE seems an overkill for most IM related sites but then again Amazon.com type of site is not built on PHP rather on J2EE.

      I guess what it comes down to is different tools for different jobs but J2EE is little "heavier" for getting sites up quickly. The technical terms is Rapid Application Development.

      Another advantage of learning the big picture PHP if not the nitty gritty is when outsourcing one can make intelligent conversations and decisions about projects involving PHP.

      Code Warriors, what do you think?
      {{ DiscussionBoard.errors[664418].message }}
  • Profile picture of the author procoach
    As the name implies, J2EE is more suited for "Enterprise" apps.

    Creating and deploying a J2EE app is significantly more complex than creating and deploying a PHP app. What you gain is more scalibilty options.

    For the vast majority of IM sites, PHP [or ASP(X)] will do just fine.
    {{ DiscussionBoard.errors[664451].message }}
  • Profile picture of the author Adaptive
    Developer with 20 years experience answering here. You're exactly on the right track, Original Poster.

    PHP is a simple language without a library. As Darren mentioned there are many third party frameworks that can be added for individual projects. Compared to J2EE, PHP is easy to learn, quick to use for simple tasks, covers enough of the basics to be usable for a variety of moderately involved tasks.

    PHP is also straightforward to administer as a Web server add-on. It's not only free but has been fully open source since the beginning. With rendering done by the browser, the "write once run some places" problems with different Java flavors haven't been an issue for PHP. For these reasons it has become very popular in the Internet Marketing niche and in the LAMP stack in general (Linux, Apache, MySQL, and PHP).

    Additional features are added to PHP. For example, just last week PHP version 5 introduces garbage collection and namespaces - things that Java developers have been used to for more than a decade.

    Support for functional programming is also in PHP5. Most Java programmers aren't used to LISP type of thinking, nor have most PHP hackers had exposure to languages not based on C, COBOL or FORTRAN. So, I imagine that lamda functions and closures in PHP won't take the world by storm any time soon.

    J2EE has lot of moving parts and it may not be suitable for smaller web apps that don't need all that extra functionality
    That's exactly why php and mySQL are so popular. Obviously a J2EE/Oracle or ASP.Net/SQL Server stack is far more powerful and functional, but at the cost of massive complexity in overhead to put up a very simple site.

    You need to make a distinction between ASP and ASP.Net. ASP is a fairly simple technology comparable to PHP, and Microsoft came up with something much better ten years ago. ASP.Net is an enormous, powerful yet complex suite of technologies, definitely in the same league as J2EE in terms of power and learning curve.

    Here's the PHP manual. PHP: PHP Manual - Manual As an experienced J2EE developer, you'll be up and running in PHP in no time.

    My impression is that many PHP coders either don't have prior programming experience, or have only learned how to do some C hacking without a larger perspective on software engineering. PHP is the most popular of what's available and good enough to get by. This causes an ever increasing spiral of tools, libraries, and beginner training in basic techniques... leading to more beginners who get to the point of sharing their own tools, libraries, and techniques.

    In the IM niche, PHP is far and away the king of the hill. In the time it would take to establish a QA department, create source control versions, deploy a Java bean container and start strategizing a layered architecture, a PHP guru will already have cranked out ten thousand lines of code that grab eyeballs and stuff credit card orders into the database. :p

    Regards,
    Allen
    {{ DiscussionBoard.errors[664520].message }}

Trending Topics