Wrath of magic set


"Javascript" had it for a while now but the new Ecmascript 5 specification picked it up as well. Properties that are actually functions.

It's a feature that PHP introduced with their object oriented approach and I'm sure many other languages have it.

Whilst my only objection in PHP was maintainability of a full scale project, in Javascript I would call it doom. In PHP it has caused me quite some problems because magic stuff was happening and I didn't know why. And whilst that was partially a documentation issue, comments won't save the day here.

The thing is; in PHP, you already don't really know what the hell is really going on behind the scenes. I'll name "arrays" and leave it at that. Google for the workings of arrays to see what I mean.

Not in Javascript. Js is a well thought out language. Hell, it took them ten years to release a next version! So in that language I expect consistency. And what I really liked was the fact that whenever you used a property, you knew it was storage. Simple as that. Okay, maybe there were complex cases (as in, who's the owner of that property?) but in the end you knew, it is one property and whatever I set to it I'll get back when I read from it.

With these getter and setter properties you don't anymore. And that annoys me because they're mostly syntactic sugar. You don't save a function call by using them but do introduce a whole new complexity layer to the language.

And don't get me wrong. I can think of a few fun uses for them. Heck, I can see it being used, clearly. But aside from some edge cases (using external json without using jsonp), it's mostly syntactic sugar because it won't do much you couldn't otherwise already do.

I've felt this way for a long time and I know this. If you're a programmer working with me on a project or, god forbid, under me on a project, you'd better have damned good excuse for using this feature.