CSE 116

CSE 116: Computer Science 2

Course Description

In CSE115 you've learned the basics of programming. You're proficient in variables, functions, control flow, data structures, file IO, networking, databases, and security. With these concepts you can train a computer to complete any task you can imagine. So what's left to study in CSE116?

How to write large programs

While you can apply what you already know to code practically anything a computer is capable of processing, it becomes very difficult very fast to write and organize large and complex pieces of software. To this end, in CSE116 you will study:

  • Program Execution
  • Object-Oriented Programming
  • Functional Programming
  • Data Structures & Algorithms
  • Event-Based Architectures

While studying these topics we will have a strong focus on how your programs work, not just that they work.

This course's content (lectures, assignments, etc.) are primarily based off of Prof. Hartloff's spring offering of the course.


CSE115 Review

If you did not take the new CSE115, or would otherwise like to review the material, below are some CSE115 resources to help you get caught up:

Keep in mind that you must understand the concepts of CSE115 and be prepared to apply them to a new language (Scala).

Academic Integrity

CSE Department Academic Integrity Policy:

UB Academic Integrity Policy:

In addition to the department and university policies, the following details apply to this course.

All submitted work must be of your own creation and you must not share your submission with anyone else. If any submission is very similar to code that has been submitted by another student or can be found online, it is in violation of this courses academic integrity policy and all students will be penalized whether they were copying or sharing their code with other students so they can copy. If two submissions are similar beyond what is likely if the students worked independently, then both students are in violation of the academic integrity policy.

All violations will result in: 

An F in CSE116.

It is your responsibility to understand what constitutes an academic integrity violation. If you have any question whether something you are doing is a violation or not, ask for clarification before receiving an F in the course. I will not entertain excuses after you have been caught.

Examples of acceptable behavior:

  • Discussing an assignment with your classmates and brainstorming abstract solutions, then writing code independently
  • Searching the Internet for supplementary material on the course topics (and referencing it in your code if used)
  • Asking the teaching staff for clarification on a homework question

Examples of unacceptable behavior:

  • Submitting code or other work that is not your own for course credit.
  • Allowing another student to see your code or submission for an assignment.
  • Collaborating with another student to write code for an assignment [other than working with your teammates on the team project].
  • Allowing another student to access your work that will be submitted for course credit. (Examples: Do not post you code publicly, host your code in a public repository, or allow a classmate to access your laptop)
  • Copying a large amount of material found on the Internet into your submission.
  • Attempting to access the grading code on AutoLab.

If you plan on cheating, plan on taking this course again.

Learning Objectives

In CSE116 you will learn concepts related to the following 5 learning objectives. Being successful in CSE116 requires completing all 5 of these objectives.

Program Execution

In CSE115 there was a focus on writing programs to accomplish specific tasks. In CSE116 we will focus on how those programs run. We will look at how memory is managed and how to automate the testing of programs.

A student has completed this objective if they are able to:

  • Write and run automated tests to verify the functionality of a method
  • Implement, and trace through the execution of, programs that pass references of objects to methods
  • Trace through a program and track the state of the stack and heap memory throughout its execution

Object-Oriented Programming

Instead of writing programs as a collection of variables and functions, with object-oriented programming we will group these variables and functions into classes and objects. This allows developers to reason about their programs at a higher level of abstraction.

A student has completed this objective if they are able to:

  • Use inheritance to create a new class by extending an existing class and overriding its functionality
  • Implement, and trace through the execution of, programs that use polymorphism
  • Implement programs that change behavior based on the type of an object stored in a variable

Functional Programming

Functional programming is based on functions with clearly defined input/output behavior. If a function is called multiple times with the same input, it must always have the same output regardless of the state of the program. This consistent behavior makes functional programs suitable for multi-threading and distributed systems.

A student has completed this objective if they are able to:

  • Implement, and trace through the execution of, recursive methods or functions
  • Implement, call, and trace through the execution of methods that take a function as a parameter and return a function
  • Implement, and trace through the execution of, programs that do not depend on state (immutability)

Data Structures & Algorithms

We will study several new approaches for storing data and computing with that data. Primarily we will see linked-lists, trees, and graphs while exploring applications of each structure.

A student has completed this objective if they are able to:

  • Implement programs that use linked-lists, trees, and graphs and their algorithms
  • Implement new algorithms to expand the functionality of linked-lists, trees, and graphs
  • Trace through the execution of programs using linked-lists, trees, and graphs

Event-Based Architectures

As CPUs and GPUs add more cores and large apps are distributed across multiple machines (ex. YouTube is much too large run on a single machine) the importance of concurrently executing code is more important than ever. Event-based architectures provide a way for concurrently executing pieces of code to communicate with each other while accomplishing the goals of a larger program.

A student has completed this objective if they are able to:

  • Implement event-based software using actor systems
  • Implement event-based software using web sockets
  • Trace through the execution of software designed with event-based architectures


While we will use the same course materials as Prof. Hartloff's offering of this course, we will use the following modified grading scheme:

  • 5 Programming (Homework) Assignments (50% = 5 * 10%)
  • Lecture Quizzes (25%)
  • Final (25%)
  • Participation (5%)
We will use the following grading scale (subject to change based off of overall class performance):

Percentage Grade
90 A
86 A-
82 B+
78 B
74 B-
70 C+
66 C
62 C-
60 D
<60 F


