Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (121)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  A need for const?  (Read 7118 times)
0 Members and 1 Guest are viewing this topic.
Offline Preston

Senior Duke


Medals: 4



« Reply #30 - Posted 2003-08-14 10:49:23 »

Quote

You give people an utterly misusuable tool, and they'll misuse it utterly!  You know they do!

Yes, my recent C++ years in mid sized dev teams proved that. This is why I think Java is such a great and (more) "clean" language. I really like it. Very good work @ Gosling and all other contributors at SUN !
Offline cfmdobbie

Senior Duke


Medals: 1


Who, me?


« Reply #31 - Posted 2003-08-14 11:42:01 »

Quote


My word, that is some good reading!  I didn't realise the full extent of the changes being included in Java 1.5.

Generics, Static Import and Enumerations get all the attention, but there's also Autoboxing, Foreach, Metadata, Concurrency Utilities API, StringBuilder (unsynchronised StringBuffer), Varargs, C-style printf-type library, and use of generics in things like Comparable<T>.  Wow!

Hellomynameis Charlie Dobbie.
Offline GergisKhan

Junior Duke




&quot;C8 H10 N4 O2&quot;


« Reply #32 - Posted 2003-08-14 12:49:47 »

My personal favorite that I can't wait for (though it isn't as important construct-wise) is the foreach statement.

That thing just rocks.

But I guess the most important significant change is either autoboxing or generics; I have not yet decided which is most important to me.  Probably  both.

gK

"Go.  Teach them not to mess with us."
          -- Cao Cao, Dynasty Warriors 3
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #33 - Posted 2003-08-14 12:52:22 »

I know. Every time they release another version spec, I start thinking about all the places I could use the new features in whatever project I'm working on. It gets really depressing. Smiley

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline tortoise

Junior Duke




<3 Shmups


« Reply #34 - Posted 2003-08-14 14:16:04 »

I think generics are going to rock. A compile time error as opposed to a ClassCastException? Especially if eclipse will be able to pick up the error on the fly? Oh hell yeah Smiley
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #35 - Posted 2003-08-14 14:47:41 »

When 1.5 is available it's going to take me a while to get used to not doing things the old way Smiley

Offline GergisKhan

Junior Duke




&quot;C8 H10 N4 O2&quot;


« Reply #36 - Posted 2003-08-15 04:06:40 »

Quote
When 1.5 is available it's going to take me a while to get used to not doing things the old way  


This reminds me of your other comment about not using switch and using polymorphism instead.

I tell you, I think generics are going to rock, but I think they're going to be a PITA to remember to USE them.  

gK

"Go.  Teach them not to mess with us."
          -- Cao Cao, Dynasty Warriors 3
Offline kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #37 - Posted 2003-08-15 04:27:32 »

Any news on what's going to happen to container classes when generics turn up? We going to get a bunch on new version in util.generic which support generics?

Kev

Offline Preston

Senior Duke


Medals: 4



« Reply #38 - Posted 2003-08-15 06:25:05 »

Quote
Any news on what's going to happen to container classes when generics turn up? We going to get a bunch on new version in util.generic which support generics?

Kev

The affected classes (=many :-) will be these:
http://jcp.org/aboutJava/communityprocess/review/jsr014/
Offline kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #39 - Posted 2003-08-15 06:42:25 »

Had a quick read, does this mean all old code that uses collections will be broken if compiled against 1.5?

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online princec

JGO Kernel


Medals: 409
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #40 - Posted 2003-08-15 07:31:37 »

No, no code will need recompiling. The generics code has a fallback where all classes are defined as using T<Object>, which is exactly how the collections classes work at the moment - as collections of Ob jects.

Cas :_

Offline Athomas Goldberg

Junior Duke




Grrrrrr...


« Reply #41 - Posted 2003-08-15 12:52:48 »

Quote
My personal favorite that I can't wait for (though it isn't as important construct-wise) is the foreach statement.

That thing just rocks.

But I guess the most important significant change is either autoboxing or generics; I have not yet decided which is most important to me.  Probably  both.


Actually, foreach combined with autoboxing and generics, really rocks.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
public class MyClass {

 public void myMethod(String[] args) {
  Map m = new TreeMap();

  for (int i = 0; i < args.length; i++) {
   Integer freq = (Integer) m.get(args[i]);
   Integer incrInteger;
   if(freq==null) {
    incrInteger = new Integer(1);
   } else {
     int oldInt = freq.intValue();
     int newInt = oldInt + 1;
     incrInteger = new Integer(newInt);
   }
   m.put(args[i], incrInteger );
  }
 }
}

becomes:

1  
2  
3  
4  
5  
6  
7  
public class MyClass {
 public void myMethod(String[] args) {
  Map<String, Integer> m = new TreeMap<String, Integer>();
  for (String word : args)
   m.put(word, m.get(word) + 1);
  }
}

*This example was adapted from an interview with Josh Bloch on the new features in 1.5

Actually, I'm looking forward to the java.util.concurrency.* classes (ThreadPool, PriorityQueue, etc). As someone who's been doing multithreaded programming for a long time, and learning the hard way how to get it right, it's understandable why people frequently avoid multi-threading at all costs. I think these classes will be as significant as the Collections classes were to how Java is used.

Athomas Goldberg
Project Lead / Wildcard
Game Technologies Group
Sun Microsystems, Inc.
Offline tortoise

Junior Duke




<3 Shmups


« Reply #42 - Posted 2003-08-15 13:25:17 »

So now Java's really, really becoming "C++ done right"  Grin

Things like that little code snippet you just put there should look really attractive to a C++ programmer who hasn't done any Java yet.
Offline Abuse

JGO Knight


Medals: 13


falling into the abyss of reality


« Reply #43 - Posted 2003-08-15 15:19:18 »

If I was learning Java, and came across.....
1  
2  
3  
4  
5  
6  
7  
public class MyClass { 
 public void myMethod(String[] args) {
  Map<String, Integer> m = new TreeMap<String, Integer>();
  for (String word : args)
   m.put(word, m.get(word) + 1);
  }
}


... I would be totally lost.

Coding shortcuts are good... when the meaning of the code isn't lost.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #44 - Posted 2003-08-15 15:32:32 »

I agree, it is going to be nice to have the ability to use these tools when its appropriate, but the readability isn't that great.

Isn't it also going to lead to ppl who are moving from other languages to java using primitives for keys everywhere, instead of considering if it might be more elegant to use an object?

Kev

PS. Thanks for pointing out the default <Object> impl, mind at rest again  Smiley

Offline tortoise

Junior Duke




<3 Shmups


« Reply #45 - Posted 2003-08-15 15:56:33 »

The syntax is foreign at first but I think it improves readability quite nicely. The intention is made more clear while the implementation (which is rarely necessary to know about) is nicely hidden.

When the implementation is necessary, it becomes visible, but it also becomes a part of the intention when that happens too. Sounds good to me.
Offline cfmdobbie

Senior Duke


Medals: 1


Who, me?


« Reply #46 - Posted 2003-08-15 17:37:45 »

Yeah, it'll be a little weird at first because it doesn't look like Java1.4 - but once we start playing with it I'm sure it'll be fine!  That example rather compresses several themes into one place, anyway - most code won't be anything like as alien as that!

Hellomynameis Charlie Dobbie.
Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

theagentd (18 views)
2014-10-25 15:46:29

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (45 views)
2014-10-16 15:22:06

Norakomi (34 views)
2014-10-16 15:20:20

lcass (39 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (68 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (74 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!