119 points
*

Why are they even named like this?

When I read code, I want to be able to read it…

Is this from a time when space was expensive and you wanted to reduce the space of the source files on the devs PC???

For me (with a native language != english), this made it a lot harder to get into programming in the first place.

permalink
report
reply
89 points

I recently held a science slam about this topic! It’s a mix of the first computer scientists being mathematicians, who love their abbreviations, and limited screen size, memory and file size. It’s a trend in computing that has been well justified in the past, but has been making it harder for people to work together. And the need to use abbreviations has completely gone with the age of auto completion and language servers.

permalink
report
parent
reply
59 points

mathematicians, who love their abbreviations

Man, I hate that so much. I swear this was half the reason I struggled with maths and physics, that these guys need to write this:

Rather than this:

At some point, they even collectively decided that not having to write a multiplication dot is more important than being able to use more than a single letter for your variables. Just what the fuck?

permalink
report
parent
reply
37 points

Thing is, you usually define all your variables. At least we do in engineering (of physical variety, rather than software).

Mostly because we can’t expect everyone reading the calculation to know, and that not everyone uses the same symbols.

Not explaining each variable is bad practice, other than for very simple things. (I do expect everyone and their dog reading a process eng calc to know PV=nRT, at a minimum).

Just like (in my opinion) not defining industry specific abbreviations is also bad practice.

Mathematicians don’t do this? Shame on them.

permalink
report
parent
reply
16 points

Using full names like that might be fine for explaining a physical rule, or stating the final result of some calculation - but it certainly would be cumbersome and difficult for actually carrying out the calculations. In many cases we already fill pages with algebra showing how things can be related and rearranged to arrive at new results. That kind of work would be intractable with full word names for the variables, partially because you’d be constantly spilling off the end of the page trying to write the steps; but also because having all that stuff would actually obfuscate what you are trying to do - which is algebra. And during that process, the meanings and values of the pronumerals is not as important has how they interact with each other. So the names are just a distraction.

For setting up an equation, and for stating the final result, the meanings of the variables are very important; but during the process of manipulating the equations to get the result you want the meanings of the letters are often ignored. You only need to know that it is something that can be multiplied, or inverted, or subtracted, or whatever. Eg. suppose I want to rearrange to get the velocity. I don’t care that I’m dividing both sides by the air density times the drag coefficient and the area… I’m just dividing ρCA, which is an algebraic blob whose interpretation can be saved for some other time.

permalink
report
parent
reply
12 points

Try to write the above with pen and ink and then tell me if you can read it back yourself.

Single letters is not a good system but it was the less bad one.

permalink
report
parent
reply
8 points

I would have quit math if I had to do algebra with names instead of letters.

permalink
report
parent
reply
4 points
*

Try writing 20 algebraic manipulations of the equation on paper and you’ll quickly understand why it’s written that way.

permalink
report
parent
reply
2 points

The bottom is absolutely not more readable, and it’s much more difficult to work with.

permalink
report
parent
reply
1 point

It’s been really holding me back in learning coding. I felt pretty comfortable at first learning javascript, but as I got further the code was increasingly hard to look back to and understand, to the point I had to spend a lot of time understanding my own code.

Does it truely matter after the code has been compiled if it has more full words or not?

permalink
report
parent
reply
2 points

It matters as soon as a requirement change comes in and you have to change something. Writing a dirty ass incomprehensible, but working piece of code is ok, as long as no one touches it again.

But as soon as code has to be reworked, worked on together by multiple people, or you just want to understand what you did 2 weeks earlier, code readability becomes important.

I like Uncle Bobs Clean Code (with a grain of salt) for a general idea of what such an approach to make code readable could look like. However, it is controversial and if overdone, can achieve the opposite. I like it as a starting point though.

permalink
report
parent
reply
41 points
*

It’s from a time keyboards were so hard that you needed to do push ups on your finger tips if you wanted to endure a 9 to 5 programming job.

permalink
report
parent
reply
15 points

The reason people love IBM Model Ms nowadays is because the springs have been worn in now and can easily be pressed without additional training.

permalink
report
parent
reply
4 points

Kids these days have it so easy, pshh

permalink
report
parent
reply
39 points

I recall reading somewhere the earlier compilers had a hard limit on the length of function names, due to memory constraints.

permalink
report
parent
reply
32 points

I’ve heard it’s because old screens were like 60 character wide

permalink
report
parent
reply
26 points

Also punched cards had around 80 columns, which put a hard limit on the number of characters per line.

permalink
report
parent
reply
19 points

Did you know that in the first version of php, each function name would be hashed to lookup the code to run it? And the hashing algorithm was: the first letter. So all the functions started with a different letter.

permalink
report
parent
reply
9 points

I hope this is not true

permalink
report
parent
reply
19 points

It’s not. PHP used to use the function length as hash buckets, so by having evenly distributed lengths the execution time was faster. No idea where GP came up with that.

permalink
report
parent
reply
1 point

No it is, only 26 functions in total.

The Chinese had it way easier.

permalink
report
parent
reply
2 points
*

strncpy becomes stringnumbercopy. You can see why short version is used.

