CMSC 131 - Object Oriented Programming I



Class:

Discussions:

This is a first programming course for Computer Science majors with a focus on object-oriented programming. The goal of the course is to develop skills such as program design and testing as well as the implemetation of programs using a graphical IDE. All programming will be done in Java.

Major Topics

  • Introduction to Computer Systems
  • Programming basics: variables, operators, expressions, statements, methods
  • Java text input/output
  • Conditionals
  • Loops
  • Principles of Object Oriented Programming
  • Basics of program design
  • Testing and debugging
  • Java memory map
  • Arrays and Java arraylists
  • Java interfaces
  • Inheritance
  • Recursion

Class Announcements

  • 11/29/2018
    • Project 7 (Fish Club) has been posted.

  • 11/10/2018
    • Project 6 (Cafe 131) has been posted.

  • 10/30/2018
    • Project 5 (Poker Simulator) has been posted.

  • 10/20/2018
    • Project 4 (Mandelbrot Set) has been posted.

  • 10/09/2018
    • Project 3 (Medieval Soldiers) has been posted.

  • 09/23/2018
    • Project 2 (Flags of the World) has been posted.

  • 09/13/2018
    • Project 1 (Orioles Baseball) has been posted.

  • 09/07/2018
    • The lecture slides are posted under the Schedule tab.
    • I have included the calculation for finding the range of a data type in today's lecture slides. Sorry for the confusion in the class.

  • 09/05/2018
    • The deadline for Project 0 has been extended. The new due date is 09/12 at 11:00 PM.
    • This is where class announcements will be posted. Please check this page regularly.

Schedule

Exam Dates:


  • Midterm #1: Monday, October 8th, in Lecture.
  • Midterm #2: Monday, November 19th, in Lecture.
  • Final Exam: Thursday, December 13th, 4:00 - 6:00 PM, Location: LEF 2205

Lectures (Tentative)


Week Starting Monday Wednesday Friday
08/27 Course Intro

Lecture 01 Slides
Eclipse Demo, Computer Systems (hardware/ software)

Lecture 02 Slides
RAM, Data Storage, Programming languages Compilers/Interpreters

Lecture 03 Slides
09/03 No Class (Labor Day) Intro to Java, local variables, primitive types

Lecture 04 Slides
Strings, concatenation, more about types

Lecture 05 Slides
09/10 Scanner,Arithmetic Operators, integer division

Lecture 06 Slides
escape sequences, comparison and, equality operators, comparing objects.

Lecture 07 Slides
named constants, logical operators, If and if-else statements, nesting if and if-else statements, "else if" style, programming style / indentation errors

Lecture 08 Slides
09/17 Programming errors, Variable scope and initialization, choosing identifiers

Lecture 09 Slides
Intro to repetition.While loops,do-while loops, for loops.

Lecture 10 Slides
Nested loops, for and do-while
09/24 More nested loops, Writing static methods, Project #2 posted

Lecture 12 Slides
More nested loops & static methods

Lecture 13 Slides

What are objects? Java classes, instance variables, instance methods, memory diagrams, assignment with references, garbage collection.

Java Classes Intro
10/01 == vs. equals, writing a typical Java class (return statements), Continue writing a typical class (equals method, static vs. instance methods)

Lecture 15 Slides
constructors, Summary and review of variables, More memory diagrams Review for Midterm

Lecture 17 (Review) Slides
10/08 Midterm #1 Variable types (static, instance and local), method parameters and return, prototyping, constructors copy contructor,toString,basic equals method
10/15 equals method overriding java, variable shadowing, Java keyword "this" , Code correctness, formal verification, testing, JUnit

Lecture 22 Slides
Some more JUnit tests, Copy Constructor and Java "this" keyword, Memory diagram for method calls.
10/22 Encapsulation, public vs. private visibilities, Floating point error, Java packages, libraries, API for String and Math classes, commenting

Encapsulation
Floating Point Error
Break, continue, Intro to exception handling

Lecture 26 Slides
More exception handling (catch blocks, multiple catch blocks, finally)

Lecture 27 Slides
10/29 Some more exceptions, Intro to arrays (copying arrays), intro to 2-dimensional arrays

Lecture 28 Slides
More arrays ("resizing" arrays), arrays of references, arrays of objects, argument passing in Eclipse

Lecture 29 Slides
Mutability, StringBuffer, deep vs. shallow copies,

Lecture 30 Slides
11/05 Privacy leaks and defensive copies

Lecture 31 Slides
Using the Eclipse debugger, Method overloading Intro to Java interfaces and polymorphism

Lecture 33 Slides
11/12 ternary operator, switch statements

Lecture 34 Slides
Continue Java interfaces, wrapper classes (Integer, Double, etc) and auto-boxing/unboxing

Lecture 35 Slides
Review for Midterm
11/19 Midterm #2 Thanksgiving Break
11/26 Java collections framework, ArrayList ArrayList example, for-each loops

Lecture 37 Slides
foreach examples, Introduction to Inheritance

