2013/4/5 Witold Szczerba <[email protected]>:
> No, all I am suggesting is to split things which are not supposed to be used
> together anyway. By that, I mean to have everything in one place excluding
> the methods for contextual factory object construction and configuration.
So, back to "new Executor(...)" or "Executor.newInstance(...)"? :-)
> As I said: the "recipe" for constructing the factory instance, in a typical
> application, is never going to be mixed with actual query building and
> execution.
"Not often" is not the same as "never". In fact, I start to like the
wording "with()" as it is similar to a CTE. Instead of extracting a
view into a formal DDL view definition, you can inline it to a single
SQL statement using "with". Once you start copy/pasting that view,
you'll still extract it. But the language / DSL allows you to inline
it when you feel it's suitable.
> This is because there is no need to copy/paste the same lines of
> code every time we have to build query. And even if this is all going to be
> a single line of "with(configuration)", then again: there is no need to
> spread the configuration object all over the place if no one actually need
> that object directly (Law of Demeter, a.k.a. The Principle of Least
> Knowledge).
Yes. In client code, it might be very useful to implement an AbstractDAO:
class AbstractDAO {
TheTypeFormerlyKnownAsExecutor with() {
return TheTypeFormerlyKnownAsFactory.with(initConfiguration());
}
}
But this doesn't mean that it's necessarily a bad idea for the jOOQ
DSL to provide this "with(configuration)" method in the static
factory...
--
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.