Live data from Hacker News

How Developers Choose Names

arxiv.org

121–130 of 157 posts

Re: How Developers Choose Names

#121

Earlier quoted context omitted.

In 16 years as a developer, I have never seen this beyond the scope of a single project/language. Once things cross boundaries it stops.

What boundary would be involved in the handleClick example? Or are you speaking more generally about renames across API contracts?

[deleted]

Re: How Developers Choose Names

#122

Earlier quoted context omitted.

In 16 years as a developer, I have never seen this beyond the scope of a single project/language. Once things cross boundaries it stops.

What boundary would be involved in the handleClick example? Or are you speaking more generally about renames across API contracts?

Here is a great example that came up last week. Almost exactly like the OP. (It is even an onclick!)

I have a C# .net MVC web project. All of the JS, .cshtml templates and C# controllers are in the same visual studio solution. So it has complete vision into the code.

So the boundary is from cshtml template to javascript function and then another one from the js function (ajax call) to C# controller.

Visual studio has complete vision, but loses the connection at each boundary, so intellisense says that the C# controller function is never called.

I am not criticizing Visual Studio, it is a great tool, but this is a hard problem.

Re: How Developers Choose Names

#124

I just use a UUID for every variable name to make sure the codebase never has any ambiguity. No one is going to confuse e7693160-b5cf-4761-9202-de019cfd0fc9 with c3d8b9ac-d0da-4bbc-912b-025ce4e47f62

A good name has maximal information density. If the string is compressible, you're wasting your reader's time. That's why I use all utf-8 glyphs to render my uniformly random and highly informative (from an information theory standpoint) variable names.

Re: How Developers Choose Names

#125
post #62

I thought you just added "ly" and called it a day?

You watch your program buzz, But don't know what anything does. How do you name things so they're obvious to the eye? Descriptively, descriptively, descriptive... L-Y!

For those unfamiliar with the reference, Tom Lehrer did several songs for the educational TV program The Electric Company, including one on the use of the suffix -ly to produce adverbs: https://www.youtube.com/watch?v=dB2Ff8H7oVo

Re: How Developers Choose Names

#126

I just use a UUID for every variable name to make sure the codebase never has any ambiguity. No one is going to confuse e7693160-b5cf-4761-9202-de019cfd0fc9 with c3d8b9ac-d0da-4bbc-912b-025ce4e47f62

This implies your code has fewer than 2¹²² variables. A real coder should have more than that in each method. Sounds like you're basically a glorified VB "dev."

Re: How Developers Choose Names

#127
post #99

Say what you want, but it's better than how mathematicians choose names imho.

In defense of mathematicians, having conventional single letter variable makes stuff a lot easier to read.

For example in graph algorithms, I used to write descriptive names like:

  weight = adjacenyMatrix[node][neighbor]
Nowadays I write it as:

  w = G[u][v]
Because in graph theory, an edge is usually (u, v), weight is usually w, graph is usually G, etc.

It's basically the same reason why people don't name their indices "index" and instead use "i", "j", "k". And instead of point.first and point.second, you use point.x and point.y.

Naming conventions are awesome when people can agree on them.

Re: How Developers Choose Names

#128

I just use a UUID for every variable name to make sure the codebase never has any ambiguity. No one is going to confuse e7693160-b5cf-4761-9202-de019cfd0fc9 with c3d8b9ac-d0da-4bbc-912b-025ce4e47f62

A good name has maximal information density. If the string is compressible, you're wasting your reader's time. That's why I use all utf-8 glyphs to render my uniformly random and highly informative (from an information theory standpoint) variable names.

You joke but symbolic programming languages like APL are kinda neat.

https://en.wikipedia.org/wiki/APL_syntax_and_symbols

Re: How Developers Choose Names

#129
post #99

Say what you want, but it's better than how mathematicians choose names imho.

The single letters are pretty bad, but when we use a persons name instead of a concept to describe something is where it gets truly awful. What the heck is an Eigen vector? Gaussian curve? Cartesian coordinates? Hilbert space? Julia set? Mersenne prime? Zero chance of intuiting any of that

Re: How Developers Choose Names

#130
post #46

I find that I am remarkably internally consistent with how I name things. I sometimes forget about a filename, class or function that I wrote months ago (thats another problem in itself). But when I go to name the new thing I am about to write I realize that it already exists. I then pat myself on the back.

i wish that was me, if I'm not vigilant about it I always end up choosing a synonym that I didn't previously use (e.g. pressed vs clicked vs activated)
Post reply on HN