Lecture 38 Slides
More Inheritance
12/03 Inheritance example, Iterators

Lecture 39 Slides
Intro to asymptotic complexity, Intuition for thinking about asymptotic complexity Big-O notation with examples. Intro to recursion

Asymptotic Analysis

Intro to Recursion
More recursion (including examples requiring a "helper" method) More recursion examples

Lecture 41 Slides
12/10 Review for final exam (Last day of class)

Staff

Instructor: Mohammad Nayeem Teli (nayeem at cs.umd.edu)

Office: 1351 AV Williams
Office Hours: MWF 4:00 - 5:00 PM


Teaching Assistants


Name Email Responsibilities
Sigurthor Bjorgvinsson sigurthor12@ru.is 0501 & 0502 discussion leader
Ananth Penghat apenghat@terpmail.umd.edu 0503 discussion leader
Carolin Arnold arnoldc@cs.umd.edu 0201 & 0204 discussion leader
Peter Thompson pthompson234@gmail.com 0202 discussion leader
Masataro Koizumi masataro.koizumi@gmail.com 0203 discussion leader
Nick Franzese nick.franzese@gmail.com 0401 & 0409 discussion leader
Brennan Hula bhula@terpmail.umd.edu 0402 discussion leader
Goonwanth Namireddy ngoonwanth@gmail.com 0403 & 0407 discussion co-leader
Deepthi Raghundan draghun1@cs.umd.edu 0403 & 0407 discussion co-leader
Anastasiya Stolyarova anastasiyastol@gmail.com 0404 discussion leader
Isabelle Stevens isteven1@terpmail.umd.edu 0406 discussion leader
Roozbeh Bassirian Jahromi roozbehbj@gmail.com Grader
Omer Akgul akgul@cs.umd.edu Grader
Varun Manjunatha varunm@cs.umd.edu Grader
Yixuan Ren yxren@cs.umd.edu Grader
Zhichao Liu liuzeecs@gmail.com Grader
Zehua Zeng fiona.zehua.zeng@gmail.com Grader
Hamid Kazemi hamidkazemi22@gmail.com Grader
Fei Shan fshan@terpmail.umd.edu Grader
Kamal Gupta kamalgupta308@gmail.com Grader
Ping-Yeh Chiang pingyeh.chiang@gmail.com Grader


TA Office Hours

All TA office hours take place in room 1112 A.V. Williams. Please note that a TA may need to leave 5 minutes before the end of the hour in order to go to his/her class. Please be understanding of their schedules.

Time MON TUE WED THU FRI
9:00 - 10:00 Varun Kamal Zehua Deepthi Varun
10:00 - 11:00 Nick & Varun Carolin & Kamal Zehua & Nick Carolin & Deepthi Varun & Deepthi
11:00 - 12:00 Nick & Janit Carolin & Kamal Nick & Janit Carolin & Kamal Deepthi
12:00 - 1:00 Janit Zehua Janit Peter Masa
1:00 - 2:00 Goonwanth & Omer Peter & Zehua Goonwanth & Omer Peter & Ananth Masa
2:00 - 3:00 Omer & Fei Ana & Goonwanth Omer & Fei Ana & Goonwanth Zhichao & Brennan
3:00 - 4:00 Ananth & Fei Roozbeh & Ping Fei & Yixuan Roozbeh & Ping Zhichao & Yixuan
4:00 - 5:00 Ananth & Brennan Roozbeh & Thor Isabelle & Yixuan Roozbeh & Thor Yixuan & Zhichao
5:00 - 6:00 Masa & Ana Thor & Ping Isabelle Thor & Ping Zhichao

Class Resources

Campus Multi-Factor Authentication - Why Should you Know this?

Starting this semester, all students will be required to sign up for and use multi-factor authentication (MFA) to access a variety of services that use your university login. Resources such as ELMS and the class grades.cs.umd.edu server are among these. That means that before October 15th, you need to set up MFA. It is the very strong recommendation of your instructor that you set this up earlier, by September 15th, to get it out of the way since access to resources such as these are essential. The campus page about this is at https://it.umd.edu/MFA.

Online Course Tools
  • Grades Server - This is where you go to see grades on assignments and to get your class account information.
  • Submission Server - This is where you go to view your project submissions and to get limited feedback about how your project is performing on our automated tests.
  • Eclipse tutorial - Eclipse is an Integrated Development Environment (IDE) that helps us to write software efficiently. You will use Eclipse to implement the class projects this semester. See the section at the bottom of this page for specific information about setting up Eclipse.
About Java
The following web pages provide detailed references to information about Java.
  • Oracle's Java homepage - This is the place to come when you really need the latest technical specs and downloads.
  • Oracle's Java tutorial - This page has a number of links to books and web pages about Java, which you may find of interest.
  • Java 8.0 API specs - This page contains (javadoc) documentation for the Java libraries. It is an excellent reference and you should bookmark it on your browser.

Setting up Eclipse

