Andrea Goulet is giving me an existential crisis. The CEO of a software development consultation shop, she recently wrote an article called Menders vs. Makers, and something happened this week that makes me think, maybe I'm in the wrong line of work. I'm starting to suspect I'm a mender in a business that only values makers.
This week, I was working on a code base that provided a hierarchical tag editor for an inventory system. I had recently added a new feature that made it possible to see individual elements of the tag system on the Collection page; you not longer had to go visit a single object to see if it had, for example, a location tag; you could just say on the Collection page, "Show me all the objects that have a location tag, and add a new column, location."
Now that we were able to see the tags, a new problem was found: it wasn't possible to delete tags. Odd nobody had noticed that before. Since I was the last person in that code base, it was my duty to fix it. Down into the legacy code I went.
The tagging code was, well, intermingled. Validating the tags, determining the changes between the version on the client and the version on the server, writing those changes back, were all in a single gigantic Backbone sync method involving empty arrays, for loops, and concat methods. I spent about four hours, during which I:
* Replaced all `for` loops with `map / reduce / filter`
* Separated the model validation into its own method
* Used underscores's `intersection / union / difference` functions to create instruction sets for deleting and adding to the tag system
* Used Backbone's `set([_], (void 0), {unset: true})` method to delete the tags, rather than hammer the event bus with a series of change events in a `each` loop.
I struggled a lot to make sure I was using names that explained what each thing did.
In short, I did with my code what I did with my writing: try to make every line a pleasure to read, something that told a story about what was happening and what was going to happen next. I hope when someone sees overlappingTags = _.intersection(newTags, restrictedTagNames)
, it's obvious what's happening, and it should create anticipation that soon there will be a line that checks to see if overlappingTags
has anything in it and, if it does, reports an error with the offending tags.
I've always had fun doing stuff like that, turning unreadable mash into clarity. Even my recent bragging project, Polyloader, is actually a fix for the "All Python on the filesystem ends in .py" bug that sorta firewalls Python syntax from the rest of the language universe.
I've found this industry doesn't really like menders. Code editors, people who go in after the fact and apply measures both aesthetic and qualitative to the code they see, are often seen as nothing but agency overhead by managers.
On the other hand, I've yet to meet another developer who resented menders. They like menders; they want to learn from menders how make code better. Menders tend to be older, tend to know more, tend to be broadly learned and strongly opinionated. Nothing "just gets thrown there." It has to be fixed, it has to work, it has to be right. And I've yet to meet a software developer who didn't want to get it right. Often, they just don't know how, or nobody's ever told them how.
Let's show them how.