Technical University of Denmark DTU
02115   Java Programming
Autumn 2011

Lecture Plan



The lecture plan may be updated here through the semester.
The lecture plan only gives you an overview of the subjects covered by references to the textbook ''Objects First with Java''. Regarding application of the other course textbook ''Java Precisely'' and details on what to read, prepare and exercise please consult the appropriate week plan available from the link Weekly Work and Assignments
All references below to chapters, sections and pages are to the fourth edition of the ''Objects First with Java'' textbook.

References to our second textbook "Java Precisely" has to be looked up in the single week plans.


Week Date Text Description/Keywords
 1  Aug.30  Chapter 1:
1.1-1.14;
p.3-17 

Chapter 2:
2.1-2.19; p.18-55 

Chapter 3:
3.1-3.15; p.56-86 


Objects, classes, class definitions and object interaction

Objects and classes; Creating objects, new; Calling methods; Parameters; Data types, int, String; Multiple instances; State; What is an object?; Object interaction; Source code; Another example; Return values; Objects as parameters

The Ticket Machine example; Examining a class definition; Fields, constructors, and methods; Passing data via parameters; Assignment; Accessor methods; Mutator methods; Printing, System.out.println(); The conditional statement, if ... else; Local variables; Fields, parameters, and local variables; The Student class example; Experimenting with expressions

The Clock example; Abstraction and modularization; Class diagrams, object diagrams; Primitive types, object types; The ClockDisplay example, logic operators, String concatenation, the modulo operator %; Objects creating objects; Multiple constructors; Method calls; The Mail System example, this; Using a debugger, setting breakpoints, single stepping, stepping into methods; Method calling revisited

 2  Sept. 6  Chapter 4:
4.1-4.13; p.87-127 

Chapter 5: 5.1-5.14; p.128-168 


Grouping objects, library classes and documentation

Grouping objects in flexible-size collections; The personal Notebook example, using ArrayList; Object structures with collections; Generic classes; Numbering within collections; Removing an item from a collection; Processing a whole collection, the for each loop, the while loop, iterating over a collection, index access versus iterators; Summary of the Notebook example; The Auction example, anonymous objects, using collections; Flexible collection summary; Fixed-size collections, the LogAnalyzer example, declaring array variables, creating array objects, using array objects, the for loop, the for loop and iterators

Documentation for library classes; The TechSupport system; Reading class documentation, interfaces versus implementation, using library-class methods, checking string equality, equals(); Adding random behavior, the Random class, random responses, reading documentation for parameterized classes; Packages and import; Using maps for associations, the concept of a map, using a HashMap; Using sets, e.g. HashSet; Dividing strings; Writing class documentation, using javadoc; Public versus private, information hiding, private methods and public fields; Learning about classes from their interfaces; Class variables and constants, the static keyword, constants

 3  Sept.13  Chapter 6:
6.1-6.13; p.169-200 

Chapter 7: 7.1-7.16; p.201-241 


Well-behaved objects and designing classes

Testing and debugging; Unit testing, using inspectors, positive versus negative testing; Test automation, regression testing, automated checking of test results, recording a test, fixtures; Modularization and interfaces; A debugging scenario; Commenting and style; Manual walkthroughs, a high-level walkthrough, checking state with a walkthrough, verbal walkthroughs; Print statements, turning debugging information on or off; Choosing a test strategy; Debuggers; Putting the techniques into practice

The world-of-zuul game example; Introduction to coupling and cohesion; Code duplication; Making extensions, finding the relevant source code; Coupling, using encapsulation to reduce coupling; Responsibility-driven design, responsibilities and coupling; Localizing change; Implicit coupling; Thinking ahead; Cohesion, cohesion of methods, cohesion of classes, cohesion for readability, cohesion for reuse; Refactoring, refactoring and testing, an example of refactoring; Refactoring for language independance, enumerated types, further decoupling of the command interface; Design guidelines; Executing without BlueJ, class methods, the main method, limitations of class methods

 4  Sept.20  Chapter 8: 8.1-8.10; p.245-275

Chapter 9: 9.1-9.12; p.276-299 


Improving structure with inheritance

