Are long procedure names bad?

Everything else that doesn't fall into one of the other PB categories.

Are long procedure names bad?

Yes - (shorter limit, please post)
1
3%
Yes - if longer than 10 characters
2
5%
Yes - if longer than 20 characters
6
16%
Yes - if longer than 30 characters
5
14%
Yes - (longer limit, please post)
2
5%
No
19
51%
Null vote (for myself)
2
5%
 
Total votes: 37

Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Trond wrote:The problem is, that then it won't be very readable. Of course by the procedures themselves I can write comments, but everywhere I use them? And every time I want the procedure I need to lookup its name!
Yeah, I was trying to be humorous. Not enough smilies? :) Or maybe just not funny. :( * re-reads "how to make people laugh 100% of the time" *
Trond wrote:
BTW, what do you think of hyphens in proc names?
Dreadful!
You're right! Should have said underscores, not hyphens. :)
Dare2 cut down to size
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

Dare wrote:

Code: Select all

Procedure WhatIsThis(AndWhyDoICare.q)        ; See techdoc chapter 8, section "WTF IS THIS"
ROFL
LMAO

I often use some cryptical shortened words like BckGrndCol or so...

Of course a Name should be descriptive, but I agree that a Name shouldn't be too long.

a Name should Represent the MainIdea of some Routine.

when you look up codes some months later, you always have to find the basic idea again.
if you got it, some short Names are as descriptive as long sentences.
if you don't get it, you will never make any use of old code ever....

having a concept to shorten words helps....
oh... and have a nice day.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

As you probably guessed it, I love long full name. Because seriously, isn't OpenWindow() much prettier than OpnWnd() ? Programming is like a girl, it needs to be sexy ;).
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

Fred wrote:... Programming is like a girl, it needs to be sexy ;).
wrong,
It has to fit in the right place ;)
SPAMINATOR NR.1
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

Rings wrote:
Fred wrote:... Programming is like a girl, it needs to be sexy ;).
wrong,
It has to fit in the right place ;)
yap... and thats the difference between a GIRL and a WOMAN... :lol:

..jokin.. sorry... ;)
oh... and have a nice day.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I often use some cryptical shortened words like BckGrndCol

That's not very cryptic. Something like BGC might be, though.

Personally, I tend to use combined first letters of words. So for a variable
holding the Desktop height, I'll call it dth. But other times I'll use things like
sysdir$ for the result of GetSystemDirectory(). So yeah, I'm all over the
place (no comments please, Lucifer!). ;)
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post by gnozal »

From PureFORM source :
FORM_ToolbarBuilder_FillListIconFromToolbarString()
:lol:
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

And what about the names of the variables being passed to the procedures.

You might have a procedure with a thirty letter name being passed 5,6 or however many variables, all being 20 letters long. Your one line of code ends up 200 characters wide,

Code: Select all

Procedure.l AddTogetherWhatCouldBeUptoSixNumbers(NumberToAddOne.l,NumberToAddTwo.l,NumberToAddThree.l,NumberToAddFour.l,NumberToAddFive.l,NumberToAddSix.l)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Yes, but look at this:

Code: Select all

Procedure A6(A, B, C, D, E, F)
Is that procedure adding 6 number or doing something with an Audi?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

compromise:
I would call it

Code: Select all

Sum6(A1.d, A2.d, A3.d = 0, A4.d = 0, A5.d = 0, A6.d = 0)
(...I would almost never use a proc for doing this, in fact)
Last edited by Kaeru Gaman on Wed Dec 20, 2006 2:12 pm, edited 1 time in total.
oh... and have a nice day.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

So we are all agreed, meaningful but short. :D
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Kaeru Gaman wrote:compromise:
I would call it

Code: Select all

Sum6(A1.d, A2.d, A3.d = 0, A4.d = 0, A5.d = 0, A6.d = 0)
(...I would almost never use a proc for doing this, in fact)
That's good when you have only one variable type
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

> That's good when you have only one variable type

that's on reason why I said

> (...I would almost never use a proc for doing this, in fact)

additionally, the topic is about ProcedureNames, not aboute VariableTypes... ;)
oh... and have a nice day.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

I want to use a procedure so that everywhere it's called I can change what it does:

Code: Select all

Procedure SubtractLoadedFloatFromFloat(Pos.l)
  Protected Ref.s = RefFromPos(Pos)
  Out("FSUBR  dword " + Ref)
EndProcedure
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Post by nco2k »

heh, speaking of cryptic.

you can name your procedure like the crc32 checksum of its original name.

instead ThisProcedureNameIsPrettyLong() you can write 60E19EE1(). :lol:

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Post Reply