dastels @ 4:02 am
With my move to Google, I’ll be in a mixed Linux/OSX environment… so it makes sense to me to revisit emacs for my day-to-day programming.
With some help from zenspider and technomancy, I have the latest carbonized emacs up & running with a nice ruby/rails environment (rinari)… and of course… the zenburn color scheme.
dastels @ 2:36 am
I just added a confirmation dialog to a cancel button on an app that I’m working on. I tested it and stopped for a second as I read the dialog.. then broke out laughing.
 |
| What do I press if I really do want to cancel? |
dastels @ 5:29 am
Tonight I was exploring the current state of RubyCocoa (and it looks good), and I noticed a quote from Knuth’s “The Art of Computer Programming”, his 1974 ACM Turing Award Lecture.
Paul Graham has the text of the full lecture here.
This is a great talk, and should be required reading for anyone calling themselves a programmer. I found the last section, especially interesting.. here’s what I consider to be the core bit form it:
“Therefore I want to address my closing remarks to the system programmers and the machine designers who produce the systems that the rest of us must work with. Please, give us tools that are a pleasure to use, especially for our routine assignments, instead of providing something we have to fight with. Please, give us tools that encourage us to write better programs, by enhancing our pleasure when we do so.”
It struck me that Ruby and recent systems from Apple fill Knuth’s request quite nicely. According to Wikipedia, Knuth uses Macs.. I wonder how he thinks they answer his challenge from ’74. I wonder what his view of Ruby is… Anyone heard anything about that?
dastels @ 8:45 pm
Here’s an article I wrote a while ago but didn’t get around to releasing. Enjoy.
Describing Equivalence Classes in Ruby with RSpec
Since writing that article, I’ve made good use of the code. Here’s an example of it in action: grouping the cards in a deck into their types. A second method then uses those groups to reassemble the cards into an ordered list.
CARD_TYPES = ['basic land', 'land', 'creature', 'artifact',
'enchantment', 'sorcery', 'instant', '']
def maindeck_cards_grouped
maindeck_cards.equivalence_classes(*CARD_TYPES) do |card, the_type|
card.magic_card.card_type.downcase.include?(the_type)
end
end
def maindeck_cards_ordered
cards_by_class = maindeck_cards_grouped
(CARD_TYPES.inject([]) {|cards, type| cards << cards_by_class[type]}).flatten
end
dastels @ 5:18 am
The stats for our project:
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 70 | 55 | 2 | 6 | 3 | 7 |
| Helpers | 6 | 4 | 0 | 0 | 0 | 0 |
| Models | 891 | 734 | 13 | 110 | 8 | 4 |
| Libraries | 0 | 0 | 0 | 0 | 0 | 0 |
| Model specs | 2283 | 1835 | 0 | 0 | 0 | 0 |
| View specs | 0 | 0 | 0 | 0 | 0 | 0 |
| Controller specs | 0 | 0 | 0 | 0 | 0 | 0 |
| Helper specs | 0 | 0 | 0 | 0 | 0 | 0 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total | 3250 | 2628 | 15 | 116 | 7 | 20 |
+----------------------+-------+-------+---------+---------+-----+-------+
Code LOC: 793 Test LOC: 1835 Code to Test Ratio: 1:2.3
A few things to notice:
- very “rails” light… small controller… very literally a controller.. all the action happens in the models,
- all the specs are for model classes, the controller & view do very little.. although the controller could probably do with a few specs, and
- there’s over twice as much code in the specs than in the working classes.
The spec run:
$rake spec
(in /Users/dastels/Projects/Ruby-Projects/merlin/trunk)
..........................................................................
..........................................................................
..........................................................................
........................................................
Finished in 62.891545 seconds
278 examples, 0 failures
and the coverage report:
 |
| Note that echo was under development and actually didn’t get finished in time. Also we ran out of time before getting to mindbender. |
dastels @ 3:11 am
Rails Rumble ’07 is over.
It was a total good time.We didn’t get as much done on our app as we had hoped, but what we got done turned out as well as we could have hoped.I was on the IRC channel the whole time pretty much, which provided a nice sideline. The whole thing had a strong co-opatition feel. There was a great group of people involved.
A big THANK YOU to the sponsors, the organisers, the other teams, and mostly to my teammate, Nancy.
We ran into some interesting technical issues in the course of the 48 hours, which I’ll be writing about over the next few days.For those interested, or just with voyeristic tendancies (ain’t the web great), there’s a flickr pool, and I’ve posted some pics in my .mac gallery.
dastels @ 4:37 am
We’re nearing the half way point of the Rails Rumble.. 1 day, 2 hours, 24 minutes remaining as I write this. We’ve been taking some photos that I’ve been posting at my .Mac web gallery.
dastels @ 8:36 pm
We’re getting prepped for the Rails Rumble. Nancy & I have entered as a team. The kids have been told they’re on their own for the weekend. This is going to be a great bit of fun.