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
Bad Cocoa
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Delisa Mason
May 28, 2014
Programming
17k
12
Share
Bad Cocoa
How-to guide for building the kind of code you will deeply regret later
Delisa Mason
May 28, 2014
More Decks by Delisa Mason
See All by Delisa Mason
Pod for Great Good
kattrali
2
430
AppKit for iOS Developers
kattrali
5
880
Crafting iOS Dev Tools in Redcar, the Ruby Editor
kattrali
2
820
Other Decks in Programming
See All in Programming
年間50登壇、単著出版、雑誌寄稿、Podcast出演、YouTube、CM、カンファレンス主催……全部やってみたので面白さ等を比較してみよう / I’ve tried them all, so let’s compare how interesting they are.
nrslib
4
780
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
530
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
920
Vibe NLP for Applied NLP
inesmontani
PRO
0
420
Going Multiplatform with Your Android App (Android Makers 2026)
zsmb
2
420
CDK Deployのための ”反響定位”
watany
4
760
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
260
煩雑なSkills管理をSoC(関心の分離)により解決する――関心を分離し、プロンプトを部品として育てるためのOSSを作った話 / Solving Complex Skills Management Through SoC (Separation of Concerns)
nrslib
4
930
ハンズオンで学ぶクラウドネイティブ
tatsukiminami
0
130
クラウドネイティブなエンジニアに向ける Raycastの魅力と実際の活用事例
nealle
2
190
実用!Hono RPC2026
yodaka
2
210
今こそ押さえておきたい アマゾンウェブサービス(AWS)の データベースの基礎 おもクラ #6版
satoshi256kbyte
1
240
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6.1k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
180
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
450
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
170
Designing for Timeless Needs
cassininazir
0
190
How to Ace a Technical Interview
jacobian
281
24k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
98
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Being A Developer After 40
akosma
91
590k
Transcript
Bad Cocoa How to write the code of deep regret
quickly and easily - @kattrali
Think Monolithic ensure changing one part of an app requires
changing them all
Long Selector is Best Selector
Test Private Stuff ensure every test will break during refactors
maximize the number of mocks, stubs, and performSelector() calls
Do Not Write Tests no worries, the compiler will catch
your bugs
Use Delegates with Callbacks If you don't need asynchronous callbacks
for synchronous code, you aren't trying hard enough -initWithDelegate:callback:
Subclass Subclass Subclass things will be easy when you need
to swap out superclasses sometime!
Categoriception Extend your own classes with several categories instead of
containing each unit of related functionality in a single class
Maximize Responsibilities Per Class ensure the difficulty of changing individual
components later
Safely assign many responsibilities using protocols @class MyController : NSObject
<MyControllerDelegate, Why, God, Please, Stop, WithTheProtocols>
Safely assign many responsibilities using protocols BONUS: Make each component
of a protocol optional, for maximum flexibility and verbosity (and less warnings!!)
Procrastinate on Performance always wait until you have a problem
before opening Instruments.app
if (@"Avoid Static Analysis") goto fail; goto fail;
Always Swing the Heaviest Hammer NSOperation and Core Data all
day every day - maximize boilerplate code (GCD and NSCoding don't real)
Make Code Styles Inconsistent increase the difficulty of using or
extending your project avoid code style tools like clang- format and Uncrustify
Do not write documentation especially avoid easy-to-use tooling like appledoc
Optimize early Reduce duplication as soon as possible, making code
less flexible later
When in doubt, add to AppDelegate There is no better
place to dump bits of code which do not belong anywhere and need access to application state certainly not new classes
#define over static variables get the most of your available
memory for your numbers, strings, and colors
Thank you!