javascript speed test

Aside

if you had to guess, which of the following two bits of javascript code would you say executes faster?

Exhibit A:

var keys = Object.keys(MyObj); //cloning the key array
var length = keys.length;
for (var i = 0; i < length; i++) {
  var val = MyObj[keys[i]];
};

Exhibit B:

for (var key in MyObj) {
 if (MyObj.hasOwnProperty(key)) { //hasOwnProperty is a native function
  var val = MyObj[key];
 }
}

Check your answer.


[More programming riddles]

 

 

 


this is what things looked like last year in september, with an up to date version of chrome:

Screen Shot 2013-09-17 at 7.04.32 PM

pet peeve #{random()}

downwards growing, web-readable, activity logs, coupled with infinite scrolling. really cloudera? wtf:

wtf

this one should probably be listed as a ux anti-pattern. by default:

  • display the newest log entries at the top of the page
  • insert newer log entries, as they appear, at the top
  • allow the user to select a specific entry, and stay focused on that entry, as newer ones are added
  • propagate these concepts through to the small details

forcing users to scroll to the bottom of an infinite-downwards-scrolling page to see the most recent log entries makes the most common uses for an activity log, the most difficult ones to use

selected recommendations for programmers

this is a (non-comprehensive, non-final, occasionally updated) list of videos, books and essays which influence my programming life. i’ve selected specifically for samples which have stood the test of time – they’re worth going back for.

(if you have suggestions for additions, please comment below)

entrepreneurship
Beating the averages – Paul Graham


object oriented programming
Self and the power of simplicity – David Ungar, Randal B. Smith, (1991)
Self: The Movie;


software engineering
The Mythical Man-Month — Frederick P. Brooks Jr.
The Cathedral and the Bazaar — Eric Steven Raymond
Clean Code: A Handbook of Agile Software Craftsmanship — Robert C. Martin (pdf)


computer graphics/ui/ux
sketchpad demo – Ivan Sutherland (1963!)


design
The Design of Everyday Things — Donald A. Norman
Don’t Make Me Think! A Common Sense Approach to Web Usability — Steve Krug


miscellaneous
the mother of all demos – Douglas Engelbart (1968!)
computer revolution video – Allan Kay (1997) transcript
Personal Computing: Historic Beginnings – Alan Kay (2008)
Surely You’re Joking, Mr. Feynman! (Adventures of a Curious Character)


python
Learn Python the Hard Way – Zed Shaw


javascript
JavaScript: The Good Parts – Douglas Crockford


ruby
The Pragmatic Programmer’s Guide — Dave Thomas, Chad Fowler, Andy Hunt (was Yukihiro Matsumoto, a.k.a. “Matz”, not involved?) (printed on trees version)


C
C Programming Language (2nd Edition) — K&R (Brian W. Kernighan, Dennis M. Ritchie)


LISP
roots of lisp – Paul Graham


DATABASES
The Database as a Value – Rich Hickey