Foundations of Computing -- Lecture Slides Dan
Winter 2013


Lecture slides and related source code will be posted by Dan here.

Dan's Lectures

Date Topic(s)
2012-01-07 Introduction
week 1, week 2 What is programming? Structure of a Java program.
week 3 Variables, expressions, and types; Reading from the keyboard; Writing to the screen.
week 4 Using library methods, writing your own methods, if statements, boolean expressions, and comments.
week 5 Loops and iterative methods: while loops, for loops, nested loops, static variables.
week 6, week 7 Arrays, Basics of reference types, Examples of loops
week 7, week 8 Object Oriented Programming basics
  • Unit6 (draft)
  • Jorg's slides
  • (example using public properties which is a bad habit)
  • (example using private properties which take a bit more time to set up, but are definitely worthwhile in the end)
  • (Demonstrates 3 ways of calculating the same thing. One with 3 arrays, one with Point which uses public properties (bad), and finally with Point2 which uses private properties (best method) You need to compile this with the and files since it uses them.
  • Card example mentioned in notes for unit 6. It should be viewed at the same time as . It is another example of using objects. (We'll get to this in class next week)
One key thing to get out of the Card and Point examples is that by making properties PRIVATE we have much more control over them. We can go through the file, check all the times that suit was set to different values, and make sure it never has an illegal value.
week 9 More advanced objects/generics: ArrayList, HashSet, HashMap
Week 10 Recursion
  • Unit8
  • Fibonacci.txt
  • (This took 1 hour to run on my computer and calculate fib(55). If you increase the size of the input by 1, I expect it to be 2 hours, increase by 2 is 4 hours, etc. Each time you increase the size by 1 it doubles the size)
  • (This was basically instantaneous to calculate fib(65). The biggest limitation is running into the maximum size of an int. Perhaps we could use long to avoid this issue or at least delay that)
  • (compiles and runnable)
  • (compiles and runnable)
  • The spellchecker main method requires a file to be present in the same folder as the .java file. The file is a dictionary of all the words you want to compare it with, one word per line. I have tested on 2 sample dictionaries: one of all the hockey teams and one of an English dictionary I found on the web. The English dictionary is too big and at least on my computer the program doesn't terminate.
  • HockeyDictionary.txt A small dictionary that works with the spell checker
  • Dictionary.txt A large dictionary that is too big for my computer to handle the recursion of EACH word on
  • (used with example)
  • (compiles and runnable) Note: You are not responsible for understanding every detail of the code to be able to write it. But you should understand the general idea of it.
Week 11 Exception Handling
  • Unit9
  • (example of using try/catch)
  • NotesOnFolderExample.txt (notes directly from class so may contain compiler errors, etc)
  • See the evaluation section with the practice final exams as well as the final exam "road map" shown in class.
Review Examples