3 ms·
> I don't see the reason to shorten stuff like printf and main. Reducing key strokes adds something? Bugs hide in the extra chars. On a more serious note, the
by SifJar 7y ago
> I don't see the reason to shorten stuff like printf and main. Reducing key strokes adds something?
Bugs hide in the extra chars.
On a more serious note, there are several (debatable) benefits to brevity (in programming & in general communication);
- less code to keep in your head
- less chance of stupid typos (e.g. prinft instead of printf)
- more "expressive" in that each char has more meaning
- to someone who is fluent in the "shorthand", it is quicker to both write & read
- newswasboring 7y agoAll these benefits don't seem like benefits to me. I don't want to learn a new short hand language when I already learned an extra language, English, to learn programming. Also I don't see expressiveness in terms of keystrokes, you don't store bytes in your head, you store tokens. I can have very different words for a character (char, "", etc.) but in my head they take exactly the same amount of space. Are simple typos that annoying? Writing a wrong function call will lead to either a compile time error or a wrong behavior, but latter happens when the function names are not chosen smartly. Also we have IDEs now, they are pretty good at handling typos. I don't understand how it is quicker to remember printf("hello world") than P("hello world").
- uryga 7y ago> I can have very different words for a character (char, "", etc.) but in my head they take exactly the same amount of space. how sure are you? given how little we know about the brain, i'd be cautious with asserting something like that as a fact. while i don't think we store bytes in our head, i'm not certain that the length of a "symbol" doesn't matter either.
- magicalhippo 7y agoMaybe different people do it differently, after all some have photographic memory, I don't. But I certainly don't think about all the letters involved in a variable but rather the concept of the variable, or what that variable represents. Doesn't matter if it's called "numberOfBurgersPerCustomer" or "nb" as such. But in case I forget, "numberOfBurgersPerCustomer" immediately tells me what is going on compared to just "nb". I guess the point is that I don't want to wade in definitions just to get the gist of a code. I want to jump in there, see immediately what's going on and where the problem can be.
- ithkuil 7y agopritnf is an awesome typo! When you're make it your compiler can catch it. "n" spelled instead of "m" is worse