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
iOS Antipatterns - TDC 2014
Search
hannelita
August 08, 2014
Technology
0
87
iOS Antipatterns - TDC 2014
TDC 2014 - Sao Paulo
hannelita
August 08, 2014
Tweet
Share
More Decks by hannelita
See All by hannelita
Java EE 8 - Future, Wishes and Predictions
hannelita
1
210
JVM Internals Demystified
hannelita
0
360
Eletrônica
hannelita
0
180
Cassandra Meetup
hannelita
0
63
Our Daily Graphs written in Ruby and Neo4j
hannelita
1
170
Wildfly em alta disponibilidade
hannelita
0
250
Helios - o backend pra Mobile que você precisava <3
hannelita
0
120
Neo4j - Dia a dia com grafos, Neo4j e Ruby
hannelita
1
140
Swift - uma fama repentina
hannelita
1
140
Other Decks in Technology
See All in Technology
.NET 10のBlazorの期待の新機能
htkym
0
160
ストレージエンジニアの仕事と、近年の計算機について / 第58回 情報科学若手の会
pfn
PRO
4
910
ヘンリー会社紹介資料(エンジニア向け) / company deck for engineer
henryofficial
0
420
アノテーション作業書作成のGood Practice
cierpa0905
PRO
1
320
ラスベガスの歩き方 2025年版(re:Invent 事前勉強会)
junjikoide
0
600
OpenCensusと歩んだ7年間
bgpat
0
240
オブザーバビリティと育てた ID管理・認証認可基盤の歩み / The Journey of an ID Management, Authentication, and Authorization Platform Nurtured with Observability
kaminashi
2
1.3k
Azure Well-Architected Framework入門
tomokusaba
1
150
パフォーマンスチューニングのために普段からできること/Performance Tuning: Daily Practices
fujiwara3
2
170
Raycast AI APIを使ってちょっと便利なAI拡張機能を作ってみた
kawamataryo
0
210
GCASアップデート(202508-202510)
techniczna
0
110
可観測性は開発環境から、開発環境にもオブザーバビリティ導入のススメ
layerx
PRO
4
2k
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.1k
Designing for humans not robots
tammielis
254
26k
How to Ace a Technical Interview
jacobian
280
24k
Code Review Best Practice
trishagee
72
19k
4 Signs Your Business is Dying
shpigford
186
22k
Git: the NoSQL Database
bkeepers
PRO
431
66k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.7k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.3k
We Have a Design System, Now What?
morganepeng
53
7.8k
A better future with KSS
kneath
239
18k
Transcript
iOS Antipatterns Tudo que você deveria fazer no seu código,
só que não.
Oi! • Hanneli (‘H' mudo) • CodeMiner 42 • Café,
Pokémon, Lego e bichos <3 HIRING
O que é um código ‘ruim'?
Por que escrevemos código ruim?
O que vamos ver aqui • Paradigma de programação -
sua importância • Princípios de OO que colaboram para um código ‘não ruim’ • Antipatternizando patterns • OSS - exemplos de antipatterns • GIFs engraçados (ou não)
O que *Não* vamos ver aqui • Aula chata de
OO • Introdução a Objective C / iOS / etc • Design Patterns • Aula sobre SOLID
Paradigma == modelo; padrão Toda vez que você padroniza algo,
você facilita na identificação e na produção
Orientação a Objetos == paradigma O que é OO? Herança
Polimorfismo Encapsulamento
O que é OO? “Passar Mensagem.”
OO para Objective C?
Colocando ordem na ‘troca de mensagens' SOLID
“Mantenha suas classes pequenas" Xiita de código bonito, 2014 https://github.com/robbiehanson/XMPPFramework/blob/
master/Core/XMPPStream.m
None
“1 classe, 1 responsabilidade” Xiita de código bonito, 2014 S
O L I D ingle Responsibility
Como melhorar? S O L I D ingle Responsibility •
Separar o controle dos bytes em outra classe • Separar o controle dos Events em outra classe • Separar a autenticação (!!11!!!)
“Cuidado com a herança" Xiita de código bonito, 2014 https://github.com/robbiehanson/XMPPFramework/blob/
a833c29e5b26cc3cca3d1f37490eed8ff5dd65e2/Extensions/ XEP-0009/XMPPIQ%2BJabberRPC.m
None
None
None
S O L I D pen closed
Como melhorar? • Interface comum - @protocol S O L
I D pen closed
Vamos falar sobre Design Patterns
Por que todo mundo fala em Design Patterns?
Singleton
Singleton - prós •Objeto pesado criado uma única vez! •Guarda
estado
Singleton - cons
Singleton - cons •Objetos pesados!
Singleton - Vilão ou mocinho? Use com moderação!
Decorator
Decorator https://github.com/robbiehanson/XMPPFramework/blob/ a833c29e5b26cc3cca3d1f37490eed8ff5dd65e2/Utilities/ DDList.m
None
Decorator
None
Decorator • Separar esses nodes • Associar os nodes
Conclusões • Dê uma melhorada no código! • Não precisa
usar design patterns o tempo todo, mas eventualmente ajuda • Dê uma revisada nos princípios de OO e SOLID! Quem for manter seu código agradece!
Obrigada! @hannelita
[email protected]