Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Just Java Chapter-6: Question on Static is a Really Poor Name  RSS feed

 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,
After I have read the sample chapter-6 about Static, Final and Enumeration Types in detail, I got a bunch of questions to ask you.

In Static section of the sample chapter-6, I saw the following portion;
Static is a really poor name
Of all the many poorly chosen names in Java, �static� is the worst. The keyword is
carried over from the C language, where it was applied to storage which can be allocated statically (at compile time). Whenever you see �static� in Java, think �once-only� or �one-per-class.�


Frankly, I didn't notice that this is such bad name, because I memorized it into my brain, since I was in the university. But I can figure it out that the name "static" just carried over from C, but it's not that related to its nature "once-only" or "one-per-class".

Do you have any other name that should be used rather than the name "static"? I just would like to know your personal opinion on its name...

As for me, I can't think of any other name, as I have been familiar with that name for a long time... Thanks...
 
Peter van der Linden
author
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have any other name that should be used rather than the name "static"? I just would like to know your personal opinion on its name...


Hi Ko Ko,

Well, you have put your finger on the key issue! It is a lot easier for me or you or anyone
to point out a flaw, than it is to provide a solution which is obviously better.

We are looking for a word that suggests "unlike all the other fields, this one is not part
of an object". A word like "independent" or "class-level" or even "belongs-to-class"
could possibly suggest that.

It would also be good if the same word could be used with static blocks to suggest
"there is only one of these", perhaps a qualifier like "one_time" or something.

Or maybe there could be a special section in a class labelled as the "belongs_to_class" or
"one_only_for_the_whole_class"
section in which all the static things go. Or maybe we should have the special section
called "one_for_each_object" and it contains all the non-static things. Or maybe have both
sections and try to find shorter names for them.

There probably isn't a perfect solution for this, but I still think "static" (the name) sneaked
into Java from C, when it should not have even been in C (as a name, not a feature) in the
first place!

Do other people have any suggestions on changing this name to make it easier to understand?

Cheers,

Peter
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter van der Linden:
.......
A word like "independent" or "class-level" or even "belongs-to-class"
could possibly suggest that.

It would also be good if the same word could be used with static blocks to suggest
"there is only one of these", perhaps a qualifier like "one_time" or something.

Or maybe there could be a special section in a class labelled as the "belongs_to_class" or
"one_only_for_the_whole_class"
section in which all the static things go. Or maybe we should have the special section
called "one_for_each_object" and it contains all the non-static things. Or maybe have both
sections and try to find shorter names for them.

.......
Do other people have any suggestions on changing this name to make it easier to understand?


Peter, the names you mentioned above are unintentionally long to relect its nature... Among them, I prefer "independent"... What about the names like "once" and "sole"...

I can't think of more short names as well... I hope other people might have more creative short names than ours...

Thanks for your opinion too, Peter...
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about the names like "once" and "sole"...

I was thinking "singular". Or maybe "single". "classbased" or "classbound" seem too long; maybe "classic" or "classy"? Really, I like "singular" best:

Works pretty well for fields and methods, IMO. I'm not so sure about class initializers. Then again, I don't much like the syntax for instance initializers either. I'd probably prefer new keywords like "init" and "classinit" or some such.

Realisticly, I don't think there's any real hope of getting changes like these into Java. But maybe for the Next Big Language...
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jim Yingst:
Realisticly, I don't think there's any real hope of getting a change like this into Java. But maybe for the Next Big Language...


I can see the impact after such change too... The whole Java world will be upside down with that small change...

Should we blame Java Desginers for such name as "static"? I guess languages in the future, which inherits from Java, might adopt the names we are suggesting here... :roll:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!