In order to complete the projects for this course you must install Eclipse following the instructions in the Eclipse Tutorial. Note that if you install Eclipse from some other source then you will not be able to submit your projects easily! After you get Eclipse installed, you will need to connect Eclipse to your class account. Below is a screenshot of the information you will need to enter into the CVS connection dialog box during this process. You can cut and paste the following lines into the dialog box:

  • Host:
    grace.umd.edu

  • Repository Path:
    /afs/glue/class/fall2018/cmsc/131/0501/student/*****

    (Replace "*****" with your login ID.)

    Be sure to change the connection type to "extssh", as shown below

Study Questions

Below are collections of questions and practice problems that are designed to help you to learn the course material. These exercises are not being collected or graded. Answers are provided, but please try your best to solve each problem before looking at the solution! The list will be updated as the semester progresses.

Disclaimer
Your primary resource for studying should be the notes that you have taken during lectures! There will be questions on quizzes and exams that are not in any way represented in this study list. There will be questions on this study list that are not in any way represented on quizzes or exams. Please be aware that exam questions tend to combine more elements into a single question and many of the questions on the list are simpler than questions you will see on your exams. You may discuss these questions openly with anyone, including your classmates. If you are unsure about how the answer to any particular question is obtained, please drop by office hours for help. That's why we're here!



Part Questions Answers
Part 1 Questions1 Answers1
Part 2 Questions2 Answers2
Part 3 Questions3 Answers3
Part 4 Questions4 Answers4
Part 5 Questions5 Answers5
Part 6 Questions6 Answers6
Part 7 Questions7 Answers7
Part 8 Questions8 Answers8
Part 9 Questions9 Answers9
Part 10 Questions10 Answers10
Part 11 Questions11 Answers11
Part 12 Questions12 Answers12
Part 13 Questions13 Answers13
Part 14 Questions14 Answers14

Projects

To submit a project, go to the "Java" perspective in Eclipse. Right click on the project folder (e.g., p1) and select "Submit Project" from the pull-down menu. If you do not see the "Submit Project" option then your copy of Eclipse does not contain the class plug-ins. In this case, please see the Eclipse installations instructions on the Resources page, or drop by TA office hours for help.

You may submit many times (we grade only the last submission). You can check the status of your submissions by visiting the Submit Server Home Page and entering your University Directory ID and password.


Important
Your grade for each project will be based on the greater value of two scores:
(1) The score on the very last submission prior to the deadline;
(2) The score minus 20% on the very last submission prior to the late deadline (up to 24 hours late).


Click the name of a project below to see the project specification.


Project Name Due Date
Project 7: Fish Club Monday, December 10, 11:00 PM
Project 6: Cafe 131 Thursday, November 29, 11:00 PM<
Project 5: Poker Simulator Sunday, November 11, 11:00 PM
Project 4: Mandelbrot Set Tuesday, October 30, 11:00 PM
Project 3: Medieval Soldiers Thursday, October 18, 11:00 PM
Project 2: Flags of the World Thursday, October 04, 11:00 PM
Project 1: Orioles Baseball Sunday, September 23, 11:00 PM
Project 0: Hello World! Wednesday, September 12, 11:00 PM


Open/Closed Policy

Guidelines for ALL Projects
There are a few simple rules that you should keep in mind for all of our coding assignments, regardless of whether they are "open" or "closed":
  • Under no circumstances may you copy code from another student or from any other source.
  • Under no circumstances should you be viewing source-code written by other students in the class.
  • It is always OK to openly discuss course-wide policies on things like programming style, grading, submissions, etc.
  • It is always OK to openly discuss the project specification. Be careful though -- here we are talking about WHAT the project description requires you to implement, not HOW the code will be written! On closed projects the "HOW" portion is off-limits for discussion (except for discussions with the instructor or TAs).

Closed Projects
You should treat a closed project as though it were a take-home exam. You may ask for assistance from your instructor or any of the TAs, but you are not to discuss the implementation (HOW the code is written) with anyone else. This includes your class-mates, friends, family, etc.

Open Projects
Although you should always try to complete as much of an open project as you can on your own, you MAY discuss the implementation details (the "HOW") openly with anyone. However, you must write 100% of the code on your own without copying from any source. Looking directly at another student's source-code is forbidden, but on an open project you are free to discuss ideas on HOW the code is to be written.

Open Projects
Below are some "example scenarios" to help you understand what is okay and what is not. Imagine you are considering the following conversations with a classmate. The green checkmarks mean the conversation is OK, the red X's mean you would be violating the course policy -- these would be considered examples of academic dishonesty.

Something you might say... Open Project Closed Project
"What does the project description mean by 'Use symbolic constants'?"
"Are we allowed to submit the project as many times as we want?"
"It says 'maintain a sorted list' -- how are we supposed to keep the list sorted?"
"I can't get my shape to rotate properly! Can you give me a hint on how you got that to work?"
"I've been working on this method for hours and I can't figure out what's wrong! Could you look at my code and help me out?"
"I can't figure this part out -- can I look at your code to see how you did it?"
"I wrote some useful tests for this project -- let me email them to you so you can use them to see if your code is working correctly."