Posts

Perks vs. Salary

When I worked for ThoughtWorks I once got on a bus after work -- no ordinary bus, mind you, this was "Party Bus." On this "Party Bus" there were leather seats, flashing lights, a big screen TV with karaoke, and many bottles of Patron Silver and Grey Goose. We drank and sang like maniacs, then we got to the Casino where we ate a very fancy dinner (including some very pricey wine), did a little gambling, caused some trouble, and then back on the bus for more drinking and karaoke. The only thing I payed for was the gambling. The next day I was pretty hung over but I still got to pair with some of the best programmers I've ever worked with. I often think about this when people ask how ThoughtWorks is able to keep such excellent programmers when they could easily go somewhere else and make more money. If you took all that money that was spent on our night out, divided it by the 10 or so people that went, and added it to our salary, there's no way we would hav...

What's a Good Flog Score?

I've been using Flog to measure the complexity of my Ruby code and I was wondering how others interpret Flog numbers. I'll go first with my opinions: Score of Means 0-10 Awesome 11-20 Good enough 21-40 Might need refactoring 41-60 Possible to justify 61-100 Danger 100-200 Whoop, whoop, whoop 200 + Someone please think of the children (note: these are scores for an individual method) The 20 - 60 range is interesting to me. Sometimes the complexity of what you're doing will justify the score and other times the method is in desperate need of refactoring. The highest Flog score I've seen in the wild was in the 300's. What's you're personal high and what do you think of my rankings? In other news, I've redesigned the look of my blog so if you only see my post through a reader you might want to stop on by, take a look, and tell me what you think.

Subversion Password Caching Problem Leads to TextMate svn Integration Problems

I had a problem recently with TextMate's svn integration and finding the solution taught me some interesting things about Subversion and TextMate that I'd thought I'd share: First -- TextMate fails with a non-helpful error message if you don't cache svn passwords. For a long time I didn't even realize that my two problems were related. I had to type in my username and password for svn every-time (even though I wasn't using svn+ssh). And TextMate exploded when I tried to see the svn log of a file. Turns out one causes the other -- obvious in retrospect. Second -- Subversion keeps passwords and configuration files inside a .subversion folder inside the user's home directory. Try looking for a strangely named file inside ~/.subversion/auth/svn.simple for cached passwords. And there's a config file at ~/.subversion/config If you want to stop this caching of passwords you can set: store-passwords = no inside this file. Third -- Subversion will fail to ...

Presenting at Lone Star Ruby Conf

Word on the street is that Lone Star Ruby Conf was one of the best regional conferences last year, so I'm pretty excited to be presenting at the 2008 edition. It's happening Sept 4-6th in Austin, TX and speakers include: Matz, Evan Phoenix, Jim Weirich, The Rails Envy Guys, and too many other luminaries to name. I'll be giving a talk entitled " Using Metrics to Take a Hard Look at Your Code " which is a distilation of my thinking over the past year about how to use numbers not as a hammer with which to beat people, but as a tool to improve your code. Registration just opened up today, but space is limited so go sign up soon.

Disconnecting RSpec from the Database

Recently I spent some time away from RSpec and I did miss it, but one thing especially liked about the testing framework I lived in for 10 months was that it had two ways to test anything you liked: One that hit the database and one that did not. We used UnitRecord to disconnect unit tests from the database (I should mention that we defined unit tests as tests that didn't hit the db and functional tests as those that did). So the vast majority of our tests didn't really need to hit the db and ran very fast. Sometimes we wanted or needed to hit the db and we did (only occasionally in model tests, more often in controller tests, and we kept logic out of the view and only tested views at the Selenium level). It was pretty cool and I'd like to thank the team who set it up before I got there. There's been a lot of talk about whether model, view, or controller tests should hit the db but I've found that there's enough exceptions that it's worth just saying that...

Breadcrumbs are Evil

I've been on a few projects where I've had to mess with breadcrumbs and they tend to be much more trouble than they're worth. It all starts simply enough: put the users path through the app on the page. Which isn't too hard. Then the bugs come. Like: "This page is linked to from page A but it really is more of a child of page B so the breadcrumbs should show page B and not A even if they come from A" Or: "When I come to page X from the search on the front page it should have breadcrumbs with Y and Z because that's really what it's under." And: "Page L is listed under K but should be under M (followed a few days later by) Page L is listed under M but should be under K" Oh, you want a hierarchy. Which is hard. First: There's now a new job to be filled: Taxonomist. Somebody is going to have to figure out where all the pages in the app fit in some sort of tree. And this list must be maintained. Second: There must be...

Syntax Highlighting for Ruby Made Very Easy

So I've been making do with lame-o 'pre' tags for my code snippets and my blog looks, well, lame. But the various alternatives for highlighting ruby either didn't work for Blogger or smacked of effort (and you know how I feel about effort). Well, recently I joined Obtiva and I was being all nosy looking at my new co-worker's blogs, when I found Tyler Jennings post about creating Spotlight . Take some ruby code, paste it into the text box, press a button, and you get some html which you copy and past into your blog. You'll have to include the default css in your css file the first time, but that's not too hard. Output looks like this: 1 class Echo < ActionMailer :: Base 2 def copy formatted_message, incident_id 3 users_with_echo_emails = User .find( :all , 4 :conditions => " echo_email is not NULL " ) 5 users_with_echo_emails.reject! {|user| !user.receive_echo?} 6 recipi...