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
Delisa Mason
May 28, 2014
Programming
12
17k
Bad Cocoa
How-to guide for building the kind of code you will deeply regret later
Delisa Mason
May 28, 2014
Tweet
Share
More Decks by Delisa Mason
See All by Delisa Mason
Pod for Great Good
kattrali
2
420
AppKit for iOS Developers
kattrali
5
860
Crafting iOS Dev Tools in Redcar, the Ruby Editor
kattrali
2
780
Other Decks in Programming
See All in Programming
Eloquentを使ってどこまでコードの治安を保てるのか?を新人が考察してみた
itokoh0405
0
3.2k
Flutterアプリ運用の現場で役立った監視Tips 5選
ostk0069
1
460
AIの弱点、やっぱりプログラミングは人間が(も)勉強しよう / YAPC AI and Programming
kishida
9
4.9k
例外処理を理解して、設計段階からエラーを見つけやすく、起こりにくく #phpconfuk
kajitack
12
6.2k
競馬で学ぶ機械学習の基本と実践 / Machine Learning with Horse Racing
shoheimitani
13
12k
「10分以内に機能を消せる状態」 の実現のためにやっていること
togishima
1
490
AIエージェントでのJava開発がはかどるMCPをAIを使って開発してみた / java mcp for jjug
kishida
4
670
MCPサーバー「モディフィウス」で変更容易性の向上をスケールする / modifius
minodriven
8
1.5k
詳細の決定を遅らせつつ実装を早くする
shimabox
1
1.2k
乱雑なコードの整理から学ぶ設計の初歩
masuda220
PRO
31
13k
Verilator + Rust + gRPC と Efinix の RISC-V でAIアクセラレータをAIで作ってる話 RTLを語る会(18) 2025/11/08
ryuz88
0
360
『実践MLOps』から学ぶ DevOps for ML
nsakki55
2
410
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Automating Front-end Workflow
addyosmani
1371
200k
GitHub's CSS Performance
jonrohan
1032
470k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
We Have a Design System, Now What?
morganepeng
54
7.9k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
RailsConf 2023
tenderlove
30
1.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
192
56k
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!