Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Design Patterns. Questions What is a design pattern? Who needs design patterns? How different are classes and objects in APL compared.

Similar presentations


Presentation on theme: "Introduction to Design Patterns. Questions What is a design pattern? Who needs design patterns? How different are classes and objects in APL compared."— Presentation transcript:

1 Introduction to Design Patterns

2 Questions What is a design pattern? Who needs design patterns? How different are classes and objects in APL compared to the rest of the world? How different are patterns in APL?

3 What are design patterns? Design patterns are solution templates for frequently occurring problems. This term is widely applied to the design of Objects and their relations with each other.

4 Who needs design patterns? The only classes in my first application using Object Oriented programming where static classes. If you are in the same boat why do we need Object Orientation at all.

5 How different are classes and objects in APL? Type less nature of variables/objects – Type of variable is defined at the runtime.. State full nature of workspace – workspace at every point in time has preexisting state. Something else …

6 Effect of type-less nature on classes/objects Strong typing of results helps resolving data type compatibility problems at a time of compilation. Absence of strong typing gives flexibility for developers at implementation time, but may cause type compatibility issues at a runtime. Properties/fields and method’s results of classes are not strongly typed. As we will see it may be good or bad

7 Effect of state full workspace on classes State of class is defined by static members (fields, properties) of class (State of object is defined by dynamic members) State full nature of workspace may be described as the fact that at every point in time workspace is continuation of previous work rather then start from scratch. Static members are assigned at the time of class initialization. And may already change several times during test run before workspace will be saved. So application will start with static members which comes not from class definition but from intermediate state prior workspace saving.

8 Creational patterns Singleton Abstract Factory Factory Method Prototype Builder

9 Structural Patterns Adapter Bridge Composite Decorator Façade Flyweight Proxy

10 Behavioral patterns Chain of Responsibility. Command Interpreter Iterator Mediator Memento Observer State Strategy Template Method Visitor

11 Singleton Definition: Singleton is a class of which only a single instance may exist at every given time. Features: 1.Provide alternative mechanism for object creation. 2.Prevent regular object creation.

12 Singleton Possible use: 1.Load Balancers 2.Configuration class 3.Access to the object pool 4.Iterators 5.…

13 Prototype Definition: Create an object by copying existing rather then using []NEW. Features: 1.Utilize cloning of objects as alternative way to create instance instead of regular object creation. 2.No need to prevent regular object creation.

14 Prototype Possible use: 1.Classes with time and resource consuming initialization process

15 Abstract Factory Definition: Creates a series of objects without specifying object class. Features: 1.Need for interface structure defined. 2.Need for multiple interface implementations

16 Abstract Factory Note: It is more relevant to the strongly typed world as strong typing puts limitations, which this pattern trying to resolve. Possible use: 1. Tools which operate/generate different classes with the same interface

17 Adapter Definition: Creates an interface representing another interface/class. Features: 1.Need for interface structure defined. 2.Need for multiple interface implementations

18 Adapter Definition: Creates an interface to represent another interface/class. Features: 1.Allows encapsulation of class behavior.

19 Proxy Definition: Creates an interface representing another interface/class. Features: 1.Need for interface structure defined. 2.Need for multiple interface implementations


Download ppt "Introduction to Design Patterns. Questions What is a design pattern? Who needs design patterns? How different are classes and objects in APL compared."

Similar presentations


Ads by Google