Archive for October, 2006


date_sunrise and date_sunset

Now I’m starting to get irritated. I was reviewing the syntax of PHP date functions and discovered date_sunrise and date_sunset, which do just what you expect: return the time of sunrise and sunset for a given date and location. Expect that you probably didn’t expect them to be in the language core.

As time goes on, I’m becoming more curmudgeonly about decisions like this.

Java, PHP, Programming, Ruby

If not Java EE, then…?

A prediction: if a couple years from now I am still mired in a Java monoculture, I will strangle someone. Probably myself.

As I have explained before, and with some apology for the double negative to which I am about to subject you, I do not believe that Java can never be viable for web application development, or that it is a bad language. I simply assert that it is an exceedingly poor choice for the web applications that I work on. Because it’s past 1 a.m. and my son will be waking me up in less than five hours, and maybe because despite my curmudgeonly nature I am reasonably polite after all, I will spare my employer the (mild) embarrassment of an all-out rant. Suffice it to say that working among the Convinced as I do, I am very much in the minority in my belief that Java EE — really, a Java monoculture — is the number one culprit for the project I’m working on being so very, very late. It isn’t the only problem we have, but it’s a big one.

The question I’m left with is this: what do I propose as an alternative?

.NET is out. We’d need lots of new hardware and be locked with a single, closed-source vendor. Please do not bring up Mono.

Cold Fusion? Same single-vendor problem, and I remain unconvinced.

There are Python frameworks like Django and TurboGears. I like them. They’re just not compelling enough for me to suggest using them.

Tcl? Sorry, private joke.

To my mind, it comes down to PHP (using any of a number of frameworks) or Ruby on Rails.

We would stand to benefit more from both Ruby and Rails, but I am concerned about deployment scenarios. Large-scale Rails deployments are possible, but it’s still a new enough platform that people are still working out the kinks for how to do it well. To be honest, we’d just be talking about a medium-size deployment, but the same concerns apply. Could we do it? Yes. I have faith in our system administrators and our developers. I would just feel really guilty about going to them every 3-6 months with a new way of setting up the servers to deploy Rails apps. I admit that I haven’t been following that scene for a while, but it does seem every time I poke my head in that there’s something significantly different.

On the other hand, I’m satisfied that we know how to work well with PHP, at least from a sysadmin perspective. On the development side we would certainly move a lot faster than we do with Java. As PHP becomes more Java-like, you’d think that a transition from Java would be easy. That’s the whole point, right? PHP has a low barrier to entry. On the other hand, its similarities to Java (at least in the object model) may make the transition harder, as I’ve found that Java programmers are somehow blinded to or misunderstand significant platform differences — e.g. PHP’s share-nothing architecture. We would also struggle with maintaining a large PHP codebase, much as we struggle maintaining Java code in reasonable order.

But honestly? In my gut, I hesitate to propose PHP because of the language itself. It doesn’t feel that much better to write PHP code than Java code — sometimes it’s worse, especially some of PHP 5’s Java-inspired syntax. Mostly, though, I think it’s the lack of closures and blocks, language features that I’ve come to expect and rely on. Peter Williams brings up the same point about PHP.

I first learned blocks and closures about two years ago and now find programming without them mildly painful. I think that Mark Jason Dominus got it right when he said

in another thirty years people will laugh at anyone who tries to invent a language without closures, just as they’ll laugh now at anyone who tries to invent a language without recursion.

There are just so many common classes of problem that are simply and cleanly solved by closures that not having them seems like a crime.

I think I’m holding out for JRuby on Rails.



The Java Posse have posted a delightful three-part interview with Van Simmons of the ComputeCycles Project: one (#82), two (#84) and three (#86). This is an excellent introduction to Jini. I’ve been excited about Jini since it was first announced, but it kinda fell off the radar for a while and I haven’t pursued it. I might grumble about working with Java (okay I do more than grumble!), but to my mind Jini rescues it from the dustbin. I just haven’t had need for it at work, which is no excuse, and I spend as little of my free time as possible working with Java. That might change. The whole area of distributed computing  intrigues me deeply. That and concurrency; it’s about time I read Java Concurrency in Practice, which is just collecting dust on my shelf.

Also of note, a presentation about Jini by Daniel Steinberg, “Beyond the Choir.”