Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
iOSDevUK 2015: Clean Code through Dependency In...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
AppFoundry
September 15, 2015
Programming
680
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
130
Android In Practice
appfoundrybe
0
160
Android Introduction 3.0 by Siebe
appfoundrybe
0
160
Android in Practice (long)
appfoundrybe
0
240
React Native - cross-platform mobile app development
appfoundrybe
0
220
React Native Storybook
appfoundrybe
0
510
the ionic crash course
appfoundrybe
1
220
View based apps with Conductor
appfoundrybe
0
680
Android Accessibility at GDG Devfest Brussels 2016
appfoundrybe
0
700
Other Decks in Programming
See All in Programming
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
380
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2.1k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
ActionController meets Protocol Buffers
sorah
0
520
Domain-Driven Transformation
hschwentner
2
2.3k
すこし踏み込む CancellationToken
htkym
2
1.7k
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
1k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
2
660
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
3.6k
Featured
See All Featured
ラッコキーワード サービス紹介資料
rakko
1
5.3M
Chasing Engaging Ingredients in Design
codingconduct
0
360
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
750
Designing Powerful Visuals for Engaging Learning
tmiket
1
610
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
550
WENDY [Excerpt]
tessaabrams
14
40k
A Modern Web Designer's Workflow
chriscoyier
699
190k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
450
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Evolving SEO for Evolving Search Engines
ryanjones
0
330
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