News for hackers. Stuff that matters.
Re:Rick Santorum's Fake Donation Meter by Deestan on Friday May 25, 2012 @07:07PM (#4025746)
As long as it's "single page bound" JS like this, I honestly don't think it matters one bit.

Reusable components and utility libraries is something different, of course.

Re:Rick Santorum's Fake Donation Meter by sjs on Friday May 25, 2012 @08:29PM (#4025964)
It's still incredibly error prone and just bad practice. It's a telltale sign of a bad developer because a good dev would instinctively just use var without thinking about it. Good devs may make a mistake here or there but this is clearly well beyond a forgotten var keyword.
Re:Rick Santorum's Fake Donation Meter by slantyyz on Friday May 25, 2012 @09:40PM (#4026115)
>> It's a telltale sign of a bad developer

I'm just guessing, but the site was probably not developed by a technical team, probably some web shop that specializes more on the design/layout/content side and not on the JS side.

So it's likely it's the work of a non-developer than a bad developer. The net result is the same (bad code) but the distinction is that the code was possibly written by someone who wouldn't even be considered a developer.

Re:Rick Santorum's Fake Donation Meter by aaronasterling on Friday May 25, 2012 @08:34PM (#4025978)
But when writing code, how do you know that it's always going to be "single page bound"? YAGNI is frequently useful poison and nothing more. When it's so easy to do it right the first time, why not?
Re:Rick Santorum's Fake Donation Meter by Deestan on Saturday May 26, 2012 @10:22AM (#4027335)
> When it's so easy to do it right the first time, why not?

a) Because it isn't "right" as such. It's just "better" if the code is going to be reused. Which it isn't.

b) The code style serves as documentation. I can clearly read from this code that it's not a reusable component. It is now easier for me to get an idea of how and where this code is being used in the site.

c) Personally, I'm wary of "pre-emptive generalization". Every layer of abstraction makes the code slightly less readable. Also, unless there exists at least two use cases right now, you're not likely to get the reusability right anyway.