On 5 April 2013 15:59, Lukas Eder <[email protected]> wrote: > 2013/4/5 Witold Szczerba <[email protected]>: > > > > > As to the: > > with(configuration) > > .select.... > > > > Is this a real use case? I mean, in any given class responsible for > talking > > to database, why should I care about configuration object, if all I need > is > > the other object (factory instance), exchanged for configuration > instance? > > > > I believe (am I alone?), each class should ask only for things it does > care > > for. In the case above, we do not care about configuration, we care about > > that contextual factory instance. All we use configuration for, is to > > quickly exchange it for something else. That means we should never ask > for a > > configuration, but the contextual factory instance (or a provider of > that) > > instead. > > The point is that a contextual factory needs the context (= > Configuration) somehow. > > You are right, the contextual factory needs configuration. But users of contextual factory should not care. Of course, everyone can use the JOOQ as they like, but JOOQ should not go in a way when one is following the good practices, which is not mixing the object creation with use. Also, if one is asking for something which they are not directly using (configuration in this case), then they are violating a Law of Demeter.
All I am trying to say is that maybe we should not focus on how to make a fluent language to describe the process of building the query _together_ with the building of the contextual factory. I would split that as much as possible. For example, if the static method "with(Configuration cfg)" is going to be mixed with other static methods like max/min/nvl or other static DSL methods, then I would suggest splitting that. Regards, Witold Szczerba -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
