As a nitpicker on the Cattle Drive, I find myself returning to the concept of naming things well.
It's one of the most difficult things in computer science.
There are only two hard things in Computer Science: cache invalidation and naming things.
-- Phil Karlton
And of course, a popular variant: "there are two hard things in computer science: cache invalidation, naming things, and off-by-one errors".
Today I came across a blog post about this subject that speaks to the difference between explaining implementation (a name that explains what it does) and purpose (a name that explains why it is important)
I love the variant. I don't remember hearing that before. Naming things is hard because it's soft ... that is, a soft skill. For hard core programers, it may be the only soft skill they're required to have, because the only way they ever communicate is via source code. I think that kind of developer is fading away as projects become more complex and therefore more collaborative. Still, communication via source code remains vitally important, and good naming is arguably a much bigger part of that than even good comments are.
Katrina Owen
Sheriff
Joined: Nov 03, 2006
Posts: 1334
11
posted
0
Interesting, I never thought of naming as a soft skill. I always thought of soft skills as things like knowing how to read body language and how to say 'How was your weekend?' and such.
Naming things has so much to do with precision and accuracy.
Katrina Owen wrote:Interesting, I never thought of naming as a soft skill. I always thought of soft skills as things like knowing how to read body language and how to say 'How was your weekend?' and such.
Spelling is pretty useful too e.g. if you're searching for likely keywords in an undocumented morass of code or having to code to a badly spelled interface written by somebody else. I did a liberal arts degree, so I was expected to be able to spell, but my pals who studied engineering were atrocious at spelling. Which might explain why all that C code written by engineers is always so hard to read: they weren't being cryptic, they just couldn't spell properly....
Greg Charles wrote:For hard core programers, it may be the only soft skill they're required to have, because the only way they ever communicate is via source code. I think that kind of developer is fading away as projects become more complex and therefore more collaborative. Still, communication via source code remains vitally important, and good naming is arguably a much bigger part of that than even good comments are.
Yes, it's a soft skill and yes, it seems like many developers have a hard time with giving good names. I think a lot of it has to do with being so focused on implementation rather than intent. I find myself mentioning "leaky abstractions" a lot when I'm helping other developers improve the clarity of their code.
Regarding communication, my experience is quite the opposite: The more collaborative the development effort, the more important it is to have developers who can not only give good names but who are constantly looking for opportunities to give better ones. During our daily code reviews, I find myself spending a lot of time with the other developers trying to find better names for things. They will often start with one name then neglect to rename things as they refactor. So we have to go over their design decisions and discuss their motivations and the intent of the code to figure out better names for things.
Uncle Bob's "Clean Code" book has a whole chapter devoted to the topic of names.
Oh, hmm. I guess I didn't communicate that clearly, which shows my soft skills could use some polish. I didn't mean that naming things becomes less important as projects become more collaborative, which is clearly not true. I meant that with more collaborative projects, it's not the only way developers share their ideas.
I see Katrina's point, but I still think of naming things as a soft-ish skill, because it deals with communication. The compiler doesn't care if you name things well, and the program will run just as well whether you do or not. Good communication always relies on precision and accuracy, unless it's being done by a politician or executive.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.