Learn to Program
You already “program” in everyday life—any time you plan steps to reach a goal, you’re doing it.Programming on a computer is simply the formal, precise version of that.To get good at it, treat programming as a practice: time-boxed, focused, and with a specific outcome you want to reach.
Learn about Object Oriented Programing
Did you know that data has a shape?
What is your goal?
Debugging Debugging is the process of figuring out why your program isn’t behaving the way you expect.
It’s detective work: identify symptoms → trace causes → fix the root issue.
Understand the 'Base Case'
Functions let you break problems into reusable, well-defined chunks.
A good function has:
A clear purpose
Defined inputs
A predictable output
No unnecessary side effects
This makes debugging and testing dramatically easier.
Performance refers to how efficiently your program runs:
Time (speed)
Space (memory)
Responsiveness
You don’t optimize first.
You optimize after your program is correct and measurable.
Your future self (and teammates) should be able to test your code with minimal effort.
This means:
Use meaningful variable names
Keep functions short
Handle errors explicitly
Avoid “clever” one-liners that hide logic
Watch this video - Error Driven Development
Getting Specific
A specification answers two questions:
What should this program/function do?
How do we know if it is correct?
A spec reduces ambiguity and guides testing.
Break your program into separate modules (files or components), each responsible for one part of the problem.Why?
Easier debugging
Easier testing
Easier collaboration
Easier to extend later
Testing
Testing is how you confirm your program matches the specification.Input → Output Testing Given specific inputs, does your function produce the outputs the spec says it should?
Debugging vs Testing
Debugging: finding the cause of a failure
Testing: checking whether a failure exists
Unit Tests
Test small, isolated parts of your program (usually functions or classes) to ensure each piece works independently.
Integration Tests
Test whether all components work together correctly.This is the mature testing stage—you can’t do it until you have working parts to assemble.
def max(x, y):
# x & y are floats
...
Even this tiny function has billions of possible input pairs.
You’ll never test all cases.So we build a test suite:
Small enough to run quickly
Large enough to give confidence
A test suite doesn’t prove a program is perfect, but it drastically reduces the chance of bugs.
Testing reveals where things fail.
Debugging reveals why they fail.Together they form the core cycle of real programming:
Write → Test → Debug → Improve → Repeat
Watch Design Based Thinking
Watch Data Insights and how to cross the river
Watch Threat Modeling
Watch The Art of Coding w/ Pybytes
Have a question? Send me an
email
Resources and References
https://dspace.mit.edu/bitstream/handle/1721.1/150580/6-00-fall-2008/contents/assignments/index.htm
https://openlearning.mit.edu/mit-faculty/residential-digital-innovations
Introduction: Chapter 1 in How to Think Like a Computer Scientist
Variables and statements: Chapter 2 in How to Think Like a Computer Scientist
Strings: The Strings section in the Programming Python Wikibook
Conditionals: The Conditional Statements section in the Programming Python Wikibook
Loops: The Loops section in the Programming Python Wikibook
Functions and types: Chapter 3 in How to Think Like a Computer Scientist
Documenting functions: Documenting Functions from Dive Into Python
Recursion: Chapter 4 in How to Think Like a Computer Scientist
Lists: Chapter 8 in How to Think Like a Computer Scientist
Dictionaries: Chapter 10 in How to Think Like a Computer Scientist
As a reference: the Python Tutorial section on lists and dictionaries (feel free to skip 5.1.3 and 5.1.4)
Binary search: Skim the Wikipedia page about this (section 1 up until the recursive implementation, section 5, and section 6 are probably most interesting)
Exceptions (covered in recitation): Section 11.5 in How To Think Like A Computer Scientist
Classes: Chapter 12 in How to Think Like a Computer Scientist
Classes: Chapter 13 in How to Think Like a Computer Scientist
Classes: Chapter 14 in How to Think Like a Computer Scientist
Inheritance: Chapter 16 in How to Think Like a Computer Scientist