Long Function Names... Good Or Bad?
I was wondering if long function names would effect anything? I heard they would, I heard they wouldn''t, so I came to the masters for their advice
Not only function names but also class names etc.
For instance instead of having a class named OMUPCFILE{} vs OMUPLUGINCONFIGURATIONFILE{}. (OK, thats a little extrem)
To me it''s just better declarations for easier referance. I see a lot of professionals code like m(S, U); which I think is bad?
And no I''m not a begginer, I was just wondering because if it would effect performance or anything along that line, it would be bad!
Thanks for the help!
-UltimaX-
"You wished for a white christmas... Now go shovel your wishes!"
I think that "long names" are ok... unless they are too long.
But it should be no problem, if you like typing. And just a quick note - the naming & notation in Java seems to follow good idea and code looks usually clean and is easy to read.
But it should be no problem, if you like typing. And just a quick note - the naming & notation in Java seems to follow good idea and code looks usually clean and is easy to read.
Hi!
No, long function names don''t affect performance. They are, no doubt about that, good if you want to write readable code. And, in case you''re using C++, you could use namespaces, too.
cya,
Drag0n
-----------------------------
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning..." -- Rich Cook
My future web presence: Dave''s Programming Resources
No, long function names don''t affect performance. They are, no doubt about that, good if you want to write readable code. And, in case you''re using C++, you could use namespaces, too.
cya,
Drag0n
-----------------------------
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning..." -- Rich Cook
My future web presence: Dave''s Programming Resources
quote:Original post by UltimaXNo offense, but if you''re wondering this, it''s probably a safe bet that you''re a beginner.
And no I''m not a begginer, I was just wondering because if it would effect performance or anything along that line, it would be bad!
It won''t affect application performance at all. I guess, in theory, it might make compiling and linking slightly longer (since there are a few more chars to process) but this amount of time would be miniscule and silly to worry about.
The question of whether or not long names are good from a readability standpoint depends on the situation. Names should be as long as they need to be, but no longer. Long names might be a symptom of poor design. If the name has to be long to represent what a component does, the component might be doing too much, or you might be giving away too much information in the name.
There are plenty of language features and conventions that mitigate the need for long names. In your example, OMU (I''m assuming this is some project or company abbreviation?) can be made a namespace. Configuration can be shortened to Config or Cfg and everyone will still know what you mean. CfgFile can be made a nested class in OMUlugin. This allows shorter names to be used when longer ones aren''t need (hopefully it''s obvious what CfgFile you''re referring to when you''re implementing OMU:lugin::CfgFile) and allows the longer name to be used when more information or differentation is necessary.
A common technique in C programming is to take advantage of the fact that parameter names in function declarations can differ from parameter names in function definitions. For example, you might call an output buffer outputBuffer in the header, and it''s length outputBufferLen. When you implement the function in the source file, you can name these something like buf and len with no ill affects -- once again with the hopes that someone working on the source file will know what the parameters are.
There was a time when C (and Fortran?) didn''t support names longer than six characters. If you''re using a 30 year old compiler or linker, you might have an issue with long names.
Stupid stupid auto-smiley feature! In case it isn''t obvious, the message board software decided to convert colon colon P into smileys.
Ok, I''m newer to c++. I''m getting comfortable with it Anyway thanks for the advice. I figured it wouldn''t effect performance but like I said, "better declarations for easier referance." When I here it would from one person and it wouldn''t from another, I just wanted to find out. Thanks everyone, sorry to sound so stupid
-UltimaX-
"You wished for a white christmas... Now go shovel your wishes!"
-UltimaX-
"You wished for a white christmas... Now go shovel your wishes!"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement