Java Type System

  • Permalink
  • submit to reddit
  • Email
  • Follow


Putting the following down on paper (OK, pixels) helped me to understand how 
generics extend the Java type system.  Since I haven't seen any texts that 
look at things in quite this fashion, I thought I'd post it on the chance 
that it would help others as well.  Note that this only discusses object 
types, not primitives, since it's describes the ability to refer to an 
object of type A by a reference of type B, with B a supertype of A.  It also 
doesn't discuss conversions of the sort found in

    float f  = 2;

or

    Integer i = 12;

In both cases, the entity on the right-hand side is converted to an entity 
of a different type, quite different from what happens in

    Object o = "hello";

in which the left hand-side is made to refer to precisely the entity that is 
the right-hand side.  OK, here we go:

The assignment statement in Java looks like

    reference = expression;

This is legal whenever the type R of the reference is a supertype of the 
type E of the expression, where "supertype" is defined so that, for all 
types T, T is a supertype of itself.  (As mentioned above, we're going to 
ignore primitives and built-in conversion.)  Before generics, the rules for 
supertype were relatively simple:

    1. T is a supertype of T
    2. If T is a class other then Object, T's superclass is a supertype of T
    3. Object is a supertype of all interfaces and array types
    4. All interfaces that T implements or extends are supertypes of T
    5. If T is a supertype of U:
          T[] is a supertype of U[] (i.e. arrays are covariant)
    6. If T is a supertype of U and U is a supertype of V, then T is a 
supertype if V (i.e. "supertype" is transitive)

There rules are all pretty clear, even if you don't ordinarily think of them 
that way.

Generics complicate this somewhat, by adding these extra rules.

  If T is a supertype of U, and A is a supertype of B:
    1. A<T> is a supertype of B<T>
    2. A<T> is not a supertype of A<U> (i.e. generics are not covariant)
    3. T is a supertype of <? extends T>
    4. There is no type V for which <? extends T> is a supertype of V
    5. <? super T> is a supertype of T
    6. The only supertype of <? super T> is Object
    7. A<? extends T> is a supertype of A<? extends U>
    8. A<? super U> is a supertype of A<? super T>



0
Reply Mike 3/17/2010 7:07:59 PM

See related articles to this posting


On Wed, 17 Mar 2010 12:07:59 -0700, "Mike Schilling"
<mscottschilling@hotmail.com> wrote, quoted or indirectly quoted
someone who said :

>t also 
>doesn't discuss conversions of the sort found in
>
>    float f  = 2;
>
>or
>
>    Integer i = 12;
 
For the first look under "widening", for the second look under
"autoboxing".
-- 
Roedy Green Canadian Mind Products
http://mindprod.com

Responsible Development is the style of development I aspire to now. It can be summarized by answering the question, �How would I develop if it were my money?� I�m amazed how many theoretical arguments evaporate when faced with this question. 
~ Kent Beck (born: 1961 age: 49) , evangelist for extreme programming.
0
Reply Roedy 3/17/2010 10:36:31 PM

Roedy Green wrote:
> On Wed, 17 Mar 2010 12:07:59 -0700, "Mike Schilling"
> <mscottschilling@hotmail.com> wrote, quoted or indirectly quoted
> someone who said :
>
>> t also
>> doesn't discuss conversions of the sort found in
>>
>>    float f  = 2;
>>
>> or
>>
>>    Integer i = 12;
>
> For the first look under "widening", for the second look under
> "autoboxing".



Yes, Roedy, I know what thty are, but they're not relevant to what I was 
exploring. 


0
Reply Mike 3/17/2010 10:55:53 PM

On 17-03-2010 18:55, Mike Schilling wrote:
> Roedy Green wrote:
>> On Wed, 17 Mar 2010 12:07:59 -0700, "Mike Schilling"
>> <mscottschilling@hotmail.com>  wrote, quoted or indirectly quoted
>> someone who said :
>>> t also
>>> doesn't discuss conversions of the sort found in
>>>
>>>     float f  = 2;
>>>
>>> or
>>>
>>>     Integer i = 12;
>>
>> For the first look under "widening", for the second look under
>> "autoboxing".
>
> Yes, Roedy, I know what thty are, but they're not relevant to what I was
> exploring.

Most likely Roedy (as usual) did not read the entire message that he
was replying to.

Arne
0
Reply ISO 3/18/2010 12:09:06 AM

Arne Vajh�j <arne@vajhoej.dk> writes:
>Most likely Roedy (as usual) did not read the entire message
>that he was replying to.

  Mike posted some very helpful observations at the end of
  his post. But he started his post with distracting and
  boring preliminaries. Possibly Roady was not the only one
  who was not reading it to the end. Anyway, I thank Mike
  for sharing his insights!

0
Reply ram 3/18/2010 1:43:11 AM

Stefan Ram wrote:
> Arne Vajh�j <arne@vajhoej.dk> writes:
>> Most likely Roedy (as usual) did not read the entire message
>> that he was replying to.
>
>  Mike posted some very helpful observations at the end of
>  his post. But he started his post with distracting and
>  boring preliminaries. Possibly Roady was not the only one
>  who was not reading it to the end. Anyway, I thank Mike
>  for sharing his insights!

You're welcome.  (I think.) 


0
Reply Mike 3/18/2010 1:44:49 AM

