Skip to main content
Lecture 1 Cover

CS 3100: Program Design and Implementation II

Lecture 1: Course Overview & Introduction to Java

©2025 Jonathan Bell & Ellen Spertus, CC-BY-SA

Learning Objectives

  1. Understand the structure of this course and what will be expected of you
  2. Review the Systematic Program Design and Implementation Process
  3. Describe the context of Java in the historical development of OO languages and JIT runtimes
  4. Compare the Java runtime environment to Python
  5. Recognize Java syntax
  6. Understand the difference between core datatypes in Java: primitives, objects and arrays

Ellen Spertus

IllinoisMITMicrosoftUniversity of WashingtonMills CollegeGoogleApp Inventor 2 BookHour of CodeMozillaCodePathWave

Your Course Team

5 Instructors

  • Boston: Prof. Bell, Prof. Shesh, Prof. Vesely
  • Oakland: Prof. Spertus
  • New York City: Prof. Lee

Coordinating across campuses for a consistent experience

28 Teaching Assistants

  • Office hours
  • Discussion board
  • Lab support
  • Grading & feedback

All working together to support your learning

📋 See the Staff Page for photos, bios & office hours

Let's set the WABAC machine to the 1940s...

Cartoon showing Mr. Peabody (a dog) and Sherman (a boy) in front of a complicated machine

How much did a typical computer weigh in the 1940s?

A. under 100 pounds

B. 100-200 pounds

C. 200-2000 pounds

D. over a ton

Poll Everywhere QR Code or Logo

Text espertus to 22333 if the
URL isn't working for you.

https://pollev.com/espertus

Black and white photo showing two women adjusting a large computer
Jean Jennings and Frances Bilas adjusting ENIAC (1946)

University Archives and Records Center/University of Pennsylvania via IEEE Spectrum

Let's Start with a Story...

The 1950s

Computers exist, but programming them is... tedious.

Glen Beck and Betty Snyder programming the ENIAC

Glen Beck and Betty Snyder program the ENIAC (Public Domain)

Levels of programming

High-Level Language
count = index + 1
Assembly Language
load $r1, 1
add $r2, $r3, $r1
Machine Language00110001 00000001
11000010 00110001

1952: "Automatic Programming"

Grace Hopper

Grace Hopper develops the first compiler (A-0)

Her radical idea: let the machine translate human-readable code into machine code

The skeptics: "Machines can't write programs."

Photo: Lynn Gilbert, CC BY-SA 4.0

Every generation redefines what "automatic programming" means

Skepticism about automatic programming

Something to think about

Picture of Grace Hopper in naval uniform with quotation 'A ship in port is safe, but that's not what ships are built for.

1960s: Margaret Hamilton

Led Apollo flight control software — popularly attributed with origin of the term "software engineering"

"I fought to bring the software legitimacy so that it—and those building it—would be given its due respect."

Her "radical" approach: rigorous testing, error handling, treating software like hardware

Margaret Hamilton with Apollo guidance software

Margaret Hamilton with Apollo guidance software printouts (Public Domain)

Despite Progress, Software Projects Were Failing

Despite innovations in programming:

  • Software was very inefficient
  • Software was of low quality
  • Software often did not meet requirements
  • Projects were unmanageable
  • Software was, sometimes, never delivered

Something had to change

1968: NATO Software Engineering Conference

Garmisch, Germany — 50 experts from 11 countries

The term "software engineering" was deliberately provocative:

Software should be built with the same rigor as bridges and buildings

A formal call to action: we must study how to build software

Systematic Techniques for Building Software Are Possible

There could be systematic techniques for writing software

Just as civil engineering has methods for building bridges...

...software engineering could have methods for building programs.

The rest is history: new processes, tools, languages, and paradigms emerged over the following decades — and continue to emerge today.

Software engineering?

Gerald Weinberg
"If builders built houses the way programmers built programs, the first woodpecker to come along would destroy civilization."

Photo: SE Radio 280

Did the software crisis end?

Edsger Dijkstra
"The major cause of the software crisis is that the machines have become several orders of magnitude more powerful! To put it quite bluntly: as long as there were no machines, programming was no problem at all; when we had a few weak computers, programming became a mild problem, and now we have gigantic computers, programming has become an equally gigantic problem."

Photo: Hamilton Richards, CC BY-SA 3.0 · Quote: Dijkstra's 1972 Turing Award lecture

