CS263, Fall 2023 (Development)

CS263 Outline

Fall 2023 (Development)

Upcoming Events
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:

  1. Explain the Syllabus.
  2. Explain the importance of Office Hours.
  3. Explain the importance of questions.
  4. Summarize the structure of this course.
  5. Summarize the structure of an assignment prompt.
  6. Summarize the content to be covered.
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:

  1. downloading a full set of all example code (in the form of a GitHub repository)
  2. running a basic Python program
  3. running a given set of tests using pytest

Objectives

At the conclusion of this Module students will be able to:

  1. Checkout the course example set GitHub Repository.
  2. Create a project in their preferred IDE: VSCode or Vim (with appropriate plugins).
  3. Run a provided Python program.
  4. Run a set of provided tests for a Python program.
  5. Describe the basic structure of a Python program.
  6. Discuss PEP 8.
  7. Discuss PEP 20.
  8. Discuss how to approach an somewhat unfamiliar language (e.g., Python or Rust).

Relevance

The first steps in learning any program language are to:

  1. Set up your compiler or interpreter
  2. Set up your IDE
  3. Run a simple “Hello World” program
  4. Familiarize yourself with the style of the language
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:

  1. Make use of variables to represent simple types (i.e., int, float, char, and bool).
  2. Make use of variables to store strings.
  3. Write functions that accept zero or more arguments.
  4. Write functions that return zero values.
  5. Write functions that return one value.
  6. Write functions that return multiple values.
  7. Make use of modules to organize functions.
  8. 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.

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:

  1. Perform basic string manipulations (e.g., extract a substring).
  2. Perform basic string comparison using built-in functions (e.g., startswith).
  3. Extract data from user input (through input).
  4. Write code that outputs to the command line.
  5. Make use of f-string syntax to format output (e.g., alignment, decimal precision, number of digits).
  6. 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)

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:

  1. Extract data from command line arguments (through sys.argv).
  2. Utilize while loops.
  3. Utilize for loops.
  4. Utilize conditional blocks that make use of if, elif, and else.

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).

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:

  1. Compare Python lists to a Java/C++ arrays.
  2. Utilize the list slice syntax.
  3. Utilize List Comprehensions and generator expressions.
  4. Compare lists and tuples in the context of mutability.
  5. Make use of built-in functions such as sum, min, and max to perform aggregate operations on collections.
  6. Make use of the built-in sort function.
  7. Make use of the built-in sort function with a provided key argument.
  8. 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.

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:

  1. Write code to read data from a plaintext file
  2. Write code to write data to a plaintext file
  3. Make use of the with context manager to guarantee input and output files are closed
  4. Discuss context managers in the context of scope
  5. Write code to handle specific exceptions (e.g., ValueError)
  6. Refactor code to make use of context managers.
  7. 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.

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

  1. Summarize how testing can be incorporated into the refactoring process
  2. Discuss regression testing in the context of refactoring
  3. Write tests for an existing codebase
  4. Add pydoc documentation for an existing codebase
  5. Discuss best practices for import statements
  6. Discuss the benefits of isort, black and pytest
  7. Discuss the functionality of isort, black and pytest
  8. 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.

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:

  1. Map existing knowledge of object oriented C++ or Java onto Python.
  2. Utilize properties and setters.
  3. Explain how to implement __eq__ and __hashcode__.
  4. Explain how to implement __str__.
  5. Define the concept of a Python module and compare it to a Java package or C++ namespace.
  6. Apply the D.R.Y principle.
  7. Summarize the justification for a formal class checklist.
  8. 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.

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:

  1. Summarize the difference between inheritance and subtyping.
  2. Implement the Python deep copy (i.e., __deepcopy__) alongside an inheritance hierarchy.
  3. Discuss Protocols vs. ABCs.
  4. Discuss Liskov substitution (S.O.L.I.D.).
  5. Explain how to implement __iter__.
  6. Describe the use of an inner class in the context of abstraction and encapsulation.
  7. 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.

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:

  1. Create an empty (uninitialized) numpy.array.
  2. Create a numpy.array initialized to all zeroes.
  3. Create a numpy.array initialized to all ones.
  4. Create a numpy.array of ints from a Python list.
  5. Create a numpy.array of floats from a Python list.
  6. Obtain the dimensions of a numpy.array using shape .
  7. Write and rewrite code to make use of NumPy’s broadcast functionality in place of a loop.
  8. Perform basic statistical analysis (e.g., mean, min, max, and standard deviation) using NumPy.
  9. Explain the axis parameter.
  10. Summarize the performance (runtime and memory utilization) of NumPy in comparison the Python lists.

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.

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.

All times in this schedule are given in Eastern Time.

Symbol Key
lecture Lecture:
slides Slides :
event Event or important date
text Read
lab Do lab:
asst Assignment:
exam Take the
activity Do:
recitation In your recitation section:
construct Under construction: