This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-09-10 22:23:10

abee
Scratcher
Registered: 2007-05-25
Posts: 100+

suggestion: give a meaningful variable name, not t1, t2.

It seems some scratchers use variable named t1, t2 for thier mod.
Originaly, this kind of name (temporary one, two) is given as an alternative by Smalltalk decompiler when the source code is missing. If you set .sources and .changes file correctly, your browser displays meaningful names.
So, I suggest to give a meaningful name for your variable. It enhances readability of your code for other scratchers.

Offline

 

#2 2011-09-11 03:06:44

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

Global variable names, and some block variable names already do that, but there are over 1000 methods in Scratch, and it would take a few whole years to set the name of all the variables.


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#3 2011-09-11 03:50:12

abee
Scratcher
Registered: 2007-05-25
Posts: 100+

Re: suggestion: give a meaningful variable name, not t1, t2.

I don't think so. All of temporary variables already have meaningful names when you open ScratchSourceCode1.4.image with ScratchSourceCode1.4.changes and SqueakV2.sources. So you need to give meaningful names for only the variables in mods.

Offline

 

#4 2011-09-11 06:05:06

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

Arguments left in blocks are automatically assigned to t variables. I agree that it is helpful if variables are named appropriately when they are declared. I think it's down to each user's programming style and the most we can do is encourage smalltalkers to do this as common practice, in the same way the camel case in variable names is not needed but encouraged.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#5 2011-09-11 08:43:08

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

sparks wrote:

...common practice, in the same way the camel case in variable names is not needed but encouraged.

Don't forget pascal case for classes and global variables  wink

Besides, camel case isn't needed but the first letter must be lowercase in local variables, and must be uppercase in global variables. That's only Smalltalk though.

Last edited by LS97 (2011-09-11 08:43:18)

Offline

 

#6 2011-09-11 08:46:08

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

LS97 wrote:

sparks wrote:

...common practice, in the same way the camel case in variable names is not needed but encouraged.

Don't forget pascal case for classes and global variables  wink

Besides, camel case isn't needed but the first letter must be lowercase in local variables, and must be uppercase in global variables. That's only Smalltalk though.

Yup!  wink


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#7 2011-09-11 08:59:20

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

LS97 wrote:

sparks wrote:

...common practice, in the same way the camel case in variable names is not needed but encouraged.

Don't forget pascal case for classes and global variables  wink

Besides, camel case isn't needed but the first letter must be lowercase in local variables, and must be uppercase in global variables. That's only Smalltalk though.

What's pascal case? :?

Offline

 

#8 2011-09-11 09:04:31

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

scimonster wrote:

LS97 wrote:

sparks wrote:

...common practice, in the same way the camel case in variable names is not needed but encouraged.

Don't forget pascal case for classes and global variables  wink

Besides, camel case isn't needed but the first letter must be lowercase in local variables, and must be uppercase in global variables. That's only Smalltalk though.

What's pascal case? :?

PascalCaseIsWhenWordsAreConcatenatedUsingAllUppercaseLettersIncludingTheFirstOne  smile

Offline

 

#9 2011-09-11 09:13:12

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

LS97 wrote:

scimonster wrote:

LS97 wrote:

Don't forget pascal case for classes and global variables  wink

Besides, camel case isn't needed but the first letter must be lowercase in local variables, and must be uppercase in global variables. That's only Smalltalk though.

What's pascal case? :?

PascalCaseIsWhenWordsAreConcatenatedUsingAllUppercaseLettersIncludingTheFirstOne  smile

LOL I thought it said "Pascal Casels".  tongue
So it's camelCase with the first letter Capitalized.

Last edited by scimonster (2011-09-11 09:26:19)

Offline

 

#10 2011-09-11 09:17:55

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

the first latter? That's a paradoxical sentence if ever I heard one  tongue  But yes, it's first-letter-capitalised-camel-case.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#11 2011-09-11 09:27:22

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

sparks wrote:

the first latter? That's a paradoxical sentence if ever I heard one  tongue  But yes, it's first-letter-capitalised-camel-case.

>_<
So I made too mistakes. D: (thats on porpis  lol )

Offline

 

#12 2011-09-11 09:40:01

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

The world has truly gone two pot if Scimonster has caught the dreaded mispeling vyrus.

You changed your sig. Now I can't see you as I scroll through the fora! I thought I was talking to some random Scratcher all the way through this topic!  big_smile


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#13 2011-09-11 09:57:00

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

sparks wrote:

The world has truly gone two pot if Scimonster has caught the dreaded mispeling vyrus.

You changed your sig. Now I can't see you as I scroll through the fora! I thought I was talking to some random Scratcher all the way through this topic!  big_smile

Same! I liked the old one  sad   sad
And don't you dare change yours sparks  tongue

Last edited by LS97 (2011-09-11 09:57:12)

Offline

 

#14 2011-09-11 10:07:59

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

Haha, I never read usernames really, I know people by their sigs which is why the sig switching day a while back totally threw me!

And my sig changes itself, sorry about that!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#15 2011-09-11 10:10:56

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

sparks wrote:

Haha, I never read usernames really, I know people by their sigs which is why the sig switching day a while back totally threw me!

And my sig changes itself, sorry about that!

oh yeah, that day was a terrible mess  tongue

What I mean by your sig changing is the text inside it is fine, but keep the skin.

Offline

 

#16 2011-09-11 10:24:16

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

Haha, I will probably change it in the future but not till I have the time or patience to draw something better  tongue


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#17 2011-09-11 11:18:51

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: suggestion: give a meaningful variable name, not t1, t2.

LS97 wrote:

sparks wrote:

The world has truly gone two pot if Scimonster has caught the dreaded mispeling vyrus.

You changed your sig. Now I can't see you as I scroll through the fora! I thought I was talking to some random Scratcher all the way through this topic!  big_smile

Same! I liked the old one  sad   sad
And don't you dare change yours sparks  tongue

This one is just for 9/11. I'll put it back in a day or two.

sparks wrote:

Haha, I never read usernames really, I know people by their sigs which is why the sig switching day a while back totally threw me!

And my sig changes itself, sorry about that!

I don't read usernames either.  lol

Offline

 

Board footer