Moore's Law: Computing Power Has Grown 67 Million Times Since 1972

Moore's Law visualization

Software Engineering is the Integral of Programming Over Time

This explains why we care about changeability, readability, and testing

Questions that seem "non-technical" become engineering concerns:

  • Who uses our software?
  • Who maintains it?
  • What assumptions do we bake in?

These costs compound over time

Most Software Cost Is Maintenance, Not Initial Development

Sustainability — the ability of software to continue providing value over time

Four dimensions we'll consider:

Technical: Can we maintain it?
Economic: Can we afford it?
Social: Does it serve people well?
Environmental: What resources does it consume?

These aren't separate from "real" engineering—they are engineering concerns when you think over time

This Class

50+ years of research, practice, and hard-won lessons

How do we design, build, and maintain software that is sustainable at scale?

Using Java to explore ideas that transcend any single language

Good Process Helps You Design Better Programs

Software Design Process

"Shift Left" on bugs: find issues faster to reduce the cost of fixing them

We Focus on Principles, Not Just Syntax

  • We focus on the big picture and why things are the way they are
  • Not just the syntax of the language
  • Flashcards + resources provided for syntax—use them!
  • We move quickly past syntax in lecture

Our perspective: AI is a noisy amplifier, but can still be useful

Concept: 'The Amplifier, Not the Signal' (Self-Demonstrating Version)
A clean, technical diagram rendered in the style of an audio engineering schematic—but with intentional AI generation artifacts scattered throughout as Easter eggs. The central amplifier unit labeled 'AI' (or perhaps 'A.I.' with a slightly wonky period) has impressive specs and glowing indicators. The signal flow shows: Input (left side) with a human providing context—requirements documents, stakeholder interviews, domain knowledge. A hand points to the input, but the hand has six fingers (the classic tell). Output (right side) shows amplified results: code, documentation, test cases—generated at impressive speed. But look closely: one document is titled 'Archetecture Design' (misspelled), another shows a code snippet with a subtle logic error visible, and a label reads 'Ssoftware Engineering' or 'Qualty Assurance.' The feedback loop shows a human evaluator with a red pen, circling errors, with thought bubbles: 'Wait, that's not right,' 'This contradicts what we discussed,' 'That's... not how you spell that.'
The reveal: A caption at the bottom breaks the fourth wall: 'This image was generated by AI. Did you spot all the errors? Neither can AI—that's why it needs you.' A small checklist appears: '☐ Extra finger ☐ Misspelled labels ☐ Logic error in code ☐ [Others hidden]' inviting students to find them all. The humor lands because the errors are genuinely the kind AI makes, and the message reinforces itself: the course staff used AI to create this image, but human review caught (most of?) the errors—demonstrating exactly the workflow being taught.

What's your experience with AI coding?

Poll image
Poll Everywhere QR Code or Logo

Text espertus to 22333 if the
URL isn't working for you.

https://pollev.com/espertus

AI coding assistance is not permitted in weeks 1-5

Concept: 'The Reviewer's Paradox' (Can't Review What You Can't Write)
A split-panel diagram rendered in the style of a thoughtful editorial illustration. On the left ('Without Foundation'), a student stares at AI-generated code on a screen. The code contains subtle bugs—a logic error here, a security vulnerability there, an inefficient algorithm—but the bugs are invisible, rendered in the same color as correct code. The student's thought bubble shows question marks and uncertainty: 'Is this... right?' A small demon labeled 'Subtle Bug' hides in the code, grinning. The student has no mental model to detect it. On the right ('With Foundation'), the same student, now having completed foundational exercises, reviews similar code. But now the bugs glow red—visible because the student has built the pattern-matching ability to recognize what 'wrong' looks like. Their thought bubble shows a checklist: 'Edge cases? ✓ Security? ⚠️ Performance? ✓' The demon is caught and highlighted. A timeline at the bottom shows the progression: 'Weeks 1-5: Build the detector → Weeks 6+: Use the detector.'
This visualization addresses the common student question 'Why can't I just use AI from day one?' The answer is visceral: you literally cannot see the problems if you haven't developed the ability to recognize them. The 'invisible bugs becoming visible' transformation is the core pedagogical goal. Details include: specific bug types labeled (null pointer, off-by-one, SQL injection), the 'detector' visualized as a mental model being constructed piece by piece through practice, and quotes from the syllabus: 'You cannot effectively review code you could not have written yourself.' The timeline reinforces that this is a progression, not a permanent restriction. The style should be warm and encouraging—not punitive. Tagline: 'First, learn to see. Then, leverage AI.' or 'You can't catch what you can't recognize.'

