STAC
THINK IN OO WAYS
WITH INTERFACE AND COL-POP
1
ABOUT SPEAKER
2
ABOUT SPEAKER
3
ABOUT SPEAKER
4
ABOUT SPEAKER
5
ABOUT SPEAKER
6
ABOUT SPEAKER
7
WHAT IS
INTERFACE
8
“SHARED BOUNDARY ACROSS WHICH
TWO SEPARATE COMPONENTS OF A
COMPUTER SYSTEM EXCHANGE
INFORMATION”
Wikipedia/interface
WHAT IS INTERFACE 9
WHAT IS INTERFACE
KEY POINT
▸ Exchange information
▸ Shared boundary
10
WHAT IS INTERFACE
KEY POINT
▸ Exchange information
▸ Shared boundary
11
WHAT IS INTERFACE
EXCHANGE INFORMATION
Procedural vs Object
12
WHAT IS INTERFACE
EXCHANGE INFORMATION
Procedural vs Object
13
WHAT IS INTERFACE
EXCHANGE INFORMATION
Procedural vs Object
14
WHAT IS INTERFACE
KEY POINT
▸ Exchange information
▸ Shared boundary
15
WHAT IS INTERFACE
KEY POINT
▸ Exchange information
▸ Shared boundary
16
WHAT IS INTERFACE
SHARED BOUNDARY
interface C
A implements C
B implements C
A.FOO(1, 2)
B.FOO(1, 2) C
——
FOO:INT, INT->INT
17
WHAT IS
COLPOP
18
WHAT IS COLPOP
COLPOP
implements Eatable, Drinkable
http://www.java67.com/2015/12/top-30-oops-
concept-interview-questions-answers-
java.html#What is the 5 objects oriented design
principle from SOLID?
19
WITH GOOD
OO DESIGN
20
WITH BAD
OO DESIGN
21
COLPOP
&
INTERFACE
22
COLLOP & INTERFACE
SOLID
▸ Single responsibility
▸ Open / Close
▸ Liskov substitution
▸ Interface segregation
▸ Dependency inversion
23
SINGLE RESPONSIBILITY
24
SINGLE RESPONSIBILITY
Cup
25
SINGLE RESPONSIBILITY
Cup
Cup
26
SINGLE RESPONSIBILITY
Cup
Cup
27
SINGLE RESPONSIBILITY
Cup
Cup
28
SINGLE RESPONSIBILITY
Cup
Cup
29
SINGLE RESPONSIBILITY
Cup
Cup
30
COLLOP & INTERFACE
SOLID
▸ Single responsibility
▸ Open / Close
▸ Liskov substitution
▸ Interface segregation
▸ Dependency inversion
31
OPEN / CLOSE
Open Close
32
OPEN / CLOSE
Open Close
OPEN
33
OPEN / CLOSE
Open Close
OPEN
34
OPEN / CLOSE
Open Close
OPEN
CLOSE
35
OPEN / CLOSE
Open Close
OPEN
CLOSE
36
COLLOP & INTERFACE
SOLID
▸ Single responsibility
▸ Open / Close
▸ Liskov substitution
▸ Interface segregation
▸ Dependency inversion
37
LISKOV SUBSTITUTION
Let q(T) is avail
38
LISKOV SUBSTITUTION
Let q(T) is avail
If S ⊂ T then q(S) is also avail
39
LISKOV SUBSTITUTION
Let q(T) is avail
If S ⊂ T then q(S) is also avail
40
LISKOV SUBSTITUTION
Let q(T) is avail
If S ⊂ T then q(S) is also avail
T
41
LISKOV SUBSTITUTION
Let q(T) is avail
If S ⊂ T then q(S) is also avail
T
S T
42
LISKOV SUBSTITUTION
Let q(T) is avail
If S ⊂ T then q(S) is also avail
T
S T
S
43
COLLOP & INTERFACE
SOLID
▸ Single responsibility
▸ Open / Close
▸ Liskov substitution
▸ Interface segregation
▸ Dependency inversion
44
INTERFACE SEGREGATION
45
INTERFACE SEGREGATION
If Cup
46
INTERFACE SEGREGATION
If Cup
47
INTERFACE SEGREGATION
If Cup
48
COLLOP & INTERFACE
SOLID
▸ Single responsibility
▸ Open / Close
▸ Liskov substitution
▸ Interface segregation
▸ Dependency inversion
49
DEPENDENCY INVERSION
50
DEPENDENCY INVERSION
51
DEPENDENCY INVERSION
52
DEPENDENCY INVERSION
Cup
53
DEPENDENCY INVERSION
Cup
Cup
54
DEPENDENCY INVERSION
Cup
Cup
Use Layering!
55
DEPENDENCY INVERSION
Cup
Cup
Use Layering!
Lamp example from The Dependency Inversion Principle[1]
56
[1] [Martin96] Robert C. Martin, Engineering
LET’S MAKE LAMP WITH BUTTON
57
button lamp on off
THE DEPENDENCY INVERSION PRINCIPLE
class Lamp {
void turn(boolean isOn);
}
class Button {
Lamp lamp;
void detect() {
lamp.turn(getPhysicalState());
}
boolean getPhysicalState() {
// … some code to get button physical state
}
}
THE DEPENDENCY INVERSION PRINCIPLE
interface ButtonClient {
void turn(boolean isOn);
}
interface Button {
boolean getState();
}
class ButtonOnOffLamp implements ButtonClient {
}
class ClickButton implements Button {
}
THE DEPENDENCY INVERSION PRINCIPLE
interface ButtonClient {
void turn(boolean isOn);
}
interface Button {
boolean getState();
}
class ButtonOnOffLamp implements ButtonClient {
}
class ClickButton implements Button {
}
THE DEPENDENCY INVERSION PRINCIPLE
interface ButtonClient {
void turn(boolean isOn);
}
interface Button {
boolean getState();
}
class ButtonOnOffLamp implements ButtonClient {
}
class ClickButton implements Button {
}
COLLOP & INTERFACE
EXTRA RULE
▸ KISS
62
COLLOP & INTERFACE
EXTRA RULE
▸ KISS
▸ Keep it Simple and Stupid
63
COLLOP & INTERFACE
EXTRA RULE
▸ KISS
▸ Keep it Simple and Stupid
▸ YAGNI
64
COLLOP & INTERFACE
EXTRA RULE
▸ KISS
▸ Keep it Simple and Stupid
▸ YAGNI
▸ You ain’t gonna need it
65
COLLOP & INTERFACE
EXTRA RULE
▸ KISS
▸ Keep it Simple and Stupid
▸ YAGNI
▸ You ain’t gonna need it
▸ Dry
66
COLLOP & INTERFACE
EXTRA RULE
▸ KISS
▸ Keep it Simple and Stupid
▸ YAGNI
▸ You ain’t gonna need it
▸ Dry
▸ Do not Repeat Yourself
67
oo with interface
10 MIN
5 MIN
STOP
PEER REVIEW
TEXT
PEER REVIEW
▸ Contrived complexity
TEXT
PEER REVIEW
▸ Contrived complexity
▸ Cyclomatic complexity
TEXT
PEER REVIEW
▸ Contrived complexity
▸ Cyclomatic complexity
▸ Down casting
TEXT
PEER REVIEW
▸ Contrived complexity
▸ Cyclomatic complexity
▸ Down casting
▸ Too many parameters
TEXT
PEER REVIEW
▸ Contrived complexity
▸ Cyclomatic complexity
▸ Down casting
▸ Too many parameters
▸ Composition over Inheritance
TEXT
MUST READ
▸ http://www.slideshare.net/gyumee/ss-55817747
▸ http://www.slideshare.net/gyumee/ss-55616001
CLEAN CODE
EFFECTIVE JAVA
CLEAN CODER
oo with interface
FURTHER INTEREST
▸
▸
▸

