This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » Suggestions
  •  » Improvement of comfort+consistancy: Renaming Items, specialy variables

#1 2008-12-07 07:46:02

MartinWollenweber
Scratcher
Registered: 2007-04-10
Posts: 100+

Improvement of comfort+consistancy: Renaming Items, specialy variables

The renaming of items (objects, sounds, costumes, variables) is somewhat uncomfortable, fault-prone and inconsistent. Before implementing new features it would be nice to make oldest features more stable. Specially with Variables: You can't edit their names like that of other items. Instead of that you have to delete it and make a new one with the new name. Than you have to look at all programs to exchange it, sometimes only possible by exchanging the blocks. So better naming of variables, translating and removing typos is not a motivating job in Scratch. With other items it's better, but not perfect: You can rename them just by typing the new name, but their usage in the program is not renamed automatically: So errors after renaming are common.

I must confess that this matter is important for me because I'm not native in English language and typos seem to love me ;-) but perhaps some other think the same? Just tell here!

I know that implementing of better renaming-features is not trivial and many people will not see the big advantage from the first look: So it's no "fast win". But because Scratch is getting more an more "grown up" and 100.000th people use it, it should also get more professional in this area.

@John: Is there a platform for Squeak-Scratch and Java-Scratch-Player improvements with ticket etc. like Andres runs it for the Homepage at ScratchR at: http://www.assembla.com/spaces/dashboard/index/scratchr ? I would be interested to help there. Perhaps I'll also start Smalltalk-Programming again (it's ten years ago that I did it, but  old love never dies :-)


Martin
...mitmachen beim  DACH-Scratch-Wiki und Scratch-Wiki-Autor werden!

Offline

 

#2 2008-12-07 11:41:41

MohamedSadek
Scratcher
Registered: 2008-09-14
Posts: 25

Re: Improvement of comfort+consistancy: Renaming Items, specialy variables

I don't get it.


MohamedSadek, Wiki Contributor and impatient Scratchr

Offline

 

#3 2008-12-07 11:52:49

MartinWollenweber
Scratcher
Registered: 2007-04-10
Posts: 100+

Re: Improvement of comfort+consistancy: Renaming Items, specialy variables

MohamedSadek: It's about "renaming" that means, you decided a name for an item in Scratch (e.g. a Variable name) and later you want to change that name, because you think an other name fits better or you made an error with the first name. Understand?


Martin
...mitmachen beim  DACH-Scratch-Wiki und Scratch-Wiki-Autor werden!

Offline

 

#4 2008-12-07 11:59:11

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Improvement of comfort+consistancy: Renaming Items, specialy variables

I agree with you. Sometimes I want to change my variable's name but I don't because it would be too much of a hassle.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#5 2008-12-07 14:20:13

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Improvement of comfort+consistancy: Renaming Items, specialy variables

I agree!  This should be improved.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#6 2008-12-08 03:06:47

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Improvement of comfort+consistancy: Renaming Items, specialy variables

I'm not sure if I fully agree.

"Renaming" stuff in any programming language is far from being trivial and often involves a great deal of interpretation and second-guessing. That's why it's usually *not* automated but left to be done manually by the programmer. Try renaming an instance variable in a Smalltalk class or a class itself (or even a local variable or a parameter in a method). Or try using your text editor's "search/replace" feature on C-code and you'll see what I mean. There's a whole branch of research related to this kind of changes, often referred to as "refactoring", and while the modifications themselves are tiny (like renaming a variable), their impact clearly is not.

Since Scratch version 1.3 you can now reassign most generic variable and list blocks (the setters and the hide/show blocks) via a drop down menu to another variable, thereby effectively renaming them. This really should take care of the hard stuff, because manually exchanging these blocks can be tedious due to possibly nested arguments. That leaves the round "getter" blocks (reporters), which you have to replace manually. Since these reporters cannot contain any arguments themselves, replacing them is about as easy as using a drop down menu.


Jens Mönig

Offline

 

#7 2008-12-08 06:20:50

MartinWollenweber
Scratcher
Registered: 2007-04-10
Posts: 100+

Re: Improvement of comfort+consistancy: Renaming Items, specialy variables

@Jens: I'm relay thankful about the better handling of variables in Scratch 1.3 and I also understand your concerns.

Therefore I made an UI-suggestion, how renaming could be better while avoiding the problems you stated above:
There will be right-click a "rename" context menu over every round variable block. If you use it, a Box, nearly the same than the "new-Variable-Box", pops up and asks you for the new name while showing the old name. It's forbidden to choose any already existing variable-Name to avoid problems (If you do, an Error-Message pops up and nothing happens). If you type a non-existing-name, all occurrences of the old name will be replaced by the new name. Because of the Block-Syntax of Scratch this is even more easy than with a Text-Editor, because only Variable-Blocks will be involved and no other part of the Source, that could accidentally be a part-String of a variable name, is changed.
You could even make it possible to switch form local to global and vice versa by that technique, what would be an additional big advantage.

This Technique could also be transfered to all other items (costumes, sounds, objects...) so you never have the very uncomfortable task to go through all your code after change one of it's items name. The little disadvantage doing that is, that you can't type the names of items directly like today, but if you left-click in the name and see the context-renaming-menu, everybody will immediately relearn the new - better - concept.

To  me this UI seams clear, easy to understand and to use with no interpretation-problems. I hope it's also easy to implement. It would motivate all Scratcher to make better readable programs, because often you find the best name for items very late, when the program is already complete. With such an easy renaming-mechanism , as described above, there would be no hesitation to change to the best name.

archmage wrote:

Sometimes I want to change my variable's name but I don't because it would be too much of a hassle.

