Batsov - batsov.com - (think)
General Information:
Latest News:
The Elements of Style in Ruby #9: Hash#has_key? and Hash#has_value? are deprecated 21 Aug 2013 | 07:04 pm
One can often similar code in the wild: has_something? predicates are not idiomatic in Ruby and Hash#has_key? and Hash#has_value? are nothing, but remnants of the early days of Ruby. In fact, accordi...
Announcing the Powerpack library 21 Aug 2013 | 06:17 pm
Powerpack is a small Ruby library containing (at this point) a few extensions to some core Ruby classes. I guess that in a way one can say it’s something like Rails’s ActiveSupport, but with much smal...
The Elements of Style in Ruby #8: Know Thy Predicates 14 Aug 2013 | 07:28 pm
I often see people writing code like this: Obviously Fixnum#even? would have been a better choice: Another bit of code you’ll often see is: While there is nothing particularly bad about that code, ...
Android is not better. Neither is iOS. 14 Aug 2013 | 04:20 pm
Prelude The following few days Paul Stamatiou’s article Android Is Better and Marco Arment’s excellent response Google Blindness have been generating a lot of heated debates. This article is pretty m...
The Elements of Style in Ruby #7: The case against === 10 Jul 2013 | 05:44 pm
Today we’ll discuss the following section from the Ruby Style Guide: Avoid explicit use of the case equality operator ===. As it name implies it’s meant to be used implicitly by case expressions and...
The Elements of Style in Ruby #6: Attributes Redux 4 Jul 2013 | 05:36 pm
Today we’ll talk about attributes in Ruby. Let’s start with the following rule from the Ruby Style Guide: Use the attr family of functions to define trivial accessors or mutators. Everyone who’s co...
The Elements of Style in Ruby #5: Readability of long numeric literals 2 Jul 2013 | 05:01 pm
Today’s topic is the following rule from the Ruby Style Guide: Add underscores to large numeric literals to improve their readability. Most of the programs we write feature a substantial number of n...
RuboCop 0.9 is now patrolling the streets! 1 Jul 2013 | 07:06 pm
RuboCop 0.9 is finally out! This was one of our most ambitious releases - over a month of work, ~250 commits, lots of new cops and features and a lot less bugs (OK, I’m not sure about this, but I sinc...
The Elements of Style in Ruby #4: Array#join vs Array#* 1 Jul 2013 | 06:28 pm
Today’s topic is the following rule from the Ruby Style Guide: Favor the use of Array#join over the fairly cryptic Array#* with a string argument. Array#join and Array#* (with a string argument) beh...
The Elements of Style in Ruby #3: Make sure something is an array 28 Jun 2013 | 05:39 pm
The subject of today’s post is the following rule from the Ruby Style Guide: Use [*var] or Array() instead of an explicit Array check, when dealing with a variable you want to treat as an Array, but ...