Mike Schilling wrote:
> Putting the following down on paper (OK, pixels) helped me to understand how 
> generics extend the Java type system.  ...

Nicely done.

Abstracting one layer, Mike has pinned an aspect of Java that particularly 
excites me, its type expression system.

"Type-oriented programming" is next-gen object-oriented programming.  Taken 
together, Java interfaces and generics form a declarative syntax of assertions 
about type relationships.

Properly used, this syntax lets the programmer direct the compiler to enforce 
assertions that lock a program into correct behavior.  Typifying the benefit, 
we eliminate runtime type checks (or crashes from lack of enforcement), e.g., 
that a collection contain only 'Person' instances.

In cases where we need a runtime type check to cooperate with compile-time 
enforcement, we coerce a 'Class<T>' variable into the mix, usually a private 
final member.  A little judicious reflection off that instance (I use the name 
'this.clazz') with conventions like that 'T' not need a complex constructor, 
and you can do anything you need for type 'T'.  The compiler infers type 
correctness from the 'Class' instance.

   public <T> T find( Class<T> clazz, Object key );

or

   public <T, K> T find( Class<T> clazz, K key );

which lets you call

   Person person = find( Person.class, name );

If the generic were applied to the type, you store the class in the instance 
rather than the argument list, e.g.,

   public class PersonManager extends Manager<Person, String>
   {
     public PersonManager()
     {
       super( Person.class ); // stores in Manager#clazz
     }
     @Override
     public Person find( String name )
     {
       return getEm().find( getClazz(), name );
     } // actually, this duplicates the superclass code
       // sorta - superclass is generic
   }

Superclass 'Manager<T, K>' left as an exercise.  I think of 'getEm()' and 
'getClazz()' as protected final methods.

-- 
Lew
0
Reply Lew 3/18/2010 4:29:29 AM

On Wed, 17 Mar 2010 15:55:53 -0700, "Mike Schilling"
<mscottschilling@hotmail.com> wrote, quoted or indirectly quoted
someone who said :

>Yes, Roedy, I know what thty are, but they're not relevant to what I was 
>exploring. 
>

You were complaining that generic docs do not cover autoboxing and
widening. I was pointing out why there was no reason to expect them
to.
-- 
Roedy Green Canadian Mind Products
http://mindprod.com

Responsible Development is the style of development I aspire to now. It can be summarized by answering the question, �How would I develop if it were my money?� I�m amazed how many theoretical arguments evaporate when faced with this question. 
~ Kent Beck (born: 1961 age: 49) , evangelist for extreme programming.
0
Reply Roedy 3/18/2010 7:55:46 AM

On 18 Mar 2010 01:43:11 GMT, ram@zedat.fu-berlin.de (Stefan Ram)
wrote, quoted or indirectly quoted someone who said :

>. Possibly Roady was not the only one
>  who was not reading it to the end

My comment still stands whether you read the whole post or not. 
-- 
Roedy Green Canadian Mind Products
http://mindprod.com

Responsible Development is the style of development I aspire to now. It can be summarized by answering the question, �How would I develop if it were my money?� I�m amazed how many theoretical arguments evaporate when faced with this question. 
~ Kent Beck (born: 1961 age: 49) , evangelist for extreme programming.
0
Reply Roedy 3/18/2010 7:57:36 AM

According to Lew  <noone@lewscanon.com>:
> "Type-oriented programming" is next-gen object-oriented programming.
> Taken together, Java interfaces and generics form a declarative syntax
> of assertions about type relationships.
> 
> Properly used, this syntax lets the programmer direct the compiler to
> enforce assertions that lock a program into correct behavior.
> Typifying the benefit, we eliminate runtime type checks (or crashes
> from lack of enforcement), e.g., that a collection contain only
> 'Person' instances.

It may be noted that this is the road that C++ took, and it proved very
slippery. C++ tries to express assertions as types, and it mostly leads
to oversized and slow compilers, rather than the powrful compile-time
bug detection that was consistently promised but less consistently
achieved.

To some extent, Java was designed as an effort to do programming "not
like C++". In my view, "type-oriented programming" is not next-gen but
previous-gen, and generics are a step "back" (at least in time).
Generics were added because something had to be done about container
types (List, Map...) but in the grand view of programming languages
evolution, they represent a kind of failure.

I am not claiming that generics are ill-designed by themselves; hard and
smart work went into them, and they do what they were meant to do. I
claim that they are a revival of an old theme, and flow opposite to the
rest of the design of Java.


	--Thomas Pornin
0
Reply Thomas 3/18/2010 11:36:43 AM

Thomas Pornin wrote:
> It may be noted that this is the road that C++ took, and it proved very
> slippery. C++ tries to express assertions as types, and it mostly leads
> to oversized and slow compilers, rather than the powrful compile-time
> bug detection that was consistently promised but less consistently
> achieved.

Java is rather the opposite - with generics, it expresses types as 
(compile-time) assertions.

I'm using "assertion" in the general sense here; this has nothing to do with 
the 'assert' keyword.

I do not see that generics has noticeably affected Java compiler size or 
speed, and it certainly has added powerful compile-time bug detection to Java.

-- 
Lew
0
Reply Lew 3/18/2010 12:43:22 PM

