[rspec-users] Associations should be private
mark at mwilden.com
Wed Oct 1 21:38:47 EDT 2008
On Wed, Oct 1, 2008 at 6:22 PM, Ashley Moran
<ashley.moran at patchspace.co.uk>wrote:
> On Oct 01, 2008, at 8:17 pm, Mark Wilden wrote:
> Sounds like future-proofing to me. In the case of libraries, that can be a
>> good thing. For application code, it flies in the face of YAGNI.
> Actually I don't think that's a YAGNI. You need *an* interface to your
> models, the question is whether to build one that litters trainwrecks
> through your code, or one that is internally refactorable.
ActiveRecord already provides an interface to your models. If you add on to
that because it might things easier in the future, that's where I call
"YAGNI." It reminds me of a book on Java by a well-known author which said
that you should declare an interface for every class, because it will make
things easier if you need to change the implementation. He's absolutely
right, of course.
However, I say that there are too many things that need doing right now -
right this second - to waste time on what may or may not happen in the
future. Put another way, what are you willing to give up in order to add
"Litters trainwrecks," BTW, I believe begs the question.
> Embrace change" - Kent Beck. The whole white book is predicated on what you
>> just pointed out about Rails.
> You meant to say Ruby there, right? ;o)
I was responding to the "convention over configuration" remark. But yeah,
Ruby certainly does make changing stuff easier than many other languages.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users