More Related Content

PDF
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
PDF
공모전을 이용한 인디게임 마케팅
PDF
Introducing Digitalocean 2009
PDF
[5Rocks] 게임데이터 분석 세미나
PDF
[메조미디어] 글로벌 모바일 마케팅 사례_2014.03
PDF
Game programing gems 3.4 3.6
PDF
Instagram marketing solution
PPT
3.4 Pascal Principle
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
공모전을 이용한 인디게임 마케팅
Introducing Digitalocean 2009
[5Rocks] 게임데이터 분석 세미나
[메조미디어] 글로벌 모바일 마케팅 사례_2014.03
Game programing gems 3.4 3.6
Instagram marketing solution
3.4 Pascal Principle

Viewers also liked (19)

PDF
데이나의 참쉬운 애드테크 (20150419)
PDF
리워드광고의 특징과 시사점
PDF
[나스미디어] 한국 모바일게임 시장 분석
PDF
[NDC2014] 친구들아 도와줘 - 다양한 툴을 이용해서 Cocos2d-x 생산성 높이기 (함동기)
PDF
2016 Q1 Facebook & Instagram Trend
PDF
[IGAWorks]광고시장의 격변과 수익모델로서의 광고(AD Tech Ecosystem)
PDF
[메조미디어] AD Tech Trend_Personalization(개인화 마케팅)이란?
PDF
교육 업종 온라인 마케팅 보고서
PDF
게임별 유저 성향 분석
PDF
변경에 강한 애플리케이션, 유기적 애플리케이션
PDF
(KOR) All About Virtual Reality & Augmented Reality by YDM
PDF
React Native를 사용한
 초간단 커뮤니티 앱 제작
