acquia

The DX Files: Defined constants as API arguments

This is part two of my series, The DX Files: Improving Drupal Developer Experience.

Many Drupal APIs accept a boolean argument (TRUE or FALSE) to determine some behavior. I believe that practice should be banned in all but exceptional cases, instead using a defined constant with a descriptive name.

Here is a perfect example from Drupal core:

<?php
    $output
= node_view($node, FALSE, TRUE);
?>

Now, quick! Who can tell me what passing FALSE as the second argument and TRUE as the third argument means?

The DX Files: Improving Drupal Developer Experience

I am declaring a personal crusade to improve Drupal’s “Developer Experience,” which I hereby abbreviate as “DX.”

Acquia Web 2.0 Expo Launch Pad video

On April 24, Jeff Whatcott and I gave a 5-minute Drupal demonstration and Acquia pitch at the Web 2.0 Expo Launch Pad event. Here's the video (larger version here).

Syndicate content