SlideShare a Scribd company logo
Object-oriented programming
Design Patterns
Beer & Code #49
JUN
16
@talevskiigor
Object-oriented programming
If you want to program just about anything these days,
you’d better learn object-oriented programming.
Anyone should write a framework and never use it !
Who cares, right? We have the framework! We don't need to
know how to "do it by hand"! Right?
OOP: Basic
Attribute - things that the object stores data in, generally variables
Method - Functions and Procedures attached to an Object and allowing the
object to perform actions
Class - a class is a template definition of the methods and variables in a
particular kind of object
Object - is a specific instance of a class; it contains real values instead of
variables
OOP: Visibility
Public
- can be accessed everywhere
Protected
- can be accessed only within the class itself and by inherited classes
Private
- may only be accessed by the class that defines the member
Access modifiers (or access specifiers) are keywords in object-oriented languages that set the
accessibility of classes, methods, and other members
OOP: What is a design pattern?
In software engineering, a design pattern is a general repeatable solution to a
commonly occurring problem in software design.
A design pattern isn't a finished design that can be transformed directly into
code.
It is a description or template for how to solve a problem that can be used in
many different situations.
Design Patterns: History
Patterns originated as an architectural concept by Christopher Alexander (1977).
In 1994, four authors Erich G., Richard H., Ralph J. and John V. published a book
Design Patterns - Elements of Reusable Object-Oriented Software.
These authors are collectively known as Gang of Four (GOF). According to these
authors design patterns are primarily based on the following principles of object
orientated design.
Program to an interface not an implementation
Favor object composition over inheritance
Design Patterns: Types
Creational Patterns - These design patterns provide a way to create objects
while hiding the creation logic, rather than instantiating objects directly using
new operator. This gives program more flexibility in deciding which objects
need to be created for a given use case.
Structural Patterns - These design patterns concern class and object
composition. Concept of inheritance is used to compose interfaces and define
ways to compose objects to obtain new functionalities.
Behavioral Patterns - These design patterns are specifically concerned with
communication between objects.
Creational Patterns
Abstract factory create series of related or dependent objects without
specifying their concrete classes. Usually the created classes all implement
the same interface
Static factory uses just one static method to create all types of objects it can
create. It is usually named factory or build
Factory method pattern creates objects without specifying the exact class to
create.
Builder pattern constructs complex objects by separating construction and
representation.
Prototype pattern creates objects by cloning an existing object.
Singleton pattern restricts object creation for a class to only one instance.
Structural Patterns (1 of 2)
Adapter / Wrapper - translate one interface for a class into a compatible interface
Bridge - Decouple an abstraction from its implementation so that the two can vary
independently.
Composite - treat a group of objects the same way as a single instance of the
object
Data Mapper - performs bidirectional transfer of data between a persistent data
store (database) and an in memory data representation (domain).
Decorator - allows behavior to be added to an individual object without affecting
the behavior of other objects from the same class
Dependency Injection - implement a loosely coupled architecture in order to get
better testable, maintainable and extendable code.
Structural Patterns (2 of 2)
Facade - provides a simplified interface to a larger body of code, such as a
class library.
Fluent Interface - write code that is easy readable just like sentences in a
natural language (like English).
Flyweight - instances of a class which are identical are shared in an
implementation instead of creating a new instance of that class for every
instance
Proxy - one class stands in for and handles all access to another class
Registry(Service locator pattern) - implement a central storage for objects often
used throughout the application, is typically implemented using an abstract
class with only static methods (or using the Singleton pattern)
Behavioral Patterns (1 of 2)
Chain Of Responsibilities - build a chain of objects to handle a call in
sequential order.
Command - an object is used to encapsulate all information needed to perform
an action or trigger an event at a later time
Iterator - make an object iterable and to make it appear like a collection of
objects
Mediator - easy way to decouple many components working together
Memento - provides the ability to restore an object to it’s previous state (undo
via rollback) or to gain access to state of the object, without revealing it’s
implementation
Null Object - not a GoF design pattern but a schema which appears frequently
enough to be considered a pattern
Behavioral Patterns (2 of 2)
Observer - implement a publish/subscribe behaviour to an object, whenever a
“Subject” object changes it’s state, the attached “Observers” will be notified
Specification - separate the statement of how to match a candidate, from the
candidate object that it is matched against
State - implements a state machine in an object-oriented way
Visitor - lets you outsource operations on objects to other objects
Strategy - separate strategies and to enable fast switching between them
Template Method - one or more algorithm steps can be overridden by
subclasses to allow differing behaviors while ensuring that the overarching
algorithm is still followed
Live coding!
What can go wrong? ;-)
Tuesday, June 21 at 6 PM - 8 PM
All you wanted to know about JavaScript, but were afraid to ask...

