Expand all sections
Course Schedule
Week of 1/25
- Lectures: We meet only on Wednesday 1/25 this week.
- Topics:
- Introduction to COMSC 201
- MaGE program introduction
- Note: homework assignments and labs work differently than in COMSC 101
- Java review
main
methodfor
loops
- Java GUIs with the Swing library
- Using the UNIX command line interface (CLI) with the Terminal application
- Calling
javac
from the CLI
- Calling
- Introduction to COMSC 201
- Readings:
- Readings are intended for you to read before you attend class.
- Make sure you understand HelloWorld.java! If you don’t, come prepared with questions.
- Java and OOP review
- Programming Guidelines
- Homework: Assignment #0
- Due Sunday, Jan 29 before 11:59pm
- Lab: No lab this week
Week of 1/30
- Lectures: Monday 1/30 and Wednesday 2/1
- Topics:
- Interfaces
- Primitive types vs reference types
- Sorting
- Selection sort
- Insertion sort
- Bubble sort
- Readings:
- For Monday:
- Read the first 3 paragraphs of this wikipedia post on Modular Programming (this explains why we have interfaces).
- Java documentation on interfaces (this explains how Java makes use of interfaces). You should read at least the first page, but feel free to read up to the “Summary of Interfaces” subsection.
- For Wednesday:
- Wikipedia article on selection sort.
- Wikipedia article on insertion sort.
- Wikipedia article on bubble sort.
- For Monday:
- Code Used in Class:
- Simple interface example:
- driver code: Honker.java
- interface: Honkable.java
- implementation #1: Car.java
- implementation #2: Goose.java
- Interfaces/sorting example:
- driver code: Top5.java
- interface: Top5able.java
- implementation #1: Top5ArrayBuiltInt.java
- implementation #2: Top5ArraySS.java
- Short tutorial on how to use the command line to create, edit, compile, and run a Java program:
- Simple interface example:
- Additional Resources:
- Homework: Assignment #1
- Due Tuesday, Feb 7 before 11:59pm
- Lab: Lab #1
Week of 2/6
- Lectures: Monday 2/6 and Wednesday 2/8
- Topics:
- Inheritance
- Keyword
static
- Recursion
- Readings:
- Java documentation on inheritance
- Java documentation on keyword static
- Java documentation on access modifiers
- Javadoc for the Java Math class. Notice anything funny about this class? (hint: try looking for some non-static methods)
- Swing-related documentation (helpful for Assignment #2!)
- Once you understand Swing’s rationale (which I explained in class), feel free to try some of this tutorial that will clarify the relationships of many of the components.
- Code Used in Class:
- Inheritance example:
- driver code: CycleShop.java
- superclass: Cycle.java
- subclass #1: RoadBike.java
- subclass #2: Tricycle.java
- A simple Swing app that draws circles where you click
- Inheritance example:
- Homework: Assignment #2
- Due Tuesday, Feb 14 before 11:59pm
- Lab: Lab #2
Week of 2/13
- Lectures: Monday 2/13 and Wednesday 2/15
- Topics:
- Binary search
- computing Fibonacci numbers
- Tower of Hanoi
- Code Used in Class:
- Binary search:
- Sum of list elements and fizzbuzz:
- Linked list class: List.java
- Driver code: ListDriver.java
- FizzBuzz.java
- Sum.java
- Fibonacci number
- Tower of Hanoi
- Readings:
- Wikipedia article on the Tower of Hanoi game. Pay special attention to the section titled “recursive solution”. Do not worry about the iterative solution.
- Video:
- Exact Instructions Challenge: Peanut Butter & Jelly Sandwich
- I just thought that this was entertaining. It also resembles programming a computer, with the small exception that programming a computer is usually less funny.
- Exact Instructions Challenge: Peanut Butter & Jelly Sandwich
- Homework: Assignment #3
- Due Tuesday, Feb 21 before 11:59pm
- Lab: Lab #3
Week of 2/20
- Lectures: Monday 2/20 and Wednesday 2/22
- Topics:
- What happens when code executes
- Memory
- Lexical scope
- Design documents
- Code skeletons and method stubs
- Intro to Model-View-Controller (MVC) design pattern
- What happens when code executes
- Code Used in Class:
- Linked List code (again)
- Try setting a breakpoint and then step through this code in Eclipse
- Watch what happens in the following windows:
- code window
- call stack window
- local variables window
- Run and rerun this program using the “Step Over”, “Step Into”, and “Continue” buttons until you understand what they do
- App.java
- List.java
- Clock based on the Model-View-Controller design pattern
- Linked List code (again)
- Video:
- The call stack
- A nice video that shows the call stack in action for a recursive implementation of factorial. Note that this video goes into less detail than we did in class, but it still captures the general idea of what the call stack does.
- Also note that the comments (and some popup captions) claim that the video is wrong because
printf
should be “on the stack aftermain()
and beforefact(5)
”. These comments are incorrect. In fact,main
pushesprintf
on the stack afterfact(5)
is popped off; the instructor omitted this detail, but his explanation is the correct one.
- The call stack
- Readings:
- Optional reading: Inside the Java Virtual Machine
- I don’t expect you to read the above link, which tells you how the JVM works in gory detail. But if you’re curious, have a look! You’ll notice that the example I went through in class in “excruciating detail” actually still left out many details. Note that the JVM is still simpler than a real computer processor!
- Practice midterm exam
- Optional reading: Inside the Java Virtual Machine
- Homework: Tetris, Part 1
- Due Tuesday, Feb 28 before 11:59pm
- Lab: Lab #4
Week of 2/27
- Lectures: Monday 2/27 and Wednesday 3/1
- Topics:
- More on the MVC design pattern
- Short exam review
- Exam!:
- In-class, closed-book midterm on Wednesday 3/1
- Readings:
- Homework: Tetris, Part 2
- Due Friday, Mar 10 before 11:59pm
- Lab: Lab #5
Week of 3/6
- Lectures: Monday 3/6 and Wednesday 3/8
- Topics:
- Tetris design discussion
- Unit testing with JUnit
- Readings:
- Homework: Tetris, Part 3
- Due Tuesday, Mar 21 before 11:59pm
- Lab: Lab #6
Week of 3/13
- Spring Break
Week of 3/20
- Lectures: Monday 3/20 and Wednesday 3/22
- Topics:
- Polymorphic code using Java generics
- Readings:
- Java generics
- read “Why Use Generics?”, “Generic Types”, “Raw Types”, “Bounded Type Parameters”, and “Generic Methods and Bounded Type Parameters”
- Java generics
- Code Used in Class:
- Generic classes:
- Try making your own class (e.g.,
Dog
) and see if you can modifyLeetApp
to work with it. - LeetApp.java
- LeetSpeak.java
- Person.java
- Cat.java
- Try making your own class (e.g.,
- Generic static methods:
- Binary search over
int
arrays: - Search modified to work with
double
arrays - This doesn’t work. Why?
- (hint: try compiling it)
- BrokenGenericBinarySearch.java
- This does work, along with my
Comparable<Cat>
- Binary search over
- Generic classes:
- Homework: Assignment #4
- Due Tuesday, Mar 28 before 11:59pm
- Lab: Lab #7
Week of 3/27
- Lectures: No class Monday 3/27; lecture only on Wednesday 3/29
- Topics:
- Stacks
- Queues
- Readings:
- Homework: Assignment #5
- Due Tuesday, Apr 4 before 11:59pm
- Lab: No lab this week
Week of 4/3
- Lectures: Monday 4/3 and Wednesday 4/5
- Topics:
- Binary trees
- Readings:
- Code Used in Class:
- Binary trees
- Linked list
- IList.java
- List.java
- Challenge question: Suppose we decide to add
void setNext(IList<T> next);
to ourIList
. This raises a problem when we try to implementsetNext
in our concreteList
class.- (easy!) What is the problem?
- (less easy) Why does it happen?
- (hard) How can you fix
IList
to make it possible to declare asetNext
method?
- Homework: Assignment #6
- Due Tuesday, Apr 11 before 11:59pm
- Lab: Lab #8
Week of 4/10
- Lectures: Monday 4/10 and Wednesday 4/12
- Topics:
- Binary search trees
- Readings:
- Homework: Assignment #7
- Due Tuesday, Apr 18 before 11:59pm
- Bonus assignment (due any time before the final exam)
- Modify the following binary tree interface so that it can be implemented without using type casting:
- Implement a binary search tree using your new interface; do not use type casting anywhere in your implementation!
- Lab: Lab #9
Week of 4/17
- Lectures: Monday 4/17 and Wednesday 4/19
- Topics:
- Analysis of algorithmic run-time
- “Big-O” notation
- Decision trees
- Readings:
- Code Used in Class:
- Checking whether a binary tree is balanced.
- The interesting stuff is here:
- You also need these classes to make the compiler happy. Note that there is no implementation because I am posting this before your binary search tree assignment is due.
- Using Java’s (awful) XML utilities to read, parse, traverse, and write XML data
- Checking whether a binary tree is balanced.
- Homework: Final Project
- Due Monday, May 1 before 11:59pm
- Lab: Lab #10
Week of 4/24
- Lectures: Monday 4/24 and Wednesday 4/26
- Topics:
- Merge sort
- XML / Final Project
- Course evaluations open on Tuesday, April 25 on MyMountHolyoke
- Please fill one out!
- Readings:
- Sorting stability
- For fun: Jean Sammet, famous MHC alumna and programming language pioneer and COBOL, the language she designed with Grace Hopper and others.
- Code Used in Class:
- MergeSort.java
- If you are having trouble understanding a particular step, note that the
MergeSort
code I posted includes a handyprintArray
method that will help you inspect what the algorithm is doing.
- If you are having trouble understanding a particular step, note that the
- Diagram demonstrating divide and merge steps
- MergeSort.java
- Extra Resources
- Homework: No homework
- Lab: Lab #11
Week of 5/1
- Lectures: We meet only on Monday 5/1 this week.
- Topics:
- What to expect beyond CS201
- Final exam review
- Readings:
- Homework: No homework
- Lab: No lab