Course Logistics

Deliverables: Assignments → final project • Quizzes • Exams • Labs • Participation

Participation (required for an A):

  1. Attendance + in-class polls
  2. Pre-lecture activities (flashcards)

Expectations: Do readings before lecture • Bi-weekly assignments ~20 hours

Do not wait until the last minute on assignments!

Grading: Letter Grade Thresholds

Your letter grade requires meeting both total points AND category thresholds:

GradeTotalIndividualGroupExamsLabsParticipation
A≥900≥240 (80%)≥160 (80%)≥280 (70%)≥11≥40 (80%)
B≥800≥210 (70%)≥140 (70%)≥220 (55%)≥9≥25 (50%)
C≥700≥180 (60%)≥120 (60%)≥200 (50%)≥7
D≥600

See the syllabus for complete details

Participation: Attendance Policy

How It Works

  • Poll Everywhere during ~34 lectures
  • Must be physically present
  • Headcount verification
  • 6 free absences, no questions asked

Points by Absences

0–650 (full)
7–1142
12–1732
18–2320
24–2910
30+0

⚠️ Completing polls remotely = academic integrity violation → 0 for all participation

No make-ups. If you'll miss many classes, contact your advisor + instructor to make a plan.

Semester Project: CookYourBooks

A comprehensive recipe management application

What you'll build over the semester:

  • 📝 Domain Model: Ingredients, quantities, recipes
  • 💾 Persistence: JSON serialization, file storage
  • 🧪 Testing: Unit tests, mutation testing
  • 🏗️ Architecture: Service layers, clean separation
  • 📷 OCR Integration: Import recipes from photos
  • 🖥️ GUI: JavaFX graphical interface

Each assignment builds on the previous — don't fall behind!

We Have Mutual Expectations

What we expect from you

  • Prepare: readings + flashcards before class
  • Engage: ask questions, help classmates
  • Ask for help early (stuck >30 min? reach out!)
  • Professional conduct in all interactions

What you can expect from us

  • Round-the-clock office hours in-person and virtual
  • 24-hour response on discussion board
  • Clear rubrics and expectations
  • Feedback that helps you improve
  • Treat you as colleagues-in-training

Learning how to get unstuck is one of the objectives of this course

What are your goals for CS 3100?

A. Learning as much as possible

B. Getting a high grade

C. Getting a strong letter of recommendation

D. Having time for other projects

Poll Everywhere QR Code or Logo

Text espertus to 22333 if the
URL isn't working for you.

https://pollev.com/espertus

Static vs. dynamic typing

When do you want errors reported?

print("hello" / "world")
  • static typing → compile-time (Java)
  • dynamic typing → run-time (Python)

The 1990s Brought Platform Fragmentation and the Internet

  • Platform fragmentation (Windows, Mac, Unix)
  • The Internet
  • 32,000× increase in complexity

C/C++ dominated, but:

  • Manual memory management → crashes
  • Platform-specific code everywhere
  • "It works on my machine" 🤷

Java & Python responded with:

  • Garbage collection
  • Platform abstraction
  • Large standard libraries
  • Object-oriented design

Java vs Python: Same Problems, Different Philosophies

Java (1995)Python (1991)
OriginSun Microsystems (corporate)CWI research (community)
TypesStatic — errors at compile timeDynamic — errors at runtime
SpeedFast (JIT compilation)Slower (interpreted)
StyleVerbose, explicitConcise, "readability counts"

Discussion: If Java is faster, why use Python?

Java
  • Android
  • Enterprise
  • Big Data
Python
  • ML/AI
  • Data Science
  • Scripting

Plot twist: Industry trending toward static typing

  • PHP → Hack
  • JavaScript → TypeScript
  • Python → mypy

Breaking Changes: A Tale of Two Philosophies

How do languages evolve without breaking existing code?

Python 2 → 3

  • print "hello"print("hello")
  • 3 / 2 = 13 / 2 = 1.5
  • Strings became Unicode by default
  • 12+ years to sunset Python 2

Java 1.0 → 21

  • Code from 1995 still compiles
  • Deprecated features stay for years
  • Binary compatibility guaranteed
  • Your old code keeps working

