Programmeerimine Delphi keskkonnas MTAT.03.214 - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Programmeerimine Delphi keskkonnas MTAT.03.214

Description:

Programmeerimine Delphi keskkonnas. MTAT.03.214. Jelena Zaitseva. jellen_at_ut.ee. Design patterns frequently recurring structures and relationships in object ... – PowerPoint PPT presentation

Number of Views:17
Avg rating:3.0/5.0
Slides: 11
Provided by: jel78
Category:

less

Transcript and Presenter's Notes

Title: Programmeerimine Delphi keskkonnas MTAT.03.214


1
Programmeerimine Delphi keskkonnasMTAT.03.214
  • Jelena Zaitseva
  • jellen_at_ut.ee

2
  • Design patterns frequently recurring structures
    and relationships in object-oriented design.

3
  • adapter
  • singleton
  • template method
  • factory
  • observer

4
adapter
  • PROBLEM How to resolve incompatible interfaces,
    or provide a stable interface to similar
    components with different interfaces?
  • SOLUTION Convert the original interface of a
    component into another interface, through an
    intermediate adapter object.

5
singleton
  • PROBLEM Exactly one instance of a class is
    allowed it is a singleton. Objects need a
    global and single point of access.
  • SOLUTION Define a static method of a class that
    returns the singleton.

6
singleton
  • Benefits
  • controlled access to sole instance
  • reduced name space
  • permits refinement of operations and
    representations
  • permits a variable number of instances

7
template method
  • template method define the skeleton of an
    algorithm in an operation, deferring some steps
    to subclasses
  • Template Method lets subclasses redefine certain
    steps of an algorithm without changing the
    algorithm's structure.

8
template method
  • The pattern is essentially an extension of
    abstract methods to more complex algorithms.

9
factory
  • PROBLEM Who should be responsible for creating
    objects when there are special considerations,
    such as complex creation logic, a desire to
    separate the creation responsibilities for better
    cohesion, and so forth?
  • SOLUTION Create an object called a Factory that
    handles the creation.

10
Observer
  • PROBLEM Different kinds of subscriber objects
    are interested in the state changes or events of
    a publisher object, and want to react in their
    own unique way when the publisher generates an
    event. Moreover, the publisher wants to maintain
    low coupling to the subscribers. What to do?
  • SOLUTION Define a subscriber or listener
    interface. Subscribers implement this interface.
    The publisher can dynamically register
    subscribers who are interested in an event, and
    notify them when an event occurs.
Write a Comment
User Comments (0)
About PowerShow.com