Topics for Exam 1 in Com S 541 This exam covers topics from homeworks 1-2, including object-oriented programming, Smalltalk, and Java. It does not cover aspect-oriented programming. REMINDERS The exam will be open book, open notes. (Warning: don't expect to learn the material during the exam, you won't have time! A good idea for studying is to condense your notes to a few pages of ready reference materials.) If you need more space, use the back of a page. Note when you do that on the front. This exam is timed. We will not grade your exam if you try to take more than the time allowed. Therefore, before you begin, please take a moment to look over the entire exam so that you can budget your time. Clarity is important; if your diagrams or programs are sloppy and hard to read, you will lose points. Correct syntax also makes a difference for programming questions. READINGS Primarily, you should read Adele Goldberg and David Robson's book, Smalltalk-80: The Language (Addison Wesley, 1989). For the design of Java, read James Gosling and Henry McGilton's paper "The Java Language Environment: A White Paper" (Sun Microsystems, June 1996, http://java.sun.com/docs/white/langenv/). Also read Gary T. Leavens and Todd D. Millstein's paper "Multiple Dispatch as Dispatch on Tuples" (OOPSLA '98 Proceedings, pages 374-387, Volume 33, number 10 of ACM SIGPLAN Notices October 1998). If you have time, see the course web site and also the course syllabus for other readings. TOPICS In the following, I use + to denote relatively more important topics, and - to denote relatively less important topics. Topics marked with ++ are almost certain to be on the exam. All of these are fair game, but if you have limited time, concentrate on the ones that are more important first (and in those, the ones you are most uncertain about). SKILLS + Smalltalk programming; be able to: + give output of Smalltalk code, especially for code that uses inheritance, method overriding, and "super" + write client code that uses existing classes in Smalltalk [HW1: like NGon's drawNested: method] ++ design and write code for classes in Smalltalk + based on specifications [HW1: HanoiDisk] + using inheritance: + as a subclass of a given class [HW1: NGon] ++ as a subclass of Collection [HW1: HanoiTower, BinaryRelation, ReflexiveRelation] + as a subclass of Stream [HW1: HanoiMoveStream] + using indexed instance variables [HW2: Tuple] + write code that uses dispatch instead of explicit tests, like the Booleans or the List example from class + Write code to (or explain how to) implement language extensions in Smalltalk, such as looking up Tuple methods [HW2: problem 2] - Write code to (or explain how to) implement Browser-like classes in Smalltalk, such as the browser for Tuple Smalltalk methods [HW2: problem 3] + Explain how to implement graphical user interfaces, like browsers, in Smalltalk [HW2: problem 3] - write code using double dispatch - write code using the visitor pattern - build part of a framework in Smalltalk - Be able to extract the problem from a paper you have read, explain its main points, and discuss its contribution vs. related work. [HW1: problem 10] TERMS AND CONCEPTS You should be able to explain and use (in problems or essays) the following concepts (with appropriate comparisons to related concepts). You should be able to give examples of these concepts. + General points about programming languages: - What is a programming language? - What is a paradigm? What kinds of paradigms are there? How do languages fit within the different paradigms? + OO design and general concepts: + What are the goals of OOP (vs. the other paradigms) - What techniques can be used to find classes in design of a program? - What makes a good object-oriented design? A bad one? - coupling, cohesion + Explain your design for the Tuple Smalltalk problems. + Smalltalk and OO language concepts: + class, subclass, object - class object, metaclass + message passing, method + abstract method + abstract vs. concrete classes + instance variables, class variables ++ protocol, behavioral protocol ++ type, subtype, behavioral subtype + polymorphism + mutable vs. immutable objects + components (composition) vs. inheritance (and when to use each) + inheritance, multiple inheritance (advantages and disadvantages) ++ self, super, and their use in methods (method inheritance) - factoring methods to allow for better method inheritance + equality in Smalltalk, = vs. == [HW1: problem 9] - hashCode vs. identityHashCode, and Set vs. IdentitySet + aliasing, exposing the rep (and how to avoid it) [HW1: BinaryRelation, ReflexiveRelation] - frameworks + Tuple-Smalltalk related: + dynamic binding and message passing vs. static overloading + ``binary'' methods (and ways to deal with them) [HW1: problem 9] + multimethods (tuples) and how they differ from single dispatch + why subclasses are not subtypes when binary methods are present [HW1: problem 9] + Give examples of programs that can be written using Tuple Smalltalk [HW2: problem 4] ++ Explain the advantages of Tuple Smalltalk (vs. Smalltalk), using examples to illustrate your points [HW2: problem 4] + Java-related: + Goals of Java vs. Smalltalk and C++ - primitive expressions, means of combination, means of abstraction + Differences between Smalltalk, Java, and C++ + How does Java provide for portability? + References vs. Pointers + The relation between lack of pointer arithmetic and garbage collection + Parameter passing in Java (compared to Smalltalk and C++), call by value, call by reference + What are the problems exception handling tries to solve? Why don't status codes, preconditions, or handlers as parameters solve these problems? + Exception handling mechanisms. Single vs. multilevel model. Termination vs. resumption model. + exception, throw, catch - Why is a useful to classify exceptions in a hierarchy? ++ type errors, strong typing, dynamic typing (vs. static typing) + goals of type checking - Morris's model of seals + Conservative and approximate nature of type systems + soundness and completeness of type systems + by-name vs. structural type checking (advantages and disadvantages) + What is a type in Java? + making subclasses and subtypes in Java + interfaces in Java and how they impact the type system; subtyping from interfaces, multiple inheritance of interfaces + Interaction between inheritance and type checking in Java + covariance, contravariance for method overriding + types of array operations, and why dynamic type checks are necessary for Java array stores + final variables, final methods, final classes - packages + protection levels (public, protected, private, package visible) - reflection