insustentavel js

28

Upload: leonardo-balter

Post on 29-Nov-2014

632 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Insustentavel js
Page 2: Insustentavel js

Código !legado

http://xkcd.com/844/

Page 3: Insustentavel js

Projetos!Fast-Food

Page 4: Insustentavel js

• Inconsistência de código • Arquitetura fraca • Onde no mundo está a documentação

(e a Carmem Sandiego) • Sem testes • Tartaruga na árvore

Sintomas de código legado

Page 5: Insustentavel js

Inconsistência

;

Page 6: Insustentavel js

Always code as if the person who ends up maintaining your code is a violent

psychopath who knows where you live.

http://c2.com/cgi/wiki?CodeForTheMaintainer

Page 7: Insustentavel js

there are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.

http://martinfowler.com/bliki/TwoHardThings.html

Page 8: Insustentavel js

https://github.com/rwaldron/idiomatic.js

http://contribute.jquery.org/style-guide/js/

Page 9: Insustentavel js

Arquitetura Fraca

Page 10: Insustentavel js

https://github.com/miketaylr/Snort/blob/master/snort.yml

Snort

https://gist.github.com/leobalter/9771910

Page 11: Insustentavel js

Revealing Module Pattern

http://christianheilmann.com/2007/08/22/again-with-the-module-pattern-reveal-something-to-the-world/

var myFoo = function(){ var foo = ''; function bar(){ /* … */ } function setFoo(newFoo) { /* … */ } function getFoo() { /* … */ } return { set: setFoo, get: getFoo } }();

Page 12: Insustentavel js

Documente seu código

https://github.com/millermedeiros/mdoc

Page 13: Insustentavel js

Testes

Page 14: Insustentavel js

" L E G A C Y C O D E I S C O D E W I T H O U T T E S T S "

M I C H A E L F E AT H E R S - W O R K I N G E F F E C T I V E LY W I T H L E G A C Y C O D E

Page 15: Insustentavel js

M U LT I P L E E N V I R O N M E N T S H E L L

Page 16: Insustentavel js

T O D O S O S B R O W S E R S

N O D E , D I S P. M Ó V E I S , E T C …

Page 17: Insustentavel js

V E R S Õ E S D E B R O W S E R S

Firefox Chrome Opera Safari IE 8 IE 9 IE 10 IE 11

Firefox Mobile Chrome p/ Android iOS Sarari Opera Mini

Windows Mobile

Page 18: Insustentavel js

FuncionaisIntegração

A/B

Unitários

Page 19: Insustentavel js

Onde dói mais se o seu sistema falhar?

Page 20: Insustentavel js

C R Í T I C O

C O M P L E X O

Page 21: Insustentavel js

https://github.com/rmurphey/js-assessment

Page 22: Insustentavel js

Além dos testes…

Page 23: Insustentavel js

O que está testado?

• quantas funções? • quantos blocos? • quantas linhas? • quantos statements?

Page 24: Insustentavel js

Cobertura

Page 25: Insustentavel js

WTF é integração contínua?

Page 26: Insustentavel js

Tartaruga na árvore

Page 27: Insustentavel js

// What is this I don't even if (obj.message === '[object Object], undefined:undefined') { return; }

Page 28: Insustentavel js

https://github.com/gruntjs/grunt-contrib-qunit/issues/58