The Hidden Skill and Art of Naming Things
Tags: ddd, linguistics, ubiquitouslanguage, namingthingsishard
Published: 2021-08-27 11:45:51

The two hardest problems in programming are cache invalidation, naming things and off-by-one. You learn a lot about algorithms while studying computer science to find clever solutions for the problem at hand - but for naming things?

For me undoubtedly this is the hardest problem. In fact, this issue exists in almost every discipline, whether you are pioneering a field and are the first one to name your discovered thing(s) or on a daily basis when communicating with your co-workers. As developers, we face this when communicating with our PM on our specs or with designers on sketches, mockups, or components.

While studying sports science it is common (and required) to start with a definition first and then use it along the way. In computer science, this of course happens for the technical terms but isn't considered for actually writing software to solve a problem in a certain domain. During my software engineer apprenticeship, I remember in _some_ situations getting tips and discuss naming things on the spot for domain-related terminology. In university, for the handful of computer science courses I had, nothing - this was left out. I can't remember a linguistic course for this, that I think would come closest for teaching this.

Discussing naming things at work is often seen as unnecessary and considered a waste of time preventing you from getting the job done. There might be some truth to it, as it wouldn't necessarily matter for the current task you might be working on, but the pain becomes "visible" when the next person has to deal with your (improper) naming. When the naming doesn't click immediately or doesn't do what the name suggests, it gets hairy and the problem is passed on to the following person (that might even be your future you). Sometimes, it's wise to take a shortcut when the context is not known well enough to give it a proper name (note to developers: please put a comment in your code).

## What Makes a Good Naming?