More Related Content

What's hot

Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
Varun C M
 
Basics of Java
Basics of JavaBasics of Java
Basics of Java
Sherihan Anver
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
Alok Kumar
 
Java Basic Oops Concept
Java Basic Oops ConceptJava Basic Oops Concept
Java Basic Oops Concept
atozknowledge .com
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
Prawesh Shrestha
 
Sending emails through PHP
Sending emails through PHPSending emails through PHP
Sending emails through PHP
krishnapriya Tadepalli
 
Statements and Conditions in PHP
Statements and Conditions in PHPStatements and Conditions in PHP
Statements and Conditions in PHP
Maruf Abdullah (Rion)
 
Pure virtual function and abstract class
Pure virtual function and abstract classPure virtual function and abstract class
Pure virtual function and abstract class
Amit Trivedi
 
Files and streams
Files and streamsFiles and streams
Files and streams
Pranali Chaudhari
 
Language translator
Language translatorLanguage translator
Language translator
asmakh89
 
Dot net assembly
Dot net assemblyDot net assembly
Dot net assembly
Dr.Neeraj Kumar Pandey
 
Oops
OopsOops
Java basic
Java basicJava basic
Java basic
Sonam Sharma
 
Introduction to c#
Introduction to c#Introduction to c#
14 file handling
14 file handling14 file handling
14 file handling
APU
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
Ashok Raj
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
Testbytes
 
PHP slides
PHP slidesPHP slides
PHP slides
Farzad Wadia
 
Java Database Connectivity
Java Database ConnectivityJava Database Connectivity
Java Database Connectivity
backdoor
 
Generic programming and concepts that should be in C++
Generic programming and concepts that should be in C++Generic programming and concepts that should be in C++
Generic programming and concepts that should be in C++
Anton Kolotaev
 

What's hot (20)

Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Basics of Java
Basics of JavaBasics of Java
Basics of Java
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
 
Java Basic Oops Concept
Java Basic Oops ConceptJava Basic Oops Concept
Java Basic Oops Concept
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
Sending emails through PHP
Sending emails through PHPSending emails through PHP
Sending emails through PHP
 
Statements and Conditions in PHP
Statements and Conditions in PHPStatements and Conditions in PHP
Statements and Conditions in PHP
 
Pure virtual function and abstract class
Pure virtual function and abstract classPure virtual function and abstract class
Pure virtual function and abstract class
 
Files and streams
Files and streamsFiles and streams
Files and streams
 
Language translator
Language translatorLanguage translator
Language translator
 
Dot net assembly
Dot net assemblyDot net assembly
Dot net assembly
 
Oops
OopsOops
Oops
 
Java basic
Java basicJava basic
Java basic
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
14 file handling
14 file handling14 file handling
14 file handling
 
Command line arguments
Command line argumentsCommand line arguments
Command line arguments
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
 
PHP slides
PHP slidesPHP slides
PHP slides
 
Java Database Connectivity
Java Database ConnectivityJava Database Connectivity
Java Database Connectivity
 
Generic programming and concepts that should be in C++
Generic programming and concepts that should be in C++Generic programming and concepts that should be in C++
Generic programming and concepts that should be in C++
 

