Jamis Buck has an incredible detailed exploration of how an dependency injected world would look for Rails. We could be cute and call it Rails on the Needle, but we won't — the metaphors are already fairly fuzzy.
I'm much intrigued by the whole dependency injection game. I've been following along from the sideline since JAOO '03 where I hung for a while with ThoughtWorkers Hammett and Aslak for chats about Ruby, testing, and of course Inversion of Control/Dependency Injection talks. Hammett introduced it as the Hollywood Principle and while fascinated, I wasn't really seeing the applicability at the time.
Martin Fowler's defining article on IoC Containers and the DI pattern brought all the concepts into focus, but I still wasn't really feeling the hurt that this approach would be solving in any of my Ruby work.
I am now. Writing functional tests for Basecamp is at least a little painful when there's no easy way to automatically inject mocks for my GatewayService (talking to Authorize.net) and my ActionMailer. The latter is getting souped up for better testing in the next release (so you don't even need a mock), but I'm still getting the picture. DI is great for injecting mocks in hard-to-get-to places.
But I've never been comfortable with the explicit registry lookups or method assigns. Especially for class methods, like Account.find_all. So that turned me off Jamis' first proposal. But a few talks with Dave Thomas brought up the idea of transparent DI:
So I suggested to David that we could make Rails more explicit. Rather than having some random instance variable containing the model’s class, we could declare that such-and-such a class represents a model that the controller is using, but have that class actually injected by the framework.
I like this idea a lot. It's basically business as usual with DI for free. So you wouldn't even have to choose whether to do DI or not up front. Just as soon as you're feeling the pain, you start injecting.
So I got the hots for this proposal. The major thing still holding me back is what it'll do to the complexity of the internals of Rails. I think it'll even decrease the amount of code used, but the conceptual complexity will go up. I'm just starting to get to terms with DI, so I can definitely relate to those fears that other contributors have voiced.
But I think the proposal Jamis has put together goes a long way to dispel those fears. It's centered purely around wiring controllers and models together and if you're uncertain of the value of injecting mocks, you can just not use it. And the world will spin around like it did yesterday.
Yes, I'm feeling good about it. And Jamis is about as smart a developer as they come, so when he's excited about something like Rails on the Needle, I'd be a fool not to listen really closely.
AFAIK I'm not a ThoughtWorker :-)
Its amazing, and I have to tell you that right this moment I'm working on something I called Castle on Rails (a small piece of the castle project - first draft available at http://www.castleproject.org ) which is exactly what you have described. The Castle Microkernel will inject all necessary models/services in the controller and the view...
Wow! For those who have seen the Waking Life film: once the knowledge is out there, it seems that it can be captured... :-)
Oh, and you've confused me with Paul Hammant. We both came from Avalon, maybe thats the reason :-)
If you're still looking for an alternative name to "Rails on the Needle", I believe you need look no further than this line of yours:
Just as soon as you're feeling the pain, you start injecting
Hence, Morphine. :)
Rails is getting more and more tempting all the time. I am a Java guy, and thought that DI was one of the things that Rails was missing, to see it added and so cleanly looks great.
My excuses for not doing Rails work are fast decreasing ;).
Morphine...heh. I can see it now. A headline: "Morphine Makes Developers Super-Productive". :-P
"transparent DI"? Sounds like Aspect Oriented Programming to me.
I'll cast my vote for adding DI to Rails. The deciding factor for me is the ability to add AOPish functionality to the model. I'm often running into instances in a current project of mine where I need to have advice added to a certain attribute assignment on a model class that doesn't really belong in the model class itself.
For instance, the project I'm working on is a PM tool for eXtreme Programming (yes, I know about Jim's StoryCards project---this is more a personal project to teach myself Ruby/Rails). In the model, I have a Project class and a StoryCard class. Project has a #status attribute that uses a third class called ProjectStatus to contain various bits of meta-data about a status. One of these is ProjectStatus#is_closed, which allows me to define several statuses but have each of them considered a closed project (i.e., Complete, Cancelled, etc.).
I want to enforce at the model level that a StoryCard can not be assigned to a Project unless Project#status.is_closed == false. However, the checking for this really shouldn't be in the StoryCard model, because that requires StoryCard to have too much internal knowledge of Project/ProjectStatus.
Currently, I'm resorting to using StoryCard.module_eval inside the Project class definition to add the status checking logic to StoryCard so that the logic is, at least, in the same file as Project. This still has a bad code smell to it, though. With DI, I should be able to use the registry to intercept the calls to StoryCard#project_id= a lot more cleanly and simply add the advice that way.
Sorry for my links
older women and younger men older moms mature nudists photos mature spunker mature gallerys mature gallerys classic mature mature nudists photos mature spunker mature video older women and younger men classic mature mature gallerys mature spunker mature anal mature nud3 pics free naked older women mature ladies in lingerie lyrics to older country songs free naked older women older women and younger men mature women stories lyrics to older country songs free thumbnail pictures of older women mature amature mature ladies in lingerie mature living mature anal older moms mature ladies in lingerie older moms mature nud3 pics mature gallerys mature living mature nud3 pics mature spunker mature spunker classic mature mature nudists photos mature nud3 pics
Hi. This is my links.
xyx creampies mature creampies free creampie pics free free creampie video free anal creampie movies creampie video store free creampie thumbnails wife oral creampies free creampie video free creampie video free anal creampie movies hairy creampie creampie pussies japanese creampie links teen anal creampies creampie video clips free creampie pics free japanese creampie links creampie ass free creampie video creampie video store wife oral creampies cum creampie xyx creampies xyx creampies cum creampie wife oral creampies creampie ass free creampie pics free xyx creampies japanese creampie links creampies movies creampie pussies free creampie video creampie t9p cum creampie teen anal creampies free creampie video teen anal creampies free creampie pics free
Hello. I am new here. It is very interesting.
mature men galleries mature women nud3 older women younger men mature nud3 women mature babes older men younger women mature wives free mature s3x mature women nud3 mature wives mature nud3 women dating mature women free mature old naked women mature women t9p free mature p0Rn older women younger men mature wives dating mature women mature men galleries free mature s3x mature women in stockings mature amateur dating mature women dating mature women mature women t9p mature wives older women younger men older women younger men mature men galleries mature wives mature amateur mature over 50 mature women in stockings free mature s3x mature women t9p mature babes mature wives mature over 50 mature nud3 women
Sorry for my links
mature pic gallery mature hardcore links mature glamour black older ladies thumbs gallery older women mature mistress older black women mature nudists older women stories mature big tits mature pantyhose pictures mature pic gallery how to meet older women mature pantyhose pictures older women stories older women stories free older women galleries mature pic gallery young girls older men young girls older men mature nudists mature big tits naked old women thumbs how to meet older women free older women galleries naked old women thumbs young girls older men mature pantyhose pictures mature big tits mature big tits older 1esbians how to meet older women mature asian women mature index mature pantyhose pictures mature mistress mature mistress mature women over 40 older 1esbians free older women galleries
Hi. This is my links.
white pantyhose cheerleader panty pics mature pantyhose pics mature women in pantyhose office girls in nylons white pantyhose satin panty galleries panty post celebrities in pantyhose girls in nylons free wet panty celebrities in pantyhose office girls in nylons cheerleader panty pics celebrities in pantyhose wet pantyhose free wet panty free wet panty white pantyhose men's pantyhose panty post free teen panties pantyhose images men's pantyhose satin panty galleries panty post wet pantyhose men caught wearing pantyhose men caught wearing pantyhose white pantyhose free teen panties panty thumbnails white pantyhose men caught wearing pantyhose winnie-cooper pantyhose mature ladies in pantyhose celebrities in pantyhose panty fetish wet pantyhose office girls in nylons
Sorry for my links
pantyhose men free pantyhose pics pantyhose fetish pantyhose pic gallery wolford pantyhose pantyhose men pantyhose men pantyhose fetish crotchless pantyhose shiny pantyhose pantyhose pic gallery shiny pantyhose free pantyhose pics free panties panty girls silkies pantyhose little school girls panties teens in pantyhose wolford pantyhose crotchless pantyhose pantyhose foot gallery free pantyhose sites pantyhose fetish free panties silkies pantyhose pantyhose fetish men in panty pics men in panty pics teens in pantyhose pantyhose fetish teens in pantyhose crotchless pantyhose little school girls panties free pantyhose pics free pantyhose sites bra and panty pics free pantyhose pics teen panty pictures shiny pantyhose panty girls
In your free time, check the pages on poker rules poker rules http://poker-rules.zindagi.us/ .