I ask because I have a couple of open issues on java.jdbc that I plan
to address and then bump to 0.1.0 - but I'd like to get a sense of
what the path to 1.0.0 might look like.
Specifically for java.jdbc, which is pretty stable and in production
use with a number of different databases, what would Clojure/core want
to see changed / added before a 1.0.0 release could be considered?
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
Hi Sean,
It's exciting that somebody has brought this question to a head so quickly. Guess we (as in *all* of us) ought to think about guidelines. Here is a quick go, in no particular order:
1. Stability and production use, as you say.
2. Some amount of time in #1 to get community feedback. (How long?)
3. Conformance with Clojure idioms.
4. Careful review to avoid unnecessary dependencies.
5. Simplicity / Power / Focus.
6. Avoid AOT requirement if at all possible.
7. Motivated maintainer.
I am not a big user of java.jdbc, but reading through the source code this morning I have the following questions/comments:
1. What is the "internal" namespace buying us? I have been down this road a few times and never ended up liking it.
2. Exposing with-connection but not get-connection is not simple. Or do we intend for ordinary users to use the internal namespace?
3. The half-earmuffs are not idiomatic. What do they mean?
4. Is there an API that lets you pass the connection directly, instead of relying on the bound one? If not, that doesn't seem simple either.
Stu
3. The half-earmuffs are not idiomatic. What do they mean?
1. Stability and production use:
Well it's a dev tool but it's already used in our code base in some test programs, it's in our repo here.
Most of the code comes from the original contrib.trace tool written by Stuart #2 (or is it #6 :)
2. Some amount of time in #1 to get community feedback
Waiting for comments, however I have no idea who's using it so how much time is reasonable ?
May I point out that I already have white hairs :)
3. Conformance with Clojure idioms;
Waiting for comments...
4. Careful review to avoid unnecessary dependencies
Done (except for clojure.pprint), if I missed some, I need a vision overhaul (which may be the case
since I cannot read small print warnings in some web pages :)))
5. Simplicity / Power / Focus;
Aside from the trace-form addition, the code has remain basically unchanged. Waiting for comments.
6. Avoid AOT requirement if at all possible.
None so far.
7. Motivated maintainer.
I intend to die at my keyboard, I'm 50 so that leaves us hopefully a good 20 years of productive work :)
Comments ?
--
Luc P.
================
The rabid Muppet
Indeed; this is a very common idiom, though I've never heard it called
"half-earmuff". Perhaps Stuart was referring to something else?
-Phil
I'm accumulating this conversation here:
http://dev.clojure.org/display/design/Moving+Projects+Into+Contrib
(is there any reason why Confluence is so slow and seems so unstable?)
> 1. Stability and production use, as you say.
> 2. Some amount of time in #1 to get community feedback. (How long?)
A function of both time and number of users, I'd say? ClojureSphere
can give us some idea of open source usage (but not production use
behind the corporate firewall):
http://clojuresphere.herokuapp.com/data.json
http://clojuresphere.herokuapp.com/java.jdbc
http://clojuresphere.herokuapp.com/tools.logging
> 3. Conformance with Clojure idioms.
Some of us will need more assistance here than others! Which is partly
why I raised this question sooner rather than later.
> 4. Careful review to avoid unnecessary dependencies.
Agreed.
> 5. Simplicity / Power / Focus.
Related to #3, agreed.
> 6. Avoid AOT requirement if at all possible.
Agreed.
> 7. Motivated maintainer.
Yup. I added the following to the where did contrib go page because
I've received several direct emails from people asking about this
particular aspect of the migration:
"If a clojure.contrib namespace is listed here but has no migration
details, that means no one has volunteered to maintain that namespace.
Part of the rationale for modular contrib is that there should be an
active maintainer going forward so that the library can be kept
compatible with new versions of Clojure."
> 1. What is the "internal" namespace buying us? I have been down this road a few times and never ended up liking it.
Good question. I inherited that structure from Stephen and just stuck
with it. I've seen quite a few projects have some sort of "public API"
namespace that then uses/requires some internal / implementation
namespace. I don't know whether it's a _good_ idiom but it seems
fairly common. At World Singles, we've settled into splitting
namespaces (only) when they have a lot of "internal" helper functions
which would otherwise "clutter" the main API namespace.
Actually just looking over our codebase I think it's more a case that
we've split namespaces in two distinct situations:
1. where we have "private" helper functions and want to reduce clutter
in the main API namespace
2. where we have "specialized" functions related to a primary API namespace
#1 is less common than I first thought. #2 itself tends to cover two things:
1. exposing a (non-Clojure) public API in the main namespace which
delegates to a (Clojure idiomatic) internal API in the specialized
namespace
2. exposing rarely used / business logic specific APIs (in the
specialized namespace) alongside a generic API in the main namespace
So that leads me to consider the java.jdbc "internal" namespace as not
buying much - it could be folded into the main namespace with
everything made private (and probably several simplifications could
then be applied)...
> 2. Exposing with-connection but not get-connection is not simple. Or do we intend for ordinary users to use the internal namespace?
Stephen could probably provide more insight there. My experience with
using java.jdbc at World Singles is the internal namespace is not
intended for ordinary users (so making its contents fully private and
merging it into the main namespace would be better).
> 3. The half-earmuffs are not idiomatic. What do they mean?
I've seen this quite a bit in other projects where a foo macro (or
function) delegates to a foo* function for the implementation. Like
Meikel, I'm a little surprised this isn't considered idiomatic.
> 4. Is there an API that lets you pass the connection directly, instead of relying on the bound one? If not, that doesn't seem simple either.
No, there's a lot of more radical work I'd like to do on the API to
provide more composability. At World Singles, we've wrapped java.jdbc
in a layer that provides a much more streamlined, almost
CRUD-data-mapper-like API that's a lot less SQL-y. I figured 0.1.0
would be a "complete" and "stable" evolution of the original c.c.sql
and then what comes between 0.1.0 and 1.0.0 can be an additional set
of more idiomatic APIs?
I wasn't sure how much backward compatibility mattered to the larger
dev team? If c.j.jdbc is meant to be a replacement for c.c.sql - how
"drop-in" compatible does it need to be over time? Isn't stability of
API one of Rich's key tenets?
First item on the Library Coding Standards:
"Get the name and signature right. Rich strongly respects Java's
commitment to not break existing code. In practice, that means we can
tweak the implementation forever, but once we publish a name and
signature we need to stick with it. (In practice I think this means
that we want many people to review the name and sig, even if they
don't review the implementation details.)"
Looking over the Library Coding Standards page, I noticed this:
"Use the bang! only for things not safe in an STM transaction."
One of the questions I've had about java.jdbc is "Should the update
operations have ! on them?" and when I look at several other
libraries, they do indeed have ! on functions that perform mutation.
In CongoMongo, for example, it has ! on functions that alter var root
as well as on functions that mutate Java objects (such as set! on the
MongoOptions object) as well as on functions that mutate the data
store (create-collection! destroy! update!). Some of those actually
would be safe if executed repeatedly, some would not.
What is really considered idiomatic here?
Should java.jdbc use ! on operations that mutate the outside world?
(and how does that sit with backward compatibility given that its
current API does not?)
> On Wed, Oct 12, 2011 at 5:19 AM, Stuart Halloway
> <stuart....@gmail.com> wrote:
>> 3. Conformance with Clojure idioms.
>
> Looking over the Library Coding Standards page, I noticed this:
>
> "Use the bang! only for things not safe in an STM transaction."
>
> One of the questions I've had about java.jdbc is "Should the update
> operations have ! on them?" and when I look at several other
> libraries, they do indeed have ! on functions that perform mutation.
> In CongoMongo, for example, it has ! on functions that alter var root
> as well as on functions that mutate Java objects (such as set! on the
> MongoOptions object) as well as on functions that mutate the data
> store (create-collection! destroy! update!). Some of those actually
> would be safe if executed repeatedly, some would not.
>
> What is really considered idiomatic here?
>
> Should java.jdbc use ! on operations that mutate the outside world?
> (and how does that sit with backward compatibility given that its
> current API does not?)
If you're using a database library, and you invoke a `put` or `update` operation, I think it's safely obvious that that's side-effecting.
I use ! to disambiguate — to highlight a particularly volatile function so that typing/seeing that bang inspires that extra moment or two of consideration.
There's swap! and alter-meta!, but there's also alter-var-root and spit, so I think the best one can say is that each case is a judgement call.
IMO, by all means, tack ! onto fns that aren't STM-safe (and use io! as well), but I wouldn't limit it to that.
Cheers,
- Chas
Have you considered (or maybe it's already done) wrapping db calls in
java.jdbc in io! for safety? I'm on the fence about how much to use
io! personally.
> --
> You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
> To post to this group, send email to cloju...@googlegroups.com.
> To unsubscribe from this group, send email to clojure-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/clojure-dev?hl=en.
>
>
I haven't considered it in depth but it does seem like a good idea for
the future. Maybe 0.2.0 or 0.3.0 :)
{:columns [:col1 :col2 :colC :colD]
:rows [[1 2 3 4]
[1 3 5 7]
[9 8 7 6]]}