Java versus PHP for web design?
March 14, 2009 6:48 PM   Subscribe

Java versus PHP: Does it make sense to use Java in a small web design business?

I'm considering transitioning out of my 9-to-5 and into a work-from-home, freelance web design business. But I'm concerned about whether I have the right skill set. Specifically, I'm wondering how essential is knowing PHP to starting this kind of business? And do people really ever use Java/Tomcat for small web design projects?

I'm so comfortable with JSP/Servlets, I'd love to be able to to continue using these tools for projects that require dynamic content. But all the articles I read on starting a web design business list PHP as an essential skill, and most never mention Java. Most web hosting companies I've researched also seem to fit this picture.

Is PHP an essential skill? Can I be successful with Java? Do any reliable web hosting companies offer Tomcat? If so, do you have any recommendations?

Also, I'd like to add that I'd love to learn PHP... I'd consider it more fun than a chore. It would just be one more thing that would make me hesitate before making the leap... and I'd hate to think that all my Java experience will go to waste.

Any thoughts would be appreciated. Thanks.
posted by whiskeyspider to Computers & Internet (16 answers total) 5 users marked this as a favorite
 
Response by poster: I should also mention that I'm solid with XHTML/CSS/Javascript.
posted by whiskeyspider at 6:51 PM on March 14, 2009


Java is perhaps overkill for small web projects. Consider focusing your time on Ruby and Python, to learn Rails and/or Django, maybe. PHP is always handy.
posted by Blazecock Pileon at 6:58 PM on March 14, 2009


I used to work for a firm that did almost exclusively Java-based websites on Tomcat.

I always felt that our time to delivery was slow compared to what we could have done using a scripting language.

Another factor to consider is that if you want to pick up work looking after existing sites, you'll need to be able to cope with PHP, because so many small crummy sites that need your care will be PHP-based.

I say this as someone who looks down his nose at PHP and prefers Python!

Until you can pick and choose your own projects, it would be smart to know PHP.
posted by i_am_joe's_spleen at 7:00 PM on March 14, 2009


Get a virtual host from Linode.com and you can run whatever you want on it. Tomcat works just fine. Lots of other companies offer VPS hosting but there were only a few places around when I first set mine up.

Java isn't overkill if you're more familiar with it, but Ruby on Rails is trendy and I suppose what they say about the ease of making sites quickly in it might be true. You might want to give it a shot. PHP Does come in handy every once in a while too. It's probably a good idea to keep on top of popular technology.
posted by delmoi at 7:45 PM on March 14, 2009


I'm a freelance web developer; Java and PHP are my two most-frequented languages. PHP was invaluable as a tool for me when I started out. As mentioned above, you can turn around small project very quickly with PHP, and you'll almost never have to worry about your site running on your client's generic shared-hosting server.

Your Java experience won't go to waste, for two reasons:

1. Chances are it'll help you write good, healthy PHP. PHP is often looked down upon because it makes it really easy to write absolutely unmaintainable code. But if you're coming from a more structured environment and you apply your current best practices to your PHP development, you'll be fine.

2. Having Java at the ready will be valuable when you start taking on larger, more JSP/servlet-appropriate projects down the road.

Good luck!
posted by DrJohnEvans at 7:46 PM on March 14, 2009


If it's small-scale, yeah, PHP will serve you fine. But DrJohnEvans is right that it's good for you to take good code structure lessons from using big-boy OO languages like Java. And I'll also second that you might enjoy exploring languages like Ruby and Python.

Just from a hosting standpoint, you'll find a lot more places that offer PHP than most other languages, and yeah, knowing PHP is a good skill in case you get any work updating or maintaining existing sites -- a whole lot of the web runs on PHP. Good news: PHP's really easy to learn.
posted by middleclasstool at 8:11 PM on March 14, 2009


PHP is dying everywhere except the low-end, so I wouldn't bother learning any more than you have to to take over/support existing stuff that you may inherit.

Keep working with what you know best. There's definitely nothing wrong with doing JSP/Servlet work, and in fact your work might be more valued or valuable that way, since it's less common but very well-thought-of.

And never forget: 95% of clients won't care what languages you use. That's why they hire out.
posted by rokusan at 8:15 PM on March 14, 2009 [1 favorite]


PHP is dead simple. And almost fun to code in. I knew nothing about PHP, and in a week had a reasonable ten pages of database lookup and report output, ready to use as a backup for a campaign's voter file.

