Transcript
Page 1: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Code Quality ?

Design Pattern

@somkiat

Page 2: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Pattern Language 1977

Page 3: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Page 4: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice

Christopher Alexander (Architect) “A Pattern Language”

Page 5: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Design Pattern 1994

Page 6: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Page 7: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Design Pattern 1994

Program to an interface, not implementation

Object composition over class inheritance

Page 8: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

SOLID 2000

Page 9: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

SOLID

Single Responsibility Principle

Open/Close Principle

Liskov Substitution Principle

Interface Segregation Principle

Dependency Inversion Principle

Page 10: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Page 11: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Functional Interface 2014

Page 12: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Page 13: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

GoF patterns

Structural

Behavioral

Creational

Page 14: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Structural patterns

Adapter Bridge Decorator

Composite Proxy Flyweight

Page 15: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Structural patterns

Adapter Bridge Decorator

Composite Proxy Flyweight

Object composition over class inheritance

Page 16: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Behavioral patterns

Command Observer State

Iteration Visitor

Page 17: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี

Creational patterns

Static Factory Singleton

Abstract Factory Builder

Monad

Page 18: Design pattern with Java 8

บริษัท สยามํานาญกิจ จํากัด และเพ่ือนพ้องน้องพ่ี