Posts from conaltradh...
Family Update
It’s been a long time since I posted an update, and it’s time.
We added another member to our family on Wednesday. At 3:53pm, Raymond Edward Baker was born here in Lindsay, ON.
Photos can be found here: http://www. flickr.com/photos/32084321%40N00/tags/baby/
Married
For those of you that don’t know, I married Rhonda Lesieur (now Rhonda Baker) tonight.
Pictures and details forthcoming.
Flexible Rails
My good friend, and fellow Vancouver Islander, Peter Armstrong has been working hard combining the ease of Rails development with the beautiful, responsive interfaces made possible by Adobe Flex.
The result of this work is a new book, Flexible Rails, which is now available for purchase. For those of you who want a little more richness in your application interfaces, and AJAX just isn’t cuitting it, Flexible Rails is exactly what you’ve been waiting for.
Peter presents the material clearly, and does a great job of bringing the reader from zero to useful application skills quickly. This is a great introduction to a very interesting application of Rails.
Go buy a copy now.
Don't Touch it With Your Bare Hands
From IM:
Dave Astels: I hate using java
Dave Astels: it’s like programming with oven mitts on
News From a Friend
Joe O’Brien writes that he’s moving on; he will soon no longer be a ThoughtWorker. He is starting a new venture, EdgeCase, which will undoubtedly be a success.
Joe is a tremendously gifted developer, and a better friend than I deserve to have. Those of you that manage to secure his services while he can still fit you into what will most certainly become a full schedule will not be disappointed1. If you’re looking for help with your large Ruby on Rails applications, you have to look no further than EdgeCase.
This is as good a time as any to announce that I am speaking alongside Joe at Real World Ruby on Rails Seminar. This will be a great opportunity to meet both of us, as well as many other talented developers in the community.
1 Joe is such a great guy that I don’t hold the fact that he drinks Corona against him. He really is that cool.
Something About Fish
Like many others recently, I too am leaving my job to start a new one. Today will be my last day at Bravenet. Tomorrow I will start working with some great folks at CollectiveX. I’m not going to quote Douglas Adams, as I did on my mail to the Bravenet company-wide, because it seems that everyone else who is switching jobs is doing it too. Bastards.
The move has already seen a renewed energy and joy from working on my personal projects. Great things can be expected. RSpec will see proper, and complete, Rails support as well as GUI runners in the near future. I will be teaching more workshops on Test-Driven Rails Development (more on that soon). Finally, I am starting a new project that will undoubtedly change the world, but that I’m not talking about yet.
I’m looking forward to a change of scenery. I enjoyed the time I spent with the folks at Bravenet, but it’s time to move on to something new.
Updates Forthcoming
As it tends to do occasionally, Real Life has interfered with doing what I want to do. Since I last updated there have been a few talks and workshops, as well as other bits that I’ll be sharing.
I’ve been diligently keeping notes and drafts of what I intend to write here, but am not yet completely happy with that I’ve come up with.
Stay tuned.
Always the Optimist.
I’m not writing shitty code; I’m creating refactoring opportunities.
Waterfall 2006
I will definitely be adding this to the list of conferences I am attending this year.
Making C Suck Less: One #define at a Time
I used to write a lot of C. My variable names were rarely more than 3 characters in length. My functions were long and contained wild switch statements; I always made sure to free() what I malloc()ed; I tuned my code so that not only was it an unreadable mess, it was a fast unreadable mess.
I’m better now.
I’m writing a Ruby extension, Net::GeoIP, for work (they let me MIT it, so go nuts). Because I keep flipping back between Ruby and C during the development of this extension1 (obviously) I have a constant reminder of the hoops I have to jump through in languages that aren’t as expressive as Ruby.
I’ve decided to just add some of these features myself, by abusing the pre-processor. Here’s a bit I thought I’d share:
#define unless(x) if (!(x))
unless(container == NULL) { GeoIP_delete(container->geoip); }
1 Indeed, my tests are written in Ruby. I make them pass with C code. And I have a big wad of Rake love gluing it all together.
RSpec 0.3.x
Today, I released three new versions of RSpec. 0.3.0, 0.3.1, and 0.3.2.
Take a look. I might write something clever about it here, but not today.
Canada on Rails
Dear Canada on Rails Attendees,
Our Canucks are scheduled to whip the Colorado Avalanche on 15 April 2006.
This is also the last game the Canucks play in the regular season, so it’s bound to be good.
Please RSVP to me via IRC (I’m srbaker).
There will be beer.
Sincerely,
-Steven
Canada on Rails
Dear Canada on Rails Attendees,
Our Canucks are scheduled to whip the Colorado Avalanche on 15 April 2006.
This is also the last game the Canucks play in the regular season, so it’s bound to be good.
Please RSVP to me via IRC (I’m srbaker).
There will be beer.
Sincerely,
-Steven
Tabs
For those of you that want to keep tabs on me, I’ve added some links on the sidebar to pages describing various parts of my geek life.
You can find a list of projects I’m currently working on, or have plans to work on, as well as information about the talks and workshops that I am scheduled to run.
It is likely that changes to those pages will be accompanied by a post here as well, so if you’re reading via RSS (as you should be) you’ll be fine.
This is my Code, I'm Proud of It
When my co-worker, Jamie, arrived at work this morning he pulled out his laptop to show me some code that he had written over the weekend. As he was getting his laptop ready, he said to me: ``I have to thank you, Steve, for teaching me the difference between ‘This is my code, I wrote it.’ and ‘This is my code, I’m proud of it.’’’ He turned the laptop towards me and said ``This is my code, I wrote it.’’ and we both laughed. Next he showed me the refactored version, and I knew that this was the code he was proud of.
Now we’re going to learn together: ``This is our code, and we’re all proud of it.’‘
UML with Mixins
Dear Lazyweb,
I am currently working on a UML model1 of a largeish Rails application. I have the inheritance diagrams complete, but a lot of my classes are using mixins.
My question to you, dearest lazyweb, is this: How do I appropriately indicate usage of mixins in a UML diagram?
Thanks,
-Steven
1 For documentation purposes. No, I didn’t do something stupid like use a code generation tool.
Introducing IoSpec
I decided to give the Io Programming Language a try. It looks great. It’s missing a BDD framework, though, so I started writing one.
randy:~/Development/iospec srbaker$ io
Io 20051221
Io> doFile("spec.io")
> true
Io> true shouldEqual(true)
> true
Io> true shouldEqual(false)
Exception: Expectation not met.
[backtrace snipped]
> nil
Io> false shouldEqual(false)
> true
RSpec gets its first port, IoSpec. Not a bad way to start the new year. The only thing missing is a runner, which I’ll be working on this week. IoSpec is almost complete, and I’ve only invested about an hour and a half into it.
Application Specific Configuration
Almost all of my rails applications to date have required application-specific configuration.
Add this to environment.rb1:
require 'ostruct'
require 'yaml'
unless Object.const_defined?(:ApplicationConfig)
ApplicationConfig = OpenStruct.new(YAML.load_file("#{RAILS_ROOT}/config/config.yml"))
end
Then, create a YAML file in config/config.yml that looks like this:
my_settings_category: preferred_language: Ruby
To access this configuration information, just use ApplicationConfig.my_settings_category[:preferred_language].
Have fun with it, comment with concerns/enhancements. I believe Ryan Davis is to blame for introducing me to ostruct. I’m still using it exhaustively, since it’s my new toy.
1 Perhaps I should move this into a plugin, so I don’t have to edit environment.rb.
If It Pops Like a Stack . . .
There has been a lot of discussion about Humane Interfaces since Martin first posted the article on his bliki. After reading his follow up I decided it was time to weigh in myself.
I understand that to some, Array may smell a bit of needless complexity. I hadn’t noticed it until the detractors pointed it out, though. Why didn’t I realize it before? Because I don’t ever think of my stacks as instances of Arrays. I think of them as stacks. Consider the following bit of code:
my_stack = ["foo", "bar"] my_stack.push "baz" my_stack.pop
There is no mention of Array here. Arrays are the furthest thing from my mind1. After all, I’m popping a stack, damnit! And in Ruby, if it pops like a stack, it must be a stack.
An Array class with 78 methods may be a bit much. But an Array class that mixes in modules for each of the different behaviours: Stack, List, Queue, etc. is almost certainly more acceptable. I wonder if Matz would accept a patch for such a refactoring of some of the standard library classes?
1 Had I instantiated my stack with Array.new instead of the [] shortcut, I might be singing a different song. I can’t remember ever using Array.new to instantiate an instance of Array, though, so it may be a bad example.