Advantages and disadvantages of optimization

Assignment Help JAVA Programming
Reference no: EM13963497

In Smalltalk, each class contains a pointer to the class template. This template stores the names of all the instance variables that belong to objects created by the class.

(a) The names of the methods are stored next to the method pointers. Why are the names of instance variables stored in the class, instead of in the objects (next to the values for the instance variables)?

(b) Each class's method dictionary stores the names of only the methods explicitly written for that class; inherited methods are found by searching up the super- class pointers at run time. What optimization could be done if each subclass contained all of the methods of its superclasses in its method dictionary? What are some of the advantages and disadvantages of this optimization?

1476_Smalltalk run-time structures for Point and PolarPoint.png

(c) The 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. Speci?cally, 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 this directly without searching through the method dictio- nary and without searching through superclasses. Can you see some advantages and disadvantages of this implementation decision compared 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 incremen- tally and, conceivably, existing classes could be rewritten and recompiled.

Reference no: EM13963497

Questions Cloud

Perceptions of acl rehabilitation : The purpose of this study is obtaining undiscovered perceptions of strength and conditioning coaches (S&C) and physiotherapists', on what defines a successful return to sport following an anterior cruciate ligament (ACL) injury.
Verify the normalization of the ground state of sho : Examine the normalization condition as applied to the second-state wave function. Can you see a way to apply the results of (a) and (b) to evaluate the integral? [Hint: What happens if you regard the SHO parameter a as a variable and differentiate..
Problem regarding the protocol conformance : We can compare Smalltalk interfaces to classes that use protocols, which are lists of operation names (selectors). When a selector allows parameters, as in at: put: , the selector name includes the colons but not the spaces.
Franchise arrangement between mcdonald''s and its franchisees : The franchise arrangement between McDonald's and its franchisees is summarized
Advantages and disadvantages of optimization : In Smalltalk, each class contains a pointer to the class template. This template stores the names of all the instance variables that belong to objects created by the class.
Specific heat of superheated steam at 150kpa is 2kj/deg : What diameters of inlet and outlet pipes would be required for a flow of 2270kg per hour with a velocity of 15m/s both before and after the reducing valve?
Objects-type case : With object-oriented programming, classes and objects can be used to avoid "type- case" statements. Here is a program in which a form of case statement is used that inspects a user-de?ned type tag to distinguish between different classes of shape ..
What are the capacity implications of the marketing campaign : Suppose that AlwaysRain Irrigation's marketing department will undertake an intense ad campaign for the bronze sprinklers, which are more expensive but also more durable than the plastic ones. What are the capacity implications of the marketing cam..
Which of the following statements is necessarily true : If the temperature of the contents is increased by 10 C degrees, the reading on the Kelvin thermometer should increase by 273 K

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a complete java program to simulate ahmed''s show

Suppose you're on a game show and you're given the choice of three doors. Behind one door is a car; there is nothing behind the others. The car and is placed randomly behind the doors before the show. The rules of the game show are as follows:

  Represent the relationship between parents - children class

Draw a class diagram that represents the relationship between parents, children, and grandparents. Take into account that a person can have both a parent and a child. Annotate associations with roles and multiplicities.

  Discuss the necessity of designing programs to handle except

Discuss the necessity of designing programs to handle exceptions of various types

  Create a class diagram that shows an interface

Create a class diagram that shows an interface called Buyer in the Violet UML editor. This interface should declare the methods to perform a buyer's responsibilities

  The federal acquisition regulation

According to the text, the Federal Acquisition Regulation (FAR) is a body of law that governs U.S. Federal Government's procurement process. The FAR is prepared, issued and maintained under the joint command of the Secretary of Defense, the Administr..

  Create the program which converts fahrenheit to celsius

Create the following program which converts Fahrenheit to Celsius. Read integer Fahrenheit temperatures from the user.

  Difference between string and stringbuilder

What is the difference between string and StringBuilder? What are the advantages and disadvantages of a StringBuilder

  Write a class to represent a credit card.

write a class to represent a credit card.

  Program that allows users to enter a dollar amount

Write a program that allows users to enter a dollar amount for their bank account balance at the beginning of the month. Then ask the user to enter a dollar amount for any number of checks written in a month, up to 50.

  How many bits are needed to represent the index size

How many bits are needed to represent the index size - what would be the index size if 8-way set associative cache were used with the same capacity and block size?

  Problem related to java programming

Question 1: Explain why NO_EXIT has been declared and used in defining the contents of the map array, rather than just directly using the value 99999 in the map array definition. Question 2: What is the value stored in map[2][1]? What is the inter..

  Program that reads customers information from a file

Write a program that reads customers information from a file, and creates a movie theatre seating with a number of rows and columns specified by a user. Then it will attempt to assign each customer to a seat in a movie theatre.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd