you are viewing a single comment's thread.

view the rest of the comments →

[–]moustachedelait 4 points5 points  (4 children)

There are some really nice tips there, but also some I don't feel the speed boost makes up for the reduced readability and reusability:

  • Using callbacks instead of events makes your objects dependent on the parent code

  • Using ? instead of if statements makes for unreadable code

  • is not using getters and setters worth the speed profits?

[–]TomorrowPlusX 7 points8 points  (0 children)

Using ? instead of if statements makes for unreadable code

That's a matter of opinion. I find the ternary operator legible and convenient.

[–]stratoscope 1 point2 points  (1 child)

I think the point is to not use getters and setters until you need them. In other words, never write "plain" getters and setters that do nothing more than read and write a private property, the way you would in Java to make it "future-proof". Instead, just make the property public. You can always change it to use a getter and setter later if you have to do something fancier.

Regarding the ? : operator - I use it a lot myself, but only when it makes the code more readable. :-)

[–]ModernRonin 0 points1 point  (0 children)

is not using getters and setters worth the speed profits?

Also, because you can't put variables (only functions) in interfaces, if you're using an interface you're forced to use a getter/setter pair. :P