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.


Instructor


Course Layout

This is a fully-online course. Lecture videos will be posted on UB Learns Piazza every Tuesday and Thursday at 12:00 p.m. EST. Labs will be based on the material covered in class and will be assigned (approximately) bi-weekly. Submission of labs and homework assignments will be done exclusively through Autolab (unless I specify otherwise).

The main method of communication will be through Piazza. Please sign up for the course with the link here.


Late Policy

All assignments must be submitted on-time and complete. Any late work submitted 24 hours after the original deadline will be eligible for 70% of the credit. No other late submissions will be accepted.


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:
http://engineering.buffalo.edu/computer-science-engineering/information-for-students/policies/academic-integrity.html

UB Academic Integrity Policy:
https://catalog.buffalo.edu/policies/integrity.html

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

Grading

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

  • 4 Programming (Homework) Assignments (40% = 4 * 10%)
  • Labs (30%)
  • Final (30%)
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


Readings

There is no textbook for this course. Instead, links to relevant readings and tutorials will be provided in the course schedule.


Schedule

  Tuesday Thursday
Week 1 (May 31)

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
Reading/Reference:
  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

Reading/Reference:
  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

Reading/Reference:
  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 7)

Lecture: Unit Testing Cont'd, Objects and Classes

Reading/Reference:
  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

Reading/Reference:
  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 14)

Lecture: Inheritance, Polymorphism

Reading/Reference:
  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

Reading/Reference:
  1. Play JSON library documentation
  2. Play JSON Maven artifact
  3. scalaj-http library
  4. State Pattern on Wikipedia
Week 4 (June 21)

Lecture: State Patterns Cont'd, Car example

Lecture: Sorting, Merge Sort and Recursion

Reading/Reference:
  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 28)

Lecture: Recursion, Functions

Reading/Reference:
  1. Collection Methods
  2. Anonymous Functions

Lecture: Immutability

Week 6 (July 5)

Lecture: Linked Lists, Stack and Queue Implementation

Reading/Reference:
  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

Reading/Reference:
  1. Trees
  2. Tree Traversals (Wikipedia)
  3. Expression Trees (Wikipedia)
  4. Expression Tree Examples
  5. Hacker Rank Question
  6. BST
Week 7 (July 12)

Lecture: Graphs, Pathfinding

Reading/Reference:
  1. Graph Overview
  2. Adjacency List
  3. BFS Overview

Lecture: Actors Introduction, Testing Actors

Reading/Reference:
  1. Akka Library
  2. Akka Actors
  3. Case Classes
  4. Actors Model (Wikipedia)
  5. Testing Actors
Week 8 (July 19)

Lecture: Testing Actors, Websocket Server, Websocket client

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

Lecture: Websocket Chat App, GUIs

Reading/Reference:
  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 26)

Lecture: MVC and MySQL

Reading/Reference:
  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

TBD

Week 10 (August 2)

Review of course material

Final Exam (time TBD)