Similar to OOP design patterns

Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur University
Shubham Narkhede
 
Design patterns
Design patternsDesign patterns
Design patterns
Elyes Mejri
 
designpatterns-.pdf
designpatterns-.pdfdesignpatterns-.pdf
designpatterns-.pdf
ElviraSolnyshkina
 
Basic design pattern interview questions
Basic design pattern interview questionsBasic design pattern interview questions
Basic design pattern interview questions
jinaldesailive
 
Design patterns
Design patternsDesign patterns
Design patterns
Vignesh Nethaji
 
Unit 1 OOSE
Unit 1 OOSE Unit 1 OOSE
Unit 1 OOSE
ChhayaShelake
 
Software design and Architecture.pptx
Software design and Architecture.pptxSoftware design and Architecture.pptx
Software design and Architecture.pptx
SHAHZAIBABBAS13
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
Satheesh Sukumaran
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
Satheesh Sukumaran
 
Object Oriented Approach for Software Development
Object Oriented Approach for Software DevelopmentObject Oriented Approach for Software Development
Object Oriented Approach for Software Development
Rishabh Soni
 
Top 30 Technical interview questions
Top 30 Technical interview questionsTop 30 Technical interview questions
Top 30 Technical interview questions
SohailSaifi15
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming ppt
Nitesh Dubey
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Luis Valencia
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
danhaley45372
 
Java chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsJava chapter 3 - OOPs concepts
Java chapter 3 - OOPs concepts
Mukesh Tekwani
 
INTRODUCTION TO JAVA
INTRODUCTION TO JAVAINTRODUCTION TO JAVA
INTRODUCTION TO JAVA
RAMALINGHAM KRISHNAMOORTHY
 
Software_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptx
ArifaMehreen1
 
Bt8901 objective oriented systems1
Bt8901 objective oriented systems1Bt8901 objective oriented systems1
Bt8901 objective oriented systems1
Techglyphs
 
Oomd unit1
Oomd unit1Oomd unit1
Oomd unit1
VivekChaudhary93
 
UML Design Class Diagrams (2014)
UML Design Class Diagrams (2014)UML Design Class Diagrams (2014)
UML Design Class Diagrams (2014)
Miriam Ruiz
 

Similar to OOP design patterns (20)

Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur University
 
Design patterns
Design patternsDesign patterns
Design patterns
 
designpatterns-.pdf
designpatterns-.pdfdesignpatterns-.pdf
designpatterns-.pdf
 
Basic design pattern interview questions
Basic design pattern interview questionsBasic design pattern interview questions
Basic design pattern interview questions
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Unit 1 OOSE
Unit 1 OOSE Unit 1 OOSE
Unit 1 OOSE
 
Software design and Architecture.pptx
Software design and Architecture.pptxSoftware design and Architecture.pptx
Software design and Architecture.pptx
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Object Oriented Approach for Software Development
Object Oriented Approach for Software DevelopmentObject Oriented Approach for Software Development
Object Oriented Approach for Software Development
 
Top 30 Technical interview questions
Top 30 Technical interview questionsTop 30 Technical interview questions
Top 30 Technical interview questions
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming ppt
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
 
Java chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsJava chapter 3 - OOPs concepts
Java chapter 3 - OOPs concepts
 
INTRODUCTION TO JAVA
INTRODUCTION TO JAVAINTRODUCTION TO JAVA
INTRODUCTION TO JAVA
 
Software_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptx
 
Bt8901 objective oriented systems1
Bt8901 objective oriented systems1Bt8901 objective oriented systems1
Bt8901 objective oriented systems1
 
Oomd unit1
Oomd unit1Oomd unit1
Oomd unit1
 
UML Design Class Diagrams (2014)
UML Design Class Diagrams (2014)UML Design Class Diagrams (2014)
UML Design Class Diagrams (2014)
 

