SlideShare une entreprise Scribd logo
1  sur  60
Télécharger pour lire hors ligne
class SuperRobotHand {}
class RobotHand {}
class Robot {
let hand: RobotHand = RobotHand()
}
class SuperRobotHand {}
class RobotHand {}
class Robot {
let hand: RobotHand = RobotHand()
}
protocol RobotHand {}
class NormalRobotHand: RobotHand {}
class SuperRobotHand: RobotHand {}
class Robot {
let hand: RobotHand = NormalRobotHand()
}
protocol RobotHand {}
class NormalRobotHand: RobotHand {}
class SuperRobotHand: RobotHand {}
class Robot {
let hand: RobotHand = NormalRobotHand()
}
protocol RobotHand {}
protocol RobotBody {}
class NormalRobotHand: RobotHand {}
class SuperRobotHand: RobotHand {}
class CoolRobotBody: RobotBody {}
class CuteRobotBody: RobotBody {}
class Robot {
init(hand: RobotHand, body: RobotBody) { ... }
}
class Factory {
func makeRobot() -> Robot {
return Robot(hand: SuperRobotHand(), body: CuteRobotBody())
}
}
class Factory {
func makeRobot() -> Robot {
return Robot(hand: SuperRobotHand(), body: CuteRobotBody())
}
}
class Robot {
/// Property Injection
let hand: RobotHand = NormalRobotHand()
/// Constructor Injection
init(body: RobotBody) {
self.hand = hand
self.body = body
}
}
class SeoulFactory {
let robot = Robot(
hand: SuperRobotHand(),
body: CuteRobotBody()
)
}
class IncheonFactory {
let robot = Robot(
hand: SuperRobotHand(),
body: CuteRobotBody()
)
}
IoC(Inversion of Control)를 구현하는 프레임워크로 객체를 관리하고,
객체의 생성을 책임지고, 의존성을 관리하는 컨테이너이다.
protocol RobotType {}
class Robot: RobotType { ... }
class SeoulFactory {
let robot = Container.get(RobotType.self)
}
class IncheonFactory {
let robot = Container.get(RobotType.self)
}
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
// weaver: movieManager = MovieManager <- MovieManaging
// weaver: movieManager.scope = .container
}
protocol MovieManaging {}
class MovieManager: MovieManaging {}
DEFINITIONS:
- service: MovieManaging
component: MovieManager
interface MovieManaging {}
@Component
class MovieManager() : MovieManaging {}
protocol MovieManaging {}
class MovieManager: MovieManaging, Component {}
protocol UserService {
func login(id: String, password: String) -> User?
func logout()
}
class UserServiceImpl: UserService, Component {
func login(id: String, password: String) -> User? {
...
}
func logout() {
...
}
init() {}
}
class LoginViewModel: Autowired {
let userService: UserService
required init(_ userService: UserService) {
self.userService = userService
}
}
class LoginViewModel: Autowired {
let userService: UserService
required init(_ userService: UserService) {
self.userService = userService
}
}
UserService
UserServiceImpl
LoginViewModel
IoC Container
class FriendListViewModel: Autowired {
func generateInfo(by id: String) -> FriendInfoViewModel? {
let friend = friendService.getFriend(by: id)
return Inject(
FriendInfoViewModel.self,
with: (
userID: friend.id,
cachedName: friend.name
)
)
}
}
class FriendListViewModel: Autowired {
func generateInfo(by id: String) -> FriendInfoViewModel? {
let friend = friendService.getFriend(by: id)
return Inject(
FriendInfoViewModel.self,
with: (
userID: friend.id,
cachedName: friend.name
)
)
}
}
class FriendPayload: Payload {
required init(
with argument: (userID: String, cachedName: String)
) { ... }
}
class FriendInfoViewModel: AutowiredFactory {
required init(
_ accountService: AccountService,
payload: FriendPayload
) { ... }
}
class FriendPayload: Payload {
required init(
with argument: (userID: String, cachedName: String)
) { ... }
}
class FriendInfoViewModel: AutowiredFactory {
required init(
_ accountService: AccountService,
payload: FriendPayload
) { ... }
}
class FriendPayload: Payload {
required init(
with argument: (userID: String, cachedName: String)
) { ... }
}
class FriendInfoViewModel: AutowiredFactory {
required init(
_ accountService: AccountService,
payload: FriendPayload
) { ... }
}
알아보자 Dependency Injection과 Deli
알아보자 Dependency Injection과 Deli
알아보자 Dependency Injection과 Deli
알아보자 Dependency Injection과 Deli

