From: Vadim Nasardinov <vadimn@redhat.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: jdbc xa patches
Date: Wed, 27 Jul 2005 19:00:39 -0400
Message-ID: <200507271900.39224.vadimn@redhat.com> (raw)
In-Reply-To: <42E80CBB.1030006@opencloud.com>
References: <20050726193540.M74424@yvyyl>
<200507271104.19933.vadimn@redhat.com>
<42E80CBB.1030006@opencloud.com>
On Wednesday 27 July 2005 18:37, Oliver Jowett wrote:
> > http://www.google.com/search?q=Java+typesafe+enum
>
> Shrug, the main reason for an enum-like pattern is to get type
> safety, but in this case there's only one field that ever uses the
> enum (and it's never passed around as a parameter), so there's not
> much scope for getting it wrong.
Sure, you can get it right without the added benefit of type safety,
given that the offending piece of code is completely isolated within a
single file. (Both TransactionState and ResourceAssociationState are
private inner classes of PGXAResource.) It's a matter of taste and I
have no vested interest in the outcome of this particular
mini-discussion.
That said, from my cursory reading of
org/postgresql/xa/PGXAResource.java, it seems to me that both
TransactionState and ResourceAssociationState instances are used as
values in a Map. If we replace these two classes with "bare ints"
without changing the rest of the code drastically, we will have to box
those ints into Integers or suchlike before putting them into their
respective maps. It's not then a huge leap to turn those Integers
into proper typesafe enums, as is currently done. Seems very
reasonable to me, when viewed on its own merits. If, however, this
goes against some established pgjdbc prejudice against typesafe enums,
then sure, nuke it. Better be globally consistent, than locally
correct.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: vadimn@redhat.com
Subject: Re: jdbc xa patches
In-Reply-To: <200507271900.39224.vadimn@redhat.com>
References: <20050726193540.M74424@yvyyl> <200507271104.19933.vadimn@redhat.com> <42E80CBB.1030006@opencloud.com> <200507271900.39224.vadimn@redhat.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox