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
iOSDevUK 2015: Clean Code through Dependency In...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
AppFoundry
September 15, 2015
Programming
670
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
iOSDevUK 2015: Clean Code through Dependency Injection
This is a 5 minute fast-talk we gave at iOSDevUK 2015.
AppFoundry
September 15, 2015
More Decks by AppFoundry
See All by AppFoundry
Introductie iOS - Jens
appfoundrybe
0
120
Android In Practice
appfoundrybe
0
160
Android Introduction 3.0 by Siebe
appfoundrybe
0
150
Android in Practice (long)
appfoundrybe
0
240
React Native - cross-platform mobile app development
appfoundrybe
0
210
React Native Storybook
appfoundrybe
0
500
the ionic crash course
appfoundrybe
1
210
View based apps with Conductor
appfoundrybe
0
670
Android Accessibility at GDG Devfest Brussels 2016
appfoundrybe
0
700
Other Decks in Programming
See All in Programming
承認済みなのに差戻しできてしまうバグ、型で潰せます
shinchit
0
120
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
230
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
420
Dockerfile CMD for Node.js
grazie1999
0
140
T3DD26: From RAGs to Riches
martinhelmich
0
120
Hono + Inertia + React で LP を構築した話
oukayuka
2
180
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
190
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
5
1.8k
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
560
VibeCodingからAgenticWorkflowへ
starfish719
0
940
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
460
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
430
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
500
The Cult of Friendly URLs
andyhume
79
7k
WCS-LA-2024
lcolladotor
0
810
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
410
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
420
Become a Pro
speakerdeck
PRO
31
6.2k
Utilizing Notion as your number one productivity tool
mfonobong
4
560
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
2
3.8k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
580
Transcript
Clean Code through Dependency Injection
Your host Mike Seghers Developer/Architect
[email protected]
@mikeseghers
Creating apps: a recent history
2012
Coding Example Acceptable in 2012 struct SkeumorphicDesigner { func createDesign(requirements:
Requirements) -> Design { //Draws some boxes with stitches, applies colors //returns Design } } struct ObjectiveCDeveloper { func createApp(requirements: Requirements, design: Design) -> App { //Does some code between [], applies the design using //InterfaceBuilder, returns App }
Coding Example Acceptable in 2012 class AppFactory2012 { private let
developer:ObjectiveCDeveloper private let designer:SkeumorphicDesigner init() { developer = ObjectiveCDeveloper() designer = SkeumorphicDesigner() } public func createApp(requirements:Requirements) -> App { let design = designer.createDesign(requirements) return developer.createApp(requirements, design: design) } } … let appFactory = AppFactory2012() let app = appFactory.createApp(requirements)
2013
Coding Example Acceptable in 2013 struct FlatDesigner { func createDesign(requirements:
Requirements) -> Design { //Draws some flat boxes, applies less color, returns Design } } struct ObjectiveCDeveloper { … }
Coding Example Acceptable in 2013 class AppFactory2013 { private let
developer:ObjectiveCDeveloper private let designer:FlatDesigner init() { developer = ObjectiveCDeveloper() designer = FlatDesigner() } public func createApp(requirements:Requirements) -> App { let design = designer.createDesign(requirements) return developer.createApp(requirements, design: design) } } … let appFactory = AppFactory2013() let app = appFactory.createApp(requirements)
Current
Coding Example Acceptable in now struct SwiftDeveloper { func createApp(requirements:
Requirements, design: Design) -> App { //Does some code without semi-colons, applies the //design using StoryBoards, returns App } struct FlatDesigner { … }
Coding Example Acceptable in now class AppFactory2014 { private let
developer:SwiftDeveloper private let designer:FlatDesigner init() { developer = SwiftDeveloper() designer = FlatDesigner() } public func createApp(requirements:Requirements) -> App { let design = designer.createDesign(requirements) return developer.createApp(requirements, design: design) } } … let appFactory = AppFactory2014() let app = appFactory.createApp(requirements)
How many app factories does one need?
Coding Example Acceptable all the time protocol Designer { func
createDesign(requirements: Requirements) -> Design } protocol Developer { func createApp(requirements: Requirements, design: Design) -> App } extension SkeumorphicDesigner : Designer {} extension FlatDesigner : Designer {} extension ObjectiveCDeveloper : Developer {} extension SwiftDeveloper : Developer {}
Coding Example Acceptable all the time class AppFoundry { private
let developer:Developer private let designer:Designer init(developer: Developer, designer: Designer) { self.developer = developer self.designer = designer } func createApp(requirements:Requirements) -> App { let design = designer.createDesign(requirements) return developer.createApp(requirements, design: design) } }
Coding Example Acceptable all the time let developer = ObjectiveCDeveloper()
let designer = SkeumorphicDesigner() let oldSchoolFoundry = AppFoundry(developer: developer, designer: designer) oldSchoolFoundry.createApp(requirements)
Coding Example Acceptable all the time let developer = ObjectiveCDeveloper()
let designer = FlatDesigner() let playingItSaveFoundry = AppFoundry(developer: developer, designer: designer) playingItSaveFoundry.createApp(requirements)
Dependency Injection
Helps with reusable code
Dependency Injection
Helps with loose coupling
Dependency Injection
Helps with (unit) tests
Dependency Injection
Helps keep your code clean
Questions? Come talk to me! Mike Seghers Developer/Architect
[email protected]
@mikeseghers
https://github.com/appfoundry/Reliant