Yearly Archives: 2016

Some thoughts on my favourite quotes of “The Clean Coder”

the clean coder - cover

Last week I finished Robert C.Martin’s The Clean Coder: A Code of Conduct for Professional Programmers. It had been on my shelf for a year and a half, and last year I even started it and got halfway through it, but ended up forgetting it for some time. Until last month, when I decided to start it again, but this time, going cover to cover.

Chances are that you’ve come across it before, at least once. If you haven’t, then I’m happy you’re reading this post now. If you have, but it didn’t arouse an interest in you, then let this post serve as a reminder to you, software developer, that it is probably one of the few must-read books that you need to read. You might not agree 100% with everything that is said in the book, although you’ll probably agree with a big chunk of it, and if you’re like me, you’ll realise about things that you never thought of before, and you’ll find some other aspects of your job where you can still improve. One way or the other, I can’t recommend it enough.

With most books (technical ones, at least), I like to do a quick recap of the things that I liked most, or that caught my eye for some reason. I won’t do a review of this book, but I wanted to list here some of the quotes that I found more interesting. Not because they looked very poetic but because of the principles and attitudes they show towards the software development profession. So, let’s get straight into it.

Excerpt from the preface. On political pressure and experts’ advice:

Despite all the protest and memos, and urgings of the engineers, the managers believed they knew better. They thought the engineers were overreacting. They didn’t trust the engineers’ data or their conclusions. They launched because they were under immense financial and political pressure. They hoped everything would be just fine.

Continue reading

Overwriting global permissions within Organic Groups for single page requests

Druplicon logo with avatar icons

In a recent project built in Drupal 7, I came across a bit of an uncommon scenario, by which some users needed to have access to certain features that were normally restricted to them, when viewing, editing or creating groups content (ie: whenever they are visiting a part of the site that is considered part of a group).

For example, while normal users didn’t have access to use certain text formats in the wysiwyg editor, those that were considered group leaders needed to make use of that particular text format. In this scenario, a group leader was an existing role within Organic Groups.

Continue reading

Upgrading Drupal’s Viewport module to Drupal 8 (Part 3 – Final)

Drupal 7 to D8 migration

Image taken from

With parts one and two of the series covered, this 3rd (and final!) part will cover some other important aspects of Drupal development that I wanted to pay attention to while working on the Drupal 8 version of the viewport module.

Essentially, the kind of aspects that are easy to forget (or ignore on purpose) when a developer comes up with a working version or something “good enough” to be released, and thinks there’s no need to write tests for the existing codebase (we’ve all done it at some point).

This post will be a mix of links to documentation and resources that were either useful or new to me, and tips about some of the utilities and classes available when writing unit or functoinal tests.

Continue reading

Upgrading Drupal’s Viewport module to Drupal 8 (Part 2)

Drupal 8 logo

In the last blog post, I started to talk about the process of upgrading the Viewport module from Drupal 7 to Drupal 8. While the module is now fully ported and has a stable version for Drupal 8, I didn’t cover all the steps and new things that I came across while working on it.

This time I’ll go through the notes I took while working on the settings page, the creation of a proper schema for configuration management, and the conversion of procedural code into PHP classes. Let’s get into it:

Continue reading

Upgrading Drupal’s Viewport module to Drupal 8 (Part 1)

Drupal relay

Image taken from Phase2 website

Viewport is one of the modules I maintain for Drupal 7. It’s a very small and simple module that does a very specific thing: it allows site admins to specify the values they want for the HTML meta tag that specifies the viewport settings for browsers. It also allows admins to choose the pages in which they want this custom viewport applied.

Back in the day a client required this functionality to embed some browser games that required very specific settings. Nowadays it’s not really common for a site admin to set those values, and developers don’t really require any UI to set them.

Continue reading