Skip to main content
Lecture 1 Cover

CS 3100: Program Design and Implementation II

Lecture 1: Course Overview & Introduction to Java

©2025 Jonathan Bell, 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

Introduction

  • Jon, Prof Bell, Prof Jon, Dr Bell, Dr Jon, etc…
  • Research: Software Engineering, Program Analysis
  • Open source contributor & project founder

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 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)

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

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.

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."
Edsger Dijkstra

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

AI as amplifier diagram with intentional errors for students to find

AI coding assistance is not permitted in weeks 1-5

Split-panel showing bugs invisible without foundation vs visible with foundation

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

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

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

Dynamic Typing Makes JIT Optimization Hard

PyPy and others have tried...

Fundamental language design differences
make it hard to match Java's performance

(Dynamic typing makes optimization very hard)

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

Discussion

Did anyone have Python experience before CS 2100?

(without mypy)

How did you find errors in your code?

Java Syntax: A Brief Tour

We won't teach syntax explicitly in lectures

But for this first lecture...a quick introduction

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 (2312^{31})

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.

Next Steps