According to Lew  <noone@lewscanon.com>:
> and it certainly has added powerful compile-time bug detection to Java.

I am not sure of that "bug" thing. Generics make life easier because
they avoids the need for a bunch of casts; they also are quite good at
documenting container types. But in practice it does not seem to detect
more bugs: the bugs it may detect are bugs that I was not doing in the
first place. It is _convenient_ that when I call a method which returns
a Collection<String> I know that the collection contains String
instances. But in pre-Java-5 code, I would have got a "Collection" and I
would have looked at the documentation to know what that Collection
contains. Generics may detect a bug only if, in that situation, I would
have boldly and wrongly assumed that the Collection contained something
else. This is not something which was actually happening at that time.

In brief, generics do not solve a bug-related problem that I had. They
do improve a documentation-related problem that I had -- namely with
code written by other people with poor documentation. They also make
code more readable due to the visual clutter implied by the extra casts.
Generics thus allow me to write code faster, because I waste less time
wading through external documentation and I can fit more useful code in
my eye-brain system. But bugs ? Nope.

Basically, after using Java and generics quite extensively, I simply do
not buy the marketing slogan "generics add powerful compile-time bug
detection". I also note that the same slogan has been used for C++ (with
regards to C) and I do not buy it either. In both situation it is a
"nice intent", the kind Hell is paved of.


	--Thomas Pornin
0
Reply Thomas 3/18/2010 1:53:52 PM

Roedy Green wrote:
> On Wed, 17 Mar 2010 15:55:53 -0700, "Mike Schilling"
> <mscottschilling@hotmail.com> wrote, quoted or indirectly quoted
> someone who said :
>
>> Yes, Roedy, I know what thty are, but they're not relevant to what I
>> was exploring.
>>
>
> You were complaining that generic docs do not cover autoboxing and
> widening.

Where the hell did that come from? 


0
Reply Mike 3/18/2010 3:32:51 PM

Thomas Pornin wrote:
> Basically, after using Java and generics quite extensively, I simply
> do not buy the marketing slogan "generics add powerful compile-time
> bug detection". I also note that the same slogan has been used for
> C++ (with regards to C) and I do not buy it either. In both situation
> it is a "nice intent", the kind Hell is paved of.

Function prototypes, invented in C++ and then retrofutted into C, prevent a 
large number of bugs caused by not getting the calling sequence of a 
function quite right. 


0
Reply Mike 3/18/2010 3:35:29 PM

On 3/18/2010 11:32 AM, Mike Schilling wrote:
> Roedy Green wrote:
>> On Wed, 17 Mar 2010 15:55:53 -0700, "Mike Schilling"
>> <mscottschilling@hotmail.com>  wrote, quoted or indirectly quoted
>> someone who said :
>>
>>> Yes, Roedy, I know what thty are, but they're not relevant to what I
>>> was exploring.
>>>
>>
>> You were complaining that generic docs do not cover autoboxing and
>> widening.
>
> Where the hell did that come from?

     Don't feel bad that you don't see your complaints, Mike.
Neither can I.  Perhaps we have similar difficulties with
reading comprehension.

-- 
Eric Sosman
esosman@ieee-dot-org.invalid
0
Reply Eric 3/18/2010 3:40:21 PM

On Thu, 18 Mar 2010 08:35:29 -0700, Mike Schilling wrote:

> Thomas Pornin wrote:
>> Basically, after using Java and generics quite extensively, I simply do
>> not buy the marketing slogan "generics add powerful compile-time bug
>> detection". I also note that the same slogan has been used for C++
>> (with regards to C) and I do not buy it either. In both situation it is
>> a "nice intent", the kind Hell is paved of.
>
                                           ^^  s/of/with/

....please. Like the UK nastiness,  "the england team", I find the 
Americanism of using 'of' instead of 'with' very irritating. Arrrr, I 
feel better with that off my chest.

> Function prototypes, invented in C++ and then retrofutted into C,
> prevent a large number of bugs caused by not getting the calling
> sequence of a function quite right.
>
So that's where it came from. I'd always assumed it was an ANSI C import 
from one of the Algols or Pascal. I still have a system with a K&R C 
compiler and really miss ANSI function prototypes every time I write 
something for it.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |
0
Reply Martin 3/18/2010 6:01:47 PM

On Wed, 17 Mar 2010, Mike Schilling wrote:

> Stefan Ram wrote:
>> Arne Vajh?j <arne@vajhoej.dk> writes:
>>> Most likely Roedy (as usual) did not read the entire message
>>> that he was replying to.
>>
>>  Mike posted some very helpful observations at the end of
>>  his post. But he started his post with distracting and
>>  boring preliminaries. Possibly Roady was not the only one
>>  who was not reading it to the end. Anyway, I thank Mike
>>  for sharing his insights!
>
> You're welcome.  (I think.)

Yeah, too long for me, so didn't read it, but i'm looking forward to the 
movie. And only partly because i heard they cast Megan Fox as a bounded 
wildcard.

tom

-- 
I need a proper outlet for my tendency towards analytical thought. --
Geneva Melzack
0
Reply Tom 3/18/2010 9:22:58 PM

On Thu, 18 Mar 2010, Thomas Pornin wrote:

