Ruby on Rails
Wednesday, August 1, 2012
Oh just stop it. Bending your app into a pretzel to get faster tests is the "band-aid".
Really? it's not about bending app into pretzel, it's about designing the app in a way that each part has only one reason to change. and not making things depend on stuff
that they don't have anything to do with them. I think shoving lots of things into models and controllers is not a good idea and we'll end up with God classes and modules which
will change for lots of different reasons.
BTW it's not for getting fast tests. in TDD when it's hard to write tests or the tests are slow when they should not (when they don't need rails for instance) they're shouting
about the problems in the design it's like an alarm. And we should pay attention to this quick feedback and do something about it otherwise it'll get worse and worse.
Tools like Spork address a single issue - "environment reloading is expensive" - with a simple solution, not reloading when it isn't needed. That's *far* more useful, especially if you're a developer on an *existing* app and don't have the luxury of rewriting everything into Object-Oriented Nirvana.
I completely agree with you that not loading things when they are not needed is a great solution. and if you think about it this whole design idea for putting things where they belong
and not in models and controllers is doing this too. You're not depending a logic to ActiveRecord or ApplicationController ergo, you're not loading things that you don't need at the moment
and you don't depend upon things that you don't have too. Of course doing this is harder in an existing application but trying to improve the design toward this style in small steps and using
the existing SLOW tests to make sure we're not breaking things is a good thing to do. Until we end up with a great design with extracted domain-logic modules in their own place and having incredibly
fast isolated tests for them. (That's my idea and probably I'm wrong though ;):D)
Good Luck ;)
Best Regards
Sam Serpoosh
Software Developer: http://masihjesus.wordpress.com
Twitter @masihjesus
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment