CS107 - Programming Paradigms from Stanford Engineering Everywhere
Advanced memory management features of C and C++; the differences between imperative and object-oriented paradigms. The functional paradigm (using LISP) and concurrent programming (using C and C++). Brief survey of other modern languages such as Python, Objective C, and C#.
Prerequisites: Programming and problem solving at the Programming Abstractions level. Prospective students should know a reasonable amount of C++. You should be comfortable with arrays, pointers, references, classes, methods, dynamic memory allocation, recursion, linked lists, binary search trees, hashing, iterators, and function pointers. You should be able to write well-decomposed, easy-to-understand code, and understand the value that comes with good variable names, short function and method implementations, and thoughtful, articulate comments.
View notes on Github Pages
This repository includes a small Ubuntu-based Docker environment with gcc,
g++, make, cmake, gdb, and valgrind.
Build the image:
make docker-buildStart a shell with the repository mounted at /workspace:
make docker-shellInside the container, configure and build the C examples with CMake:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build --target examples --parallelOr use the convenience Make target:
make examplesExample programs are written by CMake to build/examples:
./build/examples/generic-pointer/generic_swap
./build/examples/ticket-agent/TicketAgent
./build/examples/dinning
./build/examples/ice_cream_store_simulationFor gdb, start the container with ptrace enabled:
make docker-debug-shellWithout make, the equivalent Docker commands are:
docker build -t cs107-dev .
docker run --rm -it -e HOME=/root -v "$PWD":/workspace -w /workspace cs107-devYou can also use Docker Compose:
docker compose run --rm cs107- Programming Paradigms
- C Programming
- C Pointer
- Generic Pointer
- Generic Data Structure
- Generic Function
- Memory Management
- Stack and Heap
- Assembly Language
- Activation Record and Return Value
- C++ and C, Reference and Pointer
- Preprocessor and Macro
- Compiling and Linking
- More Assembly
- Ticket Agent: Going to concurrency.
- Semaphore: More examples.
- Dining Philosophers: More examples.
- Ice Cream Store Simulation: The most complicated example.