Maxims for programmers

Some maxims I think are good to follow.

Be Specific

Asking if an array is empty, should use empty? instead of blank?.

Be Concise

No code is better than any code. Less code you maintain, the better.

Be Consistent

Being consistent is easy to spot something went wrong when things are out of style.

Don‘t be obscure

Dont confuse yourself and your colleagues.

Use abstractions

You can squeeze almost everything you want to do in Ruby into oneliners, but you probably want some abstractions to make the program read better.

Use built-in tools

To find something in an array, use find instead of finding yourself:

array.each { |element| return element if element == 3 }
array.find { |element| element == 3 }

find is more specific, concise, and use built-in tools.

Sometimes maxims are in conflict. Experiences will guide your way to pick which one. Team style will show you which and don‘t forget to be consistent.