Governance Shapes Evolution

Concept: 'Two Kinds of Community' (Governance Models Shape Language Evolution)

A split-panel illustration in the style of a vintage technical manual, contrasting two approaches to language stewardship.

On the LEFT ('The Open Commons'), a public park where diverse individuals gather around a shared garden plot. A teacher, a hobbyist, a startup founder, a student, and a few corporate representatives (visibly outnumbered) all have equal-sized voting cards. A sign reads 'Python Software Foundation - All Welcome.' In the foreground, a small ceremonial bonfire where old code labeled 'Python 2' is being retired—some people cheer while a few look wistful. A banner overhead reads 'Sometimes we break things to make them better.' The community bulletin board shows a PEP titled 'Breaking Change Proposal' with many thumbs-up stickers. The mood is: progress sometimes requires letting go of the old.

On the RIGHT ('The Corporate Boardroom'), a polished conference room with a long table. At the head sits an Oracle representative; around the table are six other seats with nameplates reading: 'Acme Systems,' 'GlobalTech Industries,' 'Nexus Financial,' 'Titan Enterprises,' 'Synergy Corp,' and 'MegaBank Holdings.' All wear business attire. A sign on the wall reads 'Java Community Process - Executive Committee.' Prominently displayed: a glass museum case containing ancient code labeled 'Java 1.0 (1995) - STILL RUNS' like a sacred artifact. Red warning signs everywhere: 'DO NOT BREAK BACKWARD COMPATIBILITY' and 'Our customers have millions of lines of code.' A velvet rope separates the table from a small 'observer gallery' where several individual developers can watch but not vote. One observer holds a sign: 'Can we please have nullness annotations?' A committee member responds: 'That might break existing code.'

The visual contrast captures two attitudes toward breaking changes: LEFT embraces them when the community decides the benefit is worth the cost; RIGHT treats them as existential threats because enterprise customers demand stability. Both are legitimate—but 'community' and 'progress' mean very different things in each context.

Tagline options: 'Two definitions of community' / 'Who decides when to break things?' / 'Move fast vs. never break'

Language Choice Is a Sustainability Decision

Remember: software engineering is "the integral of programming over time."

The Python/Java comparison shows the four sustainability dimensions in action:

Technical: Will my code still run in 10 years?
Economic: What will migration cost?
Social: Who decides when to break things?
Environmental: What resources does evolution consume?

🔄 Recurring theme: We'll apply this framework to every major topic this semester.

How Does Java Deliver on Its Promise?

"Write Once, Run Anywhere"

...with performance

Different CPUs and OSes Require Different Code

  • CPUs have different instruction sets
  • OS's have different APIs
  • How do you run a program on any machine?

Bytecode Provides Platform Independence

Bytecode visualization

Java compilation/execution

Compilation Enables Optimization

Interpreted

  • Reads & executes line by line
  • 100s of instructions per statement
  • Executes every branch, every time

Native Compiled

  • Already in machine code
  • Direct CPU execution
  • Dead code eliminated, functions inlined

JIT Combines Interpretation with Native Compilation

Just-In-Time (JIT) compilation

Dynamically compiles bytecode as it executes

The program that runs Java code: JVM (Java Virtual Machine)

JIT Optimizes Your Code as It Runs

What you write:

for (int i = 0; i < 1000000; i++) {
int result = x * y; // x, y never change
sum += result + i;
}

What JIT executes:

int result = x * y;  // hoisted out!
for (int i = 0; i < 1000000; i++) {
sum += result + i;
}
JIT compilation visualization

Old Days 1

xkcd cartoon in which an old lady tells unlikely stories about computing in the old days

xkcd 1755 | CC BY-NC 2.5

Tool Mapping: Python → Java

PythonJava
pipgradle
pytestjunit
VSCodeIntelliJ IDEA | VSCode

Java Requires an Explicit Compile Step

Python

Source → Interpreter

Java

Source → Bytecode → JVM

Java requires an explicit compile step

Java Syntax: A Brief Tour

We won't teach syntax explicitly in lectures

But for this first lecture...a quick introduction

Have you programmed in Java before?

A. Nope

B. A little

C. Some

D. Lots

Poll Everywhere QR Code or Logo

Text espertus to 22333 if the
URL isn't working for you.

https://pollev.com/espertus

Hello, World!

