I have my own personal under-bed monster, and it's in the form of another breed of developer.
In truth, this article is less about that which torments me and more about two different types of developer that I've identified. I like to call these two types of developers the 'artist' and the 'engineer.' Both are skilled developers, but let's take a look at where they differ.
The artist seeks beauty in all things. They choose a wallpaper instead of using the stock one. They apply different colour schemes to their editor. They care when an image on a website has one extra pixel of padding to the right when compared to the left.
These types of developers enjoy patterns (visual ones) and consistency. They like it when things are aligned. They want their bookshelf to be ordered by the colour of the cover, or alphabetically, or any evident pattern. For definite, will they be labeled as 'that OCD person'?
I am one of these people. I am the artist. I'm fine with it. Our nature rarely raises anger from the 'engineer'. We'll keep things pretty, and they will still be functional.
Unfortunately, this peace does not work from both directions. Let's take a look at the 'engineer'.
The engineer does not give a flying pig about your consistency, or your patterns. They are a skilled developer, but they care more about the functionality of their code than its general appearance.
You think they have time to ensure their comment format is consistent across the project? Oh hell no. They don't have time to waste on that. If you encourage them to do so, they will resent you.
My monster isn't under the bed at all, is it? It's the 'engineer' sitting over there who doesn't understand my desire for visual consistency.
Consider the following snippets of PHP code. Don't worry; this isn't a highly technical article. We won't get complicated.
<?php namespace Laravel\Application; use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Collection; use Illuminate\Container\Container; use Illuminate\Database\Eloquent\Model;
This is the work of an 'artist'. They like the way that the namespaces slope. If they add a new import, they'll likely take the time to ensure that the slope still obeys the rules. It's visually pleasing, and it allows them to enjoy their class. Their code isn't just instructions; it's artwork.
In contrast, here's what the 'engineer' has done.
<?php namespace Laravel\Application; use Illuminate\Container\Container; use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Response; use Illuminate\Http\Request; use Illuminate\Support\Collection; use Illuminate\Support\Str;
This solution is perfectly fine. The code still executes as before, but the 'engineer' has instead decided to order his imports alphabetically (or in most circumstances, not order them at all.)
Let's take a look at some more work from the artist.
/** * The event dispatcher instance. * * @var \Illuminate\Contracts\Events\Dispatcher */ protected $events; /** * The IoC container instance. * * @var \Illuminate\Container\Container */ protected $container; /** * The route collection instance. * * @var \Illuminate\Routing\RouteCollection */ protected $routes; /** * The currently dispatched route instance. * * @var \Illuminate\Routing\Route */ protected $current;
The artist has provided consistent comments for all of their class properties. Having this consistency makes their class more 'balanced', more visually pleasing, and more artful.
In contrast, let's look at what the monst.. 'engineer' has done.
/** * The event dispatcher instance. * * @var \Illuminate\Contracts\Events\Dispatcher */ protected $events; /** * @var \Illuminate\Container\Container */ protected $container; /** * The route collection instance. */ protected $routes; /** * The currently dispatched route instance. * * @var Route */ protected $current;
The engineer provides descriptions only when they think that they are necessary. To add a description to every property for the sake of consistency would be a waste of their time.
Fully qualified namespaces, or relative ones? Surely it doesn't matter. PHPDoc will parse them just the same.
Note that all of the examples are perfectly legal with respect to the 'PSR-2' PHP coding standard, but instead the difference focus on layout, style, and consistency.
Which of the two developers is correct? As much as it pains me, I think that neither of them is wrong.
Both are skilled developers, and both write code that is fully functional and delivers the solutions they seek. It's unfortunate that the engineer is most likely to make the artist feel uncomfortable.
Speaking as an 'artist' (at least in the context of this article), when I write code that is inconsistent, I instantly lose an appreciation for that code. It's tainted, it's messy, and I don't love it anymore.
I'd never consider punishing an engineer for their way of coding; it simply wouldn't be fair. However, I do believe that consistency can have its advantage when working in a team.
When in a team, imposing rules that extend further than a standard code-style guide will result in code that will appear it has been written by a single individual. This makes it much easier to "scan" and to understand (at least, over time). Training the engineers to follow this practice is a difficult task. Habits form over time, and can become difficult to retrain. Especially when they do not "feel" anything for the consistent visual appearance of code.
If you'd like to observe the artist and the engineer in a non-professional environment, then consider the world of open source.
Observe the likes of Taylor Otwell (Laravel) and Fabien Potencier (Symfony). Both incredibly gifted developers, and creators of the most popular PHP frameworks on the 'market'.
Examining both frameworks, and the code they have contributed (or maintained/reviewed) I'd suggest that Taylor is the 'artist' and that Fabien is 'the engineer.'
In fact, I'd also be as bold as to suggest that artist types are more attracted to the Laravel framework and that engineers are more attracted to Symfony. Of course, this suggestion is based purely on personal observations.
The programming world is a diverse mix of personalities, and I'm incredibly grateful for this. Whether you are an artist, an engineer, or something entirely different. Please continue to write fantastic code.
Do you think that you identify as an artist or an engineer? Why not leave a comment to let me know!
Thanks for reading!