Zbyszek Tenerowicz

Read this first

Everything is an array index

Javascript engines never cease to amuse me.
Let’s look at our good old Array.prototype.splice

[1,2,3].splice(0,1) //returns [1]
[1,2,3].splice(1,1) //returns [2]
[1,2,3].splice(undefined,1) // 1
[1,2,3].splice(false,1) // 1
[1,2,3].splice(true,1) // 2!

Ok, so splice is accepting non-numbers and it’s casting them to booleans and then to numbers, right? Wrong.

[1,2,3].splice({},1) // 1
[1,2,3].splice("",1) // 1
[1,2,3].splice("one",1) // 1

Confused? That’s still pretty consistent!
Check this out:

[1,2,3].splice([],1) //1
[1,2,3].splice([1],1) //2
[1,2,3].splice([2],1) //3
[1,2,3].splice([1,2],1) //1

Go home javascript, you’re drunk.


Let’s figure this out anyway.

First:

[1,2,3].splice({toString:function(){return 2;}},1) // 3
[1,2,3].splice({toString:function(){return "2one";}},1) // 1
[1,2,3].splice({toString:function(){return "2";}},1) // 3

Ok, that’s something. Looks like...

Continue reading →


Developer eXperience design

TL;DR Sharing techniques for creating a good experience of your library, SDK or developer tools.

UX design is finally getting the attention it needed. That’s a fact. I worked with multiple designers. I teach in a school for designers. Hey, my wife is a UX designer! And they all are crazy focused on the users, the look, the feel, click, touch, attention and so on. How great is that!

Now imagine my humble self trying to build something that is supposed to be used by a developer. A set of tools that make building apps easier for her*. You know, nothing to understand there if you’re not a programmer. Did I mention it was at work, not a pet project? So it had to go through a design review.

Long story short, I got loads and loads of feedback on the features and the end-user experience of the only UI widget in the package containing ~30 methods and quite a few abstractions on top of a...

Continue reading →