PDA

View Full Version : Creating functions and procedures


DrJim
06-03-2009, 10:19 AM
Another observation - apparently the approach for creating changed a bit changed a bit during development (and since the early tutorial videos).

In the present version, there is one basic pull down menu (see below) for this, which seems to work fine. There are also several display options, which I haven't even begun to explore.

lanceA
06-04-2009, 12:07 PM
I agree Dr. Jim that the Beta release is different. I downloaded the two Alice ScreenCasts thinking they might act as tutorials, but the released software is nothing similar to what is described in the screencasts.

Like you, it took me a while to do something as simple as create a new method (methods are now called procedures). I also stumbled across how to remove the this java keyword.

If I have to hunt & peck my way through learning 3.0 (beta) without documentation this summer this is no way I can introduce it in September.

Where is Dick Baldwin when we need him most!! :o

Keep posting any new revelations you stumble across as we all begin the learning process and I will do likewise. Currently I'm off to play with opening/modifying Alice worlds in NetBeans. :eek:

(It's sad that most school systems don't have the budget to pay for attending workshops this summer - but we are in an economic crisis.)

DrJim
06-04-2009, 05:29 PM
I also stumbled across how to remove the this java keyword.

How did you do that? :confused: I haven't yet figured out a way - and the problem is rather annoying.

lanceA
06-04-2009, 07:20 PM
From the menus at the top of the Alice window select Window, from the drop down menu. Check "Is Omission Of This For Field Access Desired". That will remove the Java reserved word this.

I also note that the UNDO function is not implemented in this release.

Also, when you drag a tile to the Edit window you get a mysterious message "rendering is disabled...."

Good luck and continue to post in this room. We need to know how Alice 3.0-Beta works.

