NYU Prison Education Program: Introduction to Computer Science & Code

Summer 2019
Prof. Arlene Ducao, arlduc [at] nyu.edu
Wednesdays, 12:15-3:15 PM
Wallkill State Correctional Facility

Overview

This course will prepare students to write basic software and web pages, and it will introduce a full foundation of computer science and design coding concepts that can be applied to many kinds of technical projects. Students will be exposed to Python, HTML, CSS, and the Unix operating system. This course will take place in the computer lab, so concepts will be demonstrated and discussed through hands-on computer exercises and assignments. Concepts include data types, data structures, syntax, tags, elements, attributes, functions, variables, expressions, inheritance, statements, and version control. 

Learning Goals

  1. Learn basic computer science concepts, including data types, non-decimal numeric systems, data structures, input and output, conditions, and iteration.
  2. Work with an IDE (integrated development environment).
  3. Write basic back-end functionality with Python.
  4. Write basic front-end styles with HTML and CSS.
  5. Learn best practices for writing code that other people can read.

Schedule

This is an approximate schedule. It is subject to change based on the general work pace of the computers and the students.

  1. Introduction & Best Practices
  1. Introduction and Best Practices
    • Python: The Way of the Program
    • HTML/CSS: Structure
    • Other: PyCharm, Notepad, Explorer. Non-decimal numerical systems (binary and hex), Boolean logic, data types.
  2. Introduction Continued
    • Python: Variables, Expressions, Statements
    • HTML/CSS: Text
  3. Writing Programs and Building Structure
    • Python: Functions
    • HTML/CSS: Lists
  4. Case Studies: Designs
    • Python: Case Study: Interface Design
    • HTML/CSS: Links
  5. More Structure
    • Python: Conditionals and Recursion
    • HTML/CSS: Images
  6. Input and Output
    • Python: Fruitful Functions
    • HTML/CSS: Tables
  7. Looping Forward
    • Python: Iteration
    • HTML/CSS: Forms
  8. Strings and Styles
    • Python: Strings
    • HTML/CSS: Extra Markup
  9. Case Study and Cascading Styles
    • Python: Case Study: Word Play
    • HTML/CSS: Introducing CSS
  10. More Structure and Style
    • Python: Lists
    • HTML/CSS: Color
  11. Data Relationships
    • Python: Dictionaries
    • HTML/CSS: Text
  12. Wrap Up
    • Python: Tuples and Beyond
    • HTML/CSS: Boxes and Beyond

Course Books

Grading

Grades will be based on weekly assignments, which can be started in class. Grades are calculated as follows:

  • 30% Structure: Are all the parts of the program set up?
  • 25% Implementation:  Are all the parts of the program completed?
  • 25% Style: Have you thoughtfully used comments, variable naming, and function naming so as to help make the code understandable? Is your code organized and well indented? Is your code authored by you?
  • 20% Function:Does the program run on the computer properly? NOTE: This part can take the longest, so for the short assignments in this class, I recommend that you draft out the structure, basic implementation, and style first.

A Short Style Guide

Based on several Google Style Guides. We will refer to this guide throughout the semester, and I’ll use it for the “Style” component in grading.

Optimize for the reader, not the writer
Codebases often have extended lifetimes and more time is spent reading the code than writing it. Choose to optimize for the experience of the average software engineer reading, maintaining, and debugging code rather than the ease of writing said code. For example, when something surprising or unusual is happening in a snippet of code, leaving textual hints for the reader is valuable.

  • PROGRAM STYLE
    • Import all external packages at the beginning of your program, just after any module comments and docstrings and before module globals and constants.
    • Indentations: Be consistent in your indentations. PyCharm should auto-format your code, but I recommend indenting your code blocks with 4 spaces or 1 tab. Never use tabs or mix tabs and spaces, because this will cause an error when you run your code.
    • Maximum line length should generally be 80 characters. Exceptions:
      • Long import statements.
      • URLs, pathnames, or long flags in comments.
    • Generally place only one statement (conditionals and iterations) per line. However, you may put the result of a test on the same line as the test only if the entire statement fits on one line.
    • Functions: Try to keep them short. Long functions are sometimes appropriate, so no hard limit is placed on function length. If a function exceeds about 40 lines, think about whether it can be broken up without harming the structure of the program.

  • NAMING STYLE
    • Function names, variable names, and file names should be descriptive; avoid abbreviation. In particular, do not use abbreviations that are ambiguous or unfamiliar to readers outside your project, and do not abbreviate by deleting letters within a word.
    • Always use a .py filename extension. Never use dashes or hyphens.
    • Do not use single character names except for counters or iterators.
    • Guidelines derived from Google’s Python Recommendations:
TypeStyle
Functionslower_with_under()
Global ConstantsCAPS_WITH_UNDER
Global Variableslower_with_under
Local Variableslower_with_under
  • COMMENTING STYLE
    • Add an explanatory comment above every conditional and iterative statement. Example:
      # Iterate through each person in class
      for y in our_cs_class
    • Use docstrings! We will learn about them in class.
    • Add short inline comments to help explain potential surprises. Example:
      print(eggs + chocolate + plantain_chips) #not printing cheese yet

Academic Honesty

All work for this class must be your own and specific to this semester. Any work recycled from other classes or from another, non-original source will be rejected with serious implications for the student. Plagiarism, knowingly representing the words or ideas of another as one’s own work in any academic exercise, is absolutely unacceptable. Any student who commits plagiarism must re-do the assignment for a grade no higher than a D. In fact, a D is the highest possible course grade for any student who commits plagiarism.