CST8132: Object-Oriented Programming: Winter 2014

Rex Woollard: Office:T-318 eMail
Office Hours by appointment or Thurs 10:00-12:00 Fri 12:00-13:00

Carolyn MacIsaac: Office:T-320 eMail

David Houtman: Office:T-323 eMail
Office Hours: Tues:14:15-14:45 Wed:14:00-15:45 Thurs:11:00-11:30

Course Outline


Final Exam: Monday April 21, 1:00 – 3:30 T-102 (A/B/C)
Useful Tools:
Java Tutorials Java/JavaFX API(download) Visio-Shapes
Need extra help? Tutors are available. Login to
Useful Free Software: LibreOffice OpenOffice  NetBeans CutePDF
Install Java SE7 API documentation Locally: Java SE7u45 API
Install JavaFX 2.2 API documentation Locally: JavaFX 2.4u45 API

Sample JavaFX Battlefield Simulator: I have created a simple Battlefield Simulator using JavaFX. I will help students to explore JavaFX.

JavaFX Elements: Note: Before you can use JavaFX, you must have the most up-to-date version of Java (currently 7u51). Overview and Configuring an Eclipse Project to be JavaFX Enabled PieChartSample.java. Access the Sampler Application called Ensemble.(JAR) FX-News

Learning Activities

Due Dates

Textbook pages

Documents / Code

Online Lecture

Review: Computer Architecture: Java is a high-level language that shields you from much of the low-level detail of machine architecture. However, you will be a better programmer when you have a clearer picture of the relationship of Java code to machine level of execution. These online materials help clarify that relationship.

PDF Source

Demo:Code Under Debug

Review: Objects/Classes/References: You must understand the role of objects, classes and references to understand program development in Java. These online materials help clarify. They are drawn from Chapter 3 of an earlier textbook. You must understand these concepts.

Most of Chapter3

GradeBook.java GradeBookTest.java

Demo:Code Under Debug
Demo Memory Maps

Lecture: What's a String . . . Really?: I will explore the following code during our lecture period, with particular attention to issues of storage location (stack versus heap), persistence and memory release.

337, 674-686

PDF Source

Lab: Exercise 1: Reference Variables and Memory Maps Visio-Shapes

End of Lab Jan 7 8 10

PDF Book.java BookTest.java

Lecture: Stack versus Heap Memory Allocation: The terms stack and heap are technical terms that apply to all programming languages. More importantly, these two storage patterns influence: 1) Potential size 2) Scope (visibility) 3) Lifetime (persistence). You need a deep, intuitive appreciation for these differences. Other Resources: You'll find many web-sourced explanations, most of which are wrong or poorly phrased. Here are a couple that are accurate: Stackoverflow, Wikipedia

84, 206-207


Lab: Exercise 2: More Memory Maps: Class Person

End of Lab Jan 14 15 17

PDF Person.java PersonTest.java

Lecture: Principles in OO Programming: Notes from the lecture.


Lab: Assignment 1: Battlefield Simulator (Revised Submission Steps)

My Solution

Sunday February 2nd (midnight)

Input.java InputGUI.java Gaussian.jar GaussianSource

Lecture: StackTest: I will explore this little program to note the sequence of multiple method calls, and the behavior of stack-oriented variables.

PDF StackTest.java

Lecture: Key Elements Needed for Assignment 1: I will cover a number of essential concepts you'll need for Assignment 1. You'll probably want to take notes during the lecture.

No notes will be posted here. You'll need to take notes during the lecture.

Lab: Exercise 3: Arguments and the Stack: Arguments that are passed to methods are copies of values that are received in variables in the method. These variables are allocated on the Stack (pushed onto the Stack); these variables disappear when exiting the method (popped off the stack).

Start of Lab
Jan 21 22 24

PDF StackTest.java

Lab: Exercise 4: Stack versus Heap Memory Allocation

End of Lab Jan 21 22 24


Bonus Challenge: The Binary Wizard: Convince me that you understand how The Binary Wizard does his magic to earn a bonus. E-mail me your written explanation.

PDF-Charts PDF-Worksheet

Lecture: Exploring Arrays: All these programs are taken from your textbook. I've supplied the source code here. We'll work through them during the lecture.

Most of Chapter 7

Source: (7.2) (7.9 7.10 7.11) (7.13)

Lab Exercise 5: Exploring Single-Dimensioned Arrays: This sample program explores the differences between arrays of primitives and an array of objects. You'll need to think about the garbage collector as well.

Start of Lab Jan 28 29 31

PDF Source
Enabling JavaFX

Lecture: Getting Ready for Assignment 2: Inheritance and the Magic of Virtual Methods: The use of inheritance and virtual methods are both pillars of OO programming. During this lecture, I'll explore the magical power of these.


PDF Color

