PHP

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.

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!

Backward compatible APIs

As we begin a new year, it seems appropriate that the discussion of backward compatibility has come up yet again in Drupal. It's a perennial question, and you can tell when a new Drupal core version is ready for prime time when people start complaining about lack of backward compatibility. It's like clockwork.

However, most of these discussions don't actually get at the root issue: Drupal is architecturally incapable of backward compatibility. Backward incompatibility is baked into the way Drupal is designed. That's not a deliberate decision, but rather an implication of other design decisions that have been made.

Drupal developers could not, even if they wanted to, decide to support backward compatibility or "cleanup only" type changes in Drupal 8. It is possible to do so in Drupal 9. If we want to do that, however, then we need to decide, now, in Drupal 8, to rearchitect in ways that support backward compatibility. Backward compatibility is a feature you have to design for.

What Symfonic Drupal means

Earlier today, Dries committed a patch that adds two Symfony2 Components to Drupal: ClassLoader and HttpFoundation.

On its face it's a fairly simple patch; the new code in it is maybe a dozen lines. But it's an important part of a larger shift within Drupal to better embrace the modern web, on the server as well as the client.

The future of caching

This is not your father's Internet. When the Web was first emerging onto the scene, it was simple. Individual web pages were self-contained static blobs of text, with, if you were lucky maybe an image or two. The HTTP protocol was designed to be "dumb". It knew nothing of the relationship between an HTML page and the images it contained. There was no need to. Every request for a URI (web page, image, download, etc.) was a completely separate request. That kept everything simple, and made it very fault tolerant. A server never sat around waiting for a browser to tell it "OK, I'm done!"

Much e-ink has been spilled (can you even do that?) already discussing the myriad of ways in which the web is different today, mostly in the context of either HTML5 or web applications (or both). Most of it is completely true, although there's plenty of hyperbole to go around. One area that has not gotten much attention at all, though, is HTTP.

Well, that's not entirely true. HTTP is actually a fairly large spec, with a lot of exciting moving parts that few people think about because browsers offer no way to use them from HTML or just implement them very very badly. (Did you know that there is a PATCH command defined in HTTP? Really.) A good web services implementation (like we're trying to bake into Drupal 8 as part of the Web Services and Context Core Initiative </shamelessplug>) should leverage those lesser-known parts, certainly, but the modern web has more challenges than just using all of a decades-old spec.

Most significantly, HTTP still treats all URIs as separate, only coincidentally-related resources.

Which brings us to an extremely important challenge of the modern web that is deceptively simple: Caching.

Design Patterns of Drupal

My article from the inaugural issue of Drupal Watchdog is now online. Design Patterns of Drupal is based on my original session from DrupalCon Paris. Although Drupal-centric, it serves as a great introduction to the concept of design patterns in general.

If you're going to be at DrupalCon London, watch for Watchdog issue #2 in your swag bag! It looks like I may have as many as three articles in it, discussing mobile web design, Drupal 7's improved node access system, and how to approach the "Drupal stack" when planning a new site. I'll also be on stage talking about Code Smells and how to avoid stinky code, plus teaming up with Peter Wolanin to talk about what it means to work with Free Software.

See you in London!

Syndicate content