There is no textbook for this course. Instead, links to relevant readings and tutorials will be provided in the course schedule. When a reading is listed you should study it before lecture to be prepared for the quizzes.

Course Layout

This is a fully-online course. Lecture videos will be posted on UB Learns every Tuesday and Thursday at 11:00 a.m. EST. To ensure students keep up with the lectures, there will be a mandatory quiz that will be posted every Tuesday that covers both Tuesday's and Thursday's material. It will be due the following Monday at 11:59 p.m. These are not designed to be difficult/stressful, but it is imperative that you complete them. I will provide submission information in the first week of class.

Note: as the instructor I reserve the right to change the number of quizzes/method of ensuring students actively keep up with the class.


  Tuesday Thursday
Week 1 (May 25 - 29)

Lecture: Introduction

IntelliJ Setup:
  1. Apply for a JetBrains Educational License
  2. Install IntelliJ Ultimate on your laptop
  3. Get started with Scala in IntelliJ
  1. Scala Basics - (Except for classes, cases classes, and traits which will be covered later in the semester)
  2. Scala Conditionals
  3. Scala: Basic Types - We'll primarily use Int, Double, Char, String, Boolean, and Unit

Lecture: Scala Types

  1. Scala: String
  2. Scala: String.split - And many other String methods you may find useful
  3. Scala: For loop
  4. Scala: Reading Files
  5. Scala: Array - A sequential data structure
  6. Scala: List - A sequential data structure. You can use either Array or List as you prefer in most cases. We will explore the differences later in the course
  7. Scala: Map - A key-value store

Lecture: Unit Testing

  1. Maven Homepage - For reference only
  2. Example pom.xml - You can copy this into your projects and expand it when needed
  3. Scalatest Homepage - For reference only
  4. Scalatest FunSuite Example - A practical unit testing example
Week 2 (June 1 - 5)

Lecture: Unit Testing Cont'd, Objects and Classes

  1. Wikipedia: Class - Overview and reference (More detail than we'll cover in lecture)
  2. Scala: Class - Application of Classes using Scala syntax
  3. Python: Class - Application of Classes using Python syntax
  4. Scala API - Reference for all Scala packages/classes/objects

Lecture: Model of Execution, Model of Execution Cont'd

  1. Compilers vs. Interpreters - Scala/Java/C++ are compiled while Python/JavaScript are interpreted. What does this mean?
  2. Program Stack and Heap
  3. Debugging in IntelliJ
Week 3 (June 8 - 12)

Lecture: Inheritance, Polymorphism

  1. Inheritance in Scala
  2. Inheritance in Python
  3. OOP Overview
  4. Polymorphism in Python
  5. Polymorphism in Scala - Just the Subtype Polymorphism (Inheritance) section

Lecture: JSON, State Patterns

  1. Play JSON library documentation
  2. Play JSON Maven artifact
  3. scalaj-http library
  4. State Pattern on Wikipedia
Week 4 (June 15 - 19)

Lecture: State Patterns Cont'd, Car example

Lecture: Sorting, Merge Sort and Recursion

  1. Custom Sorting - Scala
  2. Selection Sort on Wikipedia
  3. Type Parameters - Scala
  4. Merge Sort Algorithm
  5. Recursion - Also discussed Linked-List which is the next lecture
  6. Tail Recursion
  7. Higher-Order Functions - Scala
Week 5 (June 22 - 26)

Lecture: Recursion, Functions

  1. Collection Methods
  2. Anonymous Functions

Lecture: Inheritance

Week 6 (June 29 - July 3)

Lecture: Linked Lists, Stack and Queue Implementation

  1. Linked List
  2. Array v. Linked List
  3. Algorithm Examples
  4. Linked List and Operations - Code is in C++
  5. Stack
  6. Queue

Lecture: Binary Trees and Traversals, Binary Search Trees

  1. Trees
  2. Tree Traversals (Wikipedia)
  3. Expression Trees (Wikipedia)
  4. Expression Tree Examples
  5. Hacker Rank Question
  6. BST
Week 7 (July 6 - July 10)

Lecture: Graphs, Pathfinding

  1. Graph Overview
  2. Adjacency List
  3. BFS Overview

Lecture: Actors Introduction, Testing Actors

  1. Akka Library
  2. Akka Actors
  3. Case Classes
  4. Actors Model (Wikipedia)
  5. Testing Actors
Week 8 (July 13 - July 17)

Lecture: Testing Actors, Websocket Server, Websocket client

  1. Scala socket.io Server
  2. Web Sockets (Wikipedia)
  3. Socket IO Library - Scala
  4. socket.io Client Docs

Lecture: Websocket Chat App, GUIs

  1. ScalaFX Homepage - Adapter for JavaFX in Scala
  2. JavaFX Homepage
  3. ScalaFX Button Example
  4. JavaFX 2D Shapes
  5. ScalaFX Videos - Playlist by Mark Lewis
  6. JavaFX 3D Shapes - Optional, but helpful if you're making a 3D app for your project
Week 9 (July 20 - July 24)

Lecture: MVC and MySQL

  1. MVC on Wikipedia
  2. MVC Analogies
  3. MySQL download page
  4. Connecting to MySQL
  5. SQL Tutorial - We'll use Create Table, Insert Into, Select, Where, and Update

No Lecture

Week 9 (July 20 - July 24)

No Lecture

Final Exam (11:00 a.m. - 2:00 p.m. EST)