Syllabus: LING 190 (2010-Fall)
The goal of this course is to teach you how to program well. We will use
the Python programming language, but
the concepts will be applicable to almost any language. Our focus will be
on aspects of programming that aren't usually covered in other classes:
interactive programming, objects and their representations, naming, clarity,
style, elegance, debugging, modeling, abstractions, &c. We'll
spend as much time as we need to on basic issues like syntax and data
structures, but for the most part we'll let the other courses fill in the
details while we concentrate on the more conceptual aspects of programming.
But that doesn't mean that you won't get your hands dirty. The way to
get good at programming is the same way you'd get good at anything
hard—you practice, a lot. In this course, you will be required to
practice programming (nearly) daily, and to submit weekly logs of your
practice activities. This will form a large portion of your final grade;
but much more importantly, it's the only way you'll get good.
Here's a rough sketch of the topics we'll cover:
- Basics of programming with Python
- Running the interpreter, evaluating simple expressions, getting help.
Objects, names, and variables. Simple function definitions.
- Functions & objects
- Black-box abstractions, bindings, the substitution model of function
evaluation. Objects and their names, types, object identity, instances,
and methods.
- Expressions & statements
- Why one is better than the other, but both are needed in general.
Operators and function calls, method calls, compositionality.
Imperative statements: I/O, assignments, conditionals, loops, and
other forms of flow control.
- Data structures
- Sequences, strings, and dictionaries. Basics of classes and
user-defined types.
- Classes, types, and instances
- Defining classes. What it means to be a type, what it means to be
an instance, and how both of those are objects.
- More on data
- Data abstraction, trees and hierarchical data, representational
issues.
- More on functions
- Functions as objects. Lambda expressions (and why they're broken in
Python). Nested functions. Closures (and why they're broken in
Python).
- Debugging
- Don't panic! Print-statement debugging, tracing, interactive
debuggers. Handling errors properly and when not to.
- Style & substance
- Importance of style. What style means in programming. Recognizing good
style, developing your own. Rules of thumb and when to break them.
- Writing good programs
- Factoring, modularity, reuse, and ease of modification.
Top-down vs. bottom-up programming, and how they meet in the
middle.
- Protocols & interfaces
- Protocol specification and design, separation of interface and
implementation.
- Little languages
- Program development as linguistic abstraction.
- Modeling & simulation
- Thinking of programs as models. Relation to real-world phenomena.
Abstraction and when it's right and wrong.
- Extended example
- A simple calculator program.
- Odds & ends
- Other languages, other methodologies. Where to go for help. How to
read a large program. How to write a large program (briefly), and when
not to.