Recently uploaded

Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
OECD Directorate for Financial and Enterprise Affairs
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussionArtificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
OECD Directorate for Financial and Enterprise Affairs
 
Disaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other usesDisaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other uses
RIDHIMAGARG21
 
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
OECD Directorate for Financial and Enterprise Affairs
 
Proposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP IncProposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP Inc
Raheem Muhammad
 
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
OECD Directorate for Financial and Enterprise Affairs
 
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdfWhy Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Ben Linders
 
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
OECD Directorate for Financial and Enterprise Affairs
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
gpww3sf4
 
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussionPro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
OECD Directorate for Financial and Enterprise Affairs
 
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
OECD Directorate for Financial and Enterprise Affairs
 
IEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdfIEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdf
Claudio Gallicchio
 
XP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to LeadershipXP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to Leadership
samililja
 
nationalismineurope-230420140400-1c53f60e.pptx
nationalismineurope-230420140400-1c53f60e.pptxnationalismineurope-230420140400-1c53f60e.pptx
nationalismineurope-230420140400-1c53f60e.pptx
silki0908
 
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
OECD Directorate for Financial and Enterprise Affairs
 
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
SkillCertProExams
 

Recently uploaded (20)

Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
 
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
The Intersection between Competition and Data Privacy – COLANGELO – June 2024...
 
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussionArtificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – OECD – June 2024 OECD discussion
 
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussionArtificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
Artificial Intelligence, Data and Competition – LIM – June 2024 OECD discussion
 
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
Competition and Regulation in Professions and Occupations – OECD – June 2024 ...
 
Disaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other usesDisaster Management project for holidays homework and other uses
Disaster Management project for holidays homework and other uses
 
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
Artificial Intelligence, Data and Competition – ČORBA – June 2024 OECD discus...
 
Proposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP IncProposal: The Ark Project and The BEEP Inc
Proposal: The Ark Project and The BEEP Inc
 
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
The Intersection between Competition and Data Privacy – OECD – June 2024 OECD...
 
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussionPro-competitive Industrial Policy – OECD – June 2024 OECD discussion
Pro-competitive Industrial Policy – OECD – June 2024 OECD discussion
 
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdfWhy Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
Why Psychological Safety Matters for Software Teams - ACE 2024 - Ben Linders.pdf
 
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...Competition and Regulation in Professions and Occupations – ROBSON – June 202...
Competition and Regulation in Professions and Occupations – ROBSON – June 202...
 
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
原版制作贝德福特大学毕业证(bedfordhire毕业证)硕士文凭原版一模一样
 
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussionPro-competitive Industrial Policy – LANE – June 2024 OECD discussion
Pro-competitive Industrial Policy – LANE – June 2024 OECD discussion
 
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
The Intersection between Competition and Data Privacy – KEMP – June 2024 OECD...
 
IEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdfIEEE CIS Webinar Sustainable futures.pdf
IEEE CIS Webinar Sustainable futures.pdf
 
XP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to LeadershipXP 2024 presentation: A New Look to Leadership
XP 2024 presentation: A New Look to Leadership
 
nationalismineurope-230420140400-1c53f60e.pptx
nationalismineurope-230420140400-1c53f60e.pptxnationalismineurope-230420140400-1c53f60e.pptx
nationalismineurope-230420140400-1c53f60e.pptx
 
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
The Intersection between Competition and Data Privacy – CAPEL – June 2024 OEC...
 
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
ServiceNow CIS-ITSM Exam Dumps & Questions [2024]
 

