Lately I've seen overly long function names like initialiseGraphics(). Why not just use initGfx()...

Lately I've seen overly long function names like initialiseGraphics(). Why not just use initGfx()? It's just as easy to understand, but MUCH easier to type.
Do you prefer using abbrevations, or do you stick with the full names?

C used to only allow 6 significant characters in identifier names, so I use that.

depending on language.

c?
>initgfx

java?
>AbstractGraphicsManager.intitializeGraphics()

>Do you prefer using abbrevations, or do you stick with the full names?
Commonly known abbreviations, yes. But names are supposed to be informative.

I've seen people use cnt instead of count, which is just absurd.

>MUCH easier to type.
How many times are you going to have to initialize the graphics?

I use full names because I'm not a fucking retard.

>2017
>not having an IDE with auto-complete

Fair point. And with autocomplete you might as well use long names.

"initGfx" is bad.

I'd think it's going to initialize "Gfx" and serach for a function with that name. Then I'd think about it's a certain graphics card.

Then I'd realize "fx" has always been the abbreviation for "effects" (i.e. in 3dFX, JavaFX.. ) and think it would initialize certain graphical effect.

It would cost me minutes to find out what this function would be for, only because some asshat is too lazy to write 20 letters and think it's super geeky to use weird abbreviations (in a wrong way, that is).

Nope.

At least it's not swift with 45 character method names

unsigned i, j, k;

if you're not using k later in the function, just zero it and use it as a counter

Readability > smug autism

Even if you're just working by yourself, be verbose. There is no reason to use abbreviations neither you nor anyone else will understand. You can always minify the code later if you want.

If there is a possibility that whoever reads it won't immediately have at least rough idea of what the function does, I usually try to use more descriptive name. "initGfx" is clear enough though.

>it would cost me minutes
Why do people on stackoverflow keep using this kind of language?
Why does it matter if you can ascertain what a library function does in seconds or minutes?
Are you seriously this overworked?

>MUCH easier to type
>typing your function names more than once

you type it once and then let your editors completion engine take it from there on out. Don't skimp on descriptive names unless its code convention, like using ijk for loop iterators

People like you are the reason i have to google manual, man, guide of any C / Cpp function name / class usage example.

Like String.length VS strlen(). Still strlen is still somewhat logical. Then you try to create, initialize, open socket and set up udp protocol and go crazy with all the crazy system calls with super cryptic names.

Never change!

>Then I'd realize "fx" has always been the abbreviation for "effects" (i.e. in 3dFX, JavaFX.. ) and think it would initialize certain graphical effect.
It's initGfx, not initGFx, you moron. Also "gfx" is common abbreviation. Complaining about is like claiming that using "i" instead of "iterator" or something is confusing.

GetGraphicsInitializationFactoryStrategy()

>'i' for 'iterator'
i for index

You spelled initialize wrong you fucking idiot.

I use the long names because I don't want to be rude to the maintenance programmer.

>i have to google manual
There's a reason why "K" in vim and man pages exist.

>C used to only allow 6 significant characters in identifier names

source?

Or for "integer".
Or for a control variable.

That's the problem with abbreviations:
They are only easy if you know what they mean..


Than multiply those minutes with the amount of functions you have to understand in a project.

It costs literally one second to write "initializeGraphics" and saves minutes for every other programmer looking at your code later on. Basically your clever idea of using abbreviations creates technical debts.

Like those "my code is self documenting.. :^)" guys that can't be bothered to write a simple line like "this calculates the sum of squares" but force you to look at their stupid formula and find out what it does.

I don't write code with the express purpose of making it easy to maintain so the next hired pajeet can take over for me.

This is why you career software devs are so fucked.
You don't even have a union.

>I am good because I produce unmaintainable code

user..

It's just a matter of work ethics to not make your code a cluster fuck. If you are so afraid of getting replaced by the "eternal pajeet", you should consider a differnt company..

Maybe if you don't know basic abbreviations like "gfx", maybe wasting time on it is your own fault.

>They are only easy if you know what they mean..
That's why any decent-sized projects should have this as part of the coding guidelines.

Work ethics only apply when everyone is on the same page and there is a modicum of respect for your skillset.
Developers are considered a highly unwanted liability in pretty much every company they're in, companies are always looking for ways to get rid of them so they don't have to keep paying developer wages to get the software they need.
Until that changes, you should make it easy for them to replace you with a designated H1B programmer because a spreadsheet claimed that you are fractionally more expensive than an indian.

You are either under 18, mexican or you've been on Sup Forums for too long.

You get replaced when you are not a good programmer, i.e. producing unmaintainable code.

You get replaced by executives who have never even seen your face.

GROW UP

There's always work for the best.

Get out of my face, mr. burrito coder.

>burrito
>mexican

What did he mean by this?

Sounds like you got fired because you write shitty, unmaintainable code. I doubt it had anything to do with the bottom line. The unemployment rate for devs is like 2% so you must be really bad if you got fired.

>using abbreviations
>in the age of auto fill
I've started using more descriptive function names even in C.

4) Naming

C is a Spartan language, and so should your naming be. Unlike Modula-2 and Pascal programmers, C programmers do not use cute names like ThisVariableIsATemporaryCounter. A C programmer would call that variable tmp, which is much easier to write, and not the least more difficult to understand.

HOWEVER, while mixed-case names are frowned upon, descriptive names for global variables are a must. To call a global function foo is a shooting offense.

GLOBAL variables (to be used only if you really need them) need to have descriptive names, as do global functions. If you have a function that counts the number of active users, you should call that count_active_users() or similar, you should not call it cntusr().

Encoding the type of a function into the name (so-called Hungarian notation) is brain damaged - the compiler knows the types anyway and can check those, and it only confuses the programmer. No wonder MicroSoft makes buggy programs.

LOCAL variable names should be short, and to the point. If you have some random integer loop counter, it should probably be called i. Calling it loop_counter is non-productive, if there is no chance of it being mis-understood. Similarly, tmp can be just about any type of variable that is used to hold a temporary value.

If you are afraid to mix up your local variable names, you have another problem, which is called the function-growth-hormone-imbalance syndrome. See chapter 6 (Functions).

This convinced me not to learn C.

Reading C code must be a nightmare when the guidelines look like they've been written by a fedora tipping edgelord.

Sorry you missed out because you can't program without namespaces, a feature that predates C and only exists to alleviate bad software architecture.

postdates C

This guy is wrong.

This guy is right.

>pic
This God Emperor is sending everyone back and if you don't belong here, basically you are fucked. How? Just watch his presidency!

I don't much care about namespaces.

I care about code readability. If namespaces help readability, then good.

I was actually wondering why the author was seemingly bragging about how cool it is to be an "ascetic" who writes poor code on purpose, but it turns out it's because his shitty, poorly designed language forces him to do that due to lack of a feature.
So he has to rationalize and act as if it's his conscious decision and looks down on languages that don't have to deal with that.

That's a hearty KEK on my part.

>the guidelines look like they've been written by a fedora tipping edgelord.
>mfw those are the linux kernel coding guidelines
>mfw that was written by linus
>mfw you're either a an autistic sepples apostle or a currynigger javascript "programmer"

>the guidelines look like they've been written by a fedora tipping edgelord.
>was written by linus
That explains so much.

Nice duckling syndrome. If linus told you to jump off a bridge, would you?

No, but I'm sure you would if Bjarne told you to.

Pfft, you're confused.

I am a Wirthian.