Follow

People using single letter variable names be like:
Because f u thats y

@penguwin LOL.

(But I do use one-letter names if they're like a local loop variable.)

@billblake2018

I agree, for "local" variables it's preferable. The further away the declaration is, the longer my variable names become.

@penguwin

@billblake2018 @penguwin one of my early employers had a code style guide that said single-letter variable names were ok if all uses were within 20 lines, in a single context, and there were 3 or fewer in use within that context

I liked this rule and adopted it for myself

@Calcifer @penguwin Mine was just, if you can see all the references in one (78x23, the size of an editor screen) window, you can use short names.

@penguwin longjohnsilveronahorse = longjohnsilver + horse is too much work, so you write ljsoah = ljs + horse

@penguwin Way back in the dark ages of programming when I got my start, there was a character limit in a line of code. Also, much code was typed out on punch cards or in a line oriented editor. Hence, short variable names. This was especially evident in BASIC and Fortran IV.

@penguwin Java raised me to name my variable with 20 characters on average.

@penguwin languages like Go promotes that, and depending on the context I think it makes sense

Sign in to participate in the conversation
chaos.social

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!