3. QUEM SOU EU?
Renato Oliveira
CIn-UFPE
PUG-PE
Linux User - #532503
Js e Rails developer na E.Life
4. MOTIVAÇÃO
“40% ~ 80% of the lifetime cost of a piece
of software goes to maintenance”
“Hardly any software is mainteined for its
hole life by the original author”
Sun
5. PROBLEMA
Desenvolvi um produto há 2 anos e o cliente voltou agora
e pediu para adicionar mais alguns módulos
PERGUNTA
Você tem orgulho do seu código?
Está fácil fazer esta manutenção?
6. CODE SMELL
Não é um bug
Está mais para um sintoma do código que indica um
problema maior
Indica que o código é fraco de design e que pode
atrasar o desenvolvimento ou aumentar o risco de
bugs ou falhas no futuro
Um código que não segue padrões é mais suscetível a
'smells'
12. THE ZEN OF PYTHON, BY TIM PETERS
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
13. THE ZEN OF PYTHON, BY TIM PETERS
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious
way to do it.
Although that way may not be obvious at first unless
you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good
idea.
Namespaces are one honking great idea -- let's do more
of those!
14.
15. FORMATAÇÃO DE CÓDIGO
Identação
Tabs ou espaços
Comprimento da linha
Linhas em branco
imports
16. ERRADO
ipr o,ss
mot s y
CERTO
ipr o
mot s
ipr ss
mot y
CERTO[2]
fo o ipr pt,mdr
rm s mot ah ki
20. ATRIBUTOS
AGM_OSAT =2
LUACNTNE 0
agm_aivl="luasrn"
luavrae agm tig
_tiuod_s_nen ="ur srn"
arbt_euoitro ota tig
casNmeelse
ls odDCas:
_arbt_rvd_ecas =Tu
_tiuopiaod_lse re
dfagm_uco)
e luafna(:
#cdg d ba
óio e o
dfOtauco)
e urFna(:
#cdg tnoau
óio es qi
21. RECOMENDAÇÕES
i xi Nn:
f s oe
..
.
i z
f :
..
.
i tp(b)i tp()
f yeoj s ye1:
#erd
rao
i iisac(b,it:
f sntneoj n)
#cro
et