You are here

Introduction to Computer Science II

Our CS2 course has the following calendar description:

A second course in programming emphasizing problem solving and computational thinking in an object-oriented language. Topics include abstraction, mutable data structures, methods, inheritance, polymorphism, recursion, program efficiency, testing and debugging.

Traditionally, the course has focused on object-oriented and Swing GUI programming in Java along with recursion and some other topics as time permits.

However, we've been having some problems with the course.  In particular, it was not preparing students sufficiently for what we expected of them in the next course in our sequence: a second year class about systems programming.

In Fall 2014, I tried a new design that I hoped would help provide a better bridge between our CS1 class and the systems class.  I have taught both, so I know what is expected of students and what CS2 needs to accomplish.

The central idea of my design is to begin the course with basic C++ and problem solving skills.  From there, we add problem solving with arrays, discussing how variables and arrays are stored in memory.  We introduce Java with a procedural style, allowing us to begin comparing some of the things that Java does automatically with C++'s more manual approach.  After covering object basics and dynamic memory, we slowly transition into studying Java only, covering more advanced object-oriented programming topics.  Our central textbooks are Think Like a Programmer and Introduction to Computer Science Using Java.

The objective of the course is to have students become proficient in Java, so they do not learn a lot of C++.  In fact, we use only a minimum of C++ to illustrate that while you make explicit choices in C++, such as whether to pass by value or by reference, these choices are made implicitly for you in Java.  In other words, learning C++ is in service of more deeply understanding Java.  Translation exercises emphasize differences between the languages, and students are only asked to write simple programs in C++ (more complex programs are written in Java).

We have had enough success with this design to continue it with larger groups of students in Winter 2015.  Next fall's cohort of systems programming students will give us a clearer picture of whether the design has been better preparing them for what comes next.

Learning Objectives

By the end of the course, the successful student will be able to:

  • write programs using the basic syntax of two object-oriented languages (C++ and Java) and become proficient in one of these languages (Java), including being able to:
    • follow a prescribed programming style
    • effectively use development tools including an editor, compiler, and debugger
    • employ various debugging strategies
    • create simple programs from scratch, including on paper
    • proficiently develop a program with medium complexity (100-200 lines) from scratch
  • approach written problems using general problem solving strategies, including:
    • creating a plan
    • restating the problem
    • dividing the problem into pieces
    • starting with what you know
    • simplifying the problem
    • looking for analogies
    • experimenting
  • understand principles of object-oriented programming, including:
    • encapsulation and decoupling
    • class versus object behaviour
    • inheritance and polymorphism
    • interfaces
  • effectively design objects by breaking a program down into single-purpose, reusable classes that promote data abstraction and encapsulation at the simplest level
  • choose the right level of data abstraction by knowing when to use arrays, linked lists, and objects
  • understand a basic memory model of software, and that memory is managed manually in some languages and garbage-collected in others
  • understand the difference between passing by value versus passing by reference
  • problem solve with a recursive approach, and understand the correspondence between recursively defined data and recursion schemes


Some of the course is based on the progression of Think Like a Programmer, and some on a more traditional Java OOP course.

  • Introduction
    • Introduction to C++
    • Pure Puzzles
  • Solving Problems With Arrays and Structs
    • Arrays and Structs
    • Array and Struct Problems
  • Solving Problems With Dynamic Memory
    • Dynamic Memory
    • Variable Length Strings
  • Object-Oriented Basics
    • Introduction to Objects
    • Java Basics
    • Object Behaviour
    • References and Linked Lists
    • Shallow vs Deep Copying
  • Solving Problems with Classes
    • Goals of Class Use (Encapsulation, Information Hiding, etc)
    • Interactive Storytelling App, Separated Presentation Design
    • Abstract Data Types
  • Advanced Object-Oriented Programming
    • Hierarchies and Inheritance
    • Polymorphism
    • Abstract Classes and Interfaces
  • Event-Driven Programming
    • Using Procesing in Java
    • Model-View-Controller
  • Solving Problems With Recursion

Notes and Code

The most recent version of notes and code can be found on GitHub.  Please note that I did not include code examples based on those found in Think Like a Programmer.