Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Sum01 Final Exam Review: OO Theory
1. A class is a definition of the structure for an object. Instant is the the actual object.
2. Class method doesn't require an instant to be executed, executes at a higher level can affect/changes all of its instant. Instant method requires creation of an instant and only going to apply to that instant.
3. Class variable are global (accessible by all of its instants). Instant variable are confined to particular instant comes and goes as the instant does.
4. no idea
2: class methods cannot access any instances. (unless they scan through memory to find them, that is).
3: in addition to coming and going with the instances, what else is interesting about instance variables compared to class variables? (this can be applied to #1, as well)
By the way, a true "global" variable is accessible by any method at all. Class variables have a very wide scope, but not that wide. Unless it's in Object, of course.
These are subtle but important questions. Take your time with them. -Lex Spoon
I don't know if I completely understand prototype-based object systems, but here goes...
4. A Prototype-based system is good for rapid development, because you can make an object with the attributes that you want and then clone it. You can change attributes of this clone without affecting anything else, because, in effect, it is a singleton: the only object of its "class".
A class-based system has to be planned in advance so you know that all the instances get the functionality that they require. However, in the end, it's much more structured, and you can make a change to the class which will end up changing all the instances. With a prototype-based system, you can't do this, because the instances have no relation to each other.
Link to this Page