7 kwi 2013 10:48, "Lukas Eder" <[email protected]> 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

-- 
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.


Reply via email to