Top Banner
COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008
26

COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

COMS S1007Object-Oriented Programming

and Design in JavaAugust 12, 2008

Page 2: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Final Exam Logistics

• 825 Mudd (usual classroom)• Thursday, 5:40-8:40pm

– Note the start time

• No calculators, books, notes, electronic devices, etc.

Page 3: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

What’s on the final exam?

• All material covered in lecture

• Programs discussed in lecture and posted on the class website

• Assigned readings– Emphasis will be on material covered in class

Page 4: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Assigned Readings

• Java basics– chapters 1-7

• Designing classes – 8.1 – 8.9

• Software Engineering– chapter 12

• Software Testing– 2.8, 3.6, 5.5, 7.8, 8.10; slides from 7/10

• Interfaces, Inheritance – 9.1 – 9.5, 10.1 – 10.8

• Graphics– 2.11 – 2.13, 3.9, 10.9 – 10.11, chapter 18

Page 5: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Assigned Readings

• Event handling– 9.6 – 9.10

• Threads– chapter 20

• Networking– chapter 21

• Exceptions– chapter 11

• Data structures– chapters 15 & 16

• Design patterns– not in the book!!

Page 6: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

What’s NOT on the final?

• Extra material in textbook, such as:– Common Errors– How Tos– Quality Tips– Productivity Hints– Random Facts– ….unless covered in lecture!!

• Advanced Topics covered last week

Page 7: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Format of the exam (tentative)

• 10-15 short-answer “concept” questions

• 2-3 problem solving and analysis

• 4-5 writing Java methods

• 1-2 writing Java classes

• 1-2 “Find the bugs” questions

• 3-4 determining output of Java code

Page 8: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Studying for the exam

• Review your class notes, particularly the descriptions of Java classes and APIs

• Review and make sure you understand the source code that we looked at in class and in the textbook from the assigned readings

• Review the comments made on your homeworks

• Office hours by appointment on Thursday

Page 9: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Taking the exam

• Note how much each question is worth

• Look through the entire exam and start by working on problems that you think you can do quickly and that are worth a lot of points

• Read the questions carefully to see what is expected of you

• Ask the proctor if you have any questions

Page 10: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

More advice

• Concept questions– Don’t write too much, but try to be detailed– Give an example if you can’t explain it

• Problem solving and analysis– Show your work to get partial credit– Clearly state any assumptions you make

Page 11: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

More advice

• “Find the bugs” question– Look for compile-time (syntax, semantic) errors

before trying to find logic errors– Be sure it’s a bug (look out for tricks)

• Writing Java code– You are graded on accuracy of syntax and

semantics (your code must “compile”)– Pay attention to stylistic issues– You will not be provided with any API docs,

except for classes not previously seen

Page 12: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Classes you should know well

• Math: random, pow, sqrt…• String: charAt, indexOf, size…• Scanner: constructors, hasNext, next, nextLine…• JFrame: setSize, setVisible, add…• Graphics: setColor, drawString, fillOval…• Object: equals, hashCode, toString, clone…

• These are not the only ones that may appear on the exam, but are the ones you should know best

Page 13: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Java Basics (chapters 1-7)

• OOP: classes and objects

• Encapsulation: public and private

• Methods and constructors

• Object references and aliases

• Pre- and post-increment

• Lazy evaluation of boolean expressions

• Call-by-reference vs. call-by-value

Page 14: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Coding style

• Avoid calling the same method multiple times

• Use lazy evaluation

• Use constants

• User errors vs. programmer errors

• Avoid side effects

• Member variables vs. local variables

• Aliasing a parameter

Page 15: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Designing classes (8.1 – 8.9)

• Classes vs. methods– Classes are nouns, methods are verbs

• Cohesion: everything belongs together

• Coupling: co-dependence

• Side effects: modifying an object passed as an explicit parameter

Page 16: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Interfaces & Inheritance (9.1 – 9.5, 10.1 – 10.8)

• Interfaces: collection of abstract methods

• Polymorphism

• Inner classes

• Inheritance

• Abstract classes• Object: the global superclass

Page 17: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Graphics and Java GUIs(2.11 – 2.13, 3.9, 18.1 – 18.4)

• JFrame and its methods• JComponent• Drawing with the Graphics object

• Java Swing components– JPanel, JTextField, JButton, etc.

Page 18: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Testing (2.8, 3.6, 5.5, 7.8)

• The “assert” statement

• Unit testing– White box and black box testing– Boundary values and equivalence classes

• Integration and systems testing

• Regression testing

Page 19: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Event handling (9.6 – 9.10)

• Event sources and listeners– Not just for GUI events

• Java GUI Listeners– MouseAdapter– MouseMotionAdapter– KeyAdapter– ActionListener

• MouseEvents, KeyEvents, ActionEvents

Page 20: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Networking (21.1 – 21.5)

• The ServerSocket class– constructor binds to a port– “accept” method waits for a connection

• The Socket class– “connect” method connects to a port

• Input and Output streams

Page 21: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Threads (20.1 – 20.5)

• Why use threads?

• The Thread class and Runnable interface

• Invoking a new Thread and important methods– start: begins a new thread of execution– run: starting point of executable code

• Race conditions

• Locks and synchronization

Page 22: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Exceptions (11.1 – 11.6)

• Exception hierarchy

• The try/catch/finally blocks

• Throwing exceptions

• Custom exceptions

Page 23: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Data structures (15.1 – 15.4)

• Linked Lists– LinkedList and ListIterator class

• Stack: LIFO, push/pop

• Queue: FIFO, add/remove– Either can be implemented with arrays or

with LinkedLists

Page 24: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

More Data Structures(16.1 – 16.10)

• Set: add, remove, contains

• Map: get, put

• Hashing functions and hash tables

• Trees and traversal techniques

• Heaps and Heapsort

Page 25: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Design Patterns

• What are design patterns used for?

• What are the three GoF classes of patterns?

• Singleton: limit to a single instance

• Composite: treat a collection of objects with the same interface as individual ones

• Observer: publish/subscribe

Page 26: COMS S1007 Object-Oriented Programming and Design in Java August 12, 2008.

Final Exam Logistics

• 825 Mudd (usual classroom)

• Thursday, 5:40-8:40pm– Note the start time

• No calculators, books, notes, electronic devices, etc.

• Chapters 1-12, 15-16, 18, 20, 21