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
200
JVM Internals Demystified
hannelita
0
350
Eletrônica
hannelita
0
180
Cassandra Meetup
hannelita
0
61
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
110
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
【Oracle Cloud ウェビナー】クラウド導入に「専用クラウド」という選択肢、Oracle AlloyとOCI Dedicated Region とは
oracle4engineer
PRO
3
120
AI時代だからこそ考える、僕らが本当につくりたいスクラムチーム / A Scrum Team we really want to create in this AI era
takaking22
7
3.7k
【新卒研修資料】LLM・生成AI研修 / Large Language Model・Generative AI
brainpadpr
25
17k
Function calling機能をPLaMo2に実装するには / PFN LLMセミナー
pfn
PRO
0
970
Large Vision Language Modelを用いた 文書画像データ化作業自動化の検証、運用 / shibuya_AI
sansan_randd
0
120
PLaMo2シリーズのvLLM実装 / PFN LLM セミナー
pfn
PRO
2
1k
20201008_ファインディ_品質意識を育てる役目は人かAIか___2_.pdf
findy_eventslides
1
540
Oracle Cloud Infrastructure:2025年9月度サービス・アップデート
oracle4engineer
PRO
0
480
ZOZOのAI活用実践〜社内基盤からサービス応用まで〜
zozotech
PRO
0
200
Trust as Infrastructure
bcantrill
0
350
SwiftUIのGeometryReaderとScrollViewを基礎から応用まで学び直す:設計と活用事例
fumiyasac0921
0
150
データエンジニアがこの先生きのこるには...?
10xinc
0
450
Featured
See All Featured
The Language of Interfaces
destraynor
162
25k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Done Done
chrislema
185
16k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
Rails Girls Zürich Keynote
gr2m
95
14k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.6k
GitHub's CSS Performance
jonrohan
1032
460k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
A designer walks into a library…
pauljervisheath
209
24k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
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]