Also translating the names of all items to other languages would be more easy(e.g. to use programs for educational reasons in class with no English speaking kids).

What do you think?

Last edited by MartinWollenweber (2008-12-08 06:44:02)


Martin
...mitmachen beim  DACH-Scratch-Wiki und Scratch-Wiki-Autor werden!

Offline

 

#8 2008-12-08 07:28:26

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Improvement of comfort+consistancy: Renaming Items, specialy variables

Hi Martin,

I have been experimenting myself with renaming variables in Chirp, because at the time you could not reassign complex blocks (with arguments) from one variable to another. I'm actually very glad that this is now possible in regular Scratch, so this part of Chirp has been made obsolete by Scratch.

I think I'm getting your point, but I'm still not totally convinced about it. If I understand you right you'd like to change every instance of a variable reporter block (in the whole project, i.e. in every sprite, if it's a global variable) from the existing variable name to a new, otherwise nonexisting name, via the block's context menu and a dialog box in combination with a possible error message.

I'm afraid this would lead to more problems than it might solve. Some conflicts I can imagine are:

-  wouldn't you have to change each other variable / list block as well?
-  what if several sprites each have local variables with the same name (from having been imported, or from older versions)?
- what about external modules communicating with Scratch via the remote sensor protocol and relying on global variable names?

The "renaming" variables suggestion usually comes up in the context of wanting to translate projects from the website for children's classes in different countries. I absolutely agree that it would be nice to translate variable / list names from one national language to another. The same applies to sprite names, costume names, sound names, message names and project notes, btw. I believe, however, that this should be handled as a translation mechanism, rather than a refactoring process.

Therefore, here's what I would suggest:

How about every Scratch project lets you export a .po file containing all of its user-defined resource-indicator strings. You could then edit this .po file in a normal text-editor (or pootle app) to add you own translation. If Scratch opens a project it looks for a .po file in the same directory and just changes the labels of the objects indicated by those strings (vars, sprites, costumes, messages, sounds etc.). You could even have several .po files for each project, so you can have a Bavarian translation and a Suabian one  smile

Alternatively, it might make sense to incorporate a simple "project-dictionary" into the Scratch UI itself, and to store translation-sets within the Scratch project's file format. That way you wouldn't have to bother about sharing .po files and keeping them in synch with your project. Also you could make Scratch projects automatically translate themselves whenever a new language is selected from the language menu.

What do you think?


Jens Mönig

Offline

 

#9 2008-12-08 08:32:36

MartinWollenweber
Scratcher
Registered: 2007-04-10
Posts: 100+

Re: Improvement of comfort+consistancy: Renaming Items, specialy variables

Hi Jens,
thank very much you for your fast and (positively) sophisticated answer.

Wow - I didn't think of a general translating mechanism when I suggested the renaming thing! But you are right: That seems to be a solution to even a more generalized form of that problem, if it's well implemented.

Although the problem of typos and wrong choice of resource-indicator strings in the original naming is not solved with your translation mechanism...

But why should the original language (mostly English) have a special state? I think of a resource-indicator string (e.g. a variable-name) as something like a "handle" that you use for a thing that exist even without that handle. As René_Magritte picture says "this is not a pipe", a variable is not its name...

So exchanging of that "handle" (= name in one language) should be easy, even in the original language the program was made in. I regret that I'm not in the Squeak-Implementation of Scratch (not now...:-) but is the exact name of a Scratch-variable really so important (on the condition all names are different)?

I would really like your concept with the export of a .po-File for any Scratch-Program you described. The only missing thing, to have also a renaming-tool with your concept, would be a button: "make .po-File names to the main-names of the program". Than you could translate a program from outside (by changing its .po-file), rename every item with that translation, and make the translation the "original names" so the program hold its new variable names, even without the .po-file.

A more sophisticated solution would be, to store multiple translation within the Scratch program so you could download and upload it with its translations included. Also including the translating tools inside Scratch would be nice to have. But for the start a translation from outside via file and text-editor would be very very helpful, specially if it was enlarged with the renaming-feature explained above.

I hope I find the time and overcoming, to have a closer look into the Squeak Implementation of Scratch myself soon. My Smalltalk-time is somewhat ago as you know, but to jump in again attracts me more and more .... :-)

I relay appreciate your engagement Jens!  Thank you for that!

Last edited by MartinWollenweber (2008-12-08 08:38:28)


Martin
...mitmachen beim  DACH-Scratch-Wiki und Scratch-Wiki-Autor werden!

Offline

 

#10 2008-12-14 11:57:43

MohamedSadek
Scratcher
Registered: 2008-09-14
Posts: 25

Re: Improvement of comfort+consistancy: Renaming Items, specialy variables

MartinWollenweber wrote:

MohamedSadek: It's about "renaming" that means, you decided a name for an item in Scratch (e.g. a Variable name) and later you want to change that name, because you think an other name fits better or you made an error with the first name. Understand?

Yes, I do!


MohamedSadek, Wiki Contributor and impatient Scratchr

Offline

 

#11 2008-12-19 08:58:05

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Improvement of comfort+consistancy: Renaming Items, specialy variables

I am not really sure...

You can rename a sprite, when you do, every block containing that sprite as an argument is changed too.

These blocks:

http://resources.scratchr.org/adminAccess/upload/blocks1.gif
perfectly changed into
http://resources.scratchr.org/adminAccess/upload/blocks2.gif
when I renamed "Sprite1" into "cat".

Why shouldn't it be possible with variables too?


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 
  • Index
  •  » Suggestions
  •  » Improvement of comfort+consistancy: Renaming Items, specialy variables

Board footer