Programming Exercises 573
- Explain type checking in Smalltalk.
- The designers of Java obviously thought it was not worth the additional
efficiency of allowing any method to be statically bound, as is the case
with C++. What are the arguments for and against the Java design? - What is the primary reason why all Java objects have a common
ancestor? - What is the purpose of the finalize clause in Java?
- What would be gained if Java allowed stack-dynamic objects, as well as
heap-dynamic objects? What would be the disadvantage of having both? - Compare the way Ada 95 provides polymorphism with that of C++, in
terms of programming convenience. - What are the differences between a C++ abstract class and a Java
interface? - Compare the support for polymorphism in C++ with that of
Objective-C. - Compare the capabilities and use of Objective-C protocols with Java’s
interfaces. - Critically evaluate the decision by the designers of Objective-C to use
Smalltalk’s syntax for method calls, rather than the conventional syntax
used by most imperative-based languages that support object-oriented
programming. - Explain why allowing a class to implement multiple interfaces in Java and
C# does not create the same problems that multiple inheritance in C++
creates. - Study and explain the issue of why C# does not include Java’s nonstatic
nested classes. - Can you define a reference variable for an abstract class? What use
would such a variable have? - Compare the access controls for instance variables in Java and Ruby.
- Compare the type error detection for instance variables in Java and
Ruby.
PROGRAMMING EXERCISES
- Rewrite the single_linked_list, stack_2, and queue_2 classes
in Section 12.5.2 in Java and compare the result with the C++ version in
terms of readability and ease of programming. - Repeat Programming Exercise 1 using Ada 95.
- Repeat Programming Exercise 1 using Ruby.
- Repeat Programming Exercise 1 using Objective-C.