August 2007
10 posts
A bullet in your programs head
Paul Graham, whom I agree with about 70% of the time and think he’s got things completely backwards the other 30%, presents us with Holding a program in one’s head – which I think is mostly on the agreement side of the fence.
I’ve read articles like this before – the whole “you can get more done when you aren’t distracted” thing isn’t exactly news. But I thought it would be interesting...
1 tag
Shoulda news
Some shoulda news for all you fans out there (you know who you are):
1. We spent all day slaving over some tutorials for you guys/gals. Eat ‘em up here.
2. Torrey whipped out his MS Paint skillz to create the new Shoulda logo. Bask!
Indeed!
4 tags
A smattering of t-bot news
So, we just got word that the last chapter for our book has made it through the copy editing stages and has been delivered to ‘production’. We’ve got the proof of the cover, and we’re on our way to release it in September.
You can preorder it now from Amazon.com
Also, we’re almost up and running with our new New York City office. Located at 407 Broome St., we’re sharing space with...
Unpopular Developer 4: Separation Anxiety, Part...
REST & DDD
That, however, brings me to some remaining gripes, which are increasingly oriented toward the repercussions of implementing design driven development (don’t get me wrong, DDD itself is not merely a practical, but arguably the best way to approach software design, at least on the web-but I’m don’t want to get into that here). I think it is telling that DHH’s keynote at...
real nice framework you got here
Here’s a good one I ran into in Rails the other day.
So the files under the config/environments directory are environment specific config files.
config/environment.rb on the other hand is loaded and executed for every environment.
What I wanted was a constant that was the same in the development and production environments but different in the test environment. So I naturally put the...
constant annoyance
Recently Ive been running into some strange behavior with Ruby and its class constants and methods.
For example, the following works:
class User
def self.blah
puts 'blah'
end
end
User.blah => 'blah'
User::blah => 'blah'
Somebody tell me why that works.
My only idea is that its some implementation bug about the way Ruby stores its class methods.
Either way,...
Rails has_and_belongs_to_many conveniences
The other day, I was developing an ordering system. In this system, an order has many items and each item has a price. I also needed to store how many of each item was being purchased. So I used my old friend habtm, and noticed that a simple join table wouldn’t be enough, I would need to store a quantity for each item sold. From the Rails docs:
Deprecated: Any additional fields added to...
auto load
One thing I never looked too far into Rails was: what of my files in lib do I need to require in and what don’t I need to require in?
It turns out that if you follow some naming conventions you can avoid require‘ing files in, which can help keep your various environment files shorter.
If you have a class or module in lib who’s name follows the Ruby conventions of MixedCase and who’s file...
it's the wiz and nooobody beats it
We all love wizards.
Here’s a common pattern I use for wizards.
It sucks and the code’s ugly but it works.
We’re going to create a 3-step wizard for creating a User.
class User < ActiveRecord::Base
validates_presence_of :email, :password
validates_confirmation_of :password
end
schema:
users (email, password, name, bio, created)
So in the first step we’ll collect...
3 tags
Managing Client Expectations with Code
Gentlemen! Part of design driven development is that actual coding doesn’t begin until the user interface has made its way through the design phase and is now XHTML and CSS.
From there, you likely begin to build out the application in iterative milestones. One issue you quickly run across with this is that it can be difficult for all members of the project team, including clients, to...