Actionable Task Naming – Reduce Confusion, Increase Speed
I’ve worked on many teams across many task management systems. One practice that has consistently brought clarity to our projects is actionable task naming. That is, naming tasks in a way that makes them assignable and actionable. This will reduce the number of false assumptions made, and the amount of time it takes people to interpret a task, every time they encounter the task!
Doing this is easy, too.
When you’re writing a task, say these words first (in your head): “I need you to…” or “I need them to…” or “John needs to” — you get the gist. It’s that simple (most of the time).
Instead of Hero image on the homepage is too large you could say Make homepage hero image smaller or Homepage: make hero image smaller or similar.
Note that I often remove the word “the” (Make the homepage hero image smaller).
This time I’ll illustrate why this practice is useful:Address field is optional — does that mean it is currently optional but needs to be required? Or does it mean that it’s presently required but needs to be optional? I don’t want to have to ask myself that question each time I pass by this task. It’d be much easier to understand the intent/issue if it was written Make address field optional or Make address field required or similar.
On a Related Note (for Developers)
You can use a similar practice when writing version control commit messages.
Instead of I need you to... we use the prefix This will....
The result is consistent messages that say what will happen when a commit is applied/reverted.
Example:Update jQuery UI version to 3.5.1
Twig Caching Issues in Acquia Cloud Enterprise
I’ve recently run into an issue where my site (on Acquia Cloud Enterprise) has node displays that were flip-flopping between an older version of a Twig template file, and the most recent version. I tried all combinations of drush cr, varnish cache clearing, and clearing the cache through the Drupal UI.
After reading through No reliable method exists for clearing the Twig cache, I landed on this page at Acquia: https://support.acquia.com/hc/en-us/articles/360005167754-Drupal-8-Twig-cache
I SSH’d into the production server I always SSH into, and I ran the command as shown. I did this repeatedly. I did a drush cr after. I did a drush cr before. Nothing was working. My pages were showing up with the old template, or the new template, and it seemed to be at random.
Ultimately I re-read the documentation page, more thoroughly this time, and discovered this: “connect to each web server instance and run a command like this…“
Ahah! EACH web server.
So, I logged into the Acquia Cloud interface, found the other production server’s connection string (email@example.com), connected, and ran the same command. After another drush cr all of the pages were using the new template.
That’ll teach me to jump straight to executing commands without reading the instructions carefully.
Updating a MySQL Field Based on its Row’s Position in a Select
Let’s say you have the following data in a table:
name position Stevie Ray Vaughan 1 Derek Trucks 3 Joe Bonamassa 2
Now, what if we wanted to update the position value of each row to match the order if we were to sort by name…
Creating Field Groups in a Custom Module
If you need your module to add a fieldgroup to your Drupal 7 site, follow this quick and easy process: Also, if you’re looking to create fields, see this related post.
- Build the fieldgroup through the “manage fields” UI.
- Modify the code below to include a proper $fieldgroup_name, $entity_type and $bundle_name. I needed to add a field to the user profile, so I set the $entity_type to “user” and the $bundle_name to “user”.
PHP1234567891011$fieldgroup_name = ''; // e.g., group_author_info$entity_type = ''; // e.g., node$bundle_name = ''; // e.g., storyinclude_once DRUPAL_ROOT . '/includes/utility.inc';$group = field_group_load_field_group($fieldgroup_name, $entity_type, $bundle_name, 'form');$group_var = '$' . $fieldgroup_name . ' = ' . substr(drupal_var_export($group), 9) . ";\r";$group_var = preg_replace("/ 'id'.*,\n/", '', $group_var); // remove the ID property$group_var = preg_replace("/ 'export_type'.*,\n/", '', $group_var); // remove the export_type property$output = $group_var . 'field_group_group_save($' . $fieldgroup_name . ');';drupal_set_message("<textarea rows=30 style=\"width: 100%;\">" . $output . '</textarea>');