Sophie
06-05-2009, 12:22 AM
I find that option only works on World/scene. On the "Ground" I see
"this (a.k.a. grassyGround)" in the left panel, and "this" in the code panel. In fact (take with a grain of salt, please ... I've just been at this a few days) some things in 3.0 seem to add syntactical noise from concrete Java syntax without much apparent benefit.

Is this forum a suitable way of getting feedback / suggestions back to the development team?

[And thanks, DrJim, I even thought Add procedures/functions was missing until I saw your post!]

lanceA
06-05-2009, 11:07 AM
I find that option only works on World/scene. On the "Ground" I see
"this (a.k.a. grassyGround)" in the left panel, and "this" in the code panel. In fact (take with a grain of salt, please ... I've just been at this a few days) some things in 3.0 seem to add syntactical noise from concrete Java syntax without much apparent benefit.

Is this forum a suitable way of getting feedback / suggestions back to the development team?

[And thanks, DrJim, I even thought Add procedures/functions was missing until I saw your post!]

Sophie the Java reserved word 'this' does remain on this(a.k.a.scene) but it is removed from all of my other objects, including grassyGround and any new objects that I add. And since I'm not sure what to do with this(a.k.a.scene) then I can live with it remaining on the screen. :) I have the Set Locale --> English(United States).

As far as '...syntactical noise' I'm waiting on the Netbeans plugin to really see what can be done with Alice 3.0. (I saw Dennis Cosgrove talking about it in a film clip from the JavaOne conference.)

Also I think this is the forum for this type of constructive comment about the new Alice. Gabe seems to be monitoring it well. We all just need to remember the current release is under heavy construction at the moment.

DrJim
06-05-2009, 01:40 PM
From the menus at the top of the Alice window select Window, from the drop down menu. Check "Is Omission Of This For Field Access Desired". That will remove the Java reserved word this.

An embarrased :o thanks. Guess I should actually read the menu options - but isn't that sort of like actually reading the manual, i.e., not something a macho programmer would do? :D

DrJim
06-05-2009, 02:38 PM
Just completed the attached project, which was a test of various functions. Everything seemed to work fine, but on the first call, I needed to put in a string variable (which was what the function returned).

I really don't understand what that string was supposed to do - since it's value doesn't seem to affect anything. I suspect it's some sort of a dummy, since I really haven't found anyway to just create a local parameter.

Any ideas or suggestions? :confused:

Sophie
06-07-2009, 05:39 PM
Where can I find the 3.0 equivalent of 2.x "events"?

Thanks

ttkrakus
06-09-2009, 12:58 AM
I am getting a little frustrated with v3.0...what about those "procedures"

There is so much Java jargon in this version that seing "procedures" gives me indigestion. We have "this" and "classes" and "mouseListeners", why do you have to talk about "procedures" where such syntactical construct does not exist in Java --or was it added recently and I did not notice?

Of course, we can also argue that the "for all together" does not have a syntactically counterpart in Java either...which reinforces my view that Alice should be language independent, but this is not a popular idea in this forum.

I am a bit concerned that Alice 3.0 is getting so complex that we are going to have to learn Alice 2.X first to ease the transition to Alice 3.0!

Anyways...

ttkrakus
06-09-2009, 01:31 AM
I am also confused.
Didn't you create the Reply parameter when declaring the firstCow procedure?
You do not use the argument in your procedure, but because you declared in the procedure you, then, have to pass a string to the procedure in MyScene.run()

Am I missing something here?

DrJim
06-09-2009, 10:14 AM
Didn't you create the Reply parameter when declaring the firstCow procedure?

I did not explicitly create the Reply parameter. It was automatically generated when I created the number of turns parameter to pass to firstCow. Obviously since it is there, I need to pass something back - but I don't (yet) understand were it came from in the first place.

I do have a few ideas - and will post the results if they work.

Sophie
06-09-2009, 04:06 PM
There is so much Java jargon in this version that seing "procedures" gives me indigestion. .... which reinforces my view that Alice should be language independent, but this is not a popular idea in this forum.


Amen.

I am relatively new to Alice (though quite familiar with programming, OOP, and teaching). I am excited about the new capabilities coming with 3.0 and even more apprehensive about 3.0 having an unnecessarily complex interface and steep learning curve.

To the brains behind developing Alice ... please don't bog down Alice with syntax noise from Java (or anywhere else). If you want some constructs (whether from Java or not), present them the simplest way you can, please. When a new user things "I'd like to do X" make it as easy as possible for them to find the right tools to do X.

Stepping from Alice 3.0 to editing textual Java code needs to be a conscious move, and students can expect to deal with some mappings along the way.

Thanks!

Dennis Cosgrove
06-10-2009, 04:49 PM
Apologies for the understandable frustration.

What you are seeing today is a version of Alice that is not only under heavy construction but also has been torqued to the needs of a CS101 class. As far as “not a popular idea in this forum” nothing could be further from the truth. :) I agree with you that Alice3 in its current default incantation is far too complex (even for someone in CS101, never mind middle school). We are working on it and are far from finished.

Beyond that I would like to assure you that you need not worry about convincing us that what you have described is important.

There are multiple audiences for this system and we understand that.

Beyond just the simple customization that Alice will provide (which some of you have already started to discover) what is really exciting is continuing work of Caitlin Kelleher (http://www.cse.wustl.edu/~ckelleher/) and her students at WashU (http://www.wustl.edu/) on LookingGlass. (For those of you who don't know, Caitlin's dissertation work was StorytellingAlice which is the basis of Alice3.) Having seen an advance look of Looking Glass, I can tell you that you will be very pleased when it comes out.

Looking Glass goes way beyond a simple repackaging of Alice3 optimized for middle schoolers. They are already making advances in code search, debugging, and supporting students learning from existing worlds.

So to sum up, we are working together to build two separate systems which will hopefully be better than creating one system that tries to meet the needs of different audiences.

I am getting a little frustrated with v3.0...what about those "procedures"

There is so much Java jargon in this version that seing "procedures" gives me indigestion. We have "this" and "classes" and "mouseListeners", why do you have to talk about "procedures" where such syntactical construct does not exist in Java --or was it added recently and I did not notice?

Of course, we can also argue that the "for all together" does not have a syntactically counterpart in Java either...which reinforces my view that Alice should be language independent, but this is not a popular idea in this forum.

I am a bit concerned that Alice 3.0 is getting so complex that we are going to have to learn Alice 2.X first to ease the transition to Alice 3.0!

Anyways...

DrJim
06-10-2009, 06:10 PM
Looking Glass goes way beyond a simple repackaging of Alice3 optimized for middle schoolers. They are already making advances in code search, debugging, and supporting students learning from existing worlds.

So to sum up, we are working together to build two separate systems which will hopefully be better than creating one system that tries to meet the needs of different audiences.

Great News. :):):)

And thanks for the information. For what my opinion is worth, :rolleyes: I think you are very much on the right track.

DickBaldwin
06-10-2009, 07:30 PM
Where is Dick Baldwin when we need him most!! :o


Just lurking in the background, watching to see where this thing actually goes.;)

Once v3.0 becomes a reasonably stable product, I will probably write a series of tutorials on it and incorporate it into my Java courses. Until then -- since I was deemed unqualified to be a beta tester:(, I have decided to let the beta testers do the debugging.:rolleyes:

lanceA
06-11-2009, 07:05 PM
Just lurking in the background, watching to see where this thing actually goes.;)

