Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Limits of Modularity
Samuel E. Giddins
May 19, 2015
Technology
0
64
Limits of Modularity
Samuel E. Giddins
May 19, 2015
Tweet
Share
More Decks by Samuel E. Giddins
See All by Samuel E. Giddins
Switching Disciplines as a Tech Lead
segiddins
0
6
Source Code to Executable
segiddins
0
55
Empowering iOS Developers
segiddins
1
55
Empowering iOS Developers
segiddins
0
340
Making CocoaPods Fast (with Modern Ruby Tooling)
segiddins
0
18
Making CocoaPods Fast
segiddins
0
230
Answering the Existential Question
segiddins
0
27
Scaling CocoaPods
segiddins
0
33
Building Swift Static Libraries
segiddins
0
270
Other Decks in Technology
See All in Technology
モバイルモーションキャプチャーデバイス「mocopi」を軽く試してみた / IoTLT vol.95 (新年会IoTLTラジオ)
you
0
100
Hatena Engineer Seminar #23 「チームとプロダクトを育てる Mackerel 開発合宿」
arthur1
0
650
OpenShiftのリリースノートを整理してみた
loftkun
2
450
💰年度末予算消化祭💰 Large Memory Instance で 画像分類してみた
__allllllllez__
0
120
SSMパラメーターストアでクロススタック参照の罠を回避する
shuyakinjo
0
8k
02_プロトタイピングの進め方
kouzoukaikaku
0
850
イ良い日ンマを作る(USBストレージ容量偽装の手法) / USB Storage Capacity Faking Techniques
shutingrz
0
560
スクラムマスターの悩みどころを赤裸々に告白します
nagata03
0
200
Deep Neural Networkの共同学習
hf149
0
360
Cloudflare Workersで動くOG画像生成器
aiji42
1
510
地方自治体業務あるある ーアナログ最適化編-
y150saya
1
300
SPA・SSGでSSRのようなOGP対応!
simo123
2
170
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
65
7.8k
What’s in a name? Adding method to the madness
productmarketing
12
1.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
339
18k
Building Adaptive Systems
keathley
27
1.3k
Creatively Recalculating Your Daily Design Routine
revolveconf
207
11k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
270
12k
How GitHub Uses GitHub to Build GitHub
holman
465
280k
BBQ
matthewcrist
75
8.1k
Learning to Love Humans: Emotional Interface Design
aarron
263
38k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
351
21k
Fireside Chat
paigeccino
16
1.9k
Pencils Down: Stop Designing & Start Developing
hursman
114
10k
Transcript
The Limits of Modularity Samuel Giddins
Samuel Giddins Realm CocoaPods Bundler RestKit
Bundler & CocoaPods Two Dependency Managers
None
• ruby -e "$(curl -fsSL https:// raw.githubusercontent.com/Homebrew/install/master/ install)" • brew
install python • easy_install pip • pip install pygments • brew install rbenv ruby-install • rbenv install 2.2.2 • gem install pygments.rb
Let’s take a peek at the architecture behind CocoaPods
None
In an iOS App
Let’s start at the networking layer
We have ’s NSURLConnection / NSURLSession to base things off
of So far, so good
We then use JXHTTP or AFNetworking, since both provide some
features and a nicer API
We then make a TMAPIClient (inside a pod called TMTumblrSDK),
since we want to abstract away the network calls we make
We then make a TumblrCore pod, to be able to
share code between our app and its extensions
And now, we have Tumblr.app! Whew.
That’s what’s called a deep dependency graph.
aside: Those things are really hard to fully ‘resolve’ It’s
a problem I’ve sunk many hours into
So, this is great! We’ve re-used lots of code, made
things modular, ‘componentized’ everything... Life is wonderful!
Until...
We need to change things. (And yes, this is where
we get to the interesting parts)
Let’s say we want to update our UI to show
upload progress for a new post
(I went through nearly this exact scenario when I worked
on the Tumblr app)
OK, so the first step is going to be figuring
out where, exactly, in this stack we can even start.
Start in the wrong place, and you’ll be working at
the wrong level of abstraction, and you’ll be contorting to even make simple changes.
I just need to rearchitect sockets and everything will work
beautifully!
Have fun.
Well, I just need to swizzle these three methods, and
I can do everything in my app!
And again in my share extension. And then again in
the right place because who in their right mind wants to swizzle the same method in three places!?
Again & Again & Again
So we settle upon making this change inside JXHTTP. Excellent.
@property JXHTTPRequestProgressBlock progressBlock;
While we're in there, we choose to move a few
things around to make adding support for that progressBlock easier.
And this is great! !
So now we release a new minor version, and go
back up one level to incorporate those changes.
s/~> 1.2.4/~> 1.3.0
And our tests now fail !
Imagine this happening all the way up the dependency chain
Dependency Paralysis
When our frameworks aren't perfect, the gaps between them can
easily fissure
And our frameworks are never perfect
Edge cases and implicit assumptions propogate through each dependency
One subtle change can be in just the wrong place
And everything collapses
Our usual measures for keeping things sane & safe will
work against us
• Tests • Documentation • Encapsulation • Stable releases
All of those work by applying the brakes on drastic
changes
But N levels deep, every change at the bottom is
drastic
And you'll find that almost every change requires touching something
near the bottom
We also have to decide where to put everything
And choosing wrong? => !
We hear stories of Facebooks and the like with their
mono-repos
And all of this is why Move fast vs. being
"really" modular
So, Samuel, what's the right answer?
Available now on Speaker Deck. https://speakerdeck.com/segiddins/limits-of-modularity
for (Question *question in self.audience.questions) { NSLog(@"%@", [[question ask] valueForKey:@"answer"]);
}
Samuel Giddins Realm @segiddins