package io.github.neu_pdi.cs3100.lecture2;

import io.github.neu_pdi.cs3100.utils.OtherClass;

/**
* This is a simple program that prints "Hello, World" 10 times.
* It also instantiates an object and calls a method on it.
*/
public class HelloWorld {
public static void main(String[] args) {
OtherClass other = new OtherClass(10);
for (int i = 0; i < 10; i++) {
// Print a message to the console
System.out.println("Hello, World #" + i);
}
other.doSomething();
}
}

Java File Structure: Packages, Imports, Comments

package io.github.neu_pdi.cs3100.lecture2;  // Reverse domain convention

import io.github.neu_pdi.cs3100.utils.OtherClass; // java.lang.* auto-imported

// Single-line comment
/* Multi-line comment */
/** Javadoc comment — generates documentation */

All Java Code Must Live in a Class

public class HelloWorld {
// contents here
}
  • All code must be in a class
  • public → usable by other classes
  • { } delimit scope (not indentation!)

Method Declaration

public static void main(String[] args) {
// method body
}
public→ accessible by other classes
static→ class method (no instance needed)
void→ returns nothing
main→ JVM entry point

Dissecting a Statement

System.out.println("Hello, World #" + i);
  • System → class in java.lang
  • out → static field of type PrintStream
  • println → method that prints + newline
  • + → string concatenation
  • ;required! (not Python)

A Supporting Class

public class OtherClass {
private int x;

public OtherClass(int x) {
this.x = x;
}

public void doSomething() {
System.out.println("Doing something with x = " + x);
}

public int getX() {
return x;
}
}

Key Syntax Points

  • private int x → field only accessible within class
  • Constructor has same name as class
  • this.x → refers to the field (not parameter)
  • Can have multiple constructors (unlike Python)
  • getX() → getter method (encapsulation)

Java Has Two Categories of Types

Two categories:

  1. Primitive types (values)
  2. Reference types (pointers to objects)

Primitive Types

TypeSizeValues
byte1 byte-128 to 127
short2 bytes-32,768 to 32,767
char2 bytesUnicode character
int4 bytes±2 billion
long8 bytes±9 quintillion
float4 bytes~7 decimal digits
double8 bytes~15 decimal digits
boolean1 bytetrue / false

⚠️ Java Integers Have Fixed Sizes and Can Overflow

Unlike Python:

  • Python integers grow arbitrarily
  • Java integers wrap around silently!
  • int max ≈ 2 billion (23112^{31} - 1)

Why it matters at scale:

  • byte (1B) × 8 billion = 8 GB
  • long (8B) × 8 billion = 64 GB
  • numpy/pandas use fixed-size types

Reference Variables Store Pointers, Not Values

  • Objects (anything extending Object)
  • Arrays (e.g., int[], String[])
  • Can be null (no object)

Variables store a pointer to memory

== Compares References, Not Values

String a = new String("hello");
String b = new String("hello");
System.out.println(a == b); // false!

== compares references (memory addresses)

Not values like in Python

Use .equals() for value comparison

Java Arrays Are Fixed-Size and Single-Type

Java ArrayPython List
Fixed sizeDynamic size
Single typeMixed types
Contiguous memoryPointers to objects

Summary

  • Course: principles-based, large-scale design
  • Java: "write once, run anywhere" with JIT performance
  • Static typing is winning the industry debate
  • Primitives vs references: understand the difference!

Lab 1: Java Tooling & Setup

Complete this week!

Setup Tasks

  • Install Java 21 (Temurin)
  • Configure VS Code with extensions
  • Clone from GitHub with SAML auth
  • Build your first Gradle project

Learning Tasks

  • Fix static analysis warnings
  • Debug a failing test
  • Implement a method
  • Write your own test

⚠️ Use Java 21, not Java 25! (Gradle compatibility)

Assignment 1: Recipe Domain Model

Due: Thursday, January 15 at 11:59 PM

Implement the foundation of CookYourBooks:

  • Two class hierarchies: Quantity and Ingredient
  • Enums for Unit, UnitSystem, UnitDimension
  • Comprehensive JUnit 5 test suite
  • Javadoc documentation

No AI assistance — demonstrate your Java fundamentals

Start early! Estimated ~20 hours of work.

Flashcards

Screenshot showing flashcard access in Pawtograder

Next Steps

Any questions? Ask on Pawtograder.