Once v3.0 becomes a reasonably stable product, I will probably write a series of tutorials on it and incorporate it into my Java courses. Until then -- since I was deemed unqualified to be a beta tester:(, I have decided to let the beta testers do the debugging.:rolleyes:

Thanks for the reply....;)

cawashburn
06-15-2009, 04:46 PM
Maybe I'm missing something simple or maybe it's just the difference between working in Storytelling Alice and something that's obviously very different - but is there a way to make a new scene in Alice 3.0?

DrJim
06-15-2009, 06:43 PM
- but is there a way to make a new scene in Alice 3.0?

Good question. I wondered about that myself.

At least as far as I can see, the current version hasn't implemented any way to define user classes, despite the presence of the "My Classes" folder after installation. LanceA seems to have been successful in creating new instances - but from his postings, they seem to be of existing classes.

If I'm wrong - somebody please :) clarify.

lanceA
06-15-2009, 09:25 PM
Good question. I wondered about that myself.

At least as far as I can see, the current version hasn't implemented any way to define user classes, despite the presence of the "My Classes" folder after installation. LanceA seems to have been successful in creating new instances - but from his postings, they seem to be of existing classes.

If I'm wrong - somebody please :) clarify.

Dr. Jim, so far all that I have done is create objects of existing Alice classes and this required that I import certain libraries into my code. However, I'm not sure what is meant by the users question: "...create a new scene in Alice 3.0 " ? What does this mean?


Later this week I would like to create a world in Alice 3.0 using the snow template and then attempt to use NetBeans to add a new 'scene' which changes to the Grass Template while the world is running - however, I will need to spend a good deal of time studying the code for the existing world to see how Alice 3.0 can do that.

By the way, moving your Alice world to NetBeans appears to be a one-way street, you can not write Java code in NetBeans and then run your modified program in Alice 3.0 - at least I have not determined how to do this. But look at the positive side to this - Java programs run very well all over the Net!! You don't need to film your program, you just post it on the Net for all to see!

I realize this will not be appealing to many on this site who are seeking instant gratification in creating the world's next block-buster game! ;) However, as a teaching tool this will be a great tool for transitioning to higher learning.

DrJim
06-16-2009, 10:18 AM
...create a new scene in Alice 3.0[/I][/U] " ? What does this mean?

I had assumed (which is always dangerous) that the question refered to what you are trying to do, namely create a new "this (aka scene)" with different lights, ground, object instances, etc.

cawashburn
06-16-2009, 10:35 AM
Yes, that is exactly what I was talking about - in Storytelling Alice, you can click on "Create New Scene", which brings up a new Method window and you can add a different background, characters, tripods etc. After you finish adding in the action for the new scene, you can add the "method" or scene that you just created to the bottom of the World.scene1.method and it will run after scene 1 is over.

I can't find anywhere in Alice 3.0 that allows me to create a new scene - but maybe it's called something else. It did take me quite awhile to figure out that I needed to create a new procedure to make a new method. Ugh... I just got used to Alice 2.2 syntax - if Alice 3.0 didn't have so many neat features, it wouldn't bother me, but I really want the kids to be able to use 3.0. The Sims characters and actions are a huge draw for them and has generated a lot of excitement.

Dennis Cosgrove
06-16-2009, 07:46 PM
Supporting multiple scenes is in the plans for Alice3's future. I do not have an estimate for you on when it will make it in but it is definitely a desirable feature.

Yes, that is exactly what I was talking about - in Storytelling Alice, you can click on "Create New Scene", which brings up a new Method window and you can add a different background, characters, tripods etc. After you finish adding in the action for the new scene, you can add the "method" or scene that you just created to the bottom of the World.scene1.method and it will run after scene 1 is over.

I can't find anywhere in Alice 3.0 that allows me to create a new scene - but maybe it's called something else. It did take me quite awhile to figure out that I needed to create a new procedure to make a new method. Ugh... I just got used to Alice 2.2 syntax - if Alice 3.0 didn't have so many neat features, it wouldn't bother me, but I really want the kids to be able to use 3.0. The Sims characters and actions are a huge draw for them and has generated a lot of excitement.

zwhitlock
02-12-2010, 12:34 AM
I really would like to create some functions and parameters, but they require numbers that may include decimals as well. And from what I've noticed, there is only the integer option available, which does not allow things such as 3.14 to be entered.

Does anyone know what I should do?

x2495iiii
02-12-2010, 02:36 AM
You can select whatever value for a number variable you want by clicking the "Other..." option at the bottom of the popup menu that appears when you click it.