I'd be hesitant to use it for something I had to extensively modify, as it's too easy to interleave code, data, and markup in to confound maintainability. I broke out common functions, and I made a point to add sanity checks to prevent SQL injections. But given only a week to get it out the door, I did some nasty stuff with concatenating SQL queries, something I'd have been horrified with had I not known this would be junked forever come November 5th.

But were I looking to do something simple and fast, PHP's not a bad choice.
posted by orthogonality at 8:33 PM on March 14, 2009


FWIW, you may want to look into grails- it merges some of the Ruby on Rails stuff with a java environment, giving you a pretty big speed boost for development time, while maintaining most of your existing knowledge. Technically it's groovy, not Java, but it's really easy to make the conceptual jump into groovy once you know Java (most code still works as cut and paste).
posted by jenkinsEar at 8:45 PM on March 14, 2009


Seconding the Groovy/Grails path. I've been doing Java since the late nineties and have been doing Groovy for about six months. It's amazing.
posted by funkiwan at 10:30 PM on March 14, 2009


I have found that hosting with Java tends to be a bit more expensive and exclusive, while everyone does PHP, so for small stuff I stick with PHP and save Java for places that will host things from their own servers.
posted by furtive at 11:08 PM on March 14, 2009


Orthogonality, for what it's worth, there are PHP frameworks that enforce the MVC pattern and help separate logic, data, and display and make maintainability considerably easier. We use Kohana, since it's fast, relatively lightweight, based on CodeIgniter, and very flexible.
posted by disillusioned at 3:11 AM on March 15, 2009


I think it depends on the sort of projects you're going to be working on. If you're going to be just putting together small systems or helping people set up blogs or things like that, then it's probably faster and easier for you to do it in PHP. Heavier projects would probably do better in Java or something else.

I just finished a system that's used for managing marketing teams, and we wrote it all in PHP, and it works fine. We used the Zend Framework, which is an MVC setup for PHP, and it worked really, really well. I've worked with CodeIgniter in the past, and Zend just seemed a lot more capable, more robust, and better to use.

Personally, I like PHP because it's just so easy to sit down and bang out a bunch of code in no time. Java and the others have a lot more overhead, and while that's fine if I was going to build something big, I just don't want to deal with it.
posted by gchucky at 7:43 AM on March 15, 2009


The answer really depends on who your clients will be, and what type of work you will be doing as a freelancer.

If you're going to be aiming for the "I need my very first website" crowd, building lots of one-off sites, java is probably a poor choice: your delivery times will be somewhat longer, you'll be imposing a somewhat more complicated hosting environment, and you'll be sticking the client with code that they may find it more expensive / difficult to maintain (let's face it: php coders are a dime a dozen; java coders are at least twenty-five cents.) Java is better for larger teams working on larger projects.

Which leads, obviously, to the suggestion that since you already know java, and want to keep using it, that you focus your freelance business on jobs for which it's appropriate. Not all freelancers have to focus on the itty-bitty mom-and-pop websites! Freelancing as part of a team for larger companies can be much a more profitable (real companies don't expect a website to cost less than $100), satisfying (knowledgeable clients give you more interesting tasks than just building yet another shopping cart) and sustainable (once your name gets out there) business.

Instead of changing your skills to fit a particular type of freelance work, choose a type of freelance work that fits your skills.
posted by ook at 9:25 AM on March 15, 2009 [2 favorites]


I learned Ruby (on Rails) mostly after asking a similar question. After working with it for a while, I cannot understand why anyone would use something like PHP. At least, do your work in a framework that enforces some sort of MVC.

Some claim RoR is a dying fad and others disagree. I'm more on the "others" side, as you can tell.

Java, as others have said again and again, is much of an overkill.
posted by the_dude at 1:28 PM on March 15, 2009


As others have said, it really depends on your clients.

Smaller clients will want a lot for $1-3k and won't know enough about the tech to care. PHP (with a MVC framework of course!) will allow you to whip up whatever is needed, and it will run on 99% of the shared webhosts ($5-10/month) out there.

If you want to push JSP/servlets, then you had better find some hosts that you can recommend. Most shared hosting is crap and so you'll probably have to recommend VPS'es where you can control what version of apache/tomcat/java etc is installed. The clients will need to be willing to spend at least $20/month for hosting - and if you need a lot of RAM, then perhaps 2-10x more.

But, really, I think you would need to find larger projects to use javas and servlets. You basically want to find companies that want a complex web application, and will expect to pay a chunk of cash for a properly designed and engineered solution. If a client wants a "web page", I guarantee that you will not be able to use java.
posted by kamelhoecker at 4:41 PM on March 15, 2009


« Older Should people in debt go to certain states to get...   |   When worlds collide Newer »
This thread is closed to new comments.