Delegation - Banking - Lecture Slides, Slides of Banking and Finance

Banking is an ever green field of study. In these slides of Banking, the Lecturer has discussed following important points : Delegation, Antipatterns, Generalization, Inherit, Method, Delegator, Context, Hierarchy, Problem, Adapter Pattern

Typology: Slides

2012/2013

Uploaded on 07/29/2013

sathyanarayana
sathyanarayana 🇮🇳

4.4

(21)

129 documents

1 / 23

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Delegation
Example:
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download Delegation - Banking - Lecture Slides and more Slides Banking and Finance in PDF only on Docsity!

Delegation

Example:

Delegation

Antipatterns

• Overuse generalization and inherit the method that is to

be reused

• Instead of creating a single method in the «Delegator»

that does nothing other than call a method in the

«Delegate

—consider having many different methods in the

«Delegator» call the delegate’s method

• Access non-neighboring classes

return specificFlight.regularFlight.flightNumber();

return getRegularFlight().flightNumber();

Adapter

  • Solution:

Adapter

Example:

Façade

  • Solution:

6.10 The Immutable Pattern

  • Context : —An immutable object is an object that has a state that never changes after creation
  • Problem : —How do you create a class whose instances are immutable?
  • Forces : —There must be no loopholes that would allow ‘illegal’ modification of an immutable object
  • Solution : —Ensure that the constructor of the immutable class is the only place where the values of instance variables are set or modified. —Instance methods which access properties must not have side effects. —If a method that would otherwise modify an instance variable is required, then it has to return a new instance of the class.

Read-only Interface

  • Solution:

Read-only Interface

Example:

6.12 The Proxy Pattern

  • Context : —Often, it is time-consuming and complicated to create instances of a class ( heavyweight classes). —There is a time delay and a complex mechanism involved in creating the object in memory
  • Problem : —How to reduce the need to create instances of a heavyweight class?
  • Forces : —We want all the objects in a domain model to be available for programs to use when they execute a system’s various responsibilities. —It is also important for many objects to persist from run to run of the same program

Proxy

  • Solution:

6.13 The Factory Pattern

  • Context : —A reusable framework needs to create objecs; however the class of the created objects depends on the application.
  • Problem : —How do you enable a programmer to add new application- specific class into a system built on such a framework?
  • Forces : —We want to have the framework create and work with application-specific classes that the framework does not yet know about.
  • Solution : —The framework delegates the creation of application-specific classes to a specialized class, the Factory. —The Factory is a generic interface defined in the framework. —The factory interface declares a method whose purpose is to create some subclass of a generic class.

The Factory Pattern

Solution

6.14 Detailed Example: enhancing OCSF

with some design patterns

The Observable layer of OCSF (continued)