> I am not claiming that generics are ill-designed by themselves; hard and
> smart work went into them, and they do what they were meant to do. I
> claim that they are a revival of an old theme, and flow opposite to the
> rest of the design of Java.

Interesting. Do you see Java falling into the gravity well of 
Smalltalk/Self, or something different?

tom

-- 
I need a proper outlet for my tendency towards analytical thought. --
Geneva Melzack
0
Reply Tom 3/18/2010 9:24:35 PM

On Thu, 18 Mar 2010, Martin Gregorie wrote:

> On Thu, 18 Mar 2010 08:35:29 -0700, Mike Schilling wrote:
>
>> Thomas Pornin wrote:
>>> Basically, after using Java and generics quite extensively, I simply do
>>> not buy the marketing slogan "generics add powerful compile-time bug
>>> detection". I also note that the same slogan has been used for C++
>>> (with regards to C) and I do not buy it either. In both situation it is
>>> a "nice intent", the kind Hell is paved of.
>>
>                                           ^^  s/of/with/
>
> ...please. Like the UK nastiness,  "the england team", I find the
> Americanism of using 'of' instead of 'with' very irritating. Arrrr, I
> feel better with that off my chest.

I believe it is the road to hell that is so paved, rather than hell 
itself. Hell has parquet floors throughout.

tom

-- 
I need a proper outlet for my tendency towards analytical thought. --
Geneva Melzack
0
Reply Tom 3/18/2010 9:26:58 PM

Thomas Pornin wrote:
>>> Basically, after using Java and generics quite extensively, I simply
>>> do not buy the marketing slogan "generics add powerful compile-time
>>> bug detection". I also note that the same slogan has been used for
>>> C++ (with regards to C) and I do not buy it either. In both situation
>>> it is a "nice intent", the kind Hell is paved of.
>

Martin Gregorie wrote:
>> ...please. Like the UK nastiness, =A0"the england team", I find the
>> Americanism of using 'of' instead of 'with' very irritating. Arrrr, I
>> feel better with that off my chest.
>

That's an Americanism?  I'm American, and I'm not familiar with it.

Tom Anderson wrote:
> I believe it is the road to hell that is so paved, rather than hell
> itself. Hell has parquet floors throughout.
>

If the road *to* Hell is paved with good intentions (not "intent"),
and one is traversing that road in the opposite direction, i.e., *away
from* Hell, is it not still paved with good intentions?

So the road out of Hell is paved with good intentions, yes?

The issue isn't the intentions, it's the direction in which one is
traveling atop them.

--
Lew

0
Reply Lew 3/18/2010 10:05:47 PM

According to Lew  <lew@lewscanon.com>:
> That's an Americanism?  I'm American, and I'm not familiar with it.

I am not American, neither British, and English is not my mother
language, so my texts are subject to occasional (and creative) slipage.


	--Thomas Pornin
0
Reply Thomas 3/18/2010 11:50:25 PM

On Thu, 18 Mar 2010 15:05:47 -0700, Lew wrote:

> Martin Gregorie wrote:
>>> ...please. Like the UK nastiness,  "the england team", I find the
>>> Americanism of using 'of' instead of 'with' very irritating. Arrrr, I
>>> feel better with that off my chest.
>>
>>
> That's an Americanism?  I'm American, and I'm not familiar with it.
>
I've always assumed it must be, since I've never seen it used by anybody 
other than an American. Its possible its written rather than spoken 
though I must admit that would surprise me.
 

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |
0
Reply Martin 3/18/2010 11:55:14 PM

On 18-03-2010 03:57, Roedy Green wrote:
> On 18 Mar 2010 01:43:11 GMT, ram@zedat.fu-berlin.de (Stefan Ram)
> wrote, quoted or indirectly quoted someone who said :
>> . Possibly Roady was not the only one
>>   who was not reading it to the end
>
> My comment still stands whether you read the whole post or not.

Still stand as being irrelevant for the thread.

Arne
0
Reply ISO 3/19/2010 12:48:19 AM

On 18-03-2010 11:32, Mike Schilling wrote:
> Roedy Green wrote:
>> On Wed, 17 Mar 2010 15:55:53 -0700, "Mike Schilling"
>> <mscottschilling@hotmail.com>  wrote, quoted or indirectly quoted
>> someone who said :
>>> Yes, Roedy, I know what thty are, but they're not relevant to what I
>>> was exploring.
>>
>> You were complaining that generic docs do not cover autoboxing and
>> widening.
>
> Where the hell did that come from?

Out of thin air.

But hey it managed to squeeze 3 Java concepts into one
sentence.

That may actually impress some people. Especially
if they do not know Java.

Arne
0
Reply ISO 3/19/2010 12:50:44 AM

On Thu, 18 Mar 2010 18:01:47 +0000 (UTC), Martin Gregorie
<martin@address-in-sig.invalid> wrote:

>On Thu, 18 Mar 2010 08:35:29 -0700, Mike Schilling wrote:
>
>> Thomas Pornin wrote:
>>> Basically, after using Java and generics quite extensively, I simply do
>>> not buy the marketing slogan "generics add powerful compile-time bug
>>> detection". I also note that the same slogan has been used for C++
>>> (with regards to C) and I do not buy it either. In both situation it is
>>> a "nice intent", the kind Hell is paved of.
>>
>                                           ^^  s/of/with/
>
>...please. Like the UK nastiness,  "the england team", I find the 
>Americanism of using 'of' instead of 'with' very irritating. 

