## 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 method
• for loops
• Java GUIs with the Swing library
• Using the UNIX command line interface (CLI) with the Terminal application
• Calling javac from the CLI
• Homework: Assignment #0
• Due Sunday, Jan 29 before 11:59pm
• Lab: No lab this week

#### 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:
• 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:
• 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
• Code Used in Class:
• 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
• 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 after main() and before fact(5)”. These comments are incorrect. In fact, main pushes printf on the stack after fact(5) is popped off; the instructor omitted this detail, but his explanation is the correct one.
• 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
• 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
• 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
• Homework: Tetris, Part 3
• Due Tuesday, Mar 21 before 11:59pm
• Lab: Lab #6

• Spring Break

#### Week of 3/20

• Lectures: Monday 3/20 and Wednesday 3/22
• Topics:
• Polymorphic code using Java generics
• Java generics
• read “Why Use Generics?”, “Generic Types”, “Raw Types”, “Bounded Type Parameters”, and “Generic Methods and Bounded Type Parameters”
• Code Used in Class:
• Generic classes:
• Generic static methods:
• Binary search over int arrays:
• Search modified to work with double arrays
• This doesn’t work. Why?
• This does work, along with my Comparable<Cat>
• 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
• 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
• Code Used in Class:
• Binary trees
• IList.java
• List.java
• Challenge question: Suppose we decide to add void setNext(IList<T> next); to our IList. This raises a problem when we try to implement setNext in our concrete List class.
• (easy!) What is the problem?
• (less easy) Why does it happen?
• (hard) How can you fix IList to make it possible to declare a setNext 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
• 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
• 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
• 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:
• Sorting
• Merge sort
• Quick sort
• XML
• Course evaluations
• 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
• Homework: No homework
• Lab: No lab

## Getting Help

If you need extra help, there are three primary resources available to you.

1. Meet with your TAs: See TA schedule.
2. Meet with your lab instructor:
Amy Tayloe
E-mail: atayloe@mtholyoke.edu
Office Hours: Monday-Thursday 4:05 - 5:05pm in Clapp 202
Self-scheduled in Clapp 202 or Kendade 310
3. 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:

1. The course discussion page on Piazza.
2. 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

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%

#### 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”)

1. Many of your assignments and labs will be submitted online. To submit, save your final files in your dev folder on athena.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).

2. 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 a README text file that lists the changes you’ve made, as this will help us with grading.

3. 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%.

4. 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!

5. 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

• Organize study groups,
• Consult other books or the Internet for inspiration and clarifications,

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!

#### 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

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.

## 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).