COMS W3157 Advanced Programming
Spring 2022
- TR 4:10pm-5:25pm, 417 International Affairs Building (first two weeks on Zoom) - 
- CourseWorks open to whole Columbia first few weeks – search on Vergil
 
- Three synchronous and in-person exams for all sections - 
- Thursday, Feb 24, 4:10pm: Midterm exam #1
- Thursday, Apr 14, 4:10pm: Midterm exam #2
- Tuesday, May 10, 4:20pm: Final exam
 - (Exams can be switched to online format if necessary.) - All students in all sections MUST take the exams at those times.
There are no make-up or alternate exams.
If you cannot make any of those exams, please take the course next semester. 
- Instructor: Jae Woo Lee 
- Office hours: 
Course essentials
All of the above and many more resources can be found on the
3157 Resources site.
Syllabus
Unit 1: C programming basics
- UNIX CLI basics
- Compiling & linking
- Makefile
- Git
- Binary number
- Data types
- Expressions & statements
- Storage class
- Process address space
Unit 2: Pointers and arrays
- Pointers
- Arrays
- Pointers vs. arrays
Unit 3: Function pointers and structs
- Function pointers
- Struct
- Linked list
Unit 4: File I/O
- Standard I/O
- Redirection
- File I/O
Unit 5: UNIX processes, shell, TCP/IP
- UNIX overview
- Creating processes using fork & exec
- Introduction to TCP/IP networking
Unit 6: Sockets API and HTTP
- Endianness
- Sockets API
- HTTP 1.0
Unit 7: Web-based software architecture
- HTTP 1.0 vs. HTTP 1.1
- 3-tier architecture
Past Lectures
- Course overview and logistics
- Compiling & linking
- Lecture note 01
- main.c,- myadd.c,- myadd.h- 
- Compiling & linking, a two-step process
- Function declarations
- #include <stdio.h> - how this is NOT including library code
- Independent compilation of .o files
 
 
- Compiling & linking (continued)
- main.c,- myadd.c,- myadd.h- 
- Using header file to prevent linking problem
 
 
- Makefile - 01
- Integer data types - 02
- Binary numbers - 02
Note that 01 and 02 refer to Lecture note 01
and Lecture note 02.
- Binary numbers (continued)
- 0x7FFFFFFF, 0x80000000, 0xFFFFFFFF
 
- Integer literals
- Differences between 0,'\0', and'0'
 
- Expressions & statements - 02
- Assignment as expression
- ++xand- x++
- Comparison and loginal operators
- Bitwise operators
- Picking out (i+1)th right-most bit
 
 
- Lab workflow and submission process
- Expressions & statements (continued)
- Bitwise operators
- ReviewPicking out (i+1)th right-most bit
- Turning on (i+1)th right-most bit
- Turning off (i+1)th right-most bit
 
- loops
 
- Storage class - 02
- Macros & Include guards - 01
- Process address space - 02
- How local variables are allocated on the stack
 
- Pointer types - 04
- Pointer types (continued)
- NULL pointer - 04
- Array basics - 05
- sizeofoperator - 05
- Grand Unified Theory (GUT) of arrays and pointers - 05
- Heap memory allocation - 05
- ReviewHeap memory allocation
- Char arrays
- Strings literals
- strcpy(),- strncpy(),- strcat(),- strncat()
- Argv array
- How to approach lab 2 part 2
- ReviewArgv array & Lab 2 part 2
- Exam 1logistics & coverage
- constkeyword - 07
- Function pointers - 07
- Sample code: lectnote07.c
- Complex declarations - 07
- struct- 07
- linked list in C - 07
- Lab3 linked list
- two differences: (1) void *data(2)struct List
 
- Exam 1, covering:- 
- Labs 1 and 2
- All lecture materials before struct
- All ANNemails
- Textbook sections on the topics covered in the lectures
 
- Lab3 linked list (continued)
- two differences: (1) void *data(2)struct List
 
- Standard I/O, redirection, pipelines - 09
- File I/O API in C - 09
- Buffering on standard I/O - 09
- Binary file I/O - 09
- Formatted I/O - 09
- Lab 4 overview & demo
- File permissions in UNIX - 11
- Expressing perms in octal number
- search permission in directories
- setuid permission in executables
 
- Numeric IDs in UNIX - 11
- User ID, Group ID, Process ID, Port number
 
- fork & exec
- How processes are created in UNIX
- How shell programs work
 
- Mid-semester TA Chat – No Class
- Sockets API: simple echo client & server example
- Sockets API: file sender & receiver example
- Exam 2- 
- Coverage:
- Labs 1, 2, 3, 4, 5
- Lectures up to and including 4/7
- All ANNemails
- Textbook sections on the topics covered in the lectures
 
 
Beyond C: Bash and Python
- Shell Scripting by Kent John Hall (TA)
- Compiled executable vs. shebang script vs. sourced script
- Shell language features
- Variables
- Comparators
- Control flow
- Functions
- Trap handlers
- Command substitution
 
 
- How Python Actually Works by Michael Jan (TA)
- What’s a beautiful, high-level language like PYTHON doing here
in this low-level nitty-gritty systems programming course?
Attend this lecture to find out…
- C knowledge required, Python knowledge not required
 
- Lab 7 demo
- HTTP 1.0 vs HTTP 1.1
- Dynamic web page
- 3-tier architecture
 
In Memory Of C
- free()ing the Mystery of malloc() by Hans Montero (TA)
- Invalid free revisted: what’s at the beginning of malloc’d chunks?
- Free chunk management algorithms, memory fragmentation
- GNU implementation of malloc() & free()
 
- Valgrind: Unlocking the Gates of Death by Ivy Basseches (TA)
- What is Valgrind?
- Dynamic Binary Instrumentation (DBI) frameworks
- Shadow value tools
 
- Behind the scenes: how does Valgrind execute a program?
- Tracking heap and stack (de)allocation with Valgrind
 
- From C to C++ 
- Course wrap-up 
Upcoming Lectures & Exams
- Exam 3(aka Final Exam)- 
- Coverage:
- Labs 1, 2, 3, 4, 5, 6, 7
- All lectures except guest lectures
- All ANNemails
- Textbook sections on the topics covered in the lectures
 
 
Assignments & Exams
- HW0 Part A due Tue 1/18
- HW0 Part B due Thu 1/20
- Lab 1 due Sat 2/5
- Lab 2 due Sat 2/19
- Midterm exam #1: Thursday, Feb 24, 4:10pm
- Lab 3 due Sun 3/6
- Lab 4 due Thu 3/24
- Lab 5 due Mon 4/4
- Midterm exam #2: Thursday, Apr 14, 4:10pm
- Lab 6 due Sat 4/23
- Lab 7 due Tue 5/3
- Final exam: Tuesday, May 10, 4:20pm