San Jose State University : Site Name


Main Content

Reading to Buddy

Ronald Mak

Department of Computer Engineering
Department of Computer Science
Department of Applied Data Science
Spring Semester 2021

Office hours: TuTh: 4:30-5:30 PM
Office location: ENG 250

CMPE/SE 135 Object-Oriented Analysis and Design

Section 1: TuTh 1:30 - 2:45 PM online via Zoom


# Assigned Due Assignment
1 Feb 4 Feb 12 Functional Specification

Use case form: UseCaseForm.docx
Formal report rubrics: FormalReportRubrics.pdf
2 Feb 16 Feb 26 Design Specification
3 Feb 25 Mar 5 Command-Line Rock-Paper-Scissors Game
4 Mar 4 Mar 19 RPS Game with Simple Machine Learning
5 Mar 23 Apr 14 GUI-Based RPS Game
6 Apr 20 Apr 30 Design Patterns


Week Date Content
1 Jan 28 Zoom recording Passcode: RC7mC?rv
Slides: Course objectives; project teams; postmortem report; grading; good applications; change and complexity; how to achieve good design; iterative process; poor design not a failure; Rick's Guitars; iteration #1; problems

Example programs:  
2 Feb 2 Zoom recording Passcode: Y!m?6QF2
Slides: Continued iterations: #2: fix string fields and matches, #3: encapsulate what changes, #4: new attributes, #5: refactored code, delegate the matching task

Example programs:
Feb 4 Zoom recording Passcode: Wu9WT3=A
Slides: Summary; cohesion; loose coupling; OOA&D is about satisfaction; requirements elicitation; functional and nonfunctional; requirements of requirements; how to get requirements; use cases; use case descriptions; Functional Specification; Assignment #1
3 Feb 9 Zoom recording Passcode: +.WHcuh2
Slides: Key points for good design; iterative development; solutions to adding a new mandolin instrument; Instrument and InstrumentSpec classes; abstract classes; revised Inventory class; Guitar, GuitarSpec, Mandolin, MandolinSpec classes; red flags; more instruments; design doesn't scale well; encapsulation to the rescue?

Example program:
Feb 11 Zoom recording Passcode: f=2F5n1p
Slides: Revisit our design; encapsulate with a hash map; use the Boost C++ library; boost::any; new attribute classes; the improved design; conclusions

Example programs:   Boost C++ library
Install the Boost header files (no need to build the libraries). In each project, tell Eclipse (or use the -I option on the command line) where you installed them.
4 Feb 16 Zoom recording Passcode: @9q3cbuh
Slides: Complexity; decomposition: algorithmic and object-oriented; hierarchy; design in software engineering; analysis precedes design; paralysis by analysis; where do classes come from; categories of classes; class responsibilities; class relationships: dependency, aggregation, inheritance; UML class diagrams; Assignment #2
Feb 18 Zoom recording Passcode: n@4VC#7Z
Slides: Textual analysis; CRC cards; UML sequence diagram; UML state diagram; proposed C++ Date class; code to the interface; static factory function
5 Feb 23 Zoom recording Passcode: 7=a@uaCN
Slides: Day class implementations; importance of encapsulation; principles; accessors and mutators; dangerous setter; no surprises

Example programs:
Feb 25 Zoom recording Passcode: &5@ZU5Nh
Slides: Immutable objects; sharing references to mutable objects; const fields; separate accessors and mutators; side effects; Law of Demeter; how good is an interface?; cohesion; completeness; convenience; clarity; consistency; Assignment #3
6 Mar 2 Zoom recording Passcode: .LLvZ6k!
Slides: Programming by contract; preconditions; circular queue example; assertions; exceptions; postconditions; class invariants; proof of a class invariant; interface invariant vs. implementation invariant; interfaces; RPG game; code to the interface; factory class

Example program: AssertExample.cpp
Mar 4 Zoom recording Passcode: q4#H1V3=
Slides: Interface variables; objects and interfaces; simple machine learning for RPS; Assignment #4; inheritance; superclasses and subclasses; class hierarchies; Liskov Substitution Principle; overridden member functions; polymorphism; invoke a superclass member function; invoke a superclass constructor; invoke a constructor from another; preconditions and inheritance; postconditions and inheritance; more inheritance conditions; examples: point-circle-rectangle, vector-stack

Example programs:   PointCircleRectangle.cpp   VectorStack1.cpp   VectorStack2.cpp
7 Mar 9 Zoom recording Passcode: Wg5t5=la
Slides: SimUDuck simulation game; code reuse; delegation; abstract superclass; "has a" often better than "is a"; virtual destructors

Example programs:
Mar 11 Zoom recording Passcode: #nnj90Hm
Slides: Overloading vs. overriding; operator overloading; pointers vs. references; use of references; midterm review; requirements meeting video

Requirements video
8 Mar 16 Midterm
Mar 18 Zoom recording Passcode: L^8GJj4Us
Slides: Midterm solutions; Model-View-Controller (MVC) architecture; software frameworks; building and installing wxWidgets button demo; GUI-based Rock-Paper-Scissors screenshots

Example wxWidgets program:
9 Mar 23 Zoom recording Passcode: 23k6MF*R
Slides: Installing wxWidgets on MacOS and Ubuntu; inversion of control; Hello World demo; button demo; button event handlers; Assignment #5

