This article is also available in Serbo-Croatian
There has been much discussion of late in Drupal about Object-Oriented Programming. That's not really surprising, given that Drupal 7 is the first version that has really tried to use objects in any meaningful way (vis, as something other than arrays that pass strangely). However, too much of the discussion has boiled down to "OMG objects are inflexible so they're evil!" vs. "OMG objects are cool, yay!" Both positions are harmfully naive.
It is important for us to take a step back and examine why one particular programming paradigm is useful, and to do that we must understand what we mean by "useful".
Programming paradigms, like software architecture, have trade-offs. In fact, many of the same methods for comparing architectural designs apply just as well to language design. To do that, though, we need to take a step back and look at more than just PHP-style objects.
Warning: Hard-core computer science action follows. If you're a coder, I recommend getting a cup of
$beverage before continuing, as it could take a bit to digest although I've tried to simplify it as much as possible. There's fairly little Drupal-specific stuff here so hopefully it should be useful to any PHP developer.
As anyone who has followed my past work knows, software architecture is a particular interest of mine. I find the subject fascinating, but my interest is not entirely selfish.
Understanding architecture, and the trade-offs that different architectures imply, is an important part of any software project. Whether you're discussing a Content Management Platform like Drupal, a language like PHP, or a particular web site, having a solid understanding of the "big picture" is crucial not only for building the system right in the first place but for communicating that architecture to others.
To be able to speak and think about the design of your system properly, though, you need to understand the trade-offs that come with it. There is no such thing as a free lunch, and designing a system to be powerful in one way invariably tends to harm it in another. It is important to know what your priorities are before you start building; and in a distributed collaborative environment like Drupal to all agree what those priorities are, at least to a large extent.
Let us therefore examine those priorities and the trade-offs they require.
Unless you've been living under a rock, by now you've heard about the case that is certain to keep the armchair lawyers busy for years to come: Oracle vs. Google. It's already been dissected elsewhere, but in a nutshell: Sun owned their GPL-licensed Java virtual machine, and various patents on it; Google wrote their own JVM for the Android platform, Dalvik; Oracle bought Sun; Oracle uses those patents to sue Google over their JVM; Hilarity ensues.
So what? How does that affect us, as PHP and Drupal developers? Well it doesn't... except indirectly via another product that Oracle bought as part of Sun: MySQL.
A few weeks ago, I and several others helped some friends of ours pack up their apartment into a truck in preparation for moving cross-country from Chicago to New York. It was, as such moments generally are, bitter sweet. It's always a good feeling to help out a friend, but when you're helping them get further away from you it's not as pleasant.
Of course, me being me, what struck me most about the whole process was how well it served as a model for software development and project management in general.
I admit it, I'm on Twitter. I have been for a little over a year. I have a fairly low opinion of it in general, but I am still on it and make random comments to people from time to time.
Earlier today, one of the people I follow tweeted that his young (under 5, I believe) daughter had just done something stupid. Nothing illegal or immoral, just the sort of embarrassing and sometimes destructive stupidity that young children tend to get into. And he then tweeted it.
Which means that his under age daughter's actions are now part of the permanent archive of the US government.
Ah, the spring. So many things happen in the spring. Snow melts. Flowers bloom. The Easter Bunny sells cheap chocolate. People set their clocks ahead in an attempt to confuse their pets. It is also the start of conference season in the northern hemisphere, which means flying about the country talking about Drupal. This year is especially busy, with 10 presentations in 4 cities so far. (Possibly more to come.)
Here's where you'll be able to stalk Crell in the coming weeks:
There has been some discussion in recent days regarding Object-Relational Mappers (ORMs), Drupal, and why the latter doesn't use the former. There are, actually, many reasons for that, and for why Drupal doesn't do more with the Active Record pattern.
Rather than tuck such discussion away in an issue queue, I figured it better to document a bit more widely.
According to Drupal.org, it has now been four years and five days since I first joined the Drupal community. My how time flies, and how much has changed since then.
I like giving presentations. I really do. But this has been quite a conference season this year; certainly my busiest ever. Four conferences in four different states, and nine presentations. And the year isn't even half over yet...
Here's what I've been up to:
There's been a fair bit of talk about PHP IDE's of late. That's not surprising given how useful they can be. (Really, folks, vi can only take you so far.) Most of the attention has been focused on the big boys: Eclipse and its derivatives (both free and commercial), Komodo, and NetBeans. Eclipse and NetBeans are both Java based, and Komodo is based on Mozilla's XUL platform (which also runs Firefox and company). I've been bouncing between them for a while, and haven't really been satisfied with any of them. I usually refer to Eclipse as the one I hate least. :-)
There's a new contender to keep an eye on, though, that is worthy of notice: KDevelop.