malltalk Implementation Decisions In class, we assumed that Smalltalk objects have (1) a pointer to the class and (2) a map of (instance variable name, instance variable value) pairs. Variable instances were then looked up by name in the map using the variable name as key. Though this is a reasonable representation of objects, it's not how Smalltalk actually represents objects. Instead, objects only have (1) a pointer to the class and (2) a set of instance variable values. Each class, in turn, contains a pointer to a class template, in addition to the method-dictionary pointer. This class template stores the names of all the instance variables that belong to objects created by the class and information used to lookup the variables. 1. [4pts] Why are the names of instance variables stored in the template, instead of in the objects (next to [4pts] Each class's method dictionary only stores the names of the methods explicitly written for that class; inherited methods are found by searching up the superclass pointers at run-time. One optimization approach is for each subclass to have all of the methods of its superclasses in its method dictionary as well as it's own methods. What are some of the advantages and disadvantages of this approach? [4pts] Context: Consider the build systems of object oriented languages such as C++ and Java. On any non-trivial project, the compile time for a project will become an important consideration to optimize for in terms of saving time for the developer and money for the business. Many of these languages support partial compilation or incremental compilation such that when a file changes, only the updated file needs to be recompiled and any old untouched files can remain the same. In Smalltalk, the compilation system is taken a step further and allows for files to be recompiled during runtime, which means that a developer can update the system without having to shut it down. Question: The Smalltalk class template stores the names of all the instance variables, even those inherited from parent classes. These are used to compile the methods of the class. Specifically, when a subclass is added to a Smalltalk system, the methods of the new class are compiled so that when an instance variable is accessed, the method can access the variable directly without searching through the class template and without searching through superclasses. What are some advantages and disadvantages of this implementation decision, in comparison with looking up the relative position of an instance variable in the appropriate class template each time the variable is accessed? Keep in mind that in Smalltalk, a set of classes could remain running for days, while new classes are added incrementally and, conceivably, existing classes could be rewritten and recompiled.