Student's tutorial: How to install on Windows
Example wxWidgets program:
Mar 25 Zoom recording Passcode: #AN0$BHA
Slides: Review: object-oriented design basics and principles; design patterns; shared pattern vocabulary; how to use design patterns; the Strategy Pattern; weather monitoring station example; subscriptions; Observer Pattern defined; observer pattern UML; loose coupling; weather station design and implementation; display elements implementation; Observer Pattern summary

Example program:
10 Apr 6 Zoom recording Passcode: 0A!s=dFj
Slides: Starbuzz Coffee example; initial design; second design; open-closed principle; the Decorator Pattern; UML; Starbuzz design, implementation, and test; Decorator Pattern caveats

Example program:
Apr 8 Zoom recording Passcode: g8R1pFv+
Slides: new => concrete; Pizza shop example; simple pizza factory; pizza store framework; PizzaStore subclasses; factory method; abstract and concrete Pizza classes; Factory Method Design Pattern

Example program:
11 Apr 13 Zoom recording Passcode: ?N845iF.
Slides: Adapter Design Pattern; turkey adapter example; Facade Design Pattern; home theater example; principle of least knowledge
Apr 15 Zoom recording Passcode: =G4eB2ii
Slides: State Design Pattern

State Design Pattern example programs:
12 Apr 20 Zoom recording Passcode: SfB8=BWj
Slides: Iterating over a container; Iterator Design Pattern; common iterator API; iterator example; part-whole hierarchy; tree component; subtree component; composite example; Composite Design Pattern; Assignment #6

Example programs:
Apr 22 Zoom recording Passcode: !3B?vxdU
Slides: Lambda expressions; arrays of objects; constructors and destructors; vectors of objects; copy constructor; "extra" constructor and destructor calls; how a vector grows; dynamic arrays of objects; mysterious program crash; shallow copy; deep copy

Example programs: Person.h    lambda1.cpp    lambda2.cpp    lambda3.cpp
13 Apr 27 Zoom recording Passcode: G&+H2G$@
Slides: dynamic arrays of objects; mysterious program crash; shallow copy; deep copy A "safe" array type; overloaded assignment operator; overloaded subscript operator []; copy constructor; the "Big Three"; auto; decltype

SafeArray example 1: (crashes)
SafeArray example 2 (operator =):
SafeArray example 3 (fix operator =):
SafeArray example 4 (another fix operator =):
SafeArray example 5 (overload []):>
Apr 29 Zoom recording Passcode: $31+N3Wy
Slides: Exception handling; function objects; templates

Exception handling examples: exception1.cpp   exception2.cpp   exception3.cpp
Function object examples: RandomInt.h    RandomIntTester.cpp    Summation.h    SummationTester.cpp
Template function example: TemplateExchange.h   ExchangeTests.cpp
Template class example: TemplatePair.h   PairTests.cpp
SafeArray example 7 (template):
14 May 4 Zoom recording Passcode: 1&2V&H?c
Slides: Standard Template Library (STL); iterators; containers; stl::list; stl::forward_list; stl::map; STL algorithms

Vector iterator examples: IteratorVector1.cpp   IteratorVector2.cpp
STL list example: ListTest.cpp
STL map example:
STL algorithms example: AlgorithmsTest.cpp
May 6 Zoom recording Passcode: $u4=C1M0
Slides: Raw pointers vs. smart pointers; unique pointer; shared pointer; move semantics; the "Big Five"

Example programs:   Message.h   TestMove.cpp
15 May 11 Zoom recording Passcode: b?9tr48?
Slides: Multithreaded programming; single-threaded and multithreaded Fibonacci example; pthread library; concurrency vs. parallelism; race condition; critical regions; shared resources; mutual exclusion; shared printing example; condition variables; producer-consumer model; unsynchronized and synchronized queue example; a multithreaded program example

Example programs: FibonacciST.cpp   FibonacciMT.cpp   PrintNoMutex.cpp   PrintMutex.cpp   QueueNoSync.cpp   QueueSync.cpp   OfficeHour.cpp
May 13 Zoom recording Passcode: &?9jDr8d
Project presentations


Become familiar with object-oriented analysis and program design. Employ industry-standard practices of an object-oriented approach to software development. Avoid the pitfalls of object-oriented design.

The primary goal of this course is to become a much better programmer.

You will develop the critical job skill of working in a small project team to successfully develop a software application that uses shared interfaces and data formats. Your application can then interact with applications from other teams to exchange data and results.

Course Learning Outcomes (CLO)

Department policy is to enforce
all course prerequisites strictly


SE Majors: CS 046B (C- or better)
CMPE Majors: CMPE 126 (C- or better)
Computer Engineering or Software Engineering Majors Only.

Recommended books

The following is the original "Gang of Four" design patterns book. The examples are in C++.
Design Patterns: Elements of Reusable Object-Oriented Software
Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides
Addison-Wesley Professional, 1994

The following book provides optional background material. The examples are in Java.
Object-Oriented Analysis, Design and Implementation: An Integrated Approach, 2nd edition
Brahma Dathan and Sarnath Ramnath
Springer, 2015

Useful tutorials

Some useful tutorials for my classes where the preferred platforms for application development are MacOS X and the Ubuntu distribution of Linux. Windows 10 may present significant compatibility challenges.