CS263 Outline
Fall 2023 (Development)
1 Course Overview (3 days)
Overview
This module introduces you to the course organization, policies, and mechanics. We will discuss the structure of the course.
Objectives
At the conclusion of this Orientation Module students will be able to:
- Explain the Syllabus.
- Explain the importance of Office Hours.
- Explain the importance of questions.
- Summarize the structure of this course.
- Summarize the structure of an assignment prompt.
- Summarize the content to be covered.
- Module 1 Objective Mapping
- CS 263: Syllabus (Fall 2023 (Development))
- Communications - General Guidance
- Review Course Structure, Objectives, and Requirements
- Canvas Overview & Navigation
- Support
- Meet the Instructor
- Complete the Personal Introduction Post
- The Beginning
- Office Hours
- Complete the Office Hours Survey
- Assignment Prompt Structure
- Module 1 Summary
2 Getting Set Up with Python (5 days)
Overview
This module starts with setting up a Python development environment, specifically Python 3.11 and VSCode. The remainder of this module covers:
- downloading a full set of all example code (in the form of a GitHub repository)
- running a basic Python program
- running a given set of tests using pytest
Objectives
At the conclusion of this Module students will be able to:
- Checkout the course example set GitHub Repository.
- Create a project in their preferred IDE: VSCode or Vim (with appropriate plugins).
- Run a provided Python program.
- Run a set of provided tests for a Python program.
- Describe the basic structure of a Python program.
- Discuss PEP 8.
- Discuss PEP 20.
- Discuss how to approach an somewhat unfamiliar language (e.g., Python or Rust).
Relevance
The first steps in learning any program language are to:
- Set up your compiler or interpreter
- Set up your IDE
- Run a simple “Hello World” program
- Familiarize yourself with the style of the language
- Module 2 Objective Mapping
- Why Learn Python?
- Bookmark the CS 263 GitHub Repo
- A First Look at PEP 20 (The Zen of Python)
- Structure of a Basic Python Program
- Structure of a Python Program with Tests
- Python Style & PEP 8
- Procedural, Object-Oriented, and Functional
- Pythonic Code & “Good” Code
- Install Python 3.11 and VSCode
- Explore Some Example Code
- Module 2 Summary
3 Python Basics I - Variables & Functions (1 week)
Overview
This module will cover the use of variables and functions.
Objectives
At the conclusion of this Module students will be able to:
- Make use of variables to represent simple types (i.e.,
int
,float
,char
, andbool
). - Make use of variables to store strings.
- Write functions that accept zero or more arguments.
- Write functions that return zero values.
- Write functions that return one value.
- Write functions that return multiple values.
- Make use of modules to organize functions.
- Document functions with Type Hints & pydoc.
Relevance
Variables and functions are required to write code in any language. This allows for data to be stored, computations to be performed, and (after the next module) resulted to be output.
- Module 3 Objective Mapping
- Basic Data Types & Variables
- Basics of Functions
- Functions & Modules
- Exploring Functions
- Code Documentation & Type Hints
- Module 3 Summary
4 Python Basics II - Basic IO & F-Strings (1 week)
Overview
This module will cover the use of print
and input
to output to the command line and read from the command line, respectively. Basic formatting will be discussed with an emphasis on f-string syntax.
Objectives
At the conclusion of this Module students will be able to:
- Perform basic string manipulations (e.g., extract a substring).
- Perform basic string comparison using built-in functions (e.g.,
startswith
). - Extract data from user input (through
input
). - Write code that outputs to the command line.
- Make use of
f-string
syntax to format output (e.g., alignment, decimal precision, number of digits). - Discuss the benefits of f-string syntax over the use of
.format
and%
for formatting.
Relevance
For a program to be usable (i.e., have value) data must be output in a readable form. This output requires an understanding of the formatting mechanics of the selected language (in our case Python)
- Module 4 Objective Mapping
- String Manipulation & Comparison
- User Input & Standard Input
- Basic F-Strings
- Playing With Strings
- Module 4 Summary
5 Python Basics III - Conditional Blocks & Loops (1 week)
Overview
This Module will cover the basics of loops, conditional blocks, and command line arguments.
Objectives
At the conclusion of this Module students will be able to:
- Extract data from command line arguments (through
sys.argv
). - Utilize
while
loops. - Utilize
for
loops. - Utilize conditional blocks that make use of
if
,elif
, andelse
.
Relevance
An understanding of loops and conditional blocks is necessary to write any code that deals with large sets of data (e.g., assignment and grade data within Canvas).
- Module 5 Objective Mapping
- Command Line Arguments
- Conditional Blocks & "while" Loops
- "for" Loops
- Finding Loops & Conditions
- Module 5 Summary
6 Collections - Lists, Tuples, and Dictionaries (1 week)
Overview
This Module will focus on Python lists and tuples to store data. This will include lists that contain elements of a single type and lists with elements of different types. Dictionaries will be briefly introduced as a point of comparison. However, a full discussion will be left to a data structures course.
Objectives
At the conclusion of this Module students will be able to:
- Compare Python
list
s to a Java/C++ arrays. - Utilize the
list
slice syntax. - Utilize List Comprehensions and generator expressions.
- Compare lists and tuples in the context of mutability.
- Make use of built-in functions such as
sum
,min
, andmax
to perform aggregate operations on collections. - Make use of the built-in
sort
function. - Make use of the built-in
sort
function with a providedkey
argument. - Describe when a dictionary is appropriate over a list.
Relevance
To store, generate, and process information knowledge of how to select, interact with, and compose various data structures is necessary.
- Module 6 Objective Mapping
- The Basic Python Data Structures
- Comprehensions - An Overview
- Working with Python's list
- Working With Data
- Module 6 Summary
7 File IO, Context Managers, and Exceptions (1 week)
Overview
This Module will focus on working with files. This will include making use of context managers and handling exceptions such as ValueError
and IndexError
.
Objectives
At the conclusion of this Module students will be able to:
- Write code to read data from a plaintext file
- Write code to write data to a plaintext file
- Make use of the
with
context manager to guarantee input and output files are closed - Discuss context managers in the context of scope
- Write code to handle specific exceptions (e.g.,
ValueError
) - Refactor code to make use of context managers.
- Discuss why a single bare
except
that handles all possible exceptions is considered bad practice
Relevance
Most programs interact with files in some way (e.g., your IDE when writing Python code). Without a knowledge of how to read from and write to files… it is impossible to write code to solve all but the simplest of tasks.
- Module 7 Objective Mapping
- Context Managers
- Basic Exceptions
- Exceptions & File Parsing
- Dealing With Exceptions
- Module 7 Summary
8 Writing Pythonic Code, Code Linting, and Testing with PyTest (1 week)
Overview
There are many best practices applied in well written Python code. These are considered Pythonic. While an exhaustive list of practices cannot be covered in a single module… we can extend the PEP 8 and PEP 20 discussions from Module 2.
Objectives
- Summarize how testing can be incorporated into the refactoring process
- Discuss regression testing in the context of refactoring
- Write tests for an existing codebase
- Add pydoc documentation for an existing codebase
- Discuss best practices for
import
statements - Discuss the benefits of
isort
,black
andpytest
- Discuss the functionality of
isort
,black
andpytest
- Identify style and naming issues in an existing codebase
Relevance
Well-written code allows is more readable and maintainable. Test Driven Development (TDD) is a stable of modern development.
- Module 8 Objective Mapping
- Types of Tests
- Refactoring & Regression Testing
- Refactoring & Code Style
- Refactoring & Adding Functionality
- Module 8 Summary
9 Modules, Classes, & Objects (1 week)
Overview
In this Module we will discuss the basics of separating Python code into multiple .py
files. We will also discuss best practices for writing Python classes.
Objectives
After completing this module students will be able to:
- Map existing knowledge of object oriented C++ or Java onto Python.
- Utilize properties and setters.
- Explain how to implement
__eq__
and__hashcode__
. - Explain how to implement
__str__
. - Define the concept of a Python module and compare it to a Java
package
or C++namespace
. - Apply the
D.R.Y
principle. - Summarize the justification for a formal class checklist.
- Describe the emergent nature of a class checklist.
Relevance
There are many options for writing classes in Python (e.g., from scratch, with an @dataclass
decorator). Familiarity with these aforementioned options along with a knowledge of separating code into modules are expected on software engineering projects.
- Module 9 Objective Mapping
- What is A Module?
- The C++ and Java Class Checklists
- Using the C++ Class Checklist
- Using the Java Class Checklist
- The Python Class Checklist
- Using the Python Class Checklist
- Assembling Classes
- Module 9 Summary
10 Polymorphism, Interfaces, and Protocols (1 week)
Overview
This module discusses the notion of Inheritance in OOP. This includes an
- exploration subtyping as it relates to inheritance
- introduction to function overriding.
Objectives
After completing this module students will be able to:
- Summarize the difference between inheritance and subtyping.
- Implement the Python deep copy (i.e.,
__deepcopy__
) alongside an inheritance hierarchy. - Discuss Protocols vs. ABCs.
- Discuss Liskov substitution (S.O.L.I.D.).
- Explain how to implement
__iter__
. - Describe the use of an inner class in the context of abstraction and encapsulation.
- Apply the principles defined by
S.O.L.I.D
.
Relevance
Almost all modern code makes use of Iterators, Collections, and Protocols. The ability to recognize these abstractions, design code around them, and make use of them from external libraries is a fundamental skill in software engineering.
- Module 10 Objective Mapping
- Building a Linked List - Part 1
- Building a Linked List - Part 2
- Building a Linked List - Part 3
- Protocol vs Abstract Base Class
- Gathering Iterables
- Module 10 Summary
11 NumPy (1 week)
Overview
While Python does technically have an array type, it is not used by most Python projects. In most numerical applications, NumPy is used due to its performance, built-in functionality, and numpy.array
.
Objectives
At the conclusion of this Module students will be able to:
- Create an empty (uninitialized)
numpy.array
. - Create a
numpy.array
initialized to all zeroes. - Create a
numpy.array
initialized to all ones. - Create a
numpy.array
ofint
s from a Python list. - Create a
numpy.array
offloat
s from a Python list. - Obtain the dimensions of a
numpy.array
usingshape
. - Write and rewrite code to make use of NumPy’s broadcast functionality in place of a loop.
- Perform basic statistical analysis (e.g., mean, min, max, and standard deviation) using NumPy.
- Explain the
axis
parameter. - Summarize the performance (runtime and memory utilization) of NumPy in comparison the Python
list
s.
Relevance
Well-known data science libraries, such as Pandas, rely on NumPy. Even if you do not create NumPy arrays directly… you will still end up working with them.
- Module 11 Objective Mapping
- Creating Arrays
- Broadcasting
- Statistics
- NumPy & Multi-Dimension Arrays
- NumPy & Multi-Dimension Arrays - Refactoring
- NumPy & Multi-Dimension Arrays - NumPy Magic
- Hastening to NumPy
- Module 11 Summary
12 Semester Review & Things To Explore (1 week)
Overview
This is a Pseudo-Module. There is no new material (e.g., languages, paradigms or patterns) covered. This Module is an end-of-semester wrap up. We will revisit selected topics and lectures from throughout the semester.
Lectures and topics from the entire course will be covered on the Final Exam. The lectures listed here serve as a good starting point for a final review. Use them to determine how much time you need to dedicated to reviewing each module.
Modules 10 and 11 were covered fairly recently. Be sure to go back through both modules as part of your review.
- Structure of a Basic Python Program
- Structure of a Python Program with Tests
- Python Style & PEP 8
- Pythonic Code & "Good" Code
- Working with Python's list
- Basic Exceptions
- Exceptions & File Parsing
- What is A Module?
- The Python Class Checklist
- Using the Python Class Checklist
- Complete the Final Exam
13 Postscript
All times in this schedule are given in Eastern Time.
Symbol Key | |
---|---|
Lecture: | |
Slides : | |
Event or important date | |
Read | |
Do lab: | |
Assignment: | |
Take the | |
Do: | |
In your recitation section: | |
Under construction: |
14 Presentation
Topics | Lectures | Readings | Assignments & Other Activities |
---|---|---|---|
topics | lecture slides event exam video project construct | text | exam asst selfassess exam activity lab |
Document Kind | Prefix |
---|---|
lecture | Read |
event | |
exam | Take the exam: |
lab | Do: |
asst | |
reading | Read (optional) |