tulipemoutarde.be

Software Developer

Smalltalk, Swift, Java, Obj-C

@fstephany | Email | LinkedIn

I'm currently working at Ta Mère SCRL a small development shop in Belgium.

We mainly do mobile apps (iOS, Android) for clients. We also have a strong interest in Pharo Smalltalk and Rust.

logo Ta Mère SCRL

On API Consistency

20 Mar 2010 in rant jquery 

Interacting with a well design API is a pleasure. When an interface is consistent and works in the way I expect it to work I feel good. Gregory T. Brown wrote an excellent chapter on this subject in his (now freely available) book 'Ruby Best Practices'.

Something struck me in jQuery last week: map() and each()'s parameters.

From jQuery's documentation:

.map( callback(index, domElement) ) .each( function(index, Element) ) jQuery.each( collection, callback(indexInArray, valueOfElement) ) jQuery.map( array, callback(elementOfArray, indexInArray) )


Ok, what's the deal ?
Look at the parameters of the callback of jQuery.map(). The order is different than all the others. Why?

This kind of things drives me nuts.