OOP design patterns

  • 1. Object-oriented programming Design Patterns Beer & Code #49 JUN 16 @talevskiigor
  • 2. Object-oriented programming If you want to program just about anything these days, you’d better learn object-oriented programming. Anyone should write a framework and never use it ! Who cares, right? We have the framework! We don't need to know how to "do it by hand"! Right?
  • 3. OOP: Basic Attribute - things that the object stores data in, generally variables Method - Functions and Procedures attached to an Object and allowing the object to perform actions Class - a class is a template definition of the methods and variables in a particular kind of object Object - is a specific instance of a class; it contains real values instead of variables
  • 4. OOP: Visibility Public - can be accessed everywhere Protected - can be accessed only within the class itself and by inherited classes Private - may only be accessed by the class that defines the member Access modifiers (or access specifiers) are keywords in object-oriented languages that set the accessibility of classes, methods, and other members
  • 5. OOP: What is a design pattern? In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.
  • 6. Design Patterns: History Patterns originated as an architectural concept by Christopher Alexander (1977). In 1994, four authors Erich G., Richard H., Ralph J. and John V. published a book Design Patterns - Elements of Reusable Object-Oriented Software. These authors are collectively known as Gang of Four (GOF). According to these authors design patterns are primarily based on the following principles of object orientated design. Program to an interface not an implementation Favor object composition over inheritance
  • 7. Design Patterns: Types Creational Patterns - These design patterns provide a way to create objects while hiding the creation logic, rather than instantiating objects directly using new operator. This gives program more flexibility in deciding which objects need to be created for a given use case. Structural Patterns - These design patterns concern class and object composition. Concept of inheritance is used to compose interfaces and define ways to compose objects to obtain new functionalities. Behavioral Patterns - These design patterns are specifically concerned with communication between objects.
  • 8. Creational Patterns Abstract factory create series of related or dependent objects without specifying their concrete classes. Usually the created classes all implement the same interface Static factory uses just one static method to create all types of objects it can create. It is usually named factory or build Factory method pattern creates objects without specifying the exact class to create. Builder pattern constructs complex objects by separating construction and representation. Prototype pattern creates objects by cloning an existing object. Singleton pattern restricts object creation for a class to only one instance.
  • 9. Structural Patterns (1 of 2) Adapter / Wrapper - translate one interface for a class into a compatible interface Bridge - Decouple an abstraction from its implementation so that the two can vary independently. Composite - treat a group of objects the same way as a single instance of the object Data Mapper - performs bidirectional transfer of data between a persistent data store (database) and an in memory data representation (domain). Decorator - allows behavior to be added to an individual object without affecting the behavior of other objects from the same class Dependency Injection - implement a loosely coupled architecture in order to get better testable, maintainable and extendable code.
  • 10. Structural Patterns (2 of 2) Facade - provides a simplified interface to a larger body of code, such as a class library. Fluent Interface - write code that is easy readable just like sentences in a natural language (like English). Flyweight - instances of a class which are identical are shared in an implementation instead of creating a new instance of that class for every instance Proxy - one class stands in for and handles all access to another class Registry(Service locator pattern) - implement a central storage for objects often used throughout the application, is typically implemented using an abstract class with only static methods (or using the Singleton pattern)
  • 11. Behavioral Patterns (1 of 2) Chain Of Responsibilities - build a chain of objects to handle a call in sequential order. Command - an object is used to encapsulate all information needed to perform an action or trigger an event at a later time Iterator - make an object iterable and to make it appear like a collection of objects Mediator - easy way to decouple many components working together Memento - provides the ability to restore an object to it’s previous state (undo via rollback) or to gain access to state of the object, without revealing it’s implementation Null Object - not a GoF design pattern but a schema which appears frequently enough to be considered a pattern
  • 12. Behavioral Patterns (2 of 2) Observer - implement a publish/subscribe behaviour to an object, whenever a “Subject” object changes it’s state, the attached “Observers” will be notified Specification - separate the statement of how to match a candidate, from the candidate object that it is matched against State - implements a state machine in an object-oriented way Visitor - lets you outsource operations on objects to other objects Strategy - separate strategies and to enable fast switching between them Template Method - one or more algorithm steps can be overridden by subclasses to allow differing behaviors while ensuring that the overarching algorithm is still followed
  • 13. Live coding! What can go wrong? ;-)
  • 14. Tuesday, June 21 at 6 PM - 8 PM All you wanted to know about JavaScript, but were afraid to ask...