Contenu connexe

Tendances

Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataAndroid MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataWaheed Nazir
 
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...ENSET, Université Hassan II Casablanca
 
Angular Dependency Injection
Angular Dependency InjectionAngular Dependency Injection
Angular Dependency InjectionNir Kaufman
 
Multiplatform architecture ribs in swift
Multiplatform architecture ribs in swiftMultiplatform architecture ribs in swift
Multiplatform architecture ribs in swiftNAVER Engineering
 
Spring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesSpring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesVMware Tanzu
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use casesFabio Biondi
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of SignalsCoding Academy
 
React Router: React Meetup XXL
React Router: React Meetup XXLReact Router: React Meetup XXL
React Router: React Meetup XXLRob Gietema
 
Spring Boot Actuator
Spring Boot ActuatorSpring Boot Actuator
Spring Boot ActuatorRowell Belen
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutinesRoman Elizarov
 
Introduction à React JS
Introduction à React JSIntroduction à React JS
Introduction à React JSAbdoulaye Dieng
 
React Lifecycle and Reconciliation
React Lifecycle and ReconciliationReact Lifecycle and Reconciliation
React Lifecycle and ReconciliationZhihao Li
 
Django class based views for beginners
Django class based views for beginnersDjango class based views for beginners
Django class based views for beginnersSpin Lai
 
Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular Jalpesh Vadgama
 
React js programming concept
React js programming conceptReact js programming concept
React js programming conceptTariqul islam
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥Remo Jansen
 

Tendances (20)

Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataAndroid MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
 
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
 
Angular Dependency Injection
Angular Dependency InjectionAngular Dependency Injection
Angular Dependency Injection
 
Support Web Services SOAP et RESTful Mr YOUSSFI
Support Web Services SOAP et RESTful Mr YOUSSFISupport Web Services SOAP et RESTful Mr YOUSSFI
Support Web Services SOAP et RESTful Mr YOUSSFI
 
Multiplatform architecture ribs in swift
Multiplatform architecture ribs in swiftMultiplatform architecture ribs in swift
Multiplatform architecture ribs in swift
 
Rxjs ppt
Rxjs pptRxjs ppt
Rxjs ppt
 
Spring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutesSpring Data JPA from 0-100 in 60 minutes
Spring Data JPA from 0-100 in 60 minutes
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use cases
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
 
React Router: React Meetup XXL
React Router: React Meetup XXLReact Router: React Meetup XXL
React Router: React Meetup XXL
 
Spring Boot Actuator
Spring Boot ActuatorSpring Boot Actuator
Spring Boot Actuator
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutines
 
Introduction à React JS
Introduction à React JSIntroduction à React JS
Introduction à React JS
 
React Lifecycle and Reconciliation
React Lifecycle and ReconciliationReact Lifecycle and Reconciliation
React Lifecycle and Reconciliation
 
Django class based views for beginners
Django class based views for beginnersDjango class based views for beginners
Django class based views for beginners
 
Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular Top 10 RxJs Operators in Angular
Top 10 RxJs Operators in Angular
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
Jeu jee session
Jeu jee sessionJeu jee session
Jeu jee session
 
React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
 

Similaire à 알아보자 Dependency Injection과 Deli

The definitive guide to java agents
The definitive guide to java agentsThe definitive guide to java agents
The definitive guide to java agentsRafael Winterhalter
 
Desarrollo para Android con Groovy
Desarrollo para Android con GroovyDesarrollo para Android con Groovy
Desarrollo para Android con GroovySoftware Guru
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummaryAmal Khailtash
 
Protocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftProtocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftOleksandr Stepanov
 
Intro programacion funcional
Intro programacion funcionalIntro programacion funcional
Intro programacion funcionalNSCoder Mexico
 