The DoME example, its classes and objects, its source code, the application; Using inheritance; Inheritance hierarchies; Inheritance in Java, inheritance and access rights, inheritance and initialization; Adding other item types to the DoME example; Advantages of inheritance (so far); Subtyping, subclasses and subtypes, subtyping and assignment, subtyping and parameter passing, polymorphic variables, casting; The Object class; Autoboxing and wrapper classes; The collection hierarchy

The problem: DoME's print method; Static type and dynamic type; Overriding; Dynamic method lookup; Super call in methods; Method polymorphism; Object methods: toString(); Object equality: equals() and hashCode(); Protected access; The instanceof operator; Another example of inheritance with overriding

 5  Sept.27  Chapter 10: 10.1-10.8; p.300-335 

Chapter 12: 12.1-12.6; p.381-406


Further abstraction techniques and handling errors (1st part)

Simulations; The foxes-and-rabbits simulation, the foxes-and-rabbits project, the Rabbit class, the Fox class, the Simulator class: setup, the Simulator class: a simulation step; Abstract classes, the Animal superclass, abstract methods, abstract classes; More abstract methods; Multiple inheritance, an Actor class; Interfaces, an Actor interface, multiple inheritance of interfaces, interfaces as types, interfaces as specifications, abstract class or interface?

The address-book project; Defensive programming, client-server interaction, argument checking; Server error reporting, notifying the user, notifying the client object; Exception-throwing principles, throwing an exception, exception classes, the effect of an exception, unchecked exceptions, preventing object creation; Exception handling, checked exceptions: the throws clause, catching exceptions: the try statement, throwing and catching multiple exceptions, propagating an exception, the finally clause; Defining new exception classes

 6  Oct. 4  Chapter 12: 12.7-12.10; p.407-423 

Chapter 13: 13.1-13.8; p.424-443


Handling errors (2nd part) and designing applications

Using assertions, internal consistency checks, the assert statement, guidelines for using assertions, assertions and the BlueJ unit testing framework; Error recovery and avoidance; File-based input/output, readers, writers, streams, text output with FileWriter, text input with FileReader, the File class, Scanner: reading input from the terminal, object serialization

Analysis and design, the verb/noun method, the cinema booking example, discovering classes, using CRC cards, scenarios; Class design, designing class interfaces, user interface design; Documentation; Cooperation; Prototyping; Software growth, waterfall model, iterative development; Using design patterns, structure of a pattern, decorator, singleton, factory method, observer, pattern summary

 7  Oct.11  Chapter 14: 14.1-14.6; p.444-464 
A case study

The case study, the problem description; Analysis and design, discovering classes, using CRC cards, scenarios; Class design, designing class interfaces, collaborators, the outline implementation, testing, some remaining issues; Iterativ development, development steps, a first stage, testing the first stage, a later stage of development, further ideas for development, reuse; Another example; Taking things further

Mandatory Assignment - 1st part (1)
Three hours exercise session

Oct.25  No lectures
Mandatory Assignment - 1st part (2)
Four hours exercise session

Nov. 1  No lectures
Mandatory Assignment - 1st part (3)
Four hours exercise session

10  Nov. 8  Chapter 11: 11.1-11.5; p.337-364 
Building graphical user interfaces
Introduction; Components, layout, and event handling; AWT and Swing; The ImageViewer example, First experiments: creating a frame, adding simple components, adding menus, event handling, centralized receipt of events, inner classe, anonymous inner classes, summary of key GUI elements; ImageViewer 1.0: the first complete version, image processing classes, adding the image, layout, nested containers, image filters, dialogs, summary of layout management

11  Nov.15  Chapter 11: 11.6-11.10; p.365-380 
Building graphical user interfaces
ImageViewer 2.0: improving program structure; ImageViewer 3.0: more interface components, buttons, borders; Further extensions; Another example: SoundPlayer; Summary

12  Nov.22  No lectures
Mandatory Assignment - 2nd part (1)
Four hours exercise session

13  Nov.29  No lectures
Mandatory Assignment - 2nd part (2)
Four hours exercise session





Jens Thyge Kristensen, Email: jtk@imm.dtu.dk

Newest edition:   4. October (Adjustments to week 6 and week 7)
Previous editions:
    - 23. September (Adjustments to week 5 and week 6)
    - 15. August