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

Comments

Projects
None yet
6 participants
@capitalist
Copy link

capitalist commented Jun 6, 2012

What are the differences between this and Draper?

@codeodor

This comment has been minimized.

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

This comment has been minimized.

Copy link

steveklabnik commented Jun 8, 2012

(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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link

steveklabnik commented Jun 8, 2012

(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

This comment has been minimized.

Copy link

steveklabnik commented Jun 8, 2012

@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

This comment has been minimized.

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

This comment has been minimized.

Copy link

mattvanhorn commented Jun 14, 2012

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

This comment has been minimized.

Copy link

steveklabnik commented Jun 14, 2012

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

@codeodor codeodor closed this Aug 10, 2012

@capitalist

This comment has been minimized.

Copy link
Author

capitalist commented Aug 14, 2012

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

@WojtekKruszewski

This comment has been minimized.

Copy link

WojtekKruszewski commented Sep 8, 2012

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

@WojtekKruszewski

This comment has been minimized.

Copy link

WojtekKruszewski 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