Lab: Exercise 6: Class Employee and Related Subclasses: Soon, you'll need to create subclasses of Actor, classes such as Hobbit and Wizard. In this exercise you will start with complete and working classes called Employee and Manager. Manager is a specialized class that extends Employee. You will complete the Scientist class, which also extends from Employee.

Start of Lab Feb 4 5 7


Lecture Activity: Using ArrayList: Do you want your life (in programming) to be simpler and easier, then check out this week's lecture activity.



Lecture Activity: The Problem with Arrays and the Magic of ArrayList: We will explore the following program during the lecture. Ensure that you're ready by downloading the program and building a project. We can walk through it together during the lecture. And What on Earth is a <Generic>?


PDF ArrayListCollection.java

Lecture: Working with jUnit: jUnit is an industry standard tool you can use to implement systematic testing procedures. I'm introducing this now in response to comments from returning Coop students. Their employers expect them to be familiar with jUnit.

PDF   Calculator.java CalculatorTest.java

Lab: Exercise 7: Arrays of References to Objects: Soon, you'll need to manage potentially hundreds of Actor objects in your Battlefield Simulator. Complete this exercise to help clarify how Arrays of References to Objects behave.

Start of Lab Feb 11 12 14


Lab: Assignment 2: Battlefield Simulator: Deriving Subclasses from Actor: You will build on the work you completed for Assignment 1. If you did not complete Assignment 1, you can use my solution as a starting point for Assignment 2. I'll publish my solution next week. I have revised the document to include a marking guide and corrected the data type for stealth It should be double.

Sunday February 23th (midnight)
Bonus if February 16th

JavaDoc Guidelines


Lecture Activity: Documenting Class Structure with UML: I will demonstrate the creation of UML class diagrams using Visio. If you have Visio installed, you can follow along with me.


No notes will be posted here. You'll need to work with Visio and take notes during the lecture.

Lecture Activity: Documenting Class Design with JavaDoc: I will demonstrate the creation of JavaDoc documentation, something that will be required in future lab work.

Oracle Documentation
JavaDoc Guidelines

Lab: Assignment 3: Building an Army of Actors: You will add two new subclasses of Actor, then create an Army to manage two collections of Actor objects: Forces of Light and Forces of Darkness. My Solution

Sunday March 9th (midnight)

PDF(jUnit is NOT required)

Lab: Exercise 8: Drawing a Memory Map of Your Army of Actor Objects and Skeleton Army Class

Start of Lab March 4 5 7


Lecture Activity: The Magic of JavaFX: I will demonstrate the creation of JavaFX code during the lecture. To prepare, you need to have Ensemble.jar the JavaFX sampler available.

Configuring Eclipse
Ensemble.jar (zipped version)
Code From Lecture

Lab: Exercises 9: Getting Ready for JavaFX: I have created three very small Java applications. They all work in their current form. For each of the three applications, you must:
BUILD the original project. TEST to check the success of your build before making modifications.
FIND the TODO comments (colored in BLUE). MODIFY the code as requested. TEST to check the success of your modifications.

Start of Lab March 11 12 14

Builder Design Pattern (ZIP)

Lecture: Files for Live JavaFX Build: I will use these files during the integration of my JavaFX into your Assignment 3.

FXLauncher.java Simulator.java

Lecture Activity: Moving JavaFX Nodes (e.g. an avatar): The following code is a tiny JavaFX application that moves Circle objects on the screen. We'll explore this to understand motion in the Battlefield Simulator.

Ball.java BoundingBalls.java

Lecture: Moving Your Actors on the Battlefield: I will walk through the implementation of basic movement during the lecture. I will use the Blackboard Discussion Groups to distribute packets of code during the lecture.

Lecture: The Magic of Serialization: I will explore the Serialization mechanism using this code. During your lab session next week, you'll explore Serialization using a Hexademical Editing tool.



Lab: Exercise 10: Serialization: I demonstrated the student record code during the lecture. Work through this lab exercise to explore the concept of serialization for yourself.

End of Lab Mar 28 Apr 1 2

PDF HexEditor Source

Lab: Assignment 4: Moving Actors: Actor objects now must move in relation to their nearest opponent.


Lecture: Exception Handling: The textbook has a number of very good examples. I will work through many of these during lecture. If you download the Source Code, you can preload them into Eclipse and follow along.

Chapter 11

Source Code

Lecture Bonus Activity: Researching the Java API: What's an Interface?

Bonus Time Activity using Blackboard

Lab: Exercise 11: Using the Collection interface: I have created a small Java program to explore the use of the Collection interface and several known implementing classes (ArrayList, LinkedList, TreeSet and HashSet) Note: Only one memory map is required. I revised the PDF to reflect that.

End of Lab Apr 4 8 9

Collections and Interfaces

PDF Dictionaries(zipped) Dictionary.java DictionaryTest.java


Date of Posting

Previous Quiz 1



Previous Midterm


Part -1:PDF   Part-2:PDF


Part-1 PDF   Part-2 PDF