Live data from Hacker News

Objectify: A Better Way to Build Rails Applications

jamesgolick.com

71–72 of 72 posts

Re: Objectify: A Better Way to Build Rails Applications

#71
post #70

Earlier quoted context omitted.

> The framework basically forces you to abandon messaging (since there is no exchange of messages, just single directional messages flow from the router), The services receive messages from the router, then send messages to whatever they need to call to get the job done. Being sent messages by the framework is what makes it a framework and not a library; I don't get your objection here. > abandon encapsulation (since…

The services receive messages from the router, then send messages to whatever they need to call to get the job done. Being sent messages by the framework is what makes it a framework and not a library; I don't get your objection here. If it was a framework modelled in an object oriented way it would itself be built of classes exchanging messages, but it isn't. It encourages you to also structure your code in a non ob…

> Must you go as far as to refer to a hypothetical reality just to win an argument ;) ? That's how Rails works, that's what the examples show, I am not referring to what is possible in theory, but to what the framework does and the most reasonable possible way of using it.

Eh? The sentence you quoted explains that putting domain logic in the persistence objects is precisely what objectify avoids. I do't see any examples of domain logic as separate from persistence logic at all in the examples, so I'm not sure where you're getting the idea that the framework encourages it from. If you're that tied to "how Rails works", why are we even discussing this? Objectify exists to change the way Rails works, because the way Rails works is broken.

> Ehm, no?

Ehm, yes.

    class MyFunkyResolver
      def new
        5
      end
    end

    Foo = MyFunkyResolver.new
    p Foo.new
    # 5

Re: Objectify: A Better Way to Build Rails Applications

#72
post #70

Earlier quoted context omitted.

The services receive messages from the router, then send messages to whatever they need to call to get the job done. Being sent messages by the framework is what makes it a framework and not a library; I don't get your objection here. If it was a framework modelled in an object oriented way it would itself be built of classes exchanging messages, but it isn't. It encourages you to also structure your code in a non ob…

> Must you go as far as to refer to a hypothetical reality just to win an argument ;) ? That's how Rails works, that's what the examples show, I am not referring to what is possible in theory, but to what the framework does and the most reasonable possible way of using it. Eh? The sentence you quoted explains that putting domain logic in the persistence objects is precisely what objectify avoids. I do't see any examp…

Eh? The sentence you quoted explains that putting domain logic in the persistence objects is precisely what objectify avoids. I do't see any examples of domain logic as separate from persistence logic at all in the examples, so I'm not sure where you're getting the idea that the framework encourages it from. If you're that tied to "how Rails works", why are we even discussing this? Objectify exists to change the way Rails works, because the way Rails works is broken.

I don't understand what you are trying to say. As far as I remember we are discussing here whether Objectify breaks encapsulation. In plain Rails you would have business logic together with persistence in a single class, and the data would be available to the external world only to the extent the business logic allows it. With Objectify all the data in the persistence objects has to be public for the services to be able to access it, and all the business logic is in many small services with only a single "call" method. Do you consider this to be good encapsulation? I am not tied to how Rails works, but I cannot judge all the possible ways of using Objectify, I can only judge what was presented/encouraged in examples and in the blog post and assume that you will use standard Rails practices in the rest of places, since it's in the end a Rails plugin and not a separate framework.

You are right regarding polymorphism.

Post reply on HN