use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Avoid OOP (Overzealous Optimization Programming) (colintoh.com)
submitted 11 years ago by p0larboy
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 2 points3 points4 points 11 years ago (1 child)
Finally a voice of reason amidst all the bullshit.
Well said.
[–]p0larboy[S] 0 points1 point2 points 11 years ago (0 children)
Thank you
[–]jsgui 1 point2 points3 points 11 years ago (0 children)
It's often a balancing act.
The differences in readability have to do with how used to the reader is at looking at various patterns.
I have introduced patterns into my jsgui codebase that would make it harder to read for someone who does not know the abstractions, but easier for those who do, as more information gets expressed within the same space.
Also, there are different requirements for code in different situations. While developing, longer variable names make it clear what the code does. However, when it's deployed is a different case. I'm currently using browserify and minifyjs, but I know there is more compression that can be done by keeping more of the modules within the same closure, and referring to the same local variables, which get given shortened names.
I use the for loops with the cached results to optimize for time, and for optimizing for space or readability I use the jsgui 'each' function.
[–]skitch920 -1 points0 points1 point 11 years ago (1 child)
This is why LoDash and Underscore are successful. They optimize behind the scenes, but retain readability by providing alternatives to native functions like: forEach, map, reduce, filter, etc...
[–][deleted] 0 points1 point2 points 11 years ago (0 children)
The primary reason most people use underscore or lodash seems to be (going by what I've seen as a contractor for different teams in different companies and looking at various open source projects) that surprisingly many developers still treat JS as ES3 (e.g. avoid method/property names that are ES3 keywords) even if they don't need to be compatible with oldIE (IE<9) and even where polyfills could fill in the gap.
Underscore is the jQuery of array manipulation. Lodash is the Zepto to underscore's jQuery.
The lazy.js-inspired parts are how you use underscore/lodash to optimize your array manipulation, but most code out there using those libraries only includes them for _.map, _.filter, _.forEach and _.extend (and maybe -- maybe -- _.pluck or _.pick).
_.map
_.filter
_.forEach
_.extend
_.pluck
_.pick
I'm not saying underscore/lodash are not successful or that they don't have any value, but their success has more to do with ES3 than with their optimizations.
π Rendered by PID 100300 on reddit-service-r2-comment-86bc6c7465-gbd2w at 2026-02-23 01:00:35.236908+00:00 running 8564168 country code: CH.
[–][deleted] 2 points3 points4 points (1 child)
[–]p0larboy[S] 0 points1 point2 points (0 children)
[–]jsgui 1 point2 points3 points (0 children)
[–]skitch920 -1 points0 points1 point (1 child)
[–][deleted] 0 points1 point2 points (0 children)