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
77
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
170
JVM Internals Demystified
hannelita
0
310
Eletrônica
hannelita
0
150
Cassandra Meetup
hannelita
0
48
Our Daily Graphs written in Ruby and Neo4j
hannelita
1
140
Wildfly em alta disponibilidade
hannelita
0
200
Helios - o backend pra Mobile que você precisava <3
hannelita
0
88
Neo4j - Dia a dia com grafos, Neo4j e Ruby
hannelita
1
110
Swift - uma fama repentina
hannelita
1
100
Other Decks in Technology
See All in Technology
**強い**エンジニアのなり方 - フィードバックサイクルを勝ち取る / grow one day each day
soudai
64
19k
Azure Container Apps + Bicep 〜 こんな感じで運用しています
kaz29
2
400
〜小さく始めて大きく育てる〜データ分析基盤の開発から活用まで
kniino
0
2.1k
長期間TiDBを使ってきた話 @ 私たちはなぜNewSQLを使うのかTiDB選定5社が語る選定理由と活用LT / Experiences with TiDB Over Time
chibiegg
2
850
AOAI をきっかけに 社内の Azure 管理を見直した話
recruitengineers
PRO
1
200
Azure犬駆動開発の記録/GlobalAzureFukuoka2024_20240420
nina01
1
180
ユーザーストーリーのレビューを自動化したみたの
bun913
1
380
Java EE/Jakarta EEの現状と将来―クラウドネイティブ時代にJava EEは対応できるのか?―
takakiyo
1
120
Hands-on Gemini, the Google DeepMind LLM
meteatamel
1
110
継続的な改善 x ⾮連続的な進化
sansantech
PRO
3
130
LLM とプロンプトエンジニアリング/チューターをビルドする / LLM and Prompt Engineering and Building Tutors
ks91
PRO
0
250
DevOpsDays History and my DevOps story
kawaguti
PRO
9
2.3k
Featured
See All Featured
Designing the Hi-DPI Web
ddemaree
276
33k
10 Git Anti Patterns You Should be Aware of
lemiorhan
647
58k
Optimizing for Happiness
mojombo
370
69k
Principles of Awesome APIs and How to Build Them.
keavy
120
16k
Building Better People: How to give real-time feedback that sticks.
wjessup
354
18k
Docker and Python
trallard
33
2.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
15
2.6k
A better future with KSS
kneath
231
16k
A Tale of Four Properties
chriscoyier
150
22k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
18
1.7k
Embracing the Ebb and Flow
colly
79
4.1k
Agile that works and the tools we love
rasmusluckow
324
20k
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]