Skip to content

Latest commit

 

History

History
32 lines (28 loc) · 1.25 KB

README.md

File metadata and controls

32 lines (28 loc) · 1.25 KB

php-headfirst-design-patterns

PHP implementation for Headfirst Design Patterns book examples.

Implemented design patterns

Decorator

Class Diagram

Definition

Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.

OO Principle

Classes should be open for extension but closed for modification.

Factory

Factory Method

Class Diagram

Definition

Defines an interface for creating an object, but lets subclasses decide witch class to instantiate.

Factory Method lets a defer instantiation to subclasses.

OO Principle [Dependency Inversion]

Depend upon abstractions. Do not depend upon concrete classes.

Abstract Factory

Class Diagram

Definition

provides an interface for creating families of related or dependent objects without specifying their concrete classes.

Singleton

Class Diagram

Definition

Ensures that a class has only one instance, and provides a global point of access to it.