Topics for Exam 1 in Com S 362 This exam covers topics from homework 1, problems 1 and 2. REMINDERS This test is open book and notes. However, it is to be done individually and you are not to exchange or share materials with other students during the test. If you need more space, use the back of a page. Note when you do that on the front. This test is timed. We will not grade your test if you try to take more than the time allowed. Therefore, before you begin, please take a moment to look over the entire test so that you can budget your time. For diagrams and programs, clarity is important; if your diagrams or programs are sloppy and hard to read, you will lose points. Correct syntax also makes some difference. READINGS Principally, chapters 1-2 (although you can skim chapter 1) and 5 of Arthur J. Reil's book Object-Oriented Design Heuristics (Addison-Wesley, Reading, MA, 1996.)You will also need to read something about Java, if you're not familiar with it. We recommend reading the interesting (to you) parts of the "new to Java" section on-line at http://developer.java.sun.com/developer/onlineTraining/new2java/ or get one (or more) of the books listed in the course syllabus. If you have more time, see the syllabus for further readings. TOPICS Topics marked + below are more important than topics marked - below. Topics marked with ++ are almost certain to be on the test. In general, things that are more like the homework will be more important. * Object Orientation + Explain the features of object-oriented (OO) languages like Java that make it easier to cope with change, and give examples to illustrate these ideas. - What are the disadvantages of OO programming techniques? - For what kinds of programming projects would OO techniques not be needed? * Objects and Classes + Be able to read Java code that defines an abstract data type (ADT). + Give the output of simple Java programs using instance and static variables, and instance and static methods. + Be able to explain what statements or expressions violate Java's privacy rules. ++ Be able to diagnose violations of Reil's heuristics for Java class that define ADTs, as found in chapter 2 [HW1, BadStack]. + Be able to give the Java interface that corresponds to a Java class. + Be able to write correct code for simple methods, given an interface, and specifications in javadocs and/or JUnit tests. * Inheritance and Polymorphism + Be able to explain the difference between inheritance and behavioral subtyping. + Be able to read Java code that defines recursive, tree-like ADTs. + Be able to answer questions about the fields and methods found in a subclass object given Java code for the superclass and subclass. + Be able to determine the effects of method calls when subtyping and polymorphism are used (in subclasses and implementations of interfaces), especially in for down calls to overridden methods. + Be able to read and write constructors and methods that use "super" to inherit behavior from the class's superclass. + Explain what an abstract method is, and when to use it in Java; explain what an abstract class is. + Be able to explain what statements or expressions violate Java's privacy rules for clients and subclasses when the superclass's uses "protected" visibility. ++ Be able to diagnose violations of Reil's heuristics for inheritance, as found in chapter 5 [HW1, expressions]. + Be able to refactor code for recursive types so that it no longer violates these design heuristics [HW1, expressions]. This includes knowing when to use interfaces (implements in Java), instead of inheritance (extends in Java) for implementing a class.