Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Setting Boundaries
Search
Francisco Díaz
March 10, 2016
Programming
1
75
Setting Boundaries
Presented at ViDIA meetup.
Francisco Díaz
March 10, 2016
Tweet
Share
More Decks by Francisco Díaz
See All by Francisco Díaz
Working effectively at scale
fdiaz
4
250
I hate public speaking. So why do I keep doing it?
fdiaz
0
69
Definiendo límites
fdiaz
1
54
Si odio hablar en público. ¿Por qué lo sigo haciendo?
fdiaz
2
86
Move fast and keep your code quality
fdiaz
1
310
De qué hablo cuando hablo de trabajo remoto
fdiaz
1
92
Swift Values
fdiaz
0
56
Sisifo o Cómo empezar de nuevo - y otra vez.
fdiaz
0
62
Other Decks in Programming
See All in Programming
2 週間で Twitter Bot を作ってみた
contour_gara
0
770
Git Lint
bkuhlmann
4
760
使ってみよう Azure AI Document Intelligence
kosmosebi
2
360
Goのエラースタックトレースの歴史と今後
sonatard
10
1.8k
Documentation for users with AsciiDoc and Antora
ahus1
0
370
Azure OpenAI Serviceのプロンプトエンジニアリング入門
tomokusaba
3
870
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
440
VS Code をプロダクトにどう取り込むか
onomax
1
710
Deep Dive into React Stream/Serialize
mugi_uno
3
680
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
1
360
"config" ってなんだ? / What is "config"?
okashoi
0
320
Code Reviews
bkuhlmann
4
900
Featured
See All Featured
Side Projects
sachag
451
41k
Statistics for Hackers
jakevdp
790
220k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Making the Leap to Tech Lead
cromwellryan
125
8.5k
For a Future-Friendly Web
brad_frost
172
9k
Building Better People: How to give real-time feedback that sticks.
wjessup
356
18k
The Pragmatic Product Professional
lauravandoore
26
5.8k
A designer walks into a library…
pauljervisheath
201
23k
Making Projects Easy
brettharned
109
5.5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
22
1.6k
Being A Developer After 40
akosma
66
580k
Transcript
Setting Boundaries
None
Francisco Díaz @fco_diaz
3 iOS Devs 28 hours 1 project == Merge Conflicts
What do we want? → Minimize duplication of code. →
Develop independently without stepping on each other's toes.
Feature verticals: → Big Panic button → Today widget →
Knock
Big Panic button:
What needs to be done? → Create the button. →
We need a way to create reports. → Make a backend call to save this information.
Today widget:
What needs to be done? → Create the extension button.
→ We need a way to create reports. → Make a backend call to save this information.
What was it that we wanted? → Minimize duplication of
code. → Develop independently without stepping on each other's toes.
None
Let's try again!
→ Create the button. → We need a way to
create reports. → Make a backend call to save this information.
UI / Presentation Create the button.
Business logic We need a way to create reports.
Backend connection Make a backend call to save this information.
None
To recap: → Minimize duplication of code. → Develop independently
without stepping on each other's toes.
We can solve any problem by introducing an extra level
of indirection — David Wheeler
Dependency inversion
struct ModelDataManager { let APIClient: APIType init(APIClient: APIType) { self.APIClient
= APIClient } }
protocol APIType { func createReport(completion: JSONDictionary? -> Void) } struct
API { private let manager: Alamofire.Manager init() { manager = Alamofire.Manager() } } extension API: APIType { func createReport(completion: JSONDictionary? -> Void) { manager.request(.POST, "https://some.com/api/report") .responseJSON { response in completion(response) } } }
struct ModelDataManager { let APIClient: APIType init(API: APIType) { self.APIClient
= API } static func defaultManager() -> ModelDataManager { let APIClient = API() return ModelDataManager(API: APIClient) } func createReport(completionHandler completion: Report? -> Void) { APIClient.createReport() { jsonDictionary in let report = ... // Parse jsonDictionary into Report completion(report) } } }
Benefits → Testable. → Decoupled. → Easy to fake our
networking layer.
None
struct FakeAPI: APIType { func createReport(completion: JSONDictionary? -> Void) {
let dictionary = ["id": 12345] completion(dictionary) } }
struct ModelDataManager { let APIClient: APIType init(API: APIType) { self.APIClient
= API } static func defaultManager() -> ModelDataManager { // let APIClient = API() let APIClient = FakeAPI() return ModelDataManager(API: APIClient) } }
Questions? Slides are available at: https://github.com/fdiaz/settings-boundaries-talk References: Architecture: The Lost
Years The Clean Architecture