Unit 4 -- Csc 115 Spring 2004 SO1/S02
Learning Objectives for this week
In this unit you will learn the basic concepts underlying the following features in Java and learn
how to use them to do object oriented software design:
- Inheritance
- Polymorphism
- Interfaces
Learning Resources for this week
Lecture slides:
4-00Design.ppt
Sample programs as found in the source directory of
this project.
There are also some more examples this week also in
activities (see below).
Reading Assignment:
Read Chapter 2 and make sure you understand it!
Unit 4 Activities
Short Answer Questions
Answer the following questions:
- What are the main advantages of object oriented programming?
- What does "polymorphism" mean and how can we take advantage of it?
- What does the term "encapsulation" mean?
- What concept does the keyword "extends" relate to? When would you use it? How about "inherits"?
- Match the following words with the phrase below that closely matches the correct definition of the term:
- cohesion
- coupling
- interfaces
- modularity
- polymorphism
Match the terms above with these phrases:
- a collection of method declarations with no data and no bodies
- an organizational structure in which different components of a software system are divided into separate functional units
- how related the responsibilities of a class are
- the ability of an object variable to take different forms
- how strongly a class relies on other classes
Coding practice
- Load the files, explore and make sure you understand the code from the clock example.
Course concepts covered: Inheritance and Polymorphism.
(There are some subtle points in this example which may take some time to understand
but are very important to understand before the midterm.)
-
Try experimenting with the examples posted to go with this unit.
discussed in class and in the notes!
You may want to make copies of them in a different directory so you keep your original examples intact.
In particular look at the music package example.
Problems in the textbook, Chapter 2:
R-2.4, 2.7 2,8, 2.10 and C-2.5 and 2.8
Go to the course website