Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
help with classes
Old
legend_018
Guest
 
Status:
Posts: n/a
Default help with classes - 09-17-2008, 11:38 AM

I'm not sure what Im doing wrong here.

I create a new world and add an object. I click on the object and under the methods tab, i create a new method that is specific to that object and I add some code along with some parameters within that method.

I than right click on the object and do save object.

I than do file, import and double click on that file.

I believe I"m suppose to now add objects and they will inherit the same "custom" method that I created. If I click on the original object that came in when I did the file, import...that does have the new method I created. However, if I go and click on add object and from the gallery choose another object or even the same object so it's on the screen twice. If I click on it and go to the methods tab, I don't see the new method.
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 09-17-2008, 11:56 AM

Quote:
Originally Posted by legend_018 View Post
I'm not sure what Im doing wrong here.

I create a new world and add an object. I click on the object and under the methods tab, i create a new method that is specific to that object and I add some code along with some parameters within that method.

I than right click on the object and do save object.

I than do file, import and double click on that file.

I believe I"m suppose to now add objects and they will inherit the same "custom" method that I created. If I click on the original object that came in when I did the file, import...that does have the new method I created. However, if I go and click on add object and from the gallery choose another object or even the same object so it's on the screen twice. If I click on it and go to the methods tab, I don't see the new method.
I admire your tenacity, and I don't want to sound too pessimistic, but you are trying to push Alice 2.0 into areas that it is only marginally capable of supporting.

If you really want to do object-oriented programming, and you have the freedom to do so, I recommend that you switch to another language such as Java, C#, or C++. (See http://www.dickbaldwin.com/alice/Ali...ed_Programming)

If you don't have the freedom to make to make such a switch, don't give up. Keep at it and you may be able to accomplish your goals with Alice.

Good luck,
Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free Scratch tutorials: http://www.dickbaldwin.com/tocHomeSchool.htm
Free Java/C#, etc. tutorials: http://www.dickbaldwin.com/toc.htm
   
Reply With Quote
Old
legend_018
Guest
 
Status:
Posts: n/a
Default 09-17-2008, 12:04 PM

I was trying to complete a lab project though. It was in your tutorial.

The second part of the project says:

The program named Alice0150b

The source code for this program is shown in Listing 2. The purpose of this program is to illustrate the use of the new class named SpinningHare to add new objects to your world. To run this program, do the following:

* Create a new world.
* Use the Import... item on the File menu to add two objects of your new SpinningHare class to your world.
* Rename the objects spinningHare1 and spinningHare2.
* Write and run the main method shown in Listing 2.

Once again, I included calls to the move method in addition to calls to the spin method in Listing 1 to demonstrate that the object created from the new class contains the new method named spin in addition to the primitive methods.

>>>>>>I can't do this second part. I keep on going through the tutorial for this chapter over and over and I think I'm following the instructions. So as a result I have the problem that I described above.

I really want to have some basics down before moving on. I am planning on trying to learn C# and will be using your tutorial to begin with. Thanks!!!

Last edited by legend_018; 09-17-2008 at 12:07 PM.
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 09-17-2008, 01:32 PM

Quote:
Originally Posted by legend_018 View Post
I was trying to complete a lab project though. It was in your tutorial.

The second part of the project says:

The program named Alice0150b

The source code for this program is shown in Listing 2. The purpose of this program is to illustrate the use of the new class named SpinningHare to add new objects to your world. To run this program, do the following:

* Create a new world.
* Use the Import... item on the File menu to add two objects of your new SpinningHare class to your world.
* Rename the objects spinningHare1 and spinningHare2.
* Write and run the main method shown in Listing 2.

Once again, I included calls to the move method in addition to calls to the spin method in Listing 1 to demonstrate that the object created from the new class contains the new method named spin in addition to the primitive methods.

>>>>>>I can't do this second part. I keep on going through the tutorial for this chapter over and over and I think I'm following the instructions. So as a result I have the problem that I described above.

I really want to have some basics down before moving on. I am planning on trying to learn C# and will be using your tutorial to begin with. Thanks!!!
In my opinion, the "save object" feature of Alice 2.0 is far from the mainstream in OOP. An inability to "save objects" in Alice 2.0 should have no detrimental impact on your ability to learn OOP using C#.Therefore, unless you **really** need to be able to "save objects" in Alice, I would advise you to put that feature on the back burner and move on to other aspects of Alice. Stated bluntly, in my opinion, "save object" in Alice 2.0 is a weak and crude attempt to make Alice look something like an OOP language, which it clearly isn't.

Even though the code that I published worked well for me when I published it, I skip the "save object" material in the Alice programming course that I teach.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free Scratch tutorials: http://www.dickbaldwin.com/tocHomeSchool.htm
Free Java/C#, etc. tutorials: http://www.dickbaldwin.com/toc.htm

Last edited by DickBaldwin; 09-17-2008 at 01:35 PM.
   
Reply With Quote
Old
legend_018
Guest
 
Status:
Posts: n/a
Default 09-17-2008, 01:36 PM

Great, than I will move onto the next chapter in the tutorial. Thanks!. I didn't want to miss out on something and have it bite me later on in the tutorial.

Thanks for the advise.
   
Reply With Quote
Old
DickBaldwin
Guest
 
Status:
Posts: n/a
Default 09-17-2008, 01:37 PM

Quote:
Originally Posted by legend_018 View Post
Great, than I will move onto the next chapter in the tutorial. Thanks!. I didn't want to miss out on something and have it bite me later on in the tutorial.

Thanks for the advise.
If that turns out to be a problem, please let me know.

Dick Baldwin
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 09-17-2008, 02:12 PM

Quote:
Originally Posted by DickBaldwin View Post
In my opinion, the "save object" feature of Alice 2.0 is far from the mainstream in OOP. An inability to "save objects" in Alice 2.0 should have no detrimental impact on your ability to learn OOP using C#.
Though I don't teach programming, I have to strongly agree in principle with Dick Baldwin's comments above. I also believe that the Alice team recognized the problem and this was part of their decision to move to the fully Java compatible 3.0 version - which will hopefully come along in the not too distant future.

But as Dick also says, please post your own experiences as a student on this issue as you progress into C# - particularly on any minor points that Alice might have been able to help with.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.