Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #8319

Re: borrowing Constants

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: borrowing Constants
Date Mon, 26 Sep 2011 01:22:02 +0200
Organization A noiseless patient Spider
Lines 33
Message-ID <j5od5n$7is$1@dont-email.me> (permalink)
References <cf9q77h3gnhunlqpckpsobog4oqvlhiga7@4ax.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
Injection-Date Sun, 25 Sep 2011 23:23:35 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="OPYk7znjR0ATEbqDEK73tg"; logging-data="7772"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18nk2vGw9PqoHtaPqFm0hQb"
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.22) Gecko/20110902 Thunderbird/3.1.14
In-Reply-To <cf9q77h3gnhunlqpckpsobog4oqvlhiga7@4ax.com>
Cancel-Lock sha1:jdlh+69+6DEJxsvZtKDHApJUGOw=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8319

Show key headers only | View raw


On 24/09/2011 02:40, Roedy Green allegedly wrote:
> If you have some code like this:
> 
> class A
> {
>  static String VERSION = "1.0b";
> }
> 
> and 
> class B
> {
> static String VERSION = A.VERSION;
> }
> 
> When you use Class B, does all of class A get instantiated?
> Does all of class A get put in B's jar?
> 
> 
> If so, it suggests you are better off to have a tiny common class and
> have A and B reference it.

If someone showed me that code (class B) and told me they didn't intend
to include class A in the runtime, my first question would be: "then why
do you reference it?"

If you want to decouple, decouple properly. Use a common class, a
resource file, a service provider interface, whatever. But don't rely on
intrinsics -- even if in this case those are fairly basic and
well-understood intrinsics. That's just begging for trouble.

-- 
DF.
Determinism trumps correctness.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

borrowing Constants Roedy Green <see_website@mindprod.com.invalid> - 2011-09-23 17:40 -0700
  Re: borrowing Constants Arne Vajhøj <arne@vajhoej.dk> - 2011-09-23 20:44 -0400
    Re: borrowing Constants Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-23 22:10 -0300
      Re: borrowing Constants Roedy Green <see_website@mindprod.com.invalid> - 2011-09-23 18:39 -0700
        Re: borrowing Constants Arne Vajhøj <arne@vajhoej.dk> - 2011-09-23 22:17 -0400
        Re: borrowing Constants Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-09-25 11:25 -0700
          Re: borrowing Constants Lew <lewbloch@gmail.com> - 2011-09-25 11:36 -0700
      Re: borrowing Constants Arne Vajhøj <arne@vajhoej.dk> - 2011-09-23 22:30 -0400
  Re: borrowing Constants Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-09-23 21:15 -0400
    Re: borrowing Constants Roedy Green <see_website@mindprod.com.invalid> - 2011-09-23 18:43 -0700
  Re: borrowing Constants markspace <-@.> - 2011-09-23 18:44 -0700
    Re: borrowing Constants Lew <lewbloch@gmail.com> - 2011-09-23 19:19 -0700
    Re: borrowing Constants Arne Vajhøj <arne@vajhoej.dk> - 2011-09-23 22:32 -0400
  Re: borrowing Constants Lew <lewbloch@gmail.com> - 2011-09-23 19:11 -0700
    Re: borrowing Constants Lew <lewbloch@gmail.com> - 2011-09-23 19:26 -0700
  Re: borrowing Constants v_borchert@despammed.com (Volker Borchert) - 2011-09-24 09:44 +0000
  Re: borrowing Constants Roedy Green <see_website@mindprod.com.invalid> - 2011-09-24 15:38 -0700
  Re: borrowing Constants Roedy Green <see_website@mindprod.com.invalid> - 2011-09-24 17:09 -0700
    Re: borrowing Constants Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-09-24 20:14 -0400
    Re: borrowing Constants markspace <-@.> - 2011-09-24 18:18 -0700
      Re: borrowing Constants Arne Vajhøj <arne@vajhoej.dk> - 2011-09-25 22:36 -0400
    Re: borrowing Constants Arne Vajhøj <arne@vajhoej.dk> - 2011-09-25 22:35 -0400
  Re: borrowing Constants Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-09-26 01:22 +0200

csiph-web