Such misconstructions are not really "Americanisms" in the sense that
they are unique to the American dialect of English.  They are, rather,
something I like to call "stupidisms" (trademark pending) and, IMO,
are more indicative of poor language education rather than of locale
(though certainly locale and education may have correspondence).

YMMV.

My pet peeve is using "since" for "because".  I don't care what the
new dictionaries say ... those two words are not synonyms but merely
have partially coincident meaning.

YM I don't care to hear (unless you agree 8).

>Arrrr, I feel better with that off my chest.

Ditto.
0
Reply George 3/19/2010 2:04:38 AM

On 18-03-2010 22:04, George Neuner wrote:
> On Thu, 18 Mar 2010 18:01:47 +0000 (UTC), Martin Gregorie
> <martin@address-in-sig.invalid>  wrote:
>
>> On Thu, 18 Mar 2010 08:35:29 -0700, Mike Schilling wrote:
>>
>>> Thomas Pornin wrote:
>>>> Basically, after using Java and generics quite extensively, I simply do
>>>> not buy the marketing slogan "generics add powerful compile-time bug
>>>> detection". I also note that the same slogan has been used for C++
>>>> (with regards to C) and I do not buy it either. In both situation it is
>>>> a "nice intent", the kind Hell is paved of.
>>>
>>                                            ^^  s/of/with/
>>
>> ...please. Like the UK nastiness,  "the england team", I find the
>> Americanism of using 'of' instead of 'with' very irritating.
>
> Such misconstructions are not really "Americanisms" in the sense that
> they are unique to the American dialect of English.  They are, rather,
> something I like to call "stupidisms" (trademark pending) and, IMO,
> are more indicative of poor language education rather than of locale
> (though certainly locale and education may have correspondence).
>
> YMMV.

Can you pronounce "R�dgr�d med fl�de" correctly?

Arne
0
Reply ISO 3/19/2010 2:23:05 AM

George Neuner <gneuner2@comcast.net> writes:
>something I like to call "stupidisms" (trademark pending) and, IMO,

  Am I the only one to whom this subject sounds stupid:

      �First class developer: who ?�

  ? (I am not a native speaker of English, so I am not sure.)
  Let me quote:

      �Besides a mathematical inclination, an exceptionally
      good mastery of one's native tongue is the most vital
      asset of a competent programmer.� 

    attributed to Djikstra, but I can not confirm the source

      �If your writing is semi-literate, ungrammatical, and
      riddled with misspellings, many hackers (including myself)
      will tend to ignore you. While sloppy writing does not
      invariably mean sloppy thinking, we've generally found the
      correlation to be strong -- and we have no use for sloppy
      thinkers. If you can't yet write competently, learn to.�

    Eric Raymond
    
http://www.catb.org/~esr/faqs/hacker-howto.html#skills4

      �I've found that some of the best developers of all are
      English majors. They'll often graduate with no programming
      experience at all, and certainly without a clue about the
      difference between DRAM and EPROM.

      But they can write. That's the art of conveying
      information concisely and clearly. Software development
      and writing are both the art of knowing what you're going
      to do, and then lucidly expressing your ideas.�

http://praisecurseandrecurse.blogspot.com/2007/03/english-majors-as-programmers.html

0
Reply ram 3/19/2010 2:25:13 AM

On Fri, 19 Mar 2010, Stefan Ram wrote:

> George Neuner <gneuner2@comcast.net> writes:
>> something I like to call "stupidisms" (trademark pending) and, IMO,
>
>  Am I the only one to whom this subject sounds stupid:
>
>      ?First class developer: who ??
>
>  ? (I am not a native speaker of English, so I am not sure.)
>  Let me quote:
>
>      ?Besides a mathematical inclination, an exceptionally
>      good mastery of one's native tongue is the most vital
>      asset of a competent programmer.?
>
>    attributed to Djikstra, but I can not confirm the source
>
>      ?If your writing is semi-literate, ungrammatical, and
>      riddled with misspellings, many hackers (including myself)
>      will tend to ignore you. While sloppy writing does not
>      invariably mean sloppy thinking, we've generally found the
>      correlation to be strong -- and we have no use for sloppy
>      thinkers. If you can't yet write competently, learn to.?
>
>    Eric Raymond
>
> http://www.catb.org/~esr/faqs/hacker-howto.html#skills4
>
>      ?I've found that some of the best developers of all are
>      English majors. They'll often graduate with no programming
>      experience at all, and certainly without a clue about the
>      difference between DRAM and EPROM.
>
>      But they can write. That's the art of conveying
>      information concisely and clearly. Software development
>      and writing are both the art of knowing what you're going
>      to do, and then lucidly expressing your ideas.?
>
> http://praisecurseandrecurse.blogspot.com/2007/03/english-majors-as-programmers.html

Nice quotes, Stefan! A sentiment i rather agree with - i think the skills 
of writing good natural language and good code are more similar than 
people think. Perhaps we should be setting George Orwell's essays and 
Jacques Prevert's poetry as reading in programming courses?

tom

-- 
Feeling down? Talk to someone you hate and replace that low feeling with
pure rage!! -- Rhys Davies
0
Reply Tom 3/19/2010 11:00:37 AM

