Saturday, February 20, 2016

Don't try to code in Ruby using other language style



Ruby newbies tend to write ruby code just like they did in other programming languages, just using Ruby syntax. And sometimes not even this!

A good example is in this post here at StackOverflow.

My suggestion is: Dive into ruby documentation and learn the resources Ruby offers you. 

My solution could be even smaller, I think. But the goal there was to make things clear to someone, not confusing him even more with strange constructs.

By the way... strange constructs are pretty good. But if you have a team working with you, please make sure all you team will understand these constructs. Good programming is also team programming and it doesn't help a lot if you write code that only you can understand. But this does not mean you have to avoid strange constructs. Just teach people what they mean.