Friday, June 18, 2010

Design Pattern Interview Questions

  1. Explain the Flyweight, Builder, Mediator and Memento patterns.
  2. Describe the decorator pattern and how it is used within the java.io package.

    Answer: Decorators are used to provide additional functionality to an object of some kind. The key to a decorator is that a decorator "wraps" the object decorated and looks to a client exactly the same as the object wrapped. This means that the decorator implements the same interface as the object it decorates. For example, a BufferedReader is just a decorator for a Reader.

  3. Observer Pattern:
    • Draw the class diagram for the Observer Pattern.
    • What instance variables would you have in the Observable class?
    • What would happen if an Observer removes himself from the observers list when he is notified?
    • What is thread-safety and how can you make the Observer Pattern thread-safe?
  4. Name your favourite design pattern.
  5. Explain the Model-View-Controller (MVC) compound design pattern. What patterns is it composed of?
More Interview Posts

2 comments:

  1. Good work
    http://pragyarawal.blogspot.com/

    ReplyDelete
  2. Hi

    Tks very much for post:

    I like it and hope that you continue posting.

    Let me show other source that may be good for community.

    Source: Mock interview questions

    Best rgs
    David

    ReplyDelete