Paradigmas de linguagens de programacao - aula#9
Paradigmas de linguagens de programacao - aula#9Paradigmas de linguagens de programacao - aula#9
Paradigmas de linguagens de programacao - aula#9Ismar Silveira
 
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey BuzdinMarvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey BuzdinJava User Group Latvia
 
Удобный и расширяемый роутинг в iOS-приложении / Тимур Юсипов (Avito)
Удобный и расширяемый роутинг в iOS-приложении / Тимур Юсипов (Avito)Удобный и расширяемый роутинг в iOS-приложении / Тимур Юсипов (Avito)
Удобный и расширяемый роутинг в iOS-приложении / Тимур Юсипов (Avito)Ontico
 
"Удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Avito)
"Удобный и расширяемый роутинг в iOS-приложении" Тимур  Юсипов (Avito)"Удобный и расширяемый роутинг в iOS-приложении" Тимур  Юсипов (Avito)
"Удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Avito)AvitoTech
 
What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.Mark Rees
 
Taming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeTaming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeMacoscope
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy codeShriKant Vashishtha
 
"Marshroute: удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Av...
"Marshroute: удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Av..."Marshroute: удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Av...
"Marshroute: удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Av...AvitoTech
 
Code generation for alternative languages
Code generation for alternative languagesCode generation for alternative languages
Code generation for alternative languagesRafael Winterhalter
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM patternNAVER Engineering
 

Similaire à 알아보자 Dependency Injection과 Deli (20)

The definitive guide to java agents
The definitive guide to java agentsThe definitive guide to java agents
The definitive guide to java agents
 
Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
Java byte code in practice
Java byte code in practiceJava byte code in practice
Java byte code in practice
 
Desarrollo para Android con Groovy
Desarrollo para Android con GroovyDesarrollo para Android con Groovy
Desarrollo para Android con Groovy
 
SystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features SummarySystemVerilog OOP Ovm Features Summary
SystemVerilog OOP Ovm Features Summary
 
Protocol-Oriented Programming in Swift
Protocol-Oriented Programming in SwiftProtocol-Oriented Programming in Swift
Protocol-Oriented Programming in Swift
 
Intro programacion funcional
Intro programacion funcionalIntro programacion funcional
Intro programacion funcional
 
Paradigmas de linguagens de programacao - aula#9
Paradigmas de linguagens de programacao - aula#9Paradigmas de linguagens de programacao - aula#9
Paradigmas de linguagens de programacao - aula#9
 
E:\Plp 2009 2\Plp 9
E:\Plp 2009 2\Plp 9E:\Plp 2009 2\Plp 9
E:\Plp 2009 2\Plp 9
 
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey BuzdinMarvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
 
Удобный и расширяемый роутинг в iOS-приложении / Тимур Юсипов (Avito)
Удобный и расширяемый роутинг в iOS-приложении / Тимур Юсипов (Avito)Удобный и расширяемый роутинг в iOS-приложении / Тимур Юсипов (Avito)
Удобный и расширяемый роутинг в iOS-приложении / Тимур Юсипов (Avito)
 
"Удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Avito)
"Удобный и расширяемый роутинг в iOS-приложении" Тимур  Юсипов (Avito)"Удобный и расширяемый роутинг в iOS-приложении" Тимур  Юсипов (Avito)
"Удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Avito)
 
DotNet Conference: code smells
DotNet Conference: code smellsDotNet Conference: code smells
DotNet Conference: code smells
 
What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.
 
Taming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, MacoscopeTaming Core Data by Arek Holko, Macoscope
Taming Core Data by Arek Holko, Macoscope
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy code
 
