UCSB CMPSC 8: Introduction to Computer Science

also: CMPTGCS 20: Introduction to CS for non-majors

CMPSC 8 is a course taught in the Dept. of Computer Science at UC Santa Barbara.

A course covering many of the same topics, “Introduction to CS for non-majors” is occasionally taught in CCS under the number CMPTGCS 20.

This site is maintained in this github repo: https://github.com/ucsb-cs8/ucsb-cs8.github.io. If you are a faculty member or TA that should have access to this page, contact Phill Conrad or Diba Mirza to request permission.

Which course should I start with? CS8 or CS16?

If you are taking your first course in Computer Science at UCSB, you may be wondering whether you should start in:

  • CS8, which is intended as a first course in Programming
    • CS8 targets folks that have never programmed before, and it is taught in Python
  • CS16, which is intended as a second programming course.
    • CS16 is taught in C++
    • CS16 does not assume prior background in C++
    • BUT, CS16 DOES assume prior background in programming (e.g. AP CS taught in Java)

So, there are some easy cases:

  • If you have never programmed before, you should start with CS8.
  • If you are proficient in Python or Java and confident of your programming abilities, but have not programmed in C++ before, you should start in CS16.

More nuanced cases are these:

  • If you already do have some programming background, but you are not particularly confident of those abilities, or it’s been a while and you need a refresher, you should likely start with CS8.
  • If you are proficient in C++ itself as a result of taking community college courses, check https://assist.org to see if those courses articulate to CS 16 (officially known as CMPSC 16) at UCSB. If so, you may be able to start directly in a later course such as CMPSC 24.

If you are still not sure, you may need to talk with an adviser. Brand new students can do this during summer orientation sessions when they register for courses. Continuing students may visit the CS adviser in the main CS office on the 2nd floor of Harold Frank Hall.

Textbooks

  • assignment statements—giving a value to a variable, e.g. x=5
  • boolean expressions—and, or, not and De Morgan's law
  • command line arguments—passing command line arguments to a Python Script
  • CSV files—reading and writing CSV (Comma Separated Value) files in Python
  • dictionaries—Mappings from keys to values
  • files—reading and writing files in Python
  • float—the data type that represents real numbers
  • for loops—for loops in Python, from basic to advanced
  • format—dealing with stuff such as print('a={0:5} b={1:7}'.format(a,b)
  • functional programming—an advanced topic; an alternative to iteration and recursion
  • json—Access JSON data in Python
  • MacOS—Using Python on MacOS
  • main blocks—All about that crazy looking `if __name__=="__main__":` thing that you see in some Python code
  • pytest—Unit Testing with the pytest module
  • Python 2 vs. Python 3—Understanding the difference and why it matters
  • recursion—functions that call themselves
  • scientific computing—Python tools for science and data analysis
  • Python: selenium—Automating a web browser (for web scraping)
  • Testing—Simple Interactive Testing of Python functions, and pointers to more advanced testing techniques
  • Turtle Graphics—Some basics about turtle graphics
  • Python: unittest—module for test-driven development in Python

Tutorials