7. • C with class-based OOP
• [syntax awkward:YES];
• Compiled
• No garbage collection!
8. [Disclaimer]
I will not try to convince you that JavaScript should be more like other languages.
Yet we can be more effective JS developers by learning something from others.
20. Everybody has heard about unit tests, but have you actually seen or wrote them?
21. Cr Buste
oss r.J
c S
En DOH heck
h
Fir ance
J3U eUnit JS
JSN nit
JSS Uni
writing tests?
JST pec t
JST e
est st
JSU .NE
JSp nit T
Jas ec
U
Js- Jasm nit
Js- test ine
tes -dr
Mo t-run iver
No ch ne
de a r
QU u n i
Rh nit t
Rh Un
ino it
S OA Uni
Sin tes t
Su on.js t
Te ite
Te st.M st
st.S or
Te im e
stC pl
Te ase e
Un T stI
yrt t
itT le
est
Vo in
YU ws g
jsU I T
nit est
jsU Te
scr ni st
ew ty
Is the number of JS unit testing frameworks higher than the number of JavaScript developers
wr -u n i
u t
22. In Objective C world unit testing is supported out of the box.
23. “No one pays you
for testing”
The above quote comes from a PHP talk I listened to recently.
* Don’t ask your boss or client if you can write tests – tests are part of the code, not
something extra
* The point of writing tests is to make you faster at delivering quality product, not slower.
* Tests enforce better coding style.
27. Unit test is a function
that tests
another function
28. implementation
function factorial(n) {
if (n == 1) {
return 1;
}
return n * factorial(n-1);
}
test
function testFactorial() {
assert.equals(120, factorial(5));
}
29. 3) Automate with test
runner
If you haven’t already picked a framework with integrated runner, like buster.js or js-test-
driver, use testem to run your tests.
You will NOT keep writing tests if you don’t automate running them with Continous
Integration tool like Jenkins.
40. Your sadly
pathetic
bleatings are
harshing my
mellow.
Douglas Crockford commenting on complaints about jslint being too restrictive.
This quote was one of the reasons to create jshint.
42. Anything that isn’t
crystal clear to a
static analysis tool
probably isn’t clear
to your fellow
programmers,
either.
Highly recommended article on the value of static analysis, by John Carmack:
http://www.altdevblogaday.com/2011/12/24/static-code-analysis/
63. IDE
The problem with refactoring JavaScript:
poor tool support -> makes refactoring require courage -> makes refactoring less likely to
happen.
Search and replace doesn’t constitute “tool support” for refactoring – it’s only text-based and
doesn’t guarantee that the semantics of your program will be preserved.