Holub on patterns 2 2

  • View
    1.278

  • Download
    3

  • Category

    Business

Preview:

DESCRIPTION

 

Citation preview

Holub on Patterns

Remove extends

charsyam@naver.com

Why Removes

Extends?

Extends is not Bad.

Just. Using Concrete Class

is Bad

Use Interface!

How to Remove Extens?

Use Abstract Factory!

Using 1

Employee<<interface>> EmployeeFactory

<<Employee>>+create()

Peon

<<void>>+youAreFired()

Factory

Using 2

Using 3

Use Abstract Factory!

2 Patterns Singleton

Abstract Factory

Pass Singleton Pattern

Don’t Use Double-Checked Locking

Threading Issue

Abstract Factory Pattern

Factory is changable

NOT Factory Method Pattern

Abstract Factory Pattern

Abstraction 1 Employee.Factory.create();

Abstraction 2

Employee.create();

Employee.Factory.create();

Java Example

HttpURLConnection

FtpURLConnection

2 Patterns Command Strategy

Pass Command Pattern Default Pattern

Strategy Example

Thank You!

Recommended