Against Names
The article explores the challenges of naming in computer science, highlighting anonymous identifiers in version control and utility CSS as ways to simplify workflows while balancing named and unnamed elements.
Read original articleThe article discusses the challenges of naming in computer science, referencing a well-known saying that highlights the difficulty of naming things and cache invalidation. The author reflects on their recent experiences with systems that do not rely on names, suggesting that this approach can simplify processes. They provide two examples: the use of anonymous branches in the version control system jj, which allows users to work with change IDs instead of branch names, and the adoption of utility CSS through Tailwind, which focuses on describing styles with utility classes rather than semantic names. The author argues that while naming is important, there are scenarios where it may not be necessary, and that using anonymous identifiers can streamline workflows. They conclude that the abstraction level at which names are applied is crucial, advocating for a balance between named components and anonymous elements in programming and design.
- Naming in computer science is often challenging, with some arguing it may not always be necessary.
- The version control system jj allows for anonymous branches, simplifying the process of managing changes.
- Utility CSS, as exemplified by Tailwind, emphasizes functionality over semantic naming, promoting a different approach to styling.
- The author suggests that the level of abstraction determines when naming is beneficial, advocating for a mix of named and anonymous elements.
Related
Why We Build Simple Software
Simplicity in software development, likened to a Toyota Corolla's reliability, is crucial. Emphasizing straightforward tools and reducing complexity enhances reliability. Prioritizing simplicity over unnecessary features offers better value and reliability.
CSS Classes Considered Harmful
The use of CSS classes is criticized for limitations and conflicts. History of HTML/CSS evolution is discussed, proposing attributes over classes for more flexible styling in modern web development.
Post-Architecture: Premature Abstraction Is the Root of All Evil
The article explores Post-Architecture in software development, cautioning against premature abstraction. It promotes simplicity, procedural programming, and selective abstraction for maintainable and efficient code.
My programming beliefs as of July 2024
Evan Hahn emphasizes tailored programming approaches, distinguishing "simple" from "easy," promoting testability through modularity, and advocating for ethical coding practices prioritizing societal impact and nuanced thinking in software development.
Examples of Great URL Design (2023)
The blog post emphasizes the importance of thoughtful URL design, showcasing examples from StackOverflow, Slack, and GitHub, and encourages readers to share their favorite effective URL designs.
Maybe not everyone gets the same benefit from the discipline as I do! It’s certainly possible. But I do have to wonder how much that’s the case.
For git, I'd never even considered it, but I often find myself renaming branches `thing-im-doing2` just because the first branch is broken, or having `abc-def` and `def-abc` branches accidentally...
The tooling needs to be wildly adopted though, and that's difficult. I gave up on graphite for exactly this reason.
It has kind of radicalized me against "pointless names". Names take up valuable space in the working memory of the reader. They need to carry their weight.
You only write code once, but if the software is long-lived, different people will read that code for years to come, doing support, maintenance, and adding features.
By naming something, we make it a Thing. It forms a shape in our minds. However small, it has a history and a purpose. It has relationships to other Things. Its identity is now something we take custody of, by continuously interacting with it. This can help in the smaller context but does not scale.
One example is organization of e-mail. The traditional inbox approach makes you create folders. You have to give name and meaning to each of these. Organize them into trees of subfolders. Contrast this with the search-based approach popularized by Google and notmuch - tags/labels are optional but in general you have "an ocean of mail" which you search on an ad-hoc basis[0].
I think the OPs point can be taken further. That there's an inherent human instinct to want to name and create Things and that it's beneficial to be aware of and overcome this instinct.
I have a bunch of useful code and scripts spread across a couple of libraries. I could hypothetically break out anywhere from a handful to dozens of focused individual repos with a fancy Name. Make them into npm packages, give them each a logo, maybe even separate websites and chat rooms[1].
At the extreme, look at the pathological Clueless-driven big-tech with a gazillion Projects, Initiatives, Frameworks, Processes, Working Groups, Epics, Task Forces, Swim Lanes, continuously churning through birth and death. The meta-abstractions start to run the show.
[0]: I happen to prefer the mailbox approach myself! Of course the taxonization and structuring is not all bad - here the history and meaning is inherent and useful. My point is rather that it should be applied consciously. And in my mailbox, as opposed to in much of the software I write, the Things and their forms are entirely self-inflicted (hello NSA) and not something hoisted on the minds of others.
[1]: This is apparently fashionable recently among 10x Open Source GitHub Rock Stars. It's also particularly a disease in crypto with all these "Protocol"s each spawning their own fractal universe of Things.
Without reading any code, you can tell what "inputToFocus", "postalCodeIsValid" and "daysToEarliestAppointment" mean. Then you know what this variable represents in the real world, and also what your code is operating on.
I also prefer CSS class names that describe what the object is (".alert-box.warning" or ".button.primary"), and not what it should look like. I don't like updating dozens of templates because I want to change how some things look across the website. I know that I won't forget to update one and create a hard-to-find bug.
But I feel like the two examples given don't really support the case against.
In git, branches are close to meaningless. You can use git without branch names quite well, it's just not as nice of an experience as jj. The only thing you can not do in git without having a named branch (or rather a ref of some kind, does not have to be a branch) is moving commits between local and remote repository.
In git, branches are only meaningful – briefly – when communicating with other people, in which case naming them really matters! For your own temporary use, sure, don't name then. For me that's more of a flaw of git. In most git workflows you're meant to destroy history, so it doesn't matter that the branches are also destroyed, which again results in their names being meaningless. For things that are not throwaway I'll stand by putting as much effort into naming them as is needed.
Utility CSS classes are names. They're an API. Although I understand the reasoning, Tailwind is actually a perfect example of terrible naming. Everything has a single letter name or a name composed of initials. As a beginner you have absolutely no idea what you're reading, until you learn all the cryptic names. I'll restate that I understand why it is this way, but again for me it's a flaw of Tailwind and maybe utility classes in general.
Then there's the final example of lambda functions, where supposedly everyone accepts that naming isn't important. I think this one is the best example of why naming is important. If each step here had a proper name, you wouldn't have to write out what the function does, the code itself would explain it. If I don't trust it I can verify that the code the name is given to matches the name. Once I've verified it I can forget the code and substitute it with the idea of what it's supposed to do. Or if I don't want to verify it I can just trust the name and still understand what it's supposed to do.
Good naming helps readability tremendously for me. I don't have to spend any brain processing power on parsing that `.filter(|i| *i % 2 == 0)` means `filter even numbers`, I can just read it.
PS. Actually there are already two good names there: `into_iter()` and `sum()`. I don't need to know how they're implemented to understand what they're meant to do there. It's the lambda that's the problem and shows why naming is important.
I've always hated the pattern where you have to declare a throwaway param name within a block for cases where the `::Symbol#to_proc` syntax won't work, like when the method you're trying to call needs some argument. They usually end up as nonsense single-characters anyway so they may as well just be numbers I don't have to think about!
irb(main):001> lol = [1337, 420, 69]
=> [1337, 420, 69]
irb(main):002> lol.map(&:to_s)
=> ["1337", "420", "69"]
irb(main):003> lol.map { |wow_this_sure_is_annoying| wow_this_sure_is_annoying.to_s(16) }
=> ["539", "1a4", "45"]
irb(main):004> lol.map { _1.to_s(16) }
=> ["539", "1a4", "45"]
The other is ROC (receiver operating characteristic) used in statistics and machine learning. The current usage is very divorced from its original meaning (related to radars as I understand) and it sounds very stupid when used in its current context. It is just a simple ratio of a few statistical measures. I think using such names actually makes things even less understandable.
On the other hand, definitions (ie, naming things) is very useful in math and other disciplines.
Related
Why We Build Simple Software
Simplicity in software development, likened to a Toyota Corolla's reliability, is crucial. Emphasizing straightforward tools and reducing complexity enhances reliability. Prioritizing simplicity over unnecessary features offers better value and reliability.
CSS Classes Considered Harmful
The use of CSS classes is criticized for limitations and conflicts. History of HTML/CSS evolution is discussed, proposing attributes over classes for more flexible styling in modern web development.
Post-Architecture: Premature Abstraction Is the Root of All Evil
The article explores Post-Architecture in software development, cautioning against premature abstraction. It promotes simplicity, procedural programming, and selective abstraction for maintainable and efficient code.
My programming beliefs as of July 2024
Evan Hahn emphasizes tailored programming approaches, distinguishing "simple" from "easy," promoting testability through modularity, and advocating for ethical coding practices prioritizing societal impact and nuanced thinking in software development.
Examples of Great URL Design (2023)
The blog post emphasizes the importance of thoughtful URL design, showcasing examples from StackOverflow, Slack, and GitHub, and encourages readers to share their favorite effective URL designs.