← All courses CS Skill Tree

CSCD 211

Each week below lists what you will be able to do, in the order we teach it. Open a week to see its objectives. Click an objective to read its lesson. The checks and bars track your progress; nothing is ever locked.

Ready when you are · 68 lessons
Week 1Comparators, lambdas, and method referencesJune 23 and 25 · Quiz 1 (diagnostic)
Week 2Composition, enums, and collectionsJune 30 and July 2 · Quiz 2

Composition and Enums

Enum basics: finite named instances

  • I can declare a bare-bones enum, name the SCREAMING_SNAKE_CASE convention for constants, and access individual constants via EnumType.CONSTANT.Lesson coming soon
  • I can use Enum.values() to iterate all constants, distinguish name() (safe) from ordinal() (brittle), and avoid persisting ordinals.Lesson coming soon
  • I can choose between bare-bones and enum-with-state for a given specification, and justify the choice in one sentence.Lesson coming soon

Enum with fields and methods

  • I can declare an enum with instance fields and a private constructor, and explain why each constant has its own field values.Lesson coming soon
  • I can write standard accessor methods on an enum and call them through a constant.Lesson coming soon
  • I can declare enum constants with constructor arguments matching the declared constructor's signature.Lesson coming soon

Enum `toString` and display

  • I can override toString() on an enum to control the display, and predict the difference between toString()'s output and name()'s output.Lesson coming soon
  • I can implement the field + getter + toString triplet on an enum, and explain when each access form is appropriate.Lesson coming soon

Enums in `switch`

  • I can write a switch statement on an enum, use bare-name case labels, and avoid fall-through bugs by using break.Lesson coming soon
  • I can write a switch expression with arrow form, predict the exhaustiveness check, and translate between classic switch and arrow form.Lesson coming soon

Enum natural order via `Comparable`

  • I can predict the result of enum.compareTo based on declaration order, and explain why the natural order cannot be overridden.Lesson coming soon
  • I can write a multi-key compareTo that delegates to enum compareTo as a tiebreaker, and explain when this is appropriate vs. brittle.Lesson coming soon

Composition of enums and collections

  • I can declare a class with an enum field, write its constructor with appropriate preconditions, and explain why no defensive copy is needed.Lesson coming soon
  • I can declare a class with an array-typed field of class-type elements, write a constructor that defensively copies element-by-element, and reason about the storage shape.Lesson coming soon
  • I can read a class with mixed-mutability fields, classify each field's mutability, and predict whether the constructor's assignment is correct.Lesson coming soon

ArrayList and Collections (use-side)

Why a `List<E>` exists when arrays already do

  • I can predict the size and capacity of an ArrayList through a sequence of add and remove calls.Lesson coming soon
  • I can identify a runtime ArrayStoreException risk in a covariant array assignment, and demonstrate the equivalent generic-list code is rejected at compile time.Lesson coming soon
  • I can declare variables and parameters using List<E> rather than concrete ArrayList<E>, and explain when the concrete type is justified.Lesson coming soon

Constructing an ArrayList

  • I can choose between the no-arg and capacity-hint constructors based on whether the expected size is known, and predict initial size.Lesson coming soon
  • I can defensively copy a List parameter using the copy constructor, and predict whether mutations to the original affect the copy.Lesson coming soon
  • I can choose between immutable List.of(...) and mutable new ArrayList<>(...) based on whether subsequent mutation is needed.Lesson coming soon

Reading from an ArrayList

  • I can call get(i) correctly, predict IndexOutOfBoundsException for invalid i, and reason about O(1) cost.Lesson coming soon
  • I can use size() for loop bounds and isEmpty() for emptiness checks, and choose between them stylistically.Lesson coming soon
  • I can use contains and indexOf correctly, predict equality semantics, and reason about O(n) cost.Lesson coming soon

Writing to an ArrayList

  • I can append with add(E) and insert with add(int, E), and reason about the cost difference.Lesson coming soon
  • I can distinguish set(i, x) (replace) from add(i, x) (insert) and predict size after each.Lesson coming soon
  • I can predict which overload of remove is invoked given the argument type, and force the desired overload via boxing or Object-typed argument.Lesson coming soon

for-each and `Iterable<T>`

  • I can write a for-each loop on a List, predict the iteration order, and identify when a traditional for-loop is needed.Lesson coming soon
  • I can identify the abstract method on Iterable<T> and explain how the compiler desugars for-each.Lesson coming soon

Explicit `Iterator<T>` and `ConcurrentModificationException`

  • I can write an explicit-iterator loop and predict NoSuchElementException for over-advance.Lesson coming soon
  • I can predict CME for structural modification during iteration, and identify it as a single-threaded problem despite the name.Lesson coming soon
  • I can use Iterator.remove correctly and translate to/from removeIf.Lesson coming soon