On Thu, 18 Mar 2010, Lew wrote:

> Thomas Pornin wrote:
>>>> Basically, after using Java and generics quite extensively, I simply
>>>> do not buy the marketing slogan "generics add powerful compile-time
>>>> bug detection". I also note that the same slogan has been used for
>>>> C++ (with regards to C) and I do not buy it either. In both situation
>>>> it is a "nice intent", the kind Hell is paved of.
>
> Tom Anderson wrote:
>> I believe it is the road to hell that is so paved, rather than hell
>> itself. Hell has parquet floors throughout.
>
> If the road *to* Hell is paved with good intentions (not "intent"), and 
> one is traversing that road in the opposite direction, i.e., *away from* 
> Hell, is it not still paved with good intentions?

Might not be. If it's a dual carriageway, or there's a one-way system, so 
the route back is not the same as the route there, then the paving could 
be different in either direction. And based on my experience of places on 
Earth similar to hell, i strongly suspect the one-way system.

Hmm. Are there any cases where roads have different pavings on lanes 
running in different directions? You could imagine a that a steeply 
sloping road in a wet or snowy country might - it could have a grippier 
surface on the lane running uphill.

tom

-- 
Where yesterday's future is here today
0
Reply Tom 3/19/2010 11:14:20 AM

On 19/03/2010 11:14, Tom Anderson wrote:
> On Thu, 18 Mar 2010, Lew wrote:
>
>> Thomas Pornin wrote:
>>>>> Basically, after using Java and generics quite extensively, I simply
>>>>> do not buy the marketing slogan "generics add powerful compile-time
>>>>> bug detection". I also note that the same slogan has been used for
>>>>> C++ (with regards to C) and I do not buy it either. In both situation
>>>>> it is a "nice intent", the kind Hell is paved of.
>>
>> Tom Anderson wrote:
>>> I believe it is the road to hell that is so paved, rather than hell
>>> itself. Hell has parquet floors throughout.
>>
>> If the road *to* Hell is paved with good intentions (not "intent"),
>> and one is traversing that road in the opposite direction, i.e., *away
>> from* Hell, is it not still paved with good intentions?
>
> Might not be. If it's a dual carriageway, or there's a one-way system,
> so the route back is not the same as the route there, then the paving
> could be different in either direction. And based on my experience of
> places on Earth similar to hell, i strongly suspect the one-way system.
>
> Hmm. Are there any cases where roads have different pavings on lanes
> running in different directions? You could imagine a that a steeply
> sloping road in a wet or snowy country might - it could have a grippier
> surface on the lane running uphill.
>

It must therefore be Hell's demons that apply the Shellgrip™ on the 
approaches (i.e. one side of the road) to the Hangar Lane gyratory†?

-- 
RGB
† http://en.wikipedia.org/wiki/Hanger_Lane_gyratory
0
Reply RedGrittyBrick 3/19/2010 11:28:17 AM

Tom Anderson wrote:
> Hmm. Are there any cases where roads have different pavings on lanes
> running in different directions? You could imagine a that a steeply
> sloping road in a wet or snowy country might - it could have a
> grippier surface on the lane running uphill.

When I was young, I used to walk five miles to school, uphill in both 
directions. 


0
Reply Mike 3/19/2010 2:37:38 PM
comp.lang.java.programmer 51948 articles. 38 followers. Post

30 Replies
148 Views

Similar Articles

[PageSpeed] 17


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Breaking the Java Type System
"We show that this idiom is provably incorrect and as such it leads to major violations of the Java type system that appear in the new release. The new release thus turns a type safe language into an unsafe one as static type checking does not work any more. The run-time type information in this release is incorrect so that dynamic type checking can fail in unexpected ways." Type Erasure: Breaking the Java Type System http://www.research.ibm.com/compsci/plansoft/plday/plday2005.html Parametric polymorphism for Java: is there any hope in sight? (slides) http://types.bu.ed...

Which Product to Use: Sun Java System Application Server Or Sun Java System Web Server?
Find out the unique capabilities of these products that meet your business needs with respect to developing and deploying Web applications. This article addresses frequently asked questions from customers and partners: http://developers.sun.com/prodtech/appserver/reference/techart/appserver-webserver.html ...

Which Product to Use: Sun Java System Application Server Or Sun Java System Web Server?
Find out the unique capabilities of these products that meet your business needs with respect to developing and deploying Web applications. This article addresses frequently asked questions from customers and partners: http://developers.sun.com/prodtech/appserver/reference/techart/appserver-webserver.html ...

Diff of Sun Java System AppServer vs. SunONE Server vs. Sun Java System Web Server ?
What are the differences of these three Java Servers from Sun ? Ulf Sun Java System AppServer is the new name for SunONE Server. SunONE is no longer used by Sun it seems. The Sun Java System Web Server is just that a Web Server (also does JSP/Servlets) but no EJB. Ulf Meinhardt wrote: > What are the differences of these three Java Servers from Sun ? > > Ulf > ...

