Skip to content

ankanchanda/headFirstDucker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Putting Learnings into code. From the ducker book: head first design patterns.

Chapters

  • ch1 - Intro to design patterns and Strategy
  • ch2 - Observer
  • ch3 - Decorator
  • ch4 - Factory

OO Basics

  1. Abstraction
  2. Encapsulation
  3. Polymorphism
  4. Inheritance

OO Principles

  1. Encapsulate what varies
  2. Favor composition over inheritance
  3. Program to interfaces, not implementations
  4. Strive for loosely coupled designs between objects that interact

OO Patterns

Strategy

Defines a family of algorithms, encapsulates each one and make them interchangeable. Strategy lets algorithm vary independently from clients that use it.

Observer

Defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Decorator

The Decorator Pattern attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub-classing for extending functionality.

Factory-Method

The Factory Method Pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.

Design Principles

The Open-Closed Principal

Classes should be open for extension, but closed for modification.

The Dependency Inversion Principle

Depend upon abstractions. Do not depend upon concrete classes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages