Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Case vs. Draper #6

Closed
capitalist opened this issue Jun 6, 2012 · 12 comments
Closed

Display Case vs. Draper #6

capitalist opened this issue Jun 6, 2012 · 12 comments

Comments

@capitalist
Copy link

What are the differences between this and Draper?

@codeodor
Copy link
Member

codeodor commented Jun 8, 2012

I don't have any experience with Draper, so I can't offer anything useful off the top of my head.

@avdi, you'd be the best to answer this, I'd guess. Maybe @steveklabnik has some words since I know he's put some work into Draper and also read Objects On Rails.

If you guys have a moment, would you care to comment? (Does github even let me rope someone not involved in the project into the conversation like that?)

If not, I'll do a little research on Draper next week and post what would be a superficial opinion.

I guess this could go into the documentation of display_case to help people decide when it's better to use neither, one or the other, or both in conjunction.

@steveklabnik
Copy link

(Yes, it does let you rope them in)

The biggest difference in terms of implementation is this: https://github.com/objects-on-rails/display-case/blob/master/lib/display_case/exhibits_helper.rb vs this: https://github.com/jcasimir/draper/blob/master/lib/draper/view_context.rb

Usage wise, Draper pretends to be Yet Another Model, and display_case uses the helper in the controller to handle this kind of thing. That's from my initial reading anyway.

@avdi
Copy link
Member

avdi commented Jun 8, 2012

TBH I have no idea. I wanted to get the patterns I'd been using on projects down on "paper" before I moved on to see how Draper differed, and I still haven't found the time to do a project with Draper. I gave Jeff some feedback on it in early days but I don't know how much of that he incorporated.

Sorry I don't have a better answer. I'd be interested to see a comparison.

@avdi
Copy link
Member

avdi commented Jun 8, 2012

Aside: I'd love to poke around in Draper's Rails integration bits and possibly steal stuff. I put zero time into hooking into the Rails stack and left most everything explicit. I think Draper's probably a lot more advanced in that department.

@steveklabnik
Copy link

(oh, and there's gonna be a bunch of re-writing of things for Draper 1.0, so some stuff may change in the future too.)

@steveklabnik
Copy link

@avdi ping me if I can help. I re-wrote the generators, for example, to be super awesome.

Honestly, I'm pretty sure the gems are basically identical.

@codeodor
Copy link
Member

codeodor commented Jun 8, 2012

Thanks for the response guys!

Draper pretends to be Yet Another Model, and display_case uses the helper in the controller to handle this kind of thing.

When I first heard about Draper, I kind of shrugged it off and didn't see the need for it (I was also only 1/2 paying attention). When I read through Objects on Rails and saw the Exhibit stuff, I went off to implement it myself in a project and it looked more like what you described as Draper in that quote.

Just thought it was a funny story I thought I'd share -- nothing more.

@mattvanhorn
Copy link

One of the bigger differences I think, is the fact that you can easily layer multiple exhibits on an object, where draper seems to enforce a 1-1 relationship between decorators and models

@steveklabnik
Copy link

That's not actually true, though it is kinda implied. I have an open ticket to make this use case a bit more explicit.

@capitalist
Copy link
Author

Thanks for the discussion guys. It helped shed some light on the tradeoffs.

@wkrsz
Copy link

wkrsz commented Sep 8, 2012

One Draper feature that looks very useful is automatic association decoration: jcasimir/draper@1580baa

@wkrsz
Copy link

wkrsz commented Sep 8, 2012

I like how DisplayCase relies on passing view context explicitly. Draper can do that too, but also creates and maintains own context https://github.com/jcasimir/draper/blob/master/lib/draper/view_context.rb - much too clever for my taste.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants