Desert has been upgraded to work with Rails 2, solving problems with ActionMailer templates and Rails load paths.
Nested Describes in RSpec
A reminder: RSpec supports nested describe blocks. This can be useful for sharing setup and also for organization (one describe per method being tested, with multiple it blocks). Some people reported that there are some issues when using nested describe blocks with fixture scenarios. There was also a report of some flakiness around a single it block being run more than once.
One of our projects has reported that they have been using NetBeans and are happy with it.
Sayings I use, only some of which are actually originally attributable to me. Anyone with research on a saying’s provenance, feel free to comment. This page, unlike a normal blog entry, will be updated as needed with stuff I find myself saying with air quotes.
A comment is a lie waiting to happen.
“Legacy” means any program that people are actually using.
(Feathers: “Legacy” means “no tests.”)
If you try hard enough, you can make anything fail.
There’s no such thing as human error. (Only system error.)
If you pay attention to something, it gets better.
It’s always a people problem. (Jerry Weinberg)
You can see a lot by looking. (Yogi Berra)
Yogi wrote a book called “You Can Observe A Lot By Watching” but I prefer to think he was misquoting himself.
Language Log has a take on this quote: She was seeing at me
Object-Oriented Programming is like teenage sex: everyone says they’re doing it; few actually are; and those who are rarely know what they’re doing. (Anonymous, via Misko)
Here’s a simple test for whether you’re doing it right: Is your data in the same class as the methods accessing it? Oh, really? Check again.
Double negatives are not unconfusing.
Encapsulation means putting similar things together, and keeping dissimilar things apart.
Of course, the trick of design is knowing along what axes to group or differentiate items. One rule of thumb that has served me well since the days of Gamelan — when we were sorting dozens of incoming applets per day into categories — is:
Don’t look at the item and think, “What category does this item belong in? Look at the category and think, “If I were looking for items in this category, would I want to find this item?”
In other words, make your API fit the mindset of the user, not that of the provider.
Conway’s Law: “Any piece of software reflects the organizational structure that produced it.”
Or, “The structure of the code reflects the structure of the coders.”
Read the error message.
Good Scrum diagram. Suitable for XP too (replace “sprint” with “iteration” and “daily scrum” with “daily standup”).
Courtesy of Mountain Goat Software
- Rails Bug: composed_of seems to be broken, at least in Rails 1.99. The :mappings parameter states that it can take an array of symbol-pairs, but symbols do not work — only strings work. Example:
Does not work:
:class_name => Name
:mapping => [
[:first_name, :first], # :symbol, :symbol does not work!
[:last_name, :last] # :symbol, :symbol does not work!
:class_name => Name
:mapping => [
['first_name', 'first'], # 'string', 'string' works!
['last_name', 'last'] # 'string', 'string' works!
- Ruby ain’t Java! A recent Java-convert ran into the following: when calling a private instance method, you must not indicate
self.private_method, but instead call
puts private_method #=> works!
puts self.private_method #=> self? uh oh!
'*** You Called? ***'
>> priv = PrivateCaller.new
*** You Called? ***
NoMethodError: private method `private_method' called for #</privatecaller:0x14ec39c><privatecaller:0x14ec39c>
from (irb):4:in `private_caller'