Home twitter


043

Ditching Classes for a More Simplified Style of Programming

June 11, 2020

Rather than post the same inane thing every day for the past few days, I kept my nose in the book I was reading about object prototypes in JavaScript. It was a struggle to keep my focus in the book and not keep jumping back and forth between the book and the code, but I managed it. And I'm glad I did. Towards the end, the author discusses a style of programming in JS he calls 'Object Linked to Other Objects' (OLOO) that dismisses all the class-related syntactic sugar and cruft and deals plainly with JavaScript objects. Which makes a fuck ton of sense, as there are no classes in JavaScript.

Class syntax comes from those who want to fit JS in their plastic class-oriented boxes, it seems.

Anyway, I was in the process of working on a library to authenticate users through Discord before I started reading the book. And at the time, I thought classes would be the way to go to neatly write it all out, particularly because of the whole module system. However, after reading the book, I decided to start over. Instead of taking the class approach, I'm taking the OLOO approach, and already, I'm having a much better time building this thing.