Sample Final Questions

Version of December 10th, 2007

Abstraction

What are the characteristic of object-oriented programming that help the software problem? Give examples.

What are the desirable software qualities that are helped by object-oriented programming characteristics? Explain how they help!

Compare and contrast abstract classes versus interfaces in Java.

Frameworks

Why do we use pre-existing software frameworks?

Describe the basic policies and structures of the following frameworks:

Refactorings

Definitions

What is a refactoring? Why do we use refactorings?

Suppose we have a series of refactoring that consists of:

  1. Add a new interface.
  2. Add a method to the interface call "doIt()".
  3. Add a new class with a method doIt that does some stuff that a method "work" in the existing code does.
  4. Make the new class implement the interface.
  5. Add a constructor to the new class.
  6. Add a parameter of the interface to method "work" of interface type and pass in null.
  7. Change the null to an instance of the new class.
  8. Change the code in "work" to call the "doIt" method on the new parameter, instead of what it had before.
This series of refactorings has certain positive qualities: Nonetheless the series of refactorings is deeply unsatisfactory. Why? Give a new series of refactorings that keeps all the good qualities of the previous series but avoids the shortcomings.

Design Patterns

Concepts

For each of the following design patterns, give its Intent, Applicability, Structure (using UML), and describe the roles of the participants.

  1. SINGLETON
  2. TEMPLATE METHOD
  3. STRATEGY
  4. ITERATOR
  5. COMPOSITE
  6. DECORATOR
  7. STATE
  8. FACTORY Method
  9. ABSTRACT FACTORY
  10. PROTOTYPE
  11. BUILDER
  12. COMMAND
  13. ADAPTER
  14. PROXY

Comparisons

Compare and contrast the following behavioral patterns:

Describe their similarities and differences. Mention advantages and disadvantages of each.

Compare and constrast the two design patterns:

How do we distinguish them?

Compare and contrast the design patterns:

How do we distinguish them? When are their intents?

Judgement

Describe what design patterns you would use to add the following extensions to the appointment book program:

Concurrency

Definitions

Define the following terms:

Concurrency Failures

Define safety vs. liveness. Why do techniques that improve safety have a tendency to worsen liveness, and vice versa?

What are the general principles used to avoid race conditions?

Name three techniques to avoid poor concurrency (deadlock and starvation).

Why do we often need at least three separate threads for:

  1. User-interaction
  2. server socket accepts
  3. socket reads and writes
What goes wrong if we combine (1,2) in a single thread? (2,3)? (1,3)?

Look at the code that was done in lecture on the last week in class. ($CLASSHOME/src/lecture11/) Identify a synchronization problem:

Client-Server Programming

Define/explain: