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.

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.

Today

Today's CS 51 plan

Preview
65 min

What a Fennie Daily Plan looks like for CS 51. Yours is built from your own syllabus and adapts every day to your deadlines and progress.

0 / 4 done~65m remaining
Keep this plan free

First plan free, no card required. Fennie is independent and unaffiliated with your school.

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, since it's the core mechanic of functional programming. Working through a short OCaml or Haskell tutorial over break gives you a real head start.

More Harvard courses