RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Unless Or Negative Expressions On Conditionals

It’s amazing our ability to tell histories by negative conditionals.

“If I do not have enough money then I can’t buy a car”; “If a house is not for sale, do not show the sale”; “If it is not a goal, do not change the score”; “If you dont have good grades you will not go to that party”.

It’s natural for humans being tell histories like that, believe me you do that all the time. In terms of code, this is not cool at all. It is difficult to read, it inverts a basic if-else case and turn it into hell. You should not think about negative conditionals when you are working. I’ve been coding on a code base which has more than 500 hundred lines of code, in a single method. Take a look inside those methods and you will come across if-else’s inherited in a multi-level way, and they have a lot of negative expression and conditionals. It is difficult to understand, test, and breath

http://gilgomes.com.br/unless-or-negative-expressions-on-conditionals/

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in