There's an old joke that goes, “The two hardest things in programming are cache invalidation, naming things, and off-by-one errors.” In this talk, we'll discuss the subtle art of naming things – a practice we do every day but rarely talk about.
communication. It is the artefact left behind of someone’s thoughts and intentions. A good name conveys how to use something and give you a clear sense of when it should change.
to pick a name, we have to articulate a concept. Often it is hard to express a concept in a simple word or two. Ideas can be subtle. Struggling to name something is an important part of of design. Difficulty comprehending indicates more clarification needs to be done.
manages a page. So anything that could plausibly be considered “managing a page” could easily get added to this class. These classes quickly balloon out of control.
talking about the end result of what this class does – what you’re trying to achieve. This allows you to think more clearly about what is and isn’t needed.
encoding the pattern into the name prevents altering that class in the future to not use that pattern. They’re unnecessary information that usually only adds cognitive overhead.
file name. Both can add context and lower overhead for finding files or figuring out where to place files. A well- named directory can be more powerful than a well-named class.
two audiences. You are the bridge between the human and the computer. You need to know how computers work and how humans work – both the humans which your software serves, and the humans which your software will by changed by. Your primary weapon in your toolbox against ambiguity and cognitive overhead – the forces that corrode a software’s maintainability – is to name. You name things every day. Be mindful about the words you choose. Software should be written to be read by another developer.
over 10 to 1. We are constantly reading old code as part of the effort to write new code. Making it easy to read makes it easier to write. Robert C. Martin “Uncle Bob”
over 10 to 1. We are constantly reading old code as part of the effort to write new code. Making it easy to read makes it easier to write. Robert C. Martin “Uncle Bob”
over 10 to 1. We are constantly reading old code as part of the effort to write new code. Making it easy to read makes it easier to write. Robert C. Martin “Uncle Bob”
by stone. "But which is the stone that supports the bridge?" Kublai Khan asks. "The bridge is not supported by one stone or another," Marco answers, "but by the line of the arch that they form.” Kublai Khan remains silent, reflecting. Then he adds: "Why do you speak to me of the stones? It is only the arch that matters to me.” Polo answers: "Without stones there is no arch."
all: (1) a well-defined and well-calculated plan for the work in question; (2) an evocation of clear, incisive, memorable images; (3) a language as precise as possible both in choice of words and in expression of the subtleties of thought and imagination. - Italo Calvino