Autoboxing and unboxing pitfalls

  • I can identify autoboxing in code, predict the Integer cache range, and reason about cost in hot loops.Lesson coming soon
  • I can identify code paths where unboxing might NPE and add a null check.Lesson coming soon
  • I can predict when == on Integer-typed values appears to work and when it silently breaks.Lesson coming soon

ArrayList vs array; sorting

  • I can choose between T[] and List<T> for a given specification.Lesson coming soon
  • I can sort a List<E> with a Comparator using the modern list.sort(cmp) form.Lesson coming soon
  • I can sort a List by natural order using Collections.sort or list.sort(null), and predict compile error for non-Comparable elements.Lesson coming soon

List equality, copying, and views

  • I can predict the result of list1.equals(list2) for two List instances given their sizes, element types, and element ordering, and explain why ordering matters.Lesson coming soon
  • I can produce a shallow independent copy of a List using new ArrayList<>(other) or List.copyOf, predict whether subsequent mutations affect the original, and choose between the two based on whether the result needs to be mutable.Lesson coming soon
  • I can predict whether a mutation to a sublist or its parent affects the other, and can produce an independent snapshot of a range when isolation is required.Lesson coming soon
  • I can predict whether a mutation through a wrapped or original reference succeeds, and can choose between unmodifiableList, List.copyOf, and a defensive copy depending on the required guarantees.Lesson coming soon

`ArrayList<E>` ↔ array interop

  • I can produce a typed array from a generic List<E> using toArray(new E[0]), and predict the failure when the no-arg toArray() is cast to a typed array.Lesson coming soon
  • I can predict whether set, add, and direct array writes succeed on the result of Arrays.asList(arr), and contrast it with List.of(...) and new ArrayList<>(Arrays.asList(arr)).Lesson coming soon
  • I can implement, in one line, the conversion from a reference-type array to an independent mutable ArrayList, and can implement the boxing loop required for primitive-array sources.Lesson coming soon
Week 3Custom linked lists, part oneJuly 7 and 9 · Quiz 3

Doubly-linked variant

  • I can declare a doubly-linked Node and update both directions on insert/remove.Lesson coming soon
  • I can write addLast and removeLast for DH-doubly-linked variant in O(1).Lesson coming soon
  • I can write a backward-walk traversal on a doubly-linked list.Lesson coming soon

Custom Iterator implementation

  • I can declare a non-static inner Iterator class capturing the enclosing list's head.Lesson coming soon
  • I can implement Iterator's hasNext and next.Lesson coming soon
  • I can declare LinkedList as Iterable and implement iterator().Lesson coming soon

Generic bound `<T extends Comparable<? super T>>`

  • I can declare a generic class with a Comparable bound and use compareTo on T values inside.Lesson coming soon
  • I can explain why the Comparable bound is needed and identify the alternative.Lesson coming soon
Week 4Custom linked lists, part two, and the midtermJuly 14 and 16 · Quiz 4 and the midtermComing soon

This week is a milestone: Quiz 4 and the midterm.

Week 5Inheritance and polymorphismJuly 21 and 23 · Quiz 5Coming soon

`extends` and the subclass relation

  • I can declare a subclass and explain that single inheritance is the rule.Lesson coming soon
  • I can predict whether a subclass can access a parent member based on visibility.Lesson coming soon
  • I can identify Object as the root and predict that every class has access to its methods.Lesson coming soon

`super(...)` and constructor chaining

  • super first statementLesson coming soon
  • Implicit super()Lesson coming soon
  • Missing super errorLesson coming soon

Method overriding

  • Same signatureLesson coming soon
  • @OverrideLesson coming soon
  • Override contractLesson coming soon

Dynamic dispatch

  • Runtime vs compile typeLesson coming soon
  • Method resolutionLesson coming soon
  • Fields not dispatchedLesson coming soon

`super.method()` call

  • super.methodLesson coming soon
  • super.toStringLesson coming soon

Object class and its overridable methods

  • toString defaultLesson coming soon
  • equals defaultLesson coming soon
  • hashCode defaultLesson coming soon

toString override in hierarchy

  • super.toString patternLesson coming soon
  • @Override disciplineLesson coming soon

`equals` override mechanic

  • equals patternLesson coming soon
  • getClass vs instanceofLesson coming soon
  • hashCode pairingLesson coming soon

Upcast and downcast

  • UpcastLesson coming soon
  • DowncastLesson coming soon

