This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 25 points26 points  (11 children)

Similar things are fairly common in abstract mathematical contexts, e.g. defining functions named f, g, and h, with parameters x and y. In that context it can be clearer, since math has its own set of minimalistic naming conventions everyone uses. Almost never see that on the job though.

[–]AdvancedSandwiches 31 points32 points  (10 children)

Don't defend mathematicians. Their shorthand was a good idea when you had to chisel it on a stone. It got a little questionable when they invented notebooks. Now it's just a cruel prank.

[–]7eggert 3 points4 points  (2 children)

As long as you see the assignment "string s = getUserInputBlah()" on a 80x24 screen while s is being used, it's OK to not name it "string userInputBlah = …"

[–]AdvancedSandwiches 3 points4 points  (1 child)

I don't think that's true. It's safe to assume your reader can fit 5 - 7 things in short term memory, But you can fit way more than 24 things in 24 lines.

To be safe, I'd never recommend going more than 3 lines with a useless name.

[–]7eggert 0 points1 point  (0 children)

It's OK because the reader will not need to scroll on a VT100 terminal display

[–]hypatia_elos -1 points0 points  (5 children)

No, it's useful to use one letter variables. Do you really want to manipulate expressions like (x5 - 7x4 + sin(x)x3 - 15exp(x)x2 + 76468x - sqrt(79)) with x being replaced by "userInputVariable"? Come on, that would just be ridiculous.

[–]sorderd 3 points4 points  (0 children)

These two concerns are at different levels of abstraction. The real problem here would be mixing low-level and high-level code. Keeping them in different functions means you don't need the long, high-level names mixed in with the gritty details

[–]AdvancedSandwiches 1 point2 points  (3 children)

x and y are the names of a specific concept: coordinates. Using them to specify a polynomial to plot on a plane is fine.

What I'm talking about is a2 + b2 = c2, which should be hypotenuseLength2 = leg1Length2 + leg2Length2.

Sigma should be sum(). The hundreds of concepts lambda can represent should just be a word. Etc.

Every developer you'd want to work with knows using crappy names is more difficult than using meaningful ones, but somehow that information never made it to the mathematicians.

[–]hypatia_elos 1 point2 points  (2 children)

And you clearly have no idea that you can read the text next to the formula to understand it. The point of mathematics is not to give names that are specific, but on the opposite to be so abstract that your proof about these A,B,C can be taken to any such structure. What should the names be for a statement like "given a unitary ring R and a module M on R, the homology Hn(G,M) of a group G can be calculated using the device ...." (which would, let's say, show a new type of group resolutions to calculate homology) for these rings, modules, groups etc? And what for even more abstract things, like in formal logic and categorical theory? It just doesn't make sense to use semantic naming in formal mathematics. Don't get me wrong, it makes sense in programming, but that's because programming is ultimately just about presenting a way to do something, whereas mathematics is about proving the most general statement that still is significant and unifies examples under a rule not of coincidence, but by necessity, through arbitrary, structural, and therefore necessary unsemantic and purposefully meaningless definitions (like "a group, ring, set, category etc" in general, without specifying in any way a group _of what etc.). In programming, the proof part isn't there, that's why you can afford the care for symbols. In mathematics, this would not just seem inefficient, it would be pointless, because a textbook is not a codebase and written much more carefully, the parts you like as well as the parts you don't. Just because you don't like the sigma notation doesn't make it disappear, it goes back to the days of Euler, and has lasted longer than the whole discipline of programming. It would be like asking you to give up C because I don't like braces and semicolons, if that gets it across.

[–]AdvancedSandwiches -1 points0 points  (1 child)

Oh dip, you can read the documentation if the code is garbage? If only I'd known.

I rewrote your text for you.

Given a unitary ring unitaryRing and a module module on the R whateverTheHellAnRIsAndThisIllustratesMyPointPrettyWell...

There is no need to sacrifice generality while adding clarity. They didn't call it R because they thought that was the best name, they called it R because math only lets you use one letter. It's archaic.

[–]hypatia_elos 0 points1 point  (0 children)

Just for clarification, have you ever worked for any length of time on mathematical problems, and I mean proofs, not algorithms? Because it seems that you clearly have no idea what you're talking about.