![]()
CIII - Draft (last updated 11/20/02)
Syllabus - last updated 11/17/02
Programming Survey Course Syllabus
Section 1 - Text File Processing
1 week - Review of Python
- Objective: Students recall what the whole world of programming is,
and how to write and run a program.
- 2 chapters of HTTLACS per day.
- exercises : to be defined
1 week - Files and exceptions
- Objective: Students understand and have experience reading from
and writing to files, and handling exceptions.
- single chapter of HTTLACS
- exercises - search, print out cribs in a file, or something similarly
self-contained.
2 weeks - File reformatting/processing
- Objective: Students understand Regular Expressions, including how
they work, what they are good for, and when to use them. Students
also are able to read a comma-separated-value file into one or
more Python data structures, and then to extract and to print
information from that data structure. They understand why this is
a common task.
- exercises which first have the student perform some searching
manually (using 'if' statements, for example), and then they do the
same thing using regular expressions.
- Read in comma-delimited file from DB or Excel spreadsheet, build
Python dictionaries and lists, do magic, print a report. Examples
could be to sort through test scores and find averages by school,
or print out all students over 15 years old, or print out a
histogram on zip codes, etc.
Section 2 - Databases
1 week - Database Introduction
- Objective: Students understand:
- what a database is
- what the 'DBM' model is
- a primitive database
- a very easy-to-use database
- what a database is used for
- persistence
- speed
- scalability (huge data sets)
- how it works (basically)
- database organizes data to do searching more quickly
- what the following terms mean:
- table
- index
- row or record
- record set
- transaction
- flat file
- what SQL is, and how to use it to create and inspect a database,
using the main four commands interactively:
- INSERT
- DELETE
- UPDATE
- SELECT
- exercise is to build temporary MySQL databases with different
schemas, to populate them with some simple data (by hand), and
then to get the information back out
1 week - Using a Database
- Objective: Students know how to program embedding SQL into Python
code, and how to build a database from comma-separated-value
file.
- exercise is to do all of the same work done in the first section
on csv file, but use built-in functionality of database instead of
writing all logic from scratch.
- additional exercise is to extract subset of data in a large
database into a much smaller one, which somehow provides extra
functionality.
1 week - Designing a Database
- Objective: Students are able to define a database schema such that
it can easily be used to solve a real-world problem, and to write
code which performs real-world operations on it.
- exercise is to have the class do a single project such as:
- library inventory
- gradebook
but to allow them to define the schema for it, and to write a
handful of key functions for it to perform. Once the schema is
defined, the data is supplied to them, as well as a simple
front-end (e.g., a menu-based application to allow updates to the
database), so that they can focus on the functionality.
Section 3 - Objects
1 week - Introduction to Objects
- Objective: Students understand all object terms (class, object,
instance, instantiation, constructor, method), and understand the
value of grouping data together into objects, as well as the
revolutionary approach of grouping functions which work on that
data into it as well. They understand the difference between an
object and a dicitonary, list, or tuple. They have a good grasp of
object identity versus value comparison, and know how to overload
the comparison and other operators. They also understand why
'self' is the first argument to all methods, and how to call a
method through the class, instead of the instance.
- resources - HTTLACS-12, HTTLACS-13, HTTLACS-14, OOPWP-1
- exercises - all in HTTLACS, others?
1 week - Combining Objects Using Composition and Inheritance
- Objective: Students understand how to implement objects with a
"has-a" relationship and with an "is-a" relationship, and how to
tell the difference. They have experience shifting functionality
around a class hierarchy, and have a good sense of how to tell
what should go in the base class and what should go in the derived
class. They have a walked through a reasonably elaborate OO
design, and see how implementing individual objects ultimately
results in an easy-to-use set of objects with a very simple main
loop.
- resources - HTTLACS-15, OOPWP-2,HTTLACS-16
- exercises - all in HTTLACS. Program their own "go fish" program.
1 week - Applying OO Concepts to A New Design
- Objective: Students understand how to approach a problem from a
blank sheet of paper, by identifying the key abstractions
(objects) in a problem, exploring their relationships to each
other, and defining their responsibilities to the others. They
have experience decomposing a problem without having the
constraints imposed by the DB or GUI paradigms.
- Activities: Role playing after students have identified some key
objects, each can pretend they are that object, and explain how
they will accomplish what they need to, using other objects.
- Project: Write Checkbook program as a small set of Objects,
without a command or menu interface.
Section 4 - GUI Programming
3 weeks - ??
- Objective: Students understand the challenges of GUI programming,
and how they are handled by a common GUI object framework. They
are able to write a GUI application with a representative set of
features and to make it work without the help of super-fancy
turnkey GUI programming tools. They understand how event-driven
programming is different from other paradigms. They understand
that all GUI frameworks have much in common.
- Key Concepts
- Event-driven programming
- contrast with DB or text processing
- has an event loop at its heart, watching for input, and making
calls to methods as they occur.
- matches certain domains, but NOT all.
- Inheritance
- Visually demonstrates inheritance, when a dialog is derived
from another one.
- Must connect "control" (e.g., button) to a method
- declared in Python, rather than hidden as in VB
- certain set of events pre-defined
- Good GUI design keeps ALL data outside of GUI classes
- Tempting to put state into GUI classes, especially if you
start with them, and then flesh out functionality (as in VB).
- Unless separated, event model will propagate down too far into
design.
- Final project, wrapping own OO design in a GUI, should show
this clearly.
- Done with regular method invocations, etc.
- Declared, not "clicked" into being
- GUI tools NOT necessary
- Readability IS very important, as with all declarative
things.
- OO concepts reinforced
- GUI objects are ONE SPECIFIC TYPE of object. They will NOT
typically fit super-cleanly alongside of other objects.
- Students should experience temptation of allowing GUI paradigm
to rule implementation, and see the value of separating GUI
from state.
- includes scriptability
- GUI must stay in its proper role of easing interaction with
real functionality
- GUI/DB is very simple mix, but NOT ALL PROBLEMS match that
model.
- (final) exercise is to put a real GUI on top of the checkbook
program they wrote in the previous section. The free GUI toolkit
wxPython is used. Students are to make the GUI objects they
invent look as much like the normal deposit slips, checks, and
checkbook register or account statements as possible.
Section 5 - DataBases Revisited
2 weeks - Final Project
- Objective: Students learn by experience how to integrate two
different logical models: Databases and Objects. They learn that
the Objects, which embody the clearest understanding of the
problem, must drive the DataBase implementation, rather than the
other way around. They clearly understand the advantages offered
by a DataBase, as well as the "cost" to the design of the program
using it. Each student must modify their checkbook program to
utilize the database, changing whatever functionality that is
necessary for that change. For example, they will likely move to a
model where the database is updated as each check is modified,
rather than in a "Save" operation. In addition, each student must
add some features to their checkbook program. Examples could
include:
- Check clearing
- Checkbook reconciliation
- Checkbook report writing (e.g., generating a statement of sorts)
- Categorizing checks
- Searching through checks using regular expressions
- Exporting an account to a file, and importing from one.
- Exporting a report to a file readable by Excel (csv)
- ...
Section 6 - Bonus Project
- Objective: Students use what they've learned to design from a
blank sheet of paper something that interests them. It must
utilize objects, plus two of the three other technologies
introduced in the course:
- GUI
- DB
- Flat file processing, potentially with regular expressions
- Examples:
- Battleship game (use DB for sharing a game between two players
on different machines?)
- ...
Review
Review basic concepts of Python programming that were addressed in Computer II.Review Resources/Exercises
- Programming for Non-programmers - Nodes 1-15
- How to Think Like a Computer Scientist - Chapters 1-10
- Learning to Program - Up to Modules and Functions
Along with review, possible activities include re-creating German Enigma pseudo-code and locating cribs (minus the I/O commands that appear in these examples).
Text Files, Regular Expressions & Exception Handling
File I/O Resources/Exercises
- Programming for Non-programmers - File I/O
- How to Think Like a Computer Scientist - Files and Exceptions
- Learning to Program - Handling Files
- Dealing with Text Files
Regular Expressions Resources/Exercises
Along with exercises included in the above resources, possible activities include Enigma pseudo-code and crib identification with I/O processes; work with very large comma-delimited files (20,000 records / over a dozen fields - data from anonymous K-12 student data in PSD) involving si mple and advanced reporting of characteristics.
- The re Module
- Regular Expression Syntax
- Regular Expression Objects
- Regular Expression HOWTO - SourceForge
- Advance String Handling/Intro to Regular Expressions - Exercises
- Overview and Example Exercises
- Example Exercises II
Exception Handling Resources/Exercises
- Exception Handling in Python
- Exception Handling Exercise - see end of chapter
Data Base
Data Base Resources/Exercises
- Step-by-Step Introduction to MySQL
- MySQL Connectivity With Python - beginning tutorial
- Writing MySQL scripts with the Python DB-API Interface
- Speaking MySQL Tutorial - Part I
- Speaking MySQL Tutorial - Part II
- What is SQL? - Part I
- What is SQL? - Part II
- DevShed My SQL
- Python Database Class
- Other DB Resources
Object Oriented Programming
Object Oriented Programming Resources/Exercises
- OOP with Python - Part I
- OOP with Python - Part 2
- Classes and Objects - Chapter 12 of How to Think Like a Computer Scientist
- Classes and Functions - Chapter 13 of How to Think Like a Computer Scientist
- Classes and Methods - Chapter 14 of How to Think Like a Computer Scientist
- Sets of Objects - Chapter 15 of How to Think Like a Computer Scientist
- Inheritance - Chapter 16 of How to Think Like a Computer Scientist
Graphical User Interface
Graphical User Interface Resources/Exercises
- wxPython - Introduction
- wxPython - Part 1
- wxPython - Part 2
- wxPython Wiki
- Python Programming on Win32: Capter 20: GUI Development - first half of chapter, tkinter / second half of chapter, wxPython
- Python Programming on Win32 using WxPython - similar to second half of the chapter above
- wxPython for Newbies - from IBM
- wxPython Pit - Apps, Code, Snippets, etc.
- wxPythoneers, How to Interpret the wxWindows Documentation: A Guide for Python Users
- Tkinter Introduction
- GUI in Linux
Projects
Project Resources
- Thinking in Python - Design Patterns and Problem-Solving Techniques (draft state)
Distribution Issues
Sample Python Programs