Programming Abstraction

SICP / CS61A · Python Track

用 Python 学习 abstraction、recursion、data、state、objects 与 interpreters,而不是单纯学习 Python 语法。

PRIMARY · NJU SICP 2026TEXTBOOK · Composing Programs
Semester Goal

完整走完现代 SICP / CS61A 核心路线

Python 是主要 implementation language;Scheme 与 SQL 用来理解 programming paradigms、programs as data、interpreters 和 declarative programming,而不是另开一门语言课。

Completion Node
Why this route?

语言是载体,抽象能力才是主线

原版 SICP → Scheme 现代 CS61A / Composing Programs → Python 为主 南京大学 SICP 2026 → Composing Programs + Berkeley CS61A materials 最终目标 → abstraction · composition · recursion · state · data · paradigms · interpretation

Scheme 仍然重要:Scheme Interpreter 的关键目标正是用 Python 实现一门语言的解释器。

Resource Hierarchy

SICP Resources

PRIMARY COURSE

南京大学 SICP Fall 2026

当前课程主线。每周先对照这里的 lecture、slides、lab、homework 与 project。

PRIMARY TEXTBOOK

Composing Programs · Version 2

完整经典路线;阅读 functions、data、state、objects、interpreters 与 declarative programming。

CLASSIC CS61A COMPANION

Berkeley CS61A Fall 2025

用于 lecture videos、labs、discussions、homework、四个经典 projects、复习资料与 past exams。

CURRENT BERKELEY REFERENCE

Berkeley CS61A Fall 2026

只作当前课程参考;它的新课程结构不替换本学期的经典 Scheme Interpreter 路线。

TOOLS

Python Tutor

在 functions、recursion、mutation 阶段画 environment、stack frame 与对象引用。

Composition Guide

写完第一版后检查函数职责、命名、重复与可读性。

Study Guides / Past Exams

完成对应 topic 后主动练习;不要用重看 lecture 代替解题。

Curriculum

七个学习阶段

Phase 1

Functions & Abstraction

  • expressions、names、functions、control
  • environment diagrams
  • higher-order functions、lambda

目标:把函数作为值组合,并解释 environment model。
Project:Hog

Phase 2

Recursion

  • recursive / iterative process
  • tree recursion、decomposition
  • time / space cost

目标:手画调用过程,并能解释递归定义与执行成本。

Phase 3

Data Abstraction

  • sequences、lists、trees
  • abstraction barriers
  • recursive data

重点:data abstraction,而不只是 Python list API。
Project:Cats

Phase 4

State & Iteration

  • mutable data、nonlocal
  • iterators、generators
  • lazy evaluation

连接:state → mutation → iterator → lazy computation。

Phase 5

Object-Oriented Programming

  • classes、inheritance、special methods
  • representation、composition
  • linked structures、mutable trees

连接:SICP OOP ↔ 6.102 ADT / RI / Interface。
Project:Ants

Phase 6

Languages & Interpreters

  • functional programming、Scheme lists
  • programs as data、calculator
  • eval / apply、environments、macros

Project:用 Python 构建 Scheme Interpreter。

Phase 7

Declarative Programming

  • SQL、tables、aggregation
  • declarative vs imperative

目标:用不同范式表达“是什么”,而不总是规定“怎么做”。

Interpreter Architecture

Python 实现语言解释器

Python implementation ↓ Lexer / Parser ↓ Eval ↔ Apply ↓ Scheme program result
Four Projects

项目进度

Hog

Not Started

control · functions · higher-order functions · decomposition

Cats

Not Started

recursion · sequences · abstraction · algorithms

Ants vs. SomeBees

Not Started

OOP · inheritance · abstraction · larger program organization

Scheme Interpreter

Not Started

interpreter architecture · eval / apply · environments · semantics

Connection

SICP ↔ 6.102

abstraction、ADT、interface 与 representation invariant 在 OOP 阶段汇合:SICP 建立思维模型,6.102 强化大型软件中的契约与可维护性。

Learning with AI

核心练习先由自己完成

自己读题自己设计并写第一版运行测试卡住时只请求概念解释或提示完成后让 AI 做 code review不看答案重新解释实现

recursion、environment diagrams、Hog、Cats、Ants 与 Scheme Interpreter 尤其如此。