San Jose State University : Site Name


Main Content

Working in Mars Mission Control, JPL

Ronald Mak

Department of Computer Science
Fall Semester 2013

Office hours: TuTh: 7:15-8:30 PM
Office location: MacQuarrie Hall, room 413
Mission Control, Jet Propulsion Laboratory (JPL)
NASA Mars Exploration Rover Mission

CS 151: Object-Oriented Design

Section 3: TuTh 9:00-10:15 AM Science Building 311

Unofficial field trip to the
Computer History Museum
Saturday, December 7 at 11:30 AM

Click here for photos of our
UML Class Diagram exercise!


# Date Due Assignment
1 Sept 3 Sept 12 Functional Specification
Use case form
2 Sept 12 Sept 24 Design Specification
3 Sept 24 Oct 4 First version of Rock-Paper-Scissors
4 Oct 3 Oct 25 Smart computer throw calculator
5 Oct 24 Nov 11 Graphical User Interface
6 Nov 26 Dec 6 Multithreaded RPS game server


Date Content
Aug 22 Slides: Introduction; grading; object-oriented analysis and design; journey to good design; iterative process; Rick's Guitars example; encapsulation; UML class diagram; refactoring
Aug 27 Slides: Mandolins; abstract Instrument and InstrumentSpec classes; more instruments; design that doesn't scale well; revisiting a design; conclusions
Aug 29 Slides: Analysis; requirements: sources and types, stated and implied, what they must have; automatic dog door example; use cases; functional specification
Sept 3 Slides: Waterfall model; project phases; agile software development; eliciting requirements; use cases; UML use case diagram; use case description; Assignment #1; where do classes come from; categories of classes; class responsibilities; class relationships: dependency, aggregation, inheritance

Use case description form which you can use for Assignment #1
Sept 5 Slides: CRC technique; UML diagrams: class, sequence, state; relationships among classes; multiplicities; aggregation vs. composition; UML diagramming tools; javadoc
Sept 10 Slides: Textual analysis; CRC cards; more UML sequence diagrams; UML package and class diagrams; voice mail system; Java Date and Calendar classes; coding to the interface; factory design pattern; Day class design
Sept 12 Slides: Day class design: versions 1, 2, and 3; Assignment #2
Sept 17 Slides: Importance of encapsulation; accessors and mutators; Day class example; immutable classes; sharing references to mutable objects; final fields; separating accessors and mutators; side effects; Law of Demetrer; good interfaces: cohesion, completeness, clarity, consistency
Sept 19 Slides: Programming by contract; preconditions; queue as a circular array; assertions; exceptions; postconditions; class invariants; interface invariants vs. implementation invariants
Sept 24 Slides: Assignment #3; unit testing; JUnit and NetBeans; design patterns; factory method design pattern; code to the interface; class hierarchy puzzle; "is a" with subclasses and interfaces; instanceof operator; Icon interface type; interface methods and variables; objects and interfaces
Sept 26 Slides: Review Assignment #2; Feed our pets; marker interfaces; polymorphism; Comparable interface; Comparator interface; anonymous classes
Oct 1 Slides: Anonymous classes; JFrame; JButton; JTextField; FlowLayout; button actions; ActionListener interface; Inversion of Control; Timer; timer actions; graphics context; Shape interface; drawing methods
Oct 3 Slides: Assignment #4; animation; ShapeIcon; JLabel; MoveableShape; poor design!
Oct 8 Slides: Java interface as a contract; review: design patterns, factory method design pattern, coding to the interface; strategy design pattern; dynamic class loading; demo: code flexibility; demo: Swing programming in NetBeans

Flexible coding example:
Greeter more:
Oct 10 Slides: In-class team exercise: UML class diagram; model-view-controller architecture; observer design pattern
Mar 15 Slides: Review for the midterm
Oct 22 Slides: Midterm solutions; layout managers; layout manager demo with NetBeans; composite design pattern; Swing component class hierarchy

Layout example (NetBeans project):
Oct 24 Slides: Iterator design pattern: linked lists; decorator design pattern: scrollbars, I/O stream; Assignment #5; design patterns example
Oct 29 Slides: In-class team exercise: UML class diagram; inheritance; superclasses and subclasses; class hierarchies; Liskov Substitution Principle
Oct 31 Slides: Invoking superclass methods and contructors; invoking a class's own constructor; preconditions, postconditions, and inheritance; favor composition over inheritance; superclasses and interfaces; abstract classes; mouse events; MouseAdapter; car demo

Mouse events demo:
Car dragging demo:
Nov 5 Slides: Cooking; creativity; abstract class example; template method design pattern; refactoring; multiple inheritance; geometric shapes class hierarchy; exceptions class hierarchy; catching exceptions; original "Gang of Four" design patterns
Nov 12 Slides: Data types; type compatibility; subtypes; enumerated types; instanceof; type inquiry; Object class; toString(); equality testing; hash code; cloning; reflection; inspecting a class
Nov 14 Slides: Inspecting an object; serialization; array of ints; raw ArrayList; ArrayList<Integer>; boxing and unboxing; ArrayList<SimpleShape>; Comparable<SimpleShape>; covariant Java arrays; noncovariant ArrayList types; generic methods; type bounds and wildcards; generic types and covariance
Nov 19 Slides: Type erasure; JUnit magic; reflection; inspect an array; multithreaded programming; multithreaded GUI programming; create a thread; Runnable example

Multithreaded GUI example:
Runnable example:
Nov 21 Slides: Thread states; activating and terminating threads; thread synchronization example; race condition; critical region;

Thread synchronization example:
Nov 26 Slides: Locks; lock conditions; thread-safe queue add and remove; synchronize printing; integrated Java support for multithreading; Java synchronized methods; locks and condition objects; Asignment #6

Queue examples:
Dec 3 Slides: Frameworks; applets; Java Collections framework; Collections class; Collection interface; AbstractCollection class; Iterator and Iterable interfaces; adding a new collection class; Set, List, and ListIterator interfaces; lists and binary searches; RandomAccess interface; views
Dec 5 Slides: Multithreaded merge sort animation; postmortem report; review for the final examination


First goal: You'll learn to develop well-designed software applications that do what they're supposed to do, use proven object-oriented techniques, and that are flexible, reliable, and maintainable. You'll become better programmers .

Good designs don't just happen. Each one is a destination, one that always requires a journey to reach. Every programmer, whether beginner or experienced, must take this trip for each and every project. An inexperienced programmer may meander, take the wrong paths, and maybe even backtrack before reaching that destination. But with practice and knowledge of design patterns and good object-oriented tools and techniques, subsequent journeys will become shorter.

Second goal: You'll learn critical job skills that employers look for in new college hires. You'll work together in small project teams and gain experience on how to cooperate and coordinate your joint efforts to design, develop, and test applications that each consists of over a dozen Java classes. You'll employ modern industry-standard software engineering practices. Each team will take its separate journey to Good Design.


Math 42 Discrete Mathematics grade C- or better
CS 46B Introduction to Data Structures grade C- or better
CS 49J Programming in Java
(or equivalent knowledge of Java)
grade C- or better
  Department policy is to enforce  
  all course prerequisites strictly.  

Required books

Object-Oriented Design & Patterns, 2nd ed.
Cay Horstmann
Wiley Publishing, Inc., 2006
ISBN: 978-0471744870

Recommended books

Head First Object-Oriented Analysis & Design
Brett D. McLaughlin, et al.
O'Reilly Media, 2006
ISBN: 978-0596008673