How One Missing `var` Ruined our Launch
121–130 of 223 posts
Re: How One Missing `var` Ruined our Launch
#122Earlier quoted context omitted.
Sounds like a good idea. I know emacs flymake mode can be set up to underline problems detected by jshint. Personally I like to have the tests and jshint run by a hotkey so I can happily move the code through invalid states (towards a valid goal) without being constantly complained at :)
I wrote a jshint mode for emacs https://github.com/daleharvey/jshint-mode
Re: How One Missing `var` Ruined our Launch
#123> I would posit here that nothing I could do in best practice (manual front-end testing, unit testing, error handling, etc.) would have caught the offending line. Sorry, that's incorrect. If you cannot fully simulate your environment for purposes of validation, you're not covering your bases.
That sounds like a necessary idea if you're building real-time embedded systems for aircraft operation or something, but for a lot of applications, developing a test harness to that standard would take considerably more time and effort than building out the actual product.
Re: How One Missing `var` Ruined our Launch
#124Earlier quoted context omitted.
Muphry's law.
I'm contemptuous of his coding practice, not his writing or grammar. His writing is pleasant to read... but so what? where are the multiple layers of defense standing between a simple syntactical or semantic error and a full scale business-impacting technical fuck up. that is what I meant by being vigilant and paranoid.
As for the rest... well, I don't understand where you're going with it. Pop psychology aside, are you really suggesting that you write utterly seamless code every single time? You've never done a build and then realised that you made an error somewhere along the way, gone back and fixed it? You act as if my mistake had the potential to ruin a business. Of course it didn't- I picked up on it before the code had even been pushed to the remote repository.
You can live in a world where everyone does everything perfectly, every time (and pay the price when you inevitably don't) or you can set up systems with unit testing, user testing, and- yes- developer testing that results in bugs being dealt with in a timely manner before a single end-user sees anything.
But hey, each to their own. Whatever works for you. If you get it right first time, every time, then you are a better programmer than I, and I congratulate you on it.
Re: How One Missing `var` Ruined our Launch
#125I'm not an expert in JavaScript... Given that you said that, and that the problem you hit is a common pitfall for Javascript developers (especially if you're not very seasoned with the language), I'd strongly recommend picking up a copy of Douglas Crockford's Javascript: The Good Parts . Not only does he inform readers of this particular gotcha, but he also elaborates on Javascript best practices and tools that other…
Re: How One Missing `var` Ruined our Launch
#126It's these small things to remember that can save a lot of debugging time down the road. Will remember to "use strict" when I use nodeJS again.
Re: How One Missing `var` Ruined our Launch
#127http://code.google.com/p/js2-mode/
Mind you it won't catch globals declared in chained assignments
eg
var x = y = 0; // y is defined globallyRe: How One Missing `var` Ruined our Launch
#128Also, C++ can also take down your site with a single character typo that the compiler may not catch, so even static typing can't save against everything! (I actually like C++, too, so no hate there)
Re: How One Missing `var` Ruined our Launch
#129Re: How One Missing `var` Ruined our Launch
#130Earlier quoted context omitted.
It still conjures up variables out of thin air. sum = 0 for v in someList: smu += v print sum # prints 0, doh!
Exactly. The claim is that implicit local variables are less dangerous than implicit global variables. I've been bitten badly by both. Perl was the worst, where implicit variables were scoped differently according to Larry's philosophy when he implemented it. All for the sake of brevity. Can someone please implement strict mode for Node?