2013/3/30 Christopher Deckers <chr...@gmail.com>:
Yes, I agree with that, too. While it is a good use-case to create
> When someone uses a Configuration, I believe that the purpose is to not
> repeat parameters, to have the same parameters for all Executors. In some
> cases, which I think are limited, someone could have more than one
> Configuration, but would still use those as shared parameters for sets of
> Executors. The purpose of this e-mail is to suggest strengthening this
> notion of Configuration as a global shareable set of parameters.
ad-hoc configurations through what you called "ad-hoc parameters", in
the long run, users will reuse mostly a single, global Configuration.
7 kwi 2013 10:48, "Lukas Eder" <lukas...@gmail.com> wrote:
>
>
> I'm not convinced yet. But not because I "strongly believe" that the
> current solution is perfect, I might just (still!) not understand your
> point of view. Let's put it this way:
>
> // jOOQ 2.x:
> new Factory(...).select();
>
> // jOOQ 3.0-RC1 and RC2:
> new Executor(...).select();
>
> // jOOQ 3.0-RC3
> DSL.using(...).select();
Hi,
to a answer your question, what I specifically don't like is that now, starting from 3.0, JOOQ will propagate an anti pattern of getting the configuration object to be able to "enter" the DSL.
Look at the very first example of 2.6 branch from jooq.org landing page:
----------------------
create.selectFrom(BOOK)
.where(PUBLISHED_IN.equal(2011))
.orderBy(TITLE)
----------------------
That is it. Entire example. What does it tell you? Get the "create" (I call this instance a jooq in my app) and then write the code as in example. Where to get the "create" from? It doesn't matter. This is not the business of JOOQ. Create it by yourself, use Spring, Guice, CDI, inject manually, use the lookup pattern, there are many options, none of them are the JOOQ's interest.
Now, I can see all the examples are going to be rewritten like:
----------------------
using(configuration)
.selectFrom(BOOK)
.where(PUBLISHED_IN.equal(2011))
.orderBy(TITLE)
----------------------
,which means: get the configuration from somewhere, which is breaking, at least, the principle of least knowledge. IMHO this is one of the most important and also most ignored principle in programing in general.
Also, I do believe this is polluting the DSL, because there is no equivalent of the first statement in SQL. And last, but not least, when writing:
import static org.jooq.DSL.*
we do import all the goodness of JOOQ plus the "using" evil stuff. One cannot import everything BUT the "using" stuff. This is of course the minor problem. We can just ignore that method, but the "damage" caused by encouraging developers to use it, as the "official" documentation says, as the DSL API says, is the thing I am trying to avoid.
Regards,
Witold Szczerba
Hello again,
I can see your point of view. I don't agree, but I do understand driving force behind your decision.
Thanks,
Witold Szczerba
> Where
> to get the "create" from? It doesn't matter.
You mean that org.jooq.DSL shouldn't do two things at once.
I wish to exclude the DSLContext / Executor from these thoughts. It is
complicating things unnecessarily. It has no state / lifecycle of its
own. Introducing it in the way I originally did was confusing. The
thought of having "new Executor" along with the name "Executor" seemed
to indicate that it has a life of its own. It doesn't. It had a 1-to-1
relationship with Configuration, adding DSL capabilities.
As I will
explain further down, everything you want to do can be done without
allowing "Executor" to have its own lifecycle.
I agree. Although, I think that the ConnectionProvider *should* be
loose to cover all use cases.
Yes, it is hard to get it right. Do note that this was much harder to
get right before jOOQ 3.0, before the introduction of a
ConnectionProvider. In order to get it right, a properly pooled (and
thus shareable) DataSource was needed.
B) jOOQ can provide default implementations for the
ExecuteListenerFactory, e.g. a DefaultExecuteListenerFactory, which
would contain a constant list of ExecuteListeners.
I don't think that we need the additional complexity by adding
the possibility of creating "per-Executor" setups.
If you feel that there is still a missing piece as I might not have
gotten the full picture yet (e.g. contracts too loose, additional
lifecycle for DSLContext), feel free to continue this discussion.
concrete use-case of a 3rd party tool that really relies on jOOQ
providing it with a "dedicated" connection through the
ConnectionProvider API.
> I bet you will try to argue against this convenience.
> jOOQ always overloads methods for tedious repetitive tasks.
> Anyway, this leads to a real dumb ConnectionProvider implementation
> that just delegates everything to Weblogic.
> - There are convenience methods to register "global" ExecuteListeners,
> which are wrapped in a DefaultExecuteListenerProvider
Last-minute feedback before RC3 is welcome ;-)
If not, I think the current ExecuteListenerProvider will more or less
match your expectations. It is indeed a good solution to allow for
injecting stateless / stateful ExecuteListeners into jOOQ without jOOQ
noticing.
> I don't agree with all of this, as you know :-)
So, do you think there is room for more clarification in the Javadoc / manual?