`instanceof` classic and pattern

  • Classic instanceofLesson coming soon
  • Pattern instanceofLesson coming soon

Polymorphism through base-type reference

  • Base array of subtypesLesson coming soon
  • Virtual dispatch through a loopLesson coming soon
  • Shape.area canonical exampleLesson coming soon

Concept final classes and final methods

  • final class cannot extendLesson coming soon
  • final method cannot overrideLesson coming soon

Concept protected access

  • protected vs private vs publicLesson coming soon
  • protected leaks abstractionLesson coming soon
Week 6Abstract classes, interfaces, and object identityJuly 28 and 30 · Quiz 6Coming soon

Abstract Classes and Interfaces

Concept Abstract class fundamentals

  • Declaring abstractLesson coming soon
  • Abstract class cannot be instantiatedLesson coming soon
  • Abstract classes hold state and constructorsLesson coming soon

Concept Abstract methods

  • Abstract method declarationLesson coming soon
  • Concrete subclass must overrideLesson coming soon

Concept Partial-implementation pattern

  • Concrete + abstract mixLesson coming soon
  • Template MethodLesson coming soon
  • Half-built superclass intuitionLesson coming soon

Concept The interface declaration

  • Interface declaration syntaxLesson coming soon
  • Implicit modifiers on interface methodsLesson coming soon
  • Constants on interfacesLesson coming soon

Concept `implements` and multiple-interface implementation

  • Single implementsLesson coming soon
  • Multiple implementsLesson coming soon
  • Conflict resolution across interfacesLesson coming soon

Concept Interface inheritance

  • Single interface inheritanceLesson coming soon
  • Multiple interface inheritanceLesson coming soon

Concept `default` methods (Java 8+)

  • Default-method motivationLesson coming soon
  • Diamond conflict resolutionLesson coming soon
  • When to use defaultLesson coming soon

Concept `static` (Java 8+) and `private` (Java 9+) interface methods

  • Static methods on interfacesLesson coming soon
  • Private interface methodsLesson coming soon

Concept Abstract class vs interface: the design choice

  • Why prefer interfacesLesson coming soon
  • When abstract class still winsLesson coming soon
  • Skeletal implementation patternLesson coming soon

Concept The classic 211 interfaces (pointers)

  • Comparable vs Comparator pointerLesson coming soon
  • Iterable / Iterator pointerLesson coming soon
  • Cloneable pointerLesson coming soon

Inner Classes and Object Identity

Concept Static nested class

  • Declaring static nestedLesson coming soon
  • No enclosing-instance referenceLesson coming soon
  • When to use static nestedLesson coming soon

Concept Inner (non-static member) class

  • Inner class implicit referenceLesson coming soon
  • Outer.thisLesson coming soon
  • Inner-class memory leaksLesson coming soon

Concept Local class

  • Local classLesson coming soon
  • Effectively-final captureLesson coming soon

Concept Anonymous class

  • Anonymous-class syntaxLesson coming soon
  • Pre-lambda anonymous-class idiomLesson coming soon
  • Lambdas replace anonymous classes (when target is functional)Lesson coming soon

Concept Choosing the right inner-class kind

  • Inner-class decision treeLesson coming soon
  • Lambda-first styleLesson coming soon

Concept `Object.clone()` protocol

  • Object.clone signatureLesson coming soon
  • super.clone idiomLesson coming soon
  • Cloneable as a markerLesson coming soon

Concept Shallow vs deep copy

  • Shallow copy mechanicsLesson coming soon
  • Deep-copy recipeLesson coming soon

Concept `Cloneable` is broken; modern alternatives

  • Why Cloneable is brokenLesson coming soon
  • Copy constructorLesson coming soon
  • Static factory and recordsLesson coming soon

Concept The `equals` contract

  • Five equals propertiesLesson coming soon
  • Symmetry violation in subclassesLesson coming soon
  • Real-world equals violationsLesson coming soon

Concept `equals` under inheritance: `getClass` vs `instanceof`

  • getClass vs instanceofLesson coming soon
  • canEqual patternLesson coming soon

Concept `hashCode` and the equals/hashCode consistency rule

  • equals/hashCode consistencyLesson coming soon
  • Hash-collection misbehaviorLesson coming soon
  • IDE-generated implementationsLesson coming soon

Concept `==` vs `.equals` revisited

  • == vs.equals on referencesLesson coming soon
  • Primitive ==Lesson coming soon
  • Integer cache + autoboxingLesson coming soon

Concept `final` reference vs immutable object

  • final reference vs immutable objectLesson coming soon
  • Bloch's immutability checklistLesson coming soon
Week 7Exceptions and recursionAugust 4 and 6 · Quiz 7Coming soon

