Posts

Showing posts with the label OOP

Better JavaScript Classes

Image
Update This post continues here, in the JavaScript _super Bullshit one. In my precedent post I have discussed about few common JavaScript errors, included the classic new Class() call to retrieve a runtime created function, populating its prototype. While my suggestion is both semantic and reasonable, I am pretty sure nobody on earth will ever implement that native Function wrapper , and this is the reason I am posting again, this time hopefully with a better suggestion. JavaScript Class Abstract Concept It's extremely hard to understand for those with classic OOP background but JavaScript has no Classes , just objects, where functions are first class objects but still objects! Assumed this, we can try in any case to think about a JavaScript Class as a " function which aim is to create instances of function itself ". What Is Wrong Right Now What I argued about in my precedent post is that this statement is too often unconsidered: // try with Mootools or some other libr...