Tech Lead @StackOverflow.
JavaScript and OpenSource enthusiast.

JS: Leave the classes to those other languages

Who have never used pseudoclasses in JavaScript?

It’s too hard for a “traditional OO developer” to not use classes. They are his way to describe objects.

The first time I bumped into JS I was the “traditional developer” and the first question I asked to myself was how can I work with classes in JS?
JS does not have classes but I realised pretty soon there are plenty of solutions to fake classes.

Instead of understanding and embracing the language I gave up to the temptation of using my traditional languages (Ruby, Java, etc…) knowledge with JS and I started to work using pseudoclasses. I immediately realised that doing the same things I used to do in Ruby so smoothly were much harder and more verbose to do in JS.
If I didn’t want to end up hating JS I needed to learn how the language works in more depth.

This series of articles aims to answer essentially 2 questions:

  • Why is so complicated to work with pseudoclasses?
  • Do we really need to fake classes in JS?

To do so we will cover the following 3 points in distinct posts:

This topic was also the subject of the speech I presented as part of my Thoughtworks application process. Slides and video are available at the following links.

Let’s start our path understanding how the JS Prototype chain works.

Giamir Buoncristiani

Giamir Buoncristiani

Tech Lead @StackOverflow.
JavaScript and OpenSource enthusiast.