What I hate in Javascript

The thing that gets on my nerves the most about javascript, is it’s silent deaths. I have a function XpathAttr that if you don’t pass it the correct parameter, In this case a XMLHTTPRequest object, it dies. No error, no Exception, no nothing.

Now I realise I could throw my own exception, or check that the xml parameter is actually the right type of object. But I really don’t care. I just want it to let me know execution has halted, here. Grr.

PHP – Getters and Setters

There is alot of talk about Getters and Setters being evil. The major argument is encapsulation, basically if you need that information outside the class, maybe that class should be doing the work on the information, not you. This sounds reasonably valid to me in a pure OO sense but in reality, sometimes we want to be able to just set a variable’s value.

In PHP, it seems alot easier to leave the variable public and set it directly rather than using a setVar() method. I’m of the belief that using the setVar() method will save you time later on when you want to start creating fluid interfaces. If you set a value directly, you can’t choose what you want to return. Consequently, hiding setters and getters with the use of the __get and __set magic functions can also make fluid interfaces hard to implement.

Sweat

It doesn’t happen normally, whether it’s the air pushing back the tide, or just keeping you cool. It always happens when you stop, the sun beating down and your body temperature rises. Then you feel it, it starts as a stinging in the corner of your eyes, but by the time the light turns green you can hardly see. You push off and halfway across the intersection you are thinking about how to wipe your eyes but you know your arms are covered in sweat too.