SN#13403 Sun Java[TM] System Application Server Or Sun Java[TM] System Web Server?
SYSTEM NEWS FOR SUN USERS Vol 77 Issue 2 2004-07-12 Article 13403 from section "Sun Java System" Article Answers Which One to Use in Which Situation A technical article on the Sun Developers Web site compares the Sun Java[TM] System Application Server (formerly known as Sun[TM] ONE Application Server) to the Sun Java[TM] System Web Server (formerly known as Sun[TM] ONE Web Server), weighing out the differences between the two and recommending the one to choose in a variety of situations. Details at http://sun.systemnews.com/g?A...

SN#18176 Download Available: Sun Java[TM] System Access Manager Policy Agent 2.2 for Sun Java[TM] System Web Server 7.0
SYSTEM NEWS FOR SUN USERS Vol 112 Issue 1 2007-06-04 Article 18176 from section "Software" For Authenticating and Authorizing Users Version 2.2 of the Sun Java[TM] System Access Manager Policy Agent for the Sun Java[TM] System Web Server 7.0 is now available for download from the Sun site. The agent allows the Sun Java System Access Manager 7.0 to authenticate and authorize users accessing the Sun Java System Web Server 7.0 via a Web browser. Details at http://sun.systemnews.com/g?A=18176 Have a custom version of 'System News f...

Enterprise JavaBeans Query Language in Sun Java System Application Enterprise JavaBeans Query Language in Sun Java System Application Server 8 and J2EE 1.4 SDK
This article Introduces the history and benefits of EJB QL, the concepts of finders and selectors, and the key syntaxes, along with examples. EJB QL is easy to master, especially for those familiar with SQL. For details, see: http://developers.sun.com/prodtech/appserver/reference/techart/ejbql.html?ssobm=ng ...

java as a systems administration/systems programming language?
I'm still trying to figure out what for my environment is the best way to manage and converge my server configurations into something that looks and acts the same. Originally I had been thinking the typical rdist, then I moved to cfengine, now I'm thinking about writing something that is similiar to cfengine in java, then distribute the j2sdk to all my boxes. There would be a shell script under cron that makes sure cvs is installed, the 'cvs checkout' the configuration tree (which would containe the java stuff), compile the java as needed (make), then execute to test and update...

java.jdk and java.jre system properties
The lack of a java.jdk and java.jre system property is now officially considered a bug, with a number 6304516. you can even vote for it at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6304516. -- Bush crime family lost/embezzled $3 trillion from Pentagon. Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video. http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm Canadian Mind Products, Roedy Green. See http://mindprod.com/iraq.html photos of Bush's war crimes ... which reminds me: in Windows, when I open a Command prompt and type C:\myhomedir>java...

mapping java type java.util.Map to XML
I am devoloping a webservice application using jax-ws2.1I want write a wsdl and xsd file which applyed the follow functionpublic void addElement(String id,Map<String,String> repos){...................}relevant chip of wsdl<message name="addElement"> <part name="parameters" element="tns:addElement"></part></message><portType name="..."> ........ <operation name="addElement"> <input message="tns:addElement"></input> <output message="tns:addElementResponse"><...

why do java types scoff at php and lisp scoff at java?
why? gavino wrote: > why? because. "gavino" <bootiack@yahoo.com> writes: > why? Why do Shelbyvillians scoff at Springfieldians? Why do Springfieldians scoff at Shelbyvillians? -- __Pascal Bourguignon__ http://www.informatimago.com/ ATTENTION: Despite any other listing of product contents found herein, the consumer is advised that, in actuality, this product consists of 99.9999999999% empty space. On 2006-11-16, Ray <ray_usenet@yahoo.com> wrote: > gavino wrote: >> why? > > because. Exactly! On Wed, 15 Nov 2006 16:27:...

Passing java.lang.Class type as an argument to Java method
I am trying to set the default cell renderer for a JTable from within Matlab. All my efforts to this point have been based on Sun's 'How To Use Tables' tutorial. According to methodsview('JTable') the signature of the function is setDefaultRenderer(java.lang.Class,javax.swing.table.TableCellRenderer ) I cannot get this function to executed, and I think its because I cannot create a java.lang.Class argument from within Matlab. Following a corresponding code snipit: import javax.swing.*; import java.awt.*; import java.awt.event.*; columnNames = { 'First Name', &...

java.lang.Set with elements of type java.lang.Set
Roughly I do something along the lines of: Set set = new HashSet(); Set elem = new HashSet(); set.add(elem); // now we change the elem and add it again to the set elem.add(some object here); set.add(elem); I found out the hard way that 'set' may now contain 'elem' either once or twice, the reason being that 'elem.add()' changes the hashCode of elem such that it is not noticed that it is in 'set' already on the 2nd 'set.add()'. Question: What I would actually want is an IdentityHashSet() set = new IdentityHashSet() but this does not...

Migrating Java Applications to Sun Java System Application Server
A webinar titled "Migrating Java Applications to the Sun Java System Application Server" is now available at https://sun.webex.com/sun/onstage/onstage/framesets/viewrecording1.php?EventID=346725778. In the webinar, you'll learn about the requirements, methodology, tools, and different scenarios for migrating existing applications from previous versions of Sun Java System Application Server, and from other popular application servers, to the current version of Sun Java System Application Server (8.2). If you have questions after viewing the webinar, you'll be able to...