Exception Handling

Concept The Throwable hierarchy

  • Throwable hierarchyLesson coming soon
  • Why not to catch ErrorLesson coming soon
  • Drawing the Exception/RuntimeException lineLesson coming soon

Concept Checked vs unchecked

  • Handle-or-declareLesson coming soon
  • The checked-exception debateLesson coming soon
  • Designing your own exception classLesson coming soon

Concept `try` with multiple `catch` blocks

  • Specificity-first orderingLesson coming soon
  • Unreachable catchLesson coming soon

Concept `finally` block

  • When finally runsLesson coming soon
  • When finally does not runLesson coming soon
  • Return-from-finally trapLesson coming soon

Concept Multi-catch (Java 7+)

  • Multi-catch syntaxLesson coming soon
  • Implicit-final in multi-catchLesson coming soon

Concept `try-with-resources` (Java 7+)

  • try-with-resources basicsLesson coming soon
  • Suppressed exceptionsLesson coming soon
  • Close orderLesson coming soon

Concept Exception chaining

  • Exception cause chainLesson coming soon
  • Four-constructor conventionLesson coming soon

Concept Custom exception classes

  • Choosing parent classLesson coming soon
  • Four-constructor convention is requiredLesson coming soon
  • Exception naming and messagesLesson coming soon

Concept `throws` propagation

  • Stack-walk for exceptionsLesson coming soon
  • Where to catchLesson coming soon

Concept Rethrow patterns

  • Wrap and rethrowLesson coming soon
  • Log-and-handle patternLesson coming soon
  • Don't ignore exceptionsLesson coming soon

Concept Exception vs sentinel return

  • Choosing exception over sentinelLesson coming soon
  • Sentinel returnsLesson coming soon

Concept Exceptions and overriding

  • Throws compatibility under overrideLesson coming soon
  • Unchecked override flexibilityLesson coming soon

Recursion

Concept Anatomy of a recursive method

  • Base case essentialsLesson coming soon
  • Shrinking the problemLesson coming soon
  • Two-part canonical shapeLesson coming soon

Concept The call stack and recursive frames

  • Recursion creates a stack of framesLesson coming soon
  • Frame-scoped parameters and localsLesson coming soon
  • StackOverflowErrorLesson coming soon

Concept Tracing recursive calls

  • Trace-table conventionLesson coming soon
  • Multi-parameter traceLesson coming soon

Concept Linear recursion on integers

  • Factorial recursionLesson coming soon
  • Sum recursionLesson coming soon

Concept Linear recursion on arrays

  • Recurse-on-index patternLesson coming soon
  • Identity element as base-case returnLesson coming soon

Concept Linear recursion on strings

  • Substring-based string recursionLesson coming soon
  • Index-based string recursionLesson coming soon

Concept Helper method with accumulator parameter

  • Public/private helper splitLesson coming soon
  • Accumulator threadingLesson coming soon

Concept Helper that returns partial result up the stack

  • Bottom-up returnLesson coming soon
  • Bottom-up combination patternsLesson coming soon

Concept Recursion on a linked list

  • Recurse on node.nextLesson coming soon
  • null as linked-list base caseLesson coming soon

Concept Branching recursion (a.k.a. tree recursion)

  • Fibonacci recursiveLesson coming soon
  • Tower of HanoiLesson coming soon
  • Naïve Fibonacci complexityLesson coming soon

Concept Converting recursion to iteration

  • Recursion → loop conversionLesson coming soon
  • Conversion limitsLesson coming soon

Concept Print before vs print after the recursive call

  • Print before vs afterLesson coming soon
  • Tracing-stem variantsLesson coming soon
Week 8Recursion, generics, and the finalAugust 11 and 13 · Quiz 8 and the final, in APE formatComing soon

Generic class declaration

  • I canLesson coming soon
  • I canLesson coming soon

Multi-parameter generics

  • I canLesson coming soon
  • I canLesson coming soon

Generic methods

  • I canLesson coming soon
  • I canLesson coming soon

Bounded type parameters

  • I canLesson coming soon
  • I canLesson coming soon
  • I canLesson coming soon

Using a generic class

  • I canLesson coming soon
  • I canLesson coming soon

Wildcards: `? extends T` and `? super T`

  • I canLesson coming soon
  • I canLesson coming soon
  • I canLesson coming soon

Wildcard capture and add-restrictions

  • I canLesson coming soon
  • I canLesson coming soon

Type erasure

  • I canLesson coming soon
  • I canLesson coming soon
  • I canLesson coming soon

Erasure and arrays

  • I canLesson coming soon
  • I canLesson coming soon