Object Model Flashcards

1
Q

Where is the method table stored?

A

The class representation, namely the class object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why do we need a class tun-time representation?

A
  1. dynamic binding
  2. Run-time type info
  3. Reflection
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is reflection?

A

The ability of the program to examine and possibly modify itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what is serialization?

A

Serialization is the process of turning an object in memory into a stream of bytes so you can do stuff like store it on disk or send it over the network.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a meta-class?

A

a class whose instances are classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s a terminal instance?

A

cannot be instantiated further

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a 1-level system?

A

Object only.
object describe themselves, no classes: objects can be instantiated from other objects and inherited from them.
an object is essentially a map from names (strings) to values or methods.

Example: Javascript, Self

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is prototype inheritance?

A

קישור בזמן-ריצה במקום
subclassing
בזמן הידור

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

1-level pros and cons

A

Pros:
- Extremely flexible
- As Object Oriented as it gets… (literally)
Cons:
- Performance penalty on member lookup (need to go to all the “parents” and look there)
- No compile time validations and optimizations (everything is done dynamically)
- Not very common

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the 2-level system?

A
  • Objects are instances of classes
  • Classes are compile time creatures
    (No runtime representation)
  • Minimal runtime overhead
    Zero overhead (“supermarket”) principle
    But object types cannot always be determined
    On some cases, run-time type information is available
  • No class (static) members
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the 3-level system?

A
  • Objects are instances of classes
  • Classes are also objects
  • All classes are instances of one metaclass
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Can a user-defined class affect the Class object or the meta-class in a 3-level system?

A

A user-defined class can only affect class objects state (for example, diffrent method dictionary for every user-class).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
object members are defined in the object's class.
in a 3-level system where are class members defined?
A
They should be defined in the meta-class, but there is only one so it's not possible.
we can emulate class members with static members since the are stored in some global space.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the 4-level system?

A
Each object is an instance of a class
Each class is an instance of a metaclass
Each metaclass is an instance of a meta-metaclass
One meta-metaclass (instance of itself and inherits from Object or Class)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the 5-level system?

A
Same as 4-level, except meta-metaclass (we'll call Metaclass) is and instance of metaclass class
and metaclass class is instance of Metaclass.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Draw the squeak object model. (and check yourself!)

A