"Marshroute: удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Av...
"Marshroute: удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Av..."Marshroute: удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Av...
"Marshroute: удобный и расширяемый роутинг в iOS-приложении" Тимур Юсипов (Av...
 
Code generation for alternative languages
Code generation for alternative languagesCode generation for alternative languages
Code generation for alternative languages
 
Javascript Design Patterns
Javascript Design PatternsJavascript Design Patterns
Javascript Design Patterns
 
[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern[22]Efficient and Testable MVVM pattern
[22]Efficient and Testable MVVM pattern
 

Dernier

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Dernier (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

알아보자 Dependency Injection과 Deli

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18. class SuperRobotHand {} class RobotHand {} class Robot { let hand: RobotHand = RobotHand() }
  • 19. class SuperRobotHand {} class RobotHand {} class Robot { let hand: RobotHand = RobotHand() }
  • 20. protocol RobotHand {} class NormalRobotHand: RobotHand {} class SuperRobotHand: RobotHand {} class Robot { let hand: RobotHand = NormalRobotHand() }
  • 21. protocol RobotHand {} class NormalRobotHand: RobotHand {} class SuperRobotHand: RobotHand {} class Robot { let hand: RobotHand = NormalRobotHand() }
  • 22.
  • 23.
  • 24. protocol RobotHand {} protocol RobotBody {} class NormalRobotHand: RobotHand {} class SuperRobotHand: RobotHand {} class CoolRobotBody: RobotBody {} class CuteRobotBody: RobotBody {} class Robot { init(hand: RobotHand, body: RobotBody) { ... } } class Factory { func makeRobot() -> Robot { return Robot(hand: SuperRobotHand(), body: CuteRobotBody()) } }
  • 25. class Factory { func makeRobot() -> Robot { return Robot(hand: SuperRobotHand(), body: CuteRobotBody()) } }
  • 26. class Robot { /// Property Injection let hand: RobotHand = NormalRobotHand() /// Constructor Injection init(body: RobotBody) { self.hand = hand self.body = body } }
  • 27.
  • 28. class SeoulFactory { let robot = Robot( hand: SuperRobotHand(), body: CuteRobotBody() ) } class IncheonFactory { let robot = Robot( hand: SuperRobotHand(), body: CuteRobotBody() ) }
  • 29.
  • 30. IoC(Inversion of Control)를 구현하는 프레임워크로 객체를 관리하고, 객체의 생성을 책임지고, 의존성을 관리하는 컨테이너이다.
  • 31.
  • 32. protocol RobotType {} class Robot: RobotType { ... } class SeoulFactory { let robot = Container.get(RobotType.self) } class IncheonFactory { let robot = Container.get(RobotType.self) }
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40. @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { // weaver: movieManager = MovieManager <- MovieManaging // weaver: movieManager.scope = .container } protocol MovieManaging {} class MovieManager: MovieManaging {}
  • 42. interface MovieManaging {} @Component class MovieManager() : MovieManaging {}
  • 43. protocol MovieManaging {} class MovieManager: MovieManaging, Component {}
  • 44.
  • 45.
  • 46. protocol UserService { func login(id: String, password: String) -> User? func logout() } class UserServiceImpl: UserService, Component { func login(id: String, password: String) -> User? { ... } func logout() { ... } init() {} }
  • 47.
  • 48. class LoginViewModel: Autowired { let userService: UserService required init(_ userService: UserService) { self.userService = userService } }
  • 49. class LoginViewModel: Autowired { let userService: UserService required init(_ userService: UserService) { self.userService = userService } }
  • 51.
  • 52. class FriendListViewModel: Autowired { func generateInfo(by id: String) -> FriendInfoViewModel? { let friend = friendService.getFriend(by: id) return Inject( FriendInfoViewModel.self, with: ( userID: friend.id, cachedName: friend.name ) ) } }
  • 53. class FriendListViewModel: Autowired { func generateInfo(by id: String) -> FriendInfoViewModel? { let friend = friendService.getFriend(by: id) return Inject( FriendInfoViewModel.self, with: ( userID: friend.id, cachedName: friend.name ) ) } }
  • 54. class FriendPayload: Payload { required init( with argument: (userID: String, cachedName: String) ) { ... } } class FriendInfoViewModel: AutowiredFactory { required init( _ accountService: AccountService, payload: FriendPayload ) { ... } }
  • 55. class FriendPayload: Payload { required init( with argument: (userID: String, cachedName: String) ) { ... } } class FriendInfoViewModel: AutowiredFactory { required init( _ accountService: AccountService, payload: FriendPayload ) { ... } }
  • 56. class FriendPayload: Payload { required init( with argument: (userID: String, cachedName: String) ) { ... } } class FriendInfoViewModel: AutowiredFactory { required init( _ accountService: AccountService, payload: FriendPayload ) { ... } }