Overview
This course is intended to give you the skills needed to function as a software engineer. Lessons build on the basic programming concepts in COMSC 101. The emphasis is on learning tools and strategies that assure that your code will be correct, understandable, and maintainable. During the course, you will draw on these and other lessons to implement some widely-used data structures and algorithms. By the end of the semester, you will be able to build complex applications from scratch using only design documents.
Be prepared to spend a lot of time coding: this course is programming-intensive!
Instructor: | Daniel Barowy |
dbarowy@mtholyoke.edu | |
Lectures: | Monday & Wednesday from 11:00am–12:15pm |
in 206 Clapp Laboratory | |
Labs: | either Monday from 1:15–4:05pm |
or Wednesday from 1:15–4:05pm | |
in 202 Clapp Laboratory | |
Course website | https://dbarowy.github.io/mhc-comsc-201/ |
Piazza: | https://piazza.com/mtholyoke/spring2017/cs201 |
Moodle: | https://moodle.mtholyoke.edu/course/view.php?id=10815 |
Textbook: | None |
Prerequisites
- Problem Solving and Object-Oriented Programming (COMSC 101)
The goal of this prerequisite is to ensure that you have some experience programming in Java before you start learning more advanced concepts. In particular, before starting this course, you should be familiar with Java language concepts such as variables, functions, scope, conditionals and loops. You should also know what a class is and what arrays are. If you aren’t sure if you remember all of these things, that may be OK, but please come talk to me.
Course Topics
We will cover the following topics:
- General principles:
- Abstraction
- Recursion
- Inheritance
- Polymorphism
- Java language features:
- User-defined types
- Interfaces
- Recursive functions
- Abstract classes and subclasses
- Generics
- GUI programming with even-driven code
- Assertions
- JUnit test framework
- Some important algorithms:
- Sorting
- Searching
- Some important data structures:
- Arrays
- Lists
- Stacks
- Queues
- Binary trees
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
Getting Help
If you need extra help, there are three primary resources available to you.
- Meet with your TAs: See TA schedule.
- Meet with your lab instructor:
Amy Tayloe
E-mail: atayloe@mtholyoke.edu
Office: Kendade 310
Office Hours: Monday-Thursday 4:05 - 5:05pm in Clapp 202
Self-scheduled in Clapp 202 or Kendade 310 - Meet with your course instructor:
Daniel Barowy
E-mail: dbarowy@mtholyoke.edu
Office: 8 Park St., Room #31
Office Hours: Monday & Wednesday 9:00–10:45am in 8 Park St., Room #31
or by appointment (via e-mail)
I also encourage you to make use of resources like:
- The course discussion page on Piazza.
- Stack Overflow
Policies
Course requirements
- Weekly assignments (primarily programming)
- Weekly labs
- Mid-semester programming project
- Final programming project
- One in-class midterm exam
- A self-scheduled final exam in the final exam period
Grading
This class is designed so that if you regularly attend class & lab, participate, and turn in completed assignments on time, you can feel secure that you will earn a good grade in the course.
Assignments: | 40% |
Labs: | 10% |
Mid-semester project: | 10% |
Final project: | 10% |
Midterm exam: | 10% |
Final exam: | 10% |
MaGE participation: | 5% |
Class participation: | 5% |
Lab Grades
See the lab grading page here.
Attendance
Because we do not follow a course found in a textbook, class and lab attendance is important. You are responsible for material presented in class; be sure to ask questions if there are concepts you do not understand. If you miss a class, please ask a classmate for notes and see me or the lab instructor with any subsequent questions on covered material.
Classroom conduct
Cell phones should not be out during lectures. Laptop computers and tablets are allowed only for taking notes or following along with course materials. If you choose to use a laptop or tablet, you must sit in the front row of the classroom. Violations of these policies will affect the participation component of your final grade.
Submitting coursework (aka “How to get an A on homework”)
-
Many of your assignments and labs will be submitted online. To submit, save your final files in your
dev
folder onathena.cs.mtholyoke.edu
(the CS department server) by the deadline. Please note that anything on the Desktop or other folders of the lab Macs will disappear forever when you log out (see the CS help site). -
Important: do not modify files beyond the submission date! If you decide to work out some bugs after the deadline, do so in a
postSubmission
directory. Include aREADME
text file that lists the changes you’ve made, as this will help us with grading. -
You must have comments in your code! Poor commenting or missing
javadocs
(after we have seen automatic documentation) will result in a deduction of up to 10%. -
Your program must compile! Non-compiling code will result in an automatic deduction of 25%. It is better to submit a program that works but does not satisfy all required behavior than a program that attempted to do everything, but does not run!
-
A and A- level work means quality programs that run, do what they are supposed to do, are well designed, well documented and submitted on time.
Late policy
You have 4 “free” late days to use on assignments throughout the semester. These may not be applied to the mid-semester project (Tetris) or the final project (20 Questions)!
To use a late day, you must fill out this late day Google form prior to the assignment due date. You will need to specify:
the number of late days being used for the submission the number of late days you have remaining If you do not use all your late days, each unused day (max of 4) will transform into an extra 1/8 point (i.e., up to 0.5) on your final course grade.
If you run out of late days, you may submit beyond the deadline with a penalty of 10% per day late.
Honor Code
REMINDER: YOUR CONDUCT IN THIS COURSE MUST FOLLOW THE ACADEMIC HONOR CODE! You are encouraged to
- Speak with your classmates about the lab and homework,
- Organize study groups,
- Consult other books or the Internet for inspiration and clarifications,
- Ask the lab instructor or TA to help you find bugs in your code,
but it is very important to be sure that
- All the work that you submit is your own: it is against the honor code to have somebody else do the assignment for you (including TAs or tutors) or to copy it from somewhere else (including books or the internet).
- You acknowledge classmates or TAs that you worked with for each assignment–this should be done in a comment at the top of your main source code file.
- I understand that a great way to learn about new technology is by adapting code snippets found online; however, this enters very sensitive territory! For most of the assignments, you should not be adapting code you’ve found online; you may, of course, adapt code from the course web site. In some rare situations, there will be cases where it is appropriate to use other online resources (e.g., when using Java swing libraries we have not explicitly worked through in class or lab). Any code that you adapt MUST be properly referenced (e.g., give the URL of the site you obtained the original from)! I expect to see comments where you have modified the original code. If you are at all unsure about what is acceptable, contact one of the instructors.
- We automatically compare all code submissions to other submissions from this semester and past semesters. I assure you that if you copy someone else’s homework, you will be caught!
Access to CS Network
CS Lab
You will be given
- An account on the Computer Science network, with the same username and password as you MHC account
- Access to the Clapp 202 and Kendade 307 labs, which is equipped with Macs on the Computer Science network
- See the CS help site for more information
Remote Access to CS Network
If you wish to work on a computer not in the lab (e.g., your personal computer or a LITS machine), you are responsible for transferring your files to the CS network for submission or when asking for debugging assistance.
- To access and change your files from your own computer while you are on campus, follow these instructions.
- To access the network from off-campus, connect via these instructions first, then follow the instructions above.
Resources
There is no required textbook for this course. That said, I strongly encourage you to supplement your study with at least one of the following books:
-
Learning Java, 4th edition, Patrick Niemeyer and Daniel Leuck, O’Reilly, 2013. Book on 3-hour reserve at the library. eBook available through LITS > Safari Online Books.
-
Head First Java, 2nd edition, Kathy Sierra and Burt Bates, O’Reilly, 2005. eBook available through LITS > Safari Online Books.
-
Data Structures and Other Objects Using Java, 4th edition, Michael Main, Addison-Wesley, 2012. Physical textbook on 3-hour reserve at the library.
You should also become familiar with the Java API documentation, as you will likely need to refer to it for as long as you are a Java programmer. Bookmark this page!
Here are some other useful references:
Java Programming Language: | Java API |
Java Tutorial on GUI layout | |
CS 101: Intro to Java notes, lab | |
UNIX Operating System: | COMSC 101 UNIX Basics |
General Programming: | Programming Guidelines |
COMSC 201 Video Tutorials: | Micro-Tutorials on YouTube |
COMSC 201 Notes: | notes |
Accommodations
If you have a disability for which you require accommodations, please make an appointment to see the instructor within the first two weeks of classes so that we can make appropriate arrangements. You will need to have a letter from the AccessAbility Services Office, located in Wilder Hall B4 (phone: 413-538-2634, Accessability-services@mtholyoke.edu).