permalink
report
parent
reply
14 points
*

And with a bit of namespacing and/or object orientation and usage of dots, it becomes perfectly readable.

There are also camel case and underscores in other languages…

BTW: How on earth should a newcomer know that the letter “n” in that word stands for number without having to google it? The newcomer could even assume that it’s a letter of the word string… And even, if you know that it stands for number, it’s still hard for me to understand what it means in this context… I actually had to google it… But that’s probably some C++ convention I don’t know about, because I don’t program in C++…

permalink
report
parent
reply
5 points

C is a little older than namespacing and object orientation. C++ wasn’t even a glimmer in Bjarne’s eye when these conventions were laid down.

And yes, having to google it is part of the design. Originally C programmers would have had to read actual manuals about this stuff. Once you learn the names you don’t really forget so it works well enough even now for ubiquitous standard library functions.

And yet, C was an ergonomic revelation to programmers of the time. Now it’s the arcane grandpa that most youngsters don’t put up with.

permalink
report
parent
reply
3 points
*

How on earth should a newcomer know that the letter “n” in that word stands for number without having to google it?

By looking at the difference between strcpy and strncpy. Preferably, though, you should simply learn C before writing C.

The gist of is is that strcpy takes a null-terminated string and copies it somewhere, while strncpy takes a zero-terminated string and copies it somewhere but will not write more than n bytes. strncpy literally has exactly one more parameter than strcpy, that being n, hence the name. If n is smaller than the string length (as in: distance to first null byte) then you’re bound to have garbage in your destination, and to check for that you have to dereference the pointer strncpy returns and check if it’s actually null. Yay C error handling.

In retrospect null-terminated strings were a mistake, but so were many other things, at some point you just have to accept that there’s hysterical raisins everywhere.

permalink
report
parent
reply
2 points
*

man strncpy

permalink
report
parent
reply
2 points

Why not just add function overloading to the language and have a function named copy that takes a string and an optional character count?

permalink
report
parent
reply
102 points

I can’t remember it, but I read one Microsoft blog post (in Vista era?) about how one team at Microsoft would develop some amazing new Windows component. They’d proudly name it AmazingNewService.dll. And then the operating system team would come in and say “that’s all fine and good, but you have to conform to the naming convention.” 8+3 filenames. First two letters probably “MS”, because of reasons. …and 15 years later, people still regularly go “What the fuck is MSAMNSVC.DLL?”

permalink
report
reply
4 points

Why are they still so hung up on 8.3 long after Win95?

I get not wanting to have spaces in a filename. Those suck.

Is there something low-level that still doesn’t like long filenames?

permalink
report
parent
reply
4 points

Well this was Vista era, they were probably doing that to ensure some sort of expectation from particularly tricky legacy apps. Windows prefers not to break old apps if at all possible.

permalink
report
parent
reply
2 points

sounds interesting~, any chance that I can find this post?

permalink
report
parent
reply
3 points

Like I said this was in the Vista era. Or possibly before the Vista release, part of the Longhorn hype train (Longhorn got some super hyped features, such as an epic next-generation filesystem to replace NTFS, which Microsoft ultimately canned, and Vista ended up, you know, being Vista).

This was so long ago that I unfortunately don’t remember what exact feature this was about, but it was about some new Windows component.

permalink
report
parent
reply
1 point

Thanks anyway, first time know the 8+3 filename thing in MS

permalink
report
parent
reply
88 points

man -k to the rescue: mbsrtowcs, strxfrm and wcstold are C functions.

permalink
report
reply
22 points

wcsoll is a mispronunciation of wcscoll

permalink
report
parent
reply
18 points

Oh no. You tell them forbidden knowledge of reading manual.

permalink
report
parent
reply
5 points

The function wcstol appears to be missing. Cross platform C is difficult.

permalink
report
parent
reply
4 points

Who wants to write C functions for the rest with me?

permalink
report
parent
reply
60 points

Rhowch, cwtch, mwyn have to be Welsh. Classicly Welsh sounding words, and mbrsrtowcs, strxfrm can’t possibly be Welsh. Source: my welsh uncle taught me to pronounce Welsh place names.

Wcstold, wcsoll wmffre could be either but sound really weird as Welsh to me.

permalink
report
reply
57 points

Wmffre is actually the Welsh spelling of the name “Humphrey”

permalink
report
parent
reply
23 points

I love the Welsh, but holy shit that’s not what those letters are supposed to be for. They and the Irish just made a bunch of shit up when they started to standardize spelling. It makes me understand how Russians feel when Westerners use Cyrillic letters improperly.

permalink
report
parent
reply
26 points

the letters are “supposed to be” for Latin, a language with only five different vowel sounds.

everyone since has just been making a bunch of shit up.

permalink
report
parent
reply
7 points

Having read your comment I’d like your views on “Wrwgwai” - the South American country of Uruguay.

permalink
report
parent
reply
1 point

One last joke played on the colonizers invading them

permalink
report
parent
reply
2 points

Nice.

permalink
report
parent
reply
55 points

I thought I would be better at this game than I am.

permalink
report
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 7K

    Monthly active users

  • 950

    Posts

  • 35K

    Comments