Technical Thoughts, Tutorials, and Musings

The danger of privates, and composition vs. inheritance

The private variables debate is going around the PHP world again. Brandon Savage posted a pair of articles pointing out the perils of private variables, boiling down mostly to them making extension infesible or impossible. Anthony Ferrara replied with his own article, arguing that the real problem is using inheritance in the first place rather than composition. I figured I'd weigh in on my own blog rather than in a comment. :-)

As an academic matter, I agree with Anthony. Composition and interfaces are more flexible than inheritance. I've been preaching the interface gospel within Drupal almost as long as I've been preaching Dependency Injection.

Up with which I will not PUT

For Drupal 8, we want to bake REST support directly into the core system. It's unclear if we'll be able to go full-on hypermedia by the time we ship, but it should be possible to add via contributed modules. For the base system, though, we want to at least follow REST/HTTP semantics properly.

One area we have questions about is PUT, in particular the details of its idempotence requirements. For that reason, I'm reaching out to the Interwebs to see what the consensus is. Details below.

DrupalCon Munich slides now online

After a bit of a delay, all slides from my trio of DrupalCon Munich talks are now online. The videos have been up for a while.

  1. Functional PHP: video - slides
  2. Web Services and Symfony Core Initiative: video - slides
  3. Multi-headed Drupal: video - slides

See you at the next conference!

Conference Season - Fall 2012

That moment when you realize just how much awesome you have coming up that you're not sure you're going to survive it? Yeah, that.

It's nearly time for the second half of the year conference season, and it looks like my schedule is starting to fill up. I've three conferences and 5 speaking engagements in the coming weeks, so for those interested in Stalking Crell here's where you'll be able to find me:

Midwest Developers Summit: 26-28 July

Supporting Aaron Winborn

Aaron Winborn is a longtime Drupal contributor and friend to the community. Since his diagnosis with Amyotrophic lateral sclerosis (ALS), Aaron has been trying to enjoy time with his family, to remain productive in his work and to live as normal a life as possible.

As time passes, however, the disease has made his life increasingly difficult as it attacks his nervous system. To cope with the mounting costs of treating his condition, Aaron has set up a special needs trust, and you can make a direct donation from his web site.

As a show of support for Aaron and his family, for the rest of this year, my co-authors and I intend to donate all of our royalties from sales of Drupal 7 Module Development to the special needs trust. You can read reviews and order a copy at Amazon.com.

Not only can you get one of the top books on Drupal 7 development, in so doing you can help out one of the people that has helped to make Drupal as powerful as it is.

The Kernel has landed

On Friday, Dries merged in the first major work from the Web Services and Context Core Initiative (WSCCI). In short, it means we are now making use of all of the Symfony2 Components that we've pulled into core in the past few months.

It is also step one in the biggest change in Drupal's design since Drupal 4.7.

readfile() not considered harmful

If you're like me, you've probably read a dozen or two articles about PHP performance in your career. Many of them are quite good, but some are simply flat out wrong, or misinformed.

One of the old truisms that has been repeated for as long as I can recall is "don't use readfile() if you have big files, because it reads the whole file into memory and your server will explode." The usual advice is to manually stream a file, like so:

<?php
$fp
= fopen('bigfile.tar', 'rb');
while (!
feof($fp)) {
print
fread($fp, 1024);
}
fclose($fp);
?>

There's just one problem with that age-old truism: It's not true.

Refocusing WSCCI

As Dries has already reported, we held a summit meeting at the Acquia offices in Boston last week. It was a good sprint for a couple of reasons. For one, a large number of leading core developers got more clearly on the same page about the direction of Drupal core. For another, we were able to break the "too big to swallow" logjam that has been plaguing the Web Services and Context Core Initiative (WSCCI).

Top Ten Reasons To Go To DrupalCon Denver

You mean you aren't already attending what will likely be the largest web developer conference in the Western US this year? What are you waiting for? Not sure if it will be worth it? It will be. Oh, it will be...

If you still need some convincing, or if your boss still needs some convincing, here's the top ten reasons you want to be at DrupalCon Denver:

PHP project structure survey

As Drupal is in the process of considering how to restructure code to best leverage the PSR-0 standard, I figured it would be wise to take a quick survey of how some other major projects organize their code bases. This is not a complete rundown of every project, simply roughly comparable notes for those areas Drupal is currently discussing. I am posting it here in the hopes that it will be useful to more than just Drupal.

Note: This is based on one evening's work of poking around. If you work with one of these projects and have more information to provide or want to correct a mistake I made, please do so in the comments!

Syndicate content