[rspec-users] RSpec makes me want to write better code
dchelimsky at gmail.com
Sat Sep 27 16:32:33 EDT 2008
On Sat, Sep 27, 2008 at 2:29 PM, Mark Wilden <mark at mwilden.com> wrote:
> On Sat, Sep 27, 2008 at 11:26 AM, Dan North <tastapod at gmail.com> wrote:
>> It seems these conversations come up time and again because Rails
>> overloads the idea of "model". In a Rails app the model serves as both your
>> domain model and your persistence strategy, because of the coupling inherent
>> in the Active Record pattern.
> Interesting. This coupling actually brought me to one of my first "a-ha!"
> moment in Rails (similar to when I first learned about the ++ operator in
> C). Finally, I thought, I don't have to do anything to set up the
> butt-simple relationships between models and tables that are found (as you
> say) in 90% of web apps (and other applications, too). Rails allows models
> as complicated as you want, and it also allows you to do work in the
> database when you need to (I know "find_by_sql" is a dirty word, but it
> allows me to perform pivots on multiple tables of millions of rows, where AR
> simply could not handle the SQL). But it makes the overwhelmingly common
> case simple, and I like that.
> So I've found that this model-db coupling to be a powerful feature of Rails.
> I know it's saved me a lot of work, because I've had to do it manually so
> many other times in the last 25 years. If it's not sufficient or appropriate
> in any particular case, I don't have to use it.
> I know this view puts me on the wrong side of the contest you speak of
> (which I frankly didn't even know I'd entered). And yes, using Rails the way
> I (and many others) do involves trade-offs. But the one trade-off it doesn't
> require is with TSTTCPW, which is the guiding philosophy in everything I do.
> I guess this makes me an AR pixie. :)
I *think* Dan means underlying magic code when he uses the word pixie.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users