zuhao / plotrb

A plotting library in Ruby built on top of Vega and D3.
Other
42 stars 12 forks source link

Use of &&= operator is dangerous #6

Closed pjotrp closed 11 years ago

pjotrp commented 11 years ago

The Ruby &&= operator assigns something if the expression is non-nil.

This is dangerous Perlish style coding!

You should be really clear what your code does with your data. If inputs are faulty, an error should happen.

What I mean is: catch errors as early as possible in the source, so it is clear what the cause is. You are throwing exceptions, but it is not clear what the cause is of the error. It can be much more stringent - and helpful for people using your code.

zuhao commented 11 years ago

Thanks. I've got rid of all of them. Will do validation separately later.