Skip to main content
Harvard
Computer Science
4 credits

Harvard CS 51: Abstraction and Design in Computation

CS 51 is the standard course after CS50 for Harvard CS concentrators, teaching functional programming in OCaml alongside design principles — abstraction, modularity, and multiple programming paradigms. It's where students go from making code work to making it well-designed.

Fennie is independent and not affiliated with Harvard University. This is an unofficial study guide.

Build my CS 51 study plan

What makes it hard

OCaml is the shock: after CS50's imperative C and Python, functional programming with strict typing, pattern matching, and no loops rewires how you think. Students who try to write imperative code in OCaml syntax suffer; the course only clicks once you embrace recursion and types as the design language.

What you'll cover

  • Functional programming in OCaml
  • Types and pattern matching
  • Higher-order functions
  • Abstraction and modularity
  • Lazy evaluation
  • Object-oriented and imperative paradigms compared

The CS 51 study guide

How to study for Harvard CS 51, step by step.

  1. 1

    Stop writing imperative code in OCaml syntax

    CS 51 only clicks once you accept recursion and types as the design language. When you catch yourself reaching for a loop, rewrite the thought as a recursive function or a fold instead.

  2. 2

    Do small functional exercises daily in the early weeks

    The paradigm shift is built through volume of tiny programs, not a few big ones. Ten-line OCaml exercises every day for the first month rewires the instincts the psets assume.

  3. 3

    Let the type checker be your tutor

    When OCaml rejects your code, work out why before changing anything. Each type error you genuinely understand is a permanent upgrade to your mental model of the type system.

  4. 4

    Drill the pattern-matching idioms

    Match expressions over lists, options, and custom variants recur constantly in CS 51 psets and exams. Collect the idioms as you meet them and rewrite each from memory a few days later.

  5. 5

    Pace the paradigm shift with Fennie

    Upload the CS 51 syllabus and Fennie's Daily Plan schedules those daily OCaml reps through the critical early weeks, paced to pset deadlines, with quizzes on the type system generated from your actual course materials. Free to start.

    Start my CS 51 plan free

How Fennie helps with CS 51

Daily Plans pace CS 51's paradigm shift with daily small OCaml exercises early in the semester, when the functional mindset is being built. Chat through why the type checker rejects your code — usually the fastest way to internalize the type system — and drill the pattern-matching idioms that psets and exams reuse constantly.

FAQ

Is CS 51 hard after CS50?

It's a different hard. The workload is comparable, but functional programming in OCaml forces a mental shift that takes most students several weeks. Once it clicks, the back half is smoother.

Do I need CS 51 for the Harvard CS concentration?

CS 50 followed by CS 51 (or CS 61) is the classic start of the concentration pathway. Check the current concentration requirements, since pathways have flexibility.

How do I prepare for CS 51?

Be solid on recursion before day one — it's the core mechanic of functional programming. Working through a short OCaml or Haskell tutorial over break gives you a real head start.

Pass CS 51 with a plan, not a cram

Upload your CS 51 materials and Fennie generates a Daily Plan paced to your deadline — plus chat, flashcards, and quizzes built from the actual course content.

Get started free

More Harvard courses