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

  To report the amount of the fine

To report the amount of the fine, which is $25 for the first hour or pan of an hour that the car is illegally parked, plus $10 for every additional hour or part of an hour that the car is illegally parked

  Write java program to print strings given at command line

Write a program Average.java which just prints strings that it is given at command line, one per line. If nothing is given at command line, print "No arguments".

  Constructor that accepts a file name as its argument

Write a class with a constructor that accepts a file name as its argument. Assume the file contains a series of numbers, each written on a separate line. The class should read the contents of the file into an array, and then displays the following..

  Develop java code to compute monthly rent for housing units

Develop a java code that computes monthly rent for 3 housing units namely Bungalows,Apartments and hostels. All housing units have got size,color and monthly rental rate.

  Implement the getperimeter that returns the perimeter

Design a class named Triangle that extends GeometricObject. The class contains three double data fields named side1, side2, and side3 with default values 1.0 to denote three sides of the triangle. Implement the getPerimeter that returns the perim..

  Create class called hospital and add all relevant attributes

Create a class called Hospital and add all the relevant attributes for the created class - Create a User's super class that contains all the properties common to the all the users that will be using the Hospital patient billing system.

  Write a java application that reads a file containing text

Write a Java application that reads a file containing text. Your program should read each line and display it on the console screen preceded by line numbers. If the input file is:

  Compute the daily wage of an employee

Write a JAVA program that will input Employee Name, Rate per hour, No. of hours worked and will compute the daily wage of an employee. If the number of hours worked exceeds eight hours add 30% to each excess hours as overtime rate. Formula: Daily ..

  Write down a java program and pseudocode to read a number

write a java program and pseudocode to read a number up to 15 digits long or a date ddmmyyyy. the program should

  Enhance the test score applicaion

Enhance the Test Score applicaion so it uses a "while" or a "do-while" loop plus a for loop - Change the while statement to a do-while statement, andtest this change. Does this work any better than the while loop?

  Create a non-gui based java application

Create a non-GUI based Java application that calculates weekly pay for an employee. The application should display text that requests the user input the name of the employee.

  Java application that calculates the body mass index

Write a Java application that calculates and displays the body mass index (BMI) for N people

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