Page 2 of 2
					
				
				Posted: Sun Dec 03, 2006 10:08 pm
				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. 

 
			
					
				
				Posted: Tue Dec 19, 2006 4:27 am
				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....
 
			
					
				
				Posted: Tue Dec 19, 2006 8:11 pm
				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 

.
 
			
					
				
				Posted: Tue Dec 19, 2006 8:22 pm
				by Rings
				Fred wrote:... Programming is like a girl, it needs to be sexy 

.
 
wrong, 
It has to fit in the right place 

 
			
					
				
				Posted: Tue Dec 19, 2006 8:42 pm
				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... 
 
 
..jokin.. sorry... 

 
			
					
				
				Posted: Tue Dec 19, 2006 9:06 pm
				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!). 

 
			
					
				
				Posted: Wed Dec 20, 2006 12:08 pm
				by gnozal
				From PureFORM source :
FORM_ToolbarBuilder_FillListIconFromToolbarString()

 
			
					
				
				Posted: Wed Dec 20, 2006 1:16 pm
				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)
 
			
					
				
				Posted: Wed Dec 20, 2006 2:01 pm
				by Trond
				Yes, but look at this:
Is that procedure adding 6 number or doing something with an Audi?
 
			
					
				
				Posted: Wed Dec 20, 2006 2:10 pm
				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)
 
			
					
				
				Posted: Wed Dec 20, 2006 2:11 pm
				by Derek
				So we are all agreed, meaningful but short. 

 
			
					
				
				Posted: Wed Dec 20, 2006 2:35 pm
				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)
 
That's good when you have only one variable type
 
			
					
				
				Posted: Wed Dec 20, 2006 2:40 pm
				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... 

 
			
					
				
				Posted: Wed Dec 20, 2006 2:53 pm
				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
 
			
					
				
				Posted: Wed Dec 20, 2006 3:09 pm
				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(). 
 
 
c ya,
nco2k