<!-- wp:paragraph -->
<p>A good naming is already encoded in the term <a href="https://thedomaindrivendesign.io/developing-the-ubiquitous-language/">ubiquitous language</a> and it's enough to describe it in two points:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>A non-technical/industry language eliminating inaccuracies understandable by a multi-disciplined team</li><li>No ambiguity!</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>You could say there are some people who spent more time on naming things than others. I've realized there is some mastery level to naming things, roughly:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Level 0 - Just name it with the first thing that comes to mind <br>Level 1 - Your naming suggest what it does properly <br>Level 2 - With your naming a consumer can no longer use your thing the wrong way <br>Level 3 - Your name is a beauty and makes the consumer smile, it leads to a positive emotional benefit. This is where you begin to imagineer and reach for art (this is the bonus level - hardly reached).</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><em>Important Note: This is not really a mastery level, like you shall NOT say: "I'm at naming things level 2". It's only a short, quick, and non-exhaustive scale for use within this article!</em></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Ambiguity is clearly the enemy of good and clear naming and it almost ever happens unintentionally. I consider this problem solved, when reaching level 2 with your naming, the gap from level 1 to 2 is the hardest to jump.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Naming things as a skill will unfortunately often go unnoticed, rarely praised and honored. Instead, it will most often be recognized when it's done (completely) wrong.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Test Yourself with an Example</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Let's use this wireframe (below) as an example. Imagine you are about to develop this screen which contains three sets of information. The application in which this is going to be used, is an international app and the contents for the text are stored in locale files, your job is to give these variables proper names. Easy huh?</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":327,"sizeSlug":"large","linkDestination":"none"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://gos.si/wp-content/uploads/naming-things-example.png" alt="" class="wp-image-327"/></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>There is a straight forward way to name these three variables:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Headline</li><li>Tagline</li><li>Text</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>Boom! you would think, you found three variable names that get the job done quickly and can move on. But later your brain starts to think: is it really a <em>headline</em>? What about <em>heading</em> or <em>header</em>? What even is the difference between the three? As web-developers, we can at least relate <em>header</em> to an equivalent <code>&lt;header&gt;</code> element that is there to <em>structure</em> the document into semantic sections. That's the first relief here, disconnecting <em>header</em> from <em>headline</em> and <em>heading</em>. Identifying <em>header</em> as a structural thing allows for more connections to related concepts.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Where else is structuring used to section documents? For me, I have explored this in <em>LaTeX</em> and <em>HTML</em>, each of these technologies comes with mechanics to provide structure.</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>HTML: Mainly <code>&lt;article&gt;</code>, <code>&lt;section&gt;</code>, <code>&lt;header&gt;</code> and <code>&lt;footer&gt;</code> as well as <code>&lt;h1&gt;</code> to <code>&lt;h6&gt;</code></li><li>LaTeX: Most of <code>\\part</code>, <code>\\chapter</code>, <code>\\title</code>, <code>\\heading</code>, <code>\\subheading</code> etc.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>The name of these mechanics can also help us create a guided structure for naming our variables in an entire project. These names are good candidates to prefix and structure our locales. An important learning from that little exaggeration is that the name of the variables are <em>sourced</em> from the technical implementation (if applicable). This is good knowledge to assist your naming and maybe come up with some guidance on semantics. It's not yet enough to land on the final design for the naming but a little success and very good input.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Left is the unclarity between <em>headline</em> and <em>heading</em>. I am not a native English speaker and I don't know the nuances between them linguistically, which is a problem we see occur quite often (as English is the language of international teams as well as development often happens in English, too). A possible explanation, I came up for myself, is that it depends on the context/discipline we are in. From a <em>marketing</em> perspective, this would perhaps tend to be more of a <em>headline</em>, which is important to attract the interest of a possible reader. On the other side, in scientific writing, a <em>heading</em> is quite fine to summarize the following section or it might be a required field for the article format/magazine you are publishing for.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Discussion</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Even with <em>what seems to be a simple example</em> there is a lot to learn and explore around, which gives more context to land on a proper naming. The example shown is one I haven't solved for myself yet, but it's good practice to explain the levels I described earlier:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Level 0 - Take the first naming <br>Level 1 - With a bit more investigation, come to a solution that feels has more of a <em>proper</em> naming <br>Level 2 - The naming resolves in a convention of what words to use for what purpose. At this point, you can't get the naming of your variables wrong anymore, and you also know how to implement them. <br>Level 3 - Perhaps not reachable at all for this situation (but that's ok, not every situation has a bonus level)</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Level 0 and 1 do have a trap for the uncanny valley of naming things, they may seem right and obviously are not at the same time. What exploring of level 1 unlocks is a mystified view of what's slumbering in the topic and to see the possibility of reaching level 2.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>What was the level you felt comfortable with? Did you drop at some point? Are you fine with just the first three variable names and called it a day? Have I just caught your interest and you are about to dig deeper and solve the mystery? Have you maybe already solved that one?</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Naming Things in Product Development</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>For product development domain-driven design (DDD) is a good method to aim for a ubiquitous language. Reaching there requires a conversation between stakeholders from multiple disciplines to grasp all perspectives and land on a shared language to eliminate the mental burden in your team's daily conversations and to quickly reach the point of discussion.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>From the perspective of the role of a developer, there are a couple of things you want to look for when having conversations with people from other disciplines, with yourself or peer developers. The best resource to consult are domain experts and they are likely to speak a completely different language than developers are used to. This is already the first point of friction as I've realized that developers tend to name things as they appear technically. It requires time and effort to shift your mind and allow other naming methods, such as domain-driven design. In the end, we want the code to speak <em>the</em> ubiquitous language and not let the domain adopt a technical language.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Important for naming are <strong>objects</strong> and <strong>actions</strong>. These names are taken from the <a href="https://uxdesign.cc/an-introduction-to-object-oriented-ux-and-how-to-do-it-829bf6b248a1">OOUX</a> naming convention for <em>things</em> (nouns) and <em>activities</em> (verbs). While OOUX is great and I admire it for what it offers, it is not a gold standard. If you've already settled on terms for your own team, that's great. Yet for the rest of the section, I'm going to use objects and actions as described here:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>… <strong>objects</strong> (nouns) are entites/aggregates, locations (business verticals), areas (on the screen), elements/components, etc.</li><li>… <strong>actions</strong> (verbs) are activities a stakeholder can perform directly related to an object</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>Unveiling, identifying, and characterizing them is a not-so-easy job. <strong>Landing at a vocabulary that is used in the specs (product), in graphic editor (design), and finally in code (development) is the goal</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here are a couple of ideas to improve your naming game:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li><strong>Talk and listen to designers</strong>, you may want to ask the reasons or background for something. You can also testify your assumptions, such as “do we do that, so the customer can get xyz?”. During a refinement, train yourself to understand the cues that will draw your attention. Often, there are phrases like “we do a list here, so the customer receives an explanation for xyz”. The “receives an explanation for xyz” part answers the question of <em>what</em> something is meant for. <br>By doing these things you not only get a better feeling to arrive at a proper naming. A very nice side-effect is the better understanding for design and especially the design creation process.</li><li><strong>Talk to P*-title positions (PM/PO/P*)</strong>, to understand the different ways in which the app stakeholders manipulate these <em>objects</em>, their <em>relationship</em> to others, and which <em>actions</em> they are supposed to perform. P*-title positions are a great resource to understand these nuances as they know, define and understand the product.<br>This is done as part of the <a href="https://www.rewiredux.com/ooux">ORCA process</a> and the part described here might also be done by designers (or in combination with P*-level).</li><li><strong>Full-stack pairing between FE and BE developers,</strong> to consult on objects and their technical characteristics. FE developers mostly work with a subset of the whole objects as defined in the backend or even on the database level. It is a very welcoming discussion to see how objects are represented in BE, then filtered to be transferred over the wire, consumed and processed by FE developers. Often a pairing session between BE and FE developers is fruitful to better understand the technical picture and to learn what matters on the FE and BE respectively, the <em>what</em> and <em>how</em> about the (technical) relationship.</li><li><strong>Imagine a real-life situation,</strong> sometimes it’s very helpful to think of an imaginary situation, where the work of your product is done by a human. Let's say a consulting situation, where the consultant and a customer are sitting in a room together. No digital devices, everything in paper in front of them on a table.<br>This little simulation game is very helpful to draw actions from. Especially in a non-digital situation, there is no click, no tap, no swipe a customer or consultant can do. You can directly eliminate this way of thinking. <br>Examples:<ul><li>The consultant would have a <em>folder</em> with recommendations, that can be <em>opened.</em></li><li>The customer takes a pencil and <em>signs</em> a <em>contract.</em></li><li>The customer will <em>choose</em> between <em>offers</em> lying in front of them.</li></ul></li><li><strong>Beyond Tellerrand</strong>, a thought experiment taking a couple of minutes, where you are exceeding the scope on purpose, pushing the boundary far further than it should be. This helps to explore the space around the actual context, will help fine-tune what is the boundary and more important, what your name WILL NOT BE. It's a way to see a sharper image of the scenery you are looking at.</li><li><strong>Event storm</strong>, with your multi-disciplined team (invite domain experts!) about the subject from multiple perspectives to reach a clear picture, understand the other perspectives and be further able to share empathy with them and embody their perspective (to take a stance against yourself?).</li><li><strong>Event storm with yourself</strong>, This is actually a misconception in itself but when event storming as a team is too much/not affordable, this might come in handy. When doing this on your own, you have to virtually embody other perspectives and try to understand their situation when looking at the how-to-call-it. Take it with a grain of salt.</li><li><strong>Name storm</strong> (ok, I made up that one). When you understand the scenery and the only thing left is to land on a final name and you have too many candidates, throw a name storm session to decide on a final name.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>With all these methods you should maintain a document about your domain terminology. Refine this document over time with even preciser descriptions and wording.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Writing specifications with this terminology will become utterly easy. Even the best specifications are not prevented from becoming outdated and the code remains a single source of truth. The holy grail a developer can reach for is to assure the code <em>reads</em> as the spec. Consider every location where the naming of code units does not conform to your terminology as tech debt.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Testify your existing code by reversing the approach from above. Deducting objects and actions from your code and how they are connected together, is it possible to reverse engineer the specification (for a non-developer)? Does the name of the function properly describe what it is doing or is it required to read the implementation details of it? Does the name properly express <em>(for) what</em> it is doing?</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Grow your Repertoire</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Becoming talented at naming things means you will have a big repertoire and be able to faster discard options, that you already know will not help you achieve what you are looking for. This is common amongst all talents in various disciplines. In order to stay or be talented, growing a repertoire is essential; so you can faster reach for level 2 on naming. That's why it is never a waste to pursue an idea even if it turns out to be a bad option. Following that path already has grown your repertoire over another person who took a shortcut. Don't forget to stay curious and keep up the hunger to really get to the bottom of a problem as this is the motivation for going on such a journey.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Apply Naming Things for the Biggest Impact</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Naming things often requires research, failing attempts, try and error, and overall is a costly voyage. It's wise to funnel this process to control the impact.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>First of all, identify people who have an interest in naming things properly and will do the required steps to land there. This is not something binary but on a scale, you can draw people towards one or the other end of the spectrum, much related is also the concept of <a href="https://bigsea.co/ideas/micro-and-macro-thinkers/">macro and micro thinkers</a>. I would say a person who is having a strong tendency to nail naming things is also a macro thinker. In terms of development, a macro thinker leans more on the side of architecture, developer experience, or tooling. On the other hand, micro thinkers learn more on the side of feature implementation, I have also heard the term <em>makers</em> for them. The team you work with clearly needs both and both need to be rewarded for what they are good at. At best, the macro thinkers supply the micro thinkers with tools and guides so they can get the work done quickly.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>After identifying the right people, and knowing who belongs to the different group of thinkers, macro thinkers should be tasked with getting the naming right. There are technical things, such as namings in your tooling (design system is probably the best to name here) as well as namings in your product/domain. The former is more on a building blocks/foundation/tooling level whereas the latter is more on a conceptual level and when both are defined and their characteristics are worked out, development can happen at a fast pace as these are big piles of mental burdens keeping productivity low. Having them defined will make product development and engineering a joy to do.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>I hope this article helps you understand the value and skill of naming things and hopefully you can form new strategies with your team to naming things.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Special thanks to <a href="http://twitter.com/gabrielaospina">Gabriela Ospina</a> for editing this article and nerding out with me about naming things!</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>-gossi</p>
<!-- /wp:paragraph -->