Alice Community  

Go Back   Alice Community > Alice 3 > How Do I?

Reply
 
Thread Tools Display Modes
Alice 3 for starters.
Old
hgs
Guest
 
Status:
Posts: n/a
Default Alice 3 for starters. - 02-22-2011, 03:09 PM

It is difficult to answer because some of this is ambiguous.

"What are classes?" Do you mean specifically in Alice3 or is this just the only context in which you encountered them?

I'll assume the latter, so skip this if you know it already. You don't need reminding that computers store everything as binary, which is basically a numerical representation. If you have access to binary you can do pretty much any computational operation on it, whether it is sensible or not. Suppose you have an aircraft, and part of the software controlling it will raise the undercarriage. You want to do that when you are off the ground, or it gets expensive. Whether the undercarriage is up (1) or down (0) is just one bit in this example. But so is turning on the fuel light. So you make a mistake in coding, turning on the fuel light doesn't, instead it drops the aircraft on the runway.

So then you decide that what you need are data types. You need integers, strings, and booleans, so you can't make this kind of mixup so easily. But they are still too basic, and not very descriptive. So then someone comes along and says, "all these lights, and undercarriages, and ejector seats, they are all TYPES, and you can only do certain things to them. You can't strap yourself into a light". So you get "strong typing", and the operations the language will allow are restricted to certain things, and you get an error if you use the wrong one.

So then someone else comes along, and says, "Look, all these operations that can only be done to lights, and all the ones which can only be done to ejector seats: it really only makes sense to define them inside the type, actually have them belonging to the type itself. Then you can think of the things as OBJECTS, rather like in the real world. You can have cars, and planes, and engines.... And the operations are methods."

But there are lots of different types of car, or automobile. There are sports cars, small cars for cities, estate cars or station wagons, etc. They all have an essential "car-ness" about them. So they are all in the CLASS of car. And they all get the ability to be driven, have engines, etc. But now there are subclasses of car, sportscar, etc. And the things you can do to them, drive, park, crash (oops!) are methods. The subclasses are more specific than the general car. But you can define a new subclass without having to rewrite all the common stuff again. The subclass "inherits" this from its more general parent.

So this means that one answer to "Where are the methods?" is that they are inside the class, or its parent class (the one of which it is a subclass).

In Alice 2, the methods could not be defined for a person. If you wanted RoomMate to have the same abilities as LunchLady, you'd have to define the method twice. You should be able to define it in Person, so that all people get it.

"Restricted Scope": I'm not sure about this. It could be that the scope is dependent on whether you are defining for a class or a subclass. Or it might be talking about whether the things are in the scope of the Alice 3 project at the moment, and will not be included until they are. Or it could be a language feature I don't know about.

Hope that is useful, and not too inaccurate.
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 04-01-2011, 11:03 AM

Translated into non-geek. Jk..

Making methods in Alice 3 beta is possible by clicking the left click "Class:" dropdown box, mouse over an object or element, and click Declare Procedure to create a new 'Method.

Some options in alice 2.2 are moved to different places in Alice 3


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
David B
Senior Member
 
David B's Avatar
 
Status: Offline
Posts: 1,145
Join Date: Dec 2010
Location: N/A
Default 04-01-2011, 03:27 PM

Quote:
Originally Posted by jediaction View Post
Translated into non-geek. Jk..

Making methods in Alice 3 beta is possible by clicking the left click "Class:" dropdown box, mouse over an object or element, and click Declare Procedure to create a new 'Method.

Some options in alice 2.2 are moved to different places in Alice 3
Okay. Thank you jedi, I will update my question list and move this question to the "answered" column.
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 04-01-2011, 08:22 PM

OK..Thats good


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Reply


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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.