holub on patterns 2 2

Post on 05-Dec-2014

1.278 Views

Category:

Business

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

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!

top related