Migrating Java Applications to Sun Java System Application Server
A webinar titled "Migrating Java Applications to the Sun Java System Application Server" is now available at https://sun.webex.com/sun/onstage/onstage/framesets/viewrecording1.php?EventID=346725778. In the webinar, you'll learn about the requirements, methodology, tools, and different scenarios for migrating existing applications from previous versions of Sun Java System Application Server, and from other popular application servers, to the current version of Sun Java System Application Server (8.2). If you have questions after viewing the webinar, you'll be able to...

Combining Java Reflection API with Java Annotation Types for Thread Safety
Hello everyone. I have a really complicated question (and I don'treally know if this is even possible).I am currently developing a program that is multithreaded. I have alot of methods that start a thread and call other methods from otherclasses. All the time, I have to make sure that the class's methodthat I am calling is correctly synchronized (if needed) or not. Sohere is what I was looking the last couple of days.I know Java has an Annotation Type system that it can help me markvarious methods in a class for a particular purpose (such as a @Testor @FixThis). So I was thinking, this...

How can I convert a Matlab type string to a jstring (Java type string) in JNI?
I've been struggling over the conversion of a string "mstr" passed from my Matlab function to a jstring "jstr" (Java type string) in my JNI program. Does any one know how to? Here's a simple version of my JNI program. Please help!! JNIEXPORT jstring JNICALL myfunc (JNIEnv *env, jobjectAray a) { mxArray* pa; mxArray* mstr; jstring jstr; pa = javamatrix_to_mxArray(env, a); % I have javamatrix_to_mxArray function mlfMyMatlabFunc (1, &mstr, pa); % This is my matlab funciton call jstr = mxArray_to_j...

SN#20092 Sun Support for Java System Products on System Virtualization Solutions
SYSTEM NEWS FOR SUN USERS Vol 124 Issue 4 2008-06-23 Article 20092 from section "Software" Support Statement for JES with system virtualization products and features In March, Sun released a public support statement that said Sun supports middleware products on a variety of virtualization technologies. A June update from Sun clarifies which Sun Java System products are supported with the following virtualization products and features : - Sun Logical Domains (LDoms) - Solaris 10 Containers and Zones - S...

GRUB booting XP: file system type unknown, partition type 0x7
Hi! I have Linux on hda and XP on hdb1. I have no problems booting XP when I unplug hda. Disk /dev/hdb: 60.0 GB, 60022480896 bytes 255 heads, 63 sectors/track, 7297 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hdb1 * 1 3640 29238268+ 7 HPFS/NTFS /dev/hdb2 3641 5990 18876375 83 Linux /dev/hdb3 7036 7297 2104515 82 Linux swap This is my GRUB configuration: title Windows root (hd1,0) makeactive chainloader +1 But this only leads to "file sys...

When a Java program starts up, several system threads are also started ... Is this why all Java classes have extra synchronization overhead ...
When a Java program starts up, several system threads are also started without the programmer necessarily knowing about them. Is this why all Java classes have extra synchronization overhead associated with them even if you are not using threads in your own program? -- Regards, Casey On 27.10.2006 11:34, Casey Hawthorne wrote: > When a Java program starts up, several system threads are also started > without the programmer necessarily knowing about them. Right. > Is this why all Java classes have extra synchronization overhead > associated with them even if you are not using th...

US-CA-Edwards AFB: Network Systems Analyst, ASP, Java, Systems integration; C-P (45287657603)
US-CA-Edwards AFB: Network Systems Analyst, ASP, Java, Systems integration; C-P (45287657603) ============================================================================================= Position: Network Systems Analyst Reference: SMC01164 Location: Edwards AFB CA Duration: C-P Skills: 7 + years system development experience with scripting/development languages such as ASP, JAVA, VB, SQL and/or LAPI, and Database development. Specific experience with systems integration of OpenText/LiveLink required Please send ...

US-CA-Edwards AFB: Network Systems Analyst, ASP, Java, Systems integration; C-P (45286757610)
US-CA-Edwards AFB: Network Systems Analyst, ASP, Java, Systems integration; C-P (45286757610) ============================================================================================= Position: Network Systems Analyst Reference: SMC01164 Location: Edwards AFB CA Duration: C-P Skills: 7 + years system development experience with scripting/development languages such as ASP, JAVA, VB, SQL and/or LAPI, and Database development. Specific experience with systems integration of OpenText/LiveLink required Please send ...

US-CA-Edwards AFB: Network Systems Analyst, ASP, Java, Systems integration; C-P (45285857617)
US-CA-Edwards AFB: Network Systems Analyst, ASP, Java, Systems integration; C-P (45285857617) ============================================================================================= Position: Network Systems Analyst Reference: SMC01164 Location: Edwards AFB CA Duration: C-P Skills: 7 + years system development experience with scripting/development languages such as ASP, JAVA, VB, SQL and/or LAPI, and Database development. Specific experience with systems integration of OpenText/LiveLink required Please send ...

US-CA-Edwards AFB: Network Systems Analyst, ASP, Java, Systems integration; C-P (45287057606)
US-CA-Edwards AFB: Network Systems Analyst, ASP, Java, Systems integration; C-P (45287057606) ============================================================================================= Position: Network Systems Analyst Reference: SMC01164 Location: Edwards AFB CA Duration: C-P Skills: 7 + years system development experience with scripting/development languages such as ASP, JAVA, VB, SQL and/or LAPI, and Database development. Specific experience with systems integration of OpenText/LiveLink required Please send ...