insustentavel js

Post on 29-Nov-2014

632 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Código !legado

http://xkcd.com/844/

Projetos!Fast-Food

• 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

Inconsistência

;

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

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

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

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

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

Arquitetura Fraca

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

Snort

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

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 } }();

Documente seu código

https://github.com/millermedeiros/mdoc

Testes

" 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

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

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 …

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

FuncionaisIntegração

A/B

Unitários

Onde dói mais se o seu sistema falhar?

C R Í T I C O

C O M P L E X O

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

Além dos testes…

O que está testado?

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

Cobertura

WTF é integração contínua?

Tartaruga na árvore

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

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

top related