PPTX
State of Pascal’s law
PPTX
[Unite2015 박민근] 유니티 최적화 테크닉 총정리
PDF
[메조미디어] 2017년 유망 AD & Contents Tech
PPTX
Physics Unit P2
PDF
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016
PDF
코드품질 개선을 위한 GS SHOP 고군분투기
PDF
[IGAWorks] 데이터로 본 모바일 게임시장 현황과 2015 모바일 마케팅 전략 (Game Tech2015 keynote)
데이나의 참쉬운 애드테크 (20150419)
리워드광고의 특징과 시사점
[나스미디어] 한국 모바일게임 시장 분석
[NDC2014] 친구들아 도와줘 - 다양한 툴을 이용해서 Cocos2d-x 생산성 높이기 (함동기)
2016 Q1 Facebook & Instagram Trend
[IGAWorks]광고시장의 격변과 수익모델로서의 광고(AD Tech Ecosystem)
[메조미디어] AD Tech Trend_Personalization(개인화 마케팅)이란?
교육 업종 온라인 마케팅 보고서
게임별 유저 성향 분석
변경에 강한 애플리케이션, 유기적 애플리케이션
(KOR) All About Virtual Reality & Augmented Reality by YDM
React Native를 사용한
 초간단 커뮤니티 앱 제작
State of Pascal’s law
[Unite2015 박민근] 유니티 최적화 테크닉 총정리
[메조미디어] 2017년 유망 AD & Contents Tech
Physics Unit P2
지적 대화를 위한 깊고 넓은 딥러닝 PyCon APAC 2016
코드품질 개선을 위한 GS SHOP 고군분투기
[IGAWorks] 데이터로 본 모바일 게임시장 현황과 2015 모바일 마케팅 전략 (Game Tech2015 keynote)
Ad

Recently uploaded (20)

PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Abstractive summarization using multilingual text-to-text transfer transforme...
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PPTX
2018-HIPAA-Renewal-Training for executives
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PPTX
Configure Apache Mutual Authentication
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Flame analysis and combustion estimation using large language and vision assi...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PPT
What is a Computer? Input Devices /output devices
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
CloudStack 4.21: First Look Webinar slides
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
Developing a website for English-speaking practice to English as a foreign la...
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Abstractive summarization using multilingual text-to-text transfer transforme...
Custom Battery Pack Design Considerations for Performance and Safety
2018-HIPAA-Renewal-Training for executives
Consumable AI The What, Why & How for Small Teams.pdf
Configure Apache Mutual Authentication
1 - Historical Antecedents, Social Consideration.pdf
Flame analysis and combustion estimation using large language and vision assi...
A comparative study of natural language inference in Swahili using monolingua...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Convolutional neural network based encoder-decoder for efficient real-time ob...
What is a Computer? Input Devices /output devices
Zenith AI: Advanced Artificial Intelligence
sbt 2.0: go big (Scala Days 2025 edition)
CloudStack 4.21: First Look Webinar slides
NewMind AI Weekly Chronicles – August ’25 Week III
Ad

oo with interface