Docsity

Object Oriented Design Programming - 15 Questions in Final Exam | CS 635, Exams of Computer Science

Toggle sidebar
bg1
CS 635 Final Exam, May 22, 2001
Name___________________________
Answer 9 questions. Indicate which 9 questions you are answering. Do not
answer more than 9 questions. Each question is worth 10 points.
Patterns covered in class:
Abstract Factory
Adapter
Bridge
Builder
Chain of Responsibility
Command
Command Processor
Composite
Decorator
Facade
Factory Method
Flyweight
Interpreter
Iterator
Mediator
Memento
Null Object
Observer
Prototype
Proxy
Singleton
State
Strategy
Template Method
Visitor
1.
a. Explain why tight coupling is not desirable.
b. Select one pattern other that Observer that reduces tight coupling. Explain
how it helps reduces tight coupling.
2. What is the difference between internal coupling and cohesion? Provide a
concrete example.
3. Explain one of the following types of coupling: Data Coupling, Control
Coupling, Inside Internal Object Coupling
4. What are the benefits of the refactoring "Encapsulate Subclass Constructors
with Superclass Factory Methods"?
5. Sometimes one needs to modify a class but for some reason are not allowed
to alter the class. What design pattern can be used in this situation? Explain
how it can be used
6. Give one design pattern that can be used to reduce dependence on hardware
and/or software platforms. Explain how the pattern reduces a program's
dependence on hardware and/or software platforms.
pf2

Partial preview of the text

Download Object Oriented Design Programming - 15 Questions in Final Exam | CS 635 and more Exams Computer Science in PDF only on Docsity!

CS 635 Final Exam, May 22, 2001

Name___________________________

Answer 9 questions. Indicate which 9 questions you are answering. Do not answer more than 9 questions. Each question is worth 10 points.

Patterns covered in class: Abstract Factory Adapter Bridge Builder Chain of Responsibility Command Command Processor Composite Decorator Facade Factory Method Flyweight Interpreter Iterator Mediator Memento Null Object Observer Prototype Proxy Singleton State Strategy Template Method Visitor

a. Explain why tight coupling is not desirable. b. Select one pattern other that Observer that reduces tight coupling. Explain how it helps reduces tight coupling.

  1. What is the difference between internal coupling and cohesion? Provide a concrete example.
  2. Explain one of the following types of coupling: Data Coupling, Control Coupling, Inside Internal Object Coupling
  3. What are the benefits of the refactoring "Encapsulate Subclass Constructors with Superclass Factory Methods"?
  4. Sometimes one needs to modify a class but for some reason are not allowed to alter the class. What design pattern can be used in this situation? Explain how it can be used
  5. Give one design pattern that can be used to reduce dependence on hardware and/or software platforms. Explain how the pattern reduces a program's dependence on hardware and/or software platforms.

2

  1. In object-oriented programming one is advised to avoid case (and if) statements. Select one design pattern that helps avoid case statements and explain how it helps.

  2. The patterns in the text are grouped into three types of patterns: Creational, Structural, and Behavioral. Clearly the creational patterns are related to creating objects. The State pattern is listed as behavioral, when it clearly defines some structure. The Proxy is listed as a Structural pattern when it clearly has behavior. What is the difference between Structural and Behavioral patterns? Provide criteria for determining if a new pattern should be considered Structural or Behavioral. The criteria must also explain why the current patterns are classified as they are.

a. What are the two main design principles used in design patterns? b. Select one pattern that uses both principles. Show how it uses both.

In the follow 2 problems two patterns are listed. The paired patterns are similar in some fashion. Explain how the patterns are different. You should cover when each pattern would be used over the other, the differences in intent of the patterns and any structural differences.

  1. Prototype verses Factory Method
  2. Decorator verses the Chain of Responsibility
  3. Briefly discuss how the Visitor pattern operates.
  4. Give three different patterns that in some way support undo. Select one of the patterns and describe how it supports undo.
  5. Select one of the following patterns โ€“ Strategy, Composite or Iterator and discuss the consequences (good and bad) of the pattern.
  6. Briefly outline the State pattern. The state pattern is often implemented using several other patterns. List one and explain why it is used.