-
Notifications
You must be signed in to change notification settings - Fork 108
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
Using multiple Representers to decorate an class #114
Comments
It's a great idea... And i like it ! 👍 Do you know that you can pass options in
|
When I was trying to extend Roar, I discovered that a lot of the development is in flux. Also the way that attributes are pushed around using Roar & Representable makes it very hard to extend on it. The entire thing felled very over engineered for my purpose. As I needed more flexibility in my implementation anyway, that I decided to rebuild my own DSL using a Roar like syntax. Surprisingly it took about 250 lines of code to do this, so I'd recommend to go this path if Roar feels to constrained for your intended purpose. |
@barttenbrinke I've heard that several times and my apologies for providing gems that suit more than one client's requirements. I'm totally fine when people copy the concept of a representer and implement it with their own code. Roar and Representable do not pass stuff around - Roar uses Representable, what's wrong with that? You're probably doing JSON, only, this is why you end up with that little code. It needs some architecting to have a generic interface for all formats. This API has only changed slightly in the past years so I can't really understand what you mean with "in flux". Roar has changed recently as I simplified I absolutely disagree in one thing, though. Roar is absolutely not constrained - the opposite is the case: You have a wide variety of ways to deserialize and render objects and hooking into that process and this is exactly what makes it look complicated. Of course, you only want a subset of this and now your code is leaner because it doesn't implement the entire API. I'd love to simplify, why don't you hit me up next time when you are having trouble understanding my madness? @chussenot Yepp, that works exactly the way you put it. |
Honestly, I don't get it. People use my gems, find the idea good but then rewrite it because "the original version is over-engineered." They usually end up with a subset of functionality that fits exactly their requirements. They then tell me that they "implemented it less complicated and with less code". What are they trying to say? That everyone should stop using frameworks and write it themselves because it's "less code"? Please, enlighten me what those comments are about. |
Hey @apotonick , I'm really sorry I didn't explain myself well enough in my post. What I meant with over-engineerd:
What I meant with in flux:
What I meant with Roar is constrained:
For all of these points I found no easy way to patch Roar/Representable to do this. My advice to @chussenot should have been clearer: If you are trying to do a DCI with HAL, then Roar/Representable might not be the best fit at this point. Because a DCI will probably entail loads of custom logic, which is very specific for your app, it might be a good idea to build it yourselves. I did that and by implementing just the features I needed, I was able to build something pretty lean that looks a lot like the Roar Decorator syntax, which also does custom magic that I need in my specific use case. |
Thanks @barttenbrinke sorry I had a shit day yesterday and might have over-reacted a bit. ❤️ Great points - I start to understand how you use Roar with DCI and how that might interfere with each other.
Thanks man! |
@apotonick See email :) |
As discussed here: https://groups.google.com/forum/#!msg/roar-talk/a0_8zSKuMZw/k8bTzYAelJ4J
Extending with multiple representers would be very handy when working with a Data/Context/Interaction setup.
I am trying to do the following:
In the controller:
Currently I worked around this by writing an initializer that changes https://github.com/apotonick/representable/blob/master/lib/representable.rb#L80-L83 to do inherit on extend if there are representable_attrs in the Object. I also needed to make the representable_attrs public for that.
What whould I need to write in order to get a pull request accepted for this?
The text was updated successfully, but these errors were encountered: