To PHP or not to PHP…Monday, March 28, 2005 |
After years of PHP development, I find myself trying to decide if I should stick with the language…I have been doing PHP for years; since the PHP3 days. I have found it to be a powerful and flexible language that is easy to code in and deploy. Every web application I have running at home, on this site, or any of the other hand full of sites I maintain or help maintain is written in PHP. I love the language. However, after having professionally written in Java in addition to other languages, including PHP, I am now in a full time, 100% Java position, and, having had the opportunity to dig deeper into the myriad of libraries available in Java, I find myself wondering if I should use only that.
I have been writing Java applications since JDK 1.1 (AWT-based applications… woo! ), though my time has been split among several languages (C/C++, PHP, Delphi, bash, etc). I’ve always viewed Java as a powerful language, and have always enjoyed writing in it, but I’ve never seen the need to do only Java. My experience with Java in the web realm wasn’t overwhelming. Write, compile, archive, deploy, test, rinse, repeat. With PHP, I write and test. Point a browser at the file (through a web server) and off you go! Java was a bit more tedious (IDE support was pretty weak) and I just didn’t see the need to put myself through that.
Since starting my new job, though, I have been able to really dig into some technologies that I’ve been eyeing for some time now, namely, JavaServer Faces (JSF), Hibernate, Eclipse, and Spring. The combination of these four items addressed most of my concerns with regard to the development cycle (granted, they’ve been around in one form or another, but since my job until recently wasn’t Java-heavy, I haven’t had the chance to really look at them). JSF takes a lot of the pain out of writing a web interface (PHP has similar problems, but also has a viable solution or two); Hibernate, in my experience, is the best Object/Relation Mapping and persistence tool on the market in any language; Spring makes wiring everything together; and Eclipse is just a great, multi-purpose IDE.
Having had the chance to learn these tools has really changed the way I look at web development and how to structure web applications. PHP, while it can use the same techniques, does suffer from performance penalties (since the environment must be recreated, for the most part, with every request), not being VM-based. Are these obstacles able to be overcome? Sure, they are, but you have to think differently. Is PHP still a viable language? Absolutely! The release of PHP 5 has shown that PHP isn’t just a toy language, as some might suggest, but that it is very much targeted at enterprise use. While it’s not perfect, as no language is, I think it is still a very suitable language for web development. My quandry, though, cernters around the fun I’m having with Java at work and if having that same fun at home is worth giving up the positvies (and the fun) that PHP offers. And I don’t know how to answer that question.
Another thing that makes me hesitant about adopting a single language for work and play is the danger of becoming a one trick pony. Over the years, I’ve met people that know only one language, or only one language well, whether it’s C/C, COBOL, Java or even PHP. These people tend to get stuck doing things in one particular fashion and seem to tend to have problems thinking creatively. Since I know several languages (though I would hesitate to don the "expert" moniker in any of them), I can look at problem and say, "In C, we would…" or "Java has a nice implementation of…" There’s a part of me that would hate to give up that cross-pollinization that using multiple languages gives me. Of course, the corrollary to that idea is that I’m completely off-base in my one trick pony fears.
I don’t know what I’m going to do. I might experiment with doing the next Steeplesoft project in Java and see how things go. We’ll have to see…