Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (488)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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 3 4
  ignore  |  Print  
  What would you like to see in Java?  (Read 6480 times)
0 Members and 1 Guest are viewing this topic.
Offline Mac70
« Posted 2013-10-05 16:45:45 »

Like in topic - what would you see in Java?

My propositions:

1. Operator overloading
This would be VERY useful for vector and matrix math, I think this is obvious.

2. New "for" loop
We use code like this very often:
1  
2  
3  
4  
5  
for (int i = 0; i<20; i++) {
    for (int i2 = 0; i2<20; i2++) {
        doOrGetSomething(i, i2);
    }
}

Why not replace it with something like this:
1  
2  
3  
4  
5  
for (int i -> 0 : 20) {
    for (int i2 -> 0 : 20) {
        doOrGetSomething(i, i2);
    }
}

or this:
1  
2  
3  
for (int i, i2 -> 0 : 20) {
    doOrGetSomething(i, i2);
}

or even this (only for arrays and collections) - I know we have "for each" loop, but it cannot be used in some cases:
1  
2  
3  
for (int i, i2 -> array2d) {
    doOrGetSomething(array2d[i][i2]);
}

1  
2  
3  
for (int i -> list) {
    doOrGetSomething(list.get(i));
}


Both of this ideas are just syntatic sugar, but in my opinion would be useful. Smiley

Check out my Devblog! Smiley
Offline SHC
« Reply #1 - Posted 2013-10-05 17:00:51 »

I think those are for Java 8. But I prefer the legacy for loops.

Offline Herjan
« Reply #2 - Posted 2013-10-05 17:02:09 »

I don't want that for-loops (its just me), uninitialized variables oO, I like it as it is, and if you want to walk through a List, you can already do this:
1  
2  
3  
for(Object o : List){
    o.doSomething();
}


Now I see al of that -> stuff, I actually miss pointers in Java, I like them a lot in C, in Java you have to make a lot static, but I understand that Java-developers actually want to dodge this, as this has something to do with memory management.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mac70
« Reply #3 - Posted 2013-10-05 17:02:38 »

I don't want any of your for-loops, uninitialized variables, and all that weird stuff, I like it as it is, and if you want to walk through a List, you can already do this:
1  
2  
3  
for(Object o : list){
o.doSomething();
}


Now try to delete "o" from the same list. Smiley

Also, variables are initialized - this is just syntatic sugar.

Check out my Devblog! Smiley
Offline SHC
« Reply #4 - Posted 2013-10-05 17:13:59 »

@Herjan
For removal, you have to create a new list to store items to remove and remove the elements later.

Offline SHC
« Reply #5 - Posted 2013-10-05 17:28:17 »

I don't think that
key.this()
is possible since
this
is a keyword!

Offline Sindisil
« Reply #6 - Posted 2013-10-05 18:38:31 »

About the only significant things I'd like added to the Java language (asopposed to the JVM or library), in rough order of importance, are:

  • User defined value types (ie.  structs)
  • Named parameters/keyword arguments
  • A reasonable way to have collection and object litterals   espevially for (re)initialization.
  • First class functions (though I'm so used to using interfaces for call backs and handlers that this is secondary)
Offline HeroesGraveDev

JGO Kernel


Medals: 246
Projects: 11
Exp: 2 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #7 - Posted 2013-10-05 18:45:48 »

The removal/complete fixing of applets so the security 'experts' shut up about all of Java being dangerous.

If we are talking about language features, then I'd like to see operator overloading, and perhaps macros.

Offline kpars

JGO Wizard


Medals: 77
Projects: 4
Exp: 3 years


Extreme Typist.


« Reply #8 - Posted 2013-10-05 19:27:49 »

I'd like to see more stuff done in Java2D.
You know, built in gradients, anti-aliasing, etc.

It would be a bit neat if Oracle did some more stuff involving game-dev, but I doubt we will ever see that happen in the near future.

- Jev.

Offline Danny02
« Reply #9 - Posted 2013-10-05 19:40:52 »

instead of wishing for stuff, just use Scala already. For a start, it's a better Java.

type inference
first class functions
complex type system
macros
+ a lot more cool stuff which just fits together perfectly

A few months ago I was a strong supporter of Java(saw no big flaw in it), but now I do want to do every project with Scala.

@Mac70
leaving aside that old C for loops and arrays are not that bad, but should be avoided in most cases, one can something like this in Scala:

1  
2  
3  
4  
for(x <- 0 to 20
     y <- 0 to 20) {
  val foo = bar(x, y)
}


And btw, in this example is no special syntax(the "to") just a standard Scala for comprehension.

@lukasz1985
leaving aside that PHP is the worst most horrific programming language know to mankind, you already can do this in Java.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
for(Map.Entry<Key, Value> pair : map)
{
  Key k = pair.getKey();
  Value v = pair.getValue();
}

//this is of course also shorter in Scala

for( (k,v) <- map ){

}
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mac70
« Reply #10 - Posted 2013-10-05 20:02:19 »

I'd like to see more stuff done in Java2D.
You know, built in gradients, anti-aliasing, etc.

It would be a bit neat if Oracle did some more stuff involving game-dev, but I doubt we will ever see that happen in the near future.

- Jev.

As far as I know you have gradients and anti-aliasing in Java2d.

I would also see something like LINQ built into default library.

Check out my Devblog! Smiley
Offline Agro
« Reply #11 - Posted 2013-10-05 20:05:43 »

java needs some more functional support. its starting to fall behind D:

Offline Danny02
« Reply #12 - Posted 2013-10-05 21:41:12 »

Thats right lukas, Scala is really scalable and has no/few rules. And exactly this is what makes Scala so great, there is no need to change the language just because you want another cool feature. Things like LINQ in C# or foreach loops in Java do not need to be implemented by new language features, but can be provided at the library level.

Scala is one of the most simplest languages I ever encountered, it may be strange at first, but after a few days every Java dev should grasp the basic concepts. As you mentioned, you can do really impressive advanced stuff in scala, but there is no need for a beginner to understand these concepts until they want to know.

Know let me go over your points really quick.
  • The "_" can have the meaning of a placeholder, wildcard, undefined type or unnamed value. I think these are very similar and the symbol represents a simple concept.
  • what is confusing about var/val? val are final variables aka values and var are variables.
  • That one should code after some standard should be a given. I can't count how many times I saw the Java language abused on this forum
  • no need for break/continue if you don't have loops and switches. Pls give an example which can not be solved better in Scala
  • You said it right no requirement to use return, use it if you wish. Not having to use does make code smaller and simpler i.e. def square(a:Int) = a * a
  • Integration with Java is seamless if you want it to. There a conversions implicit and explicit between Java and Scala library classes.
  • Immutable collections is a big thing which Java misses. Also immutability as a default is in many ways better. Also no one forces you to do it
  • Scala/functional programming can even be faster then Java see tail recursion
Offline Jeremy
« Reply #13 - Posted 2013-10-05 22:22:30 »

Like in topic - what would you see in Java?

My propositions:

1. Operator overloading
This would be VERY useful for vector and matrix math, I think this is obvious.

Java explicitly went out of its way not to support Operator Overloading because of what it did to code in C++. I personally agree with the decision to not operator overload. If you have something like this:

a<<10;

In C++, that snippet of code tells you nothing. If it's a input stream it could be writing to the stream (ascii art in code - sounds cool right? Not when you're trying to understand it!) or it could be bit shifting. People did some really stupid (or overly 'clever') things with operator overloading and java decided to throw it out.

I never use operator overloads because it saves 5 characters to make the language less verbose in an area where we've all agreed to be verbose (function names.)

JevaEngine, Latest Playthrough (This demo is networked with a centralized server model)

http://www.youtube.com/watch?v=rWA8bajpVXg
Offline Mac70
« Reply #14 - Posted 2013-10-05 22:28:38 »

Operator overloading would be very useful even if we will have only +, -, * and / operators - this would make code easier to read in a lot of situations like:
1. Vector/matrix math
2. StringBuilder
3. BigInteger/BigDecimal
4. Calendar

Check out my Devblog! Smiley
Offline DrZoidberg

Senior Member


Medals: 15



« Reply #15 - Posted 2013-10-05 22:35:13 »

...
Why not replace it with something like this:
1  
2  
3  
4  
5  
for (int i -> 0 : 20) {
    for (int i2 -> 0 : 20) {
        doOrGetSomething(i, i2);
    }
}


You could define yourself a Range class and a range method and use it like this
1  
2  
3  
for (int i: range(0,20)) {
    doOrGetSomething(i);
}

and with Java 8 you could even do this
1  
2  
3  
nested(range(0,20), range(0,20)).forEach((i,j) ->
    doOrGetSomething(i,j);
);

or
1  
2  
3  
for(Object elem: nested(array2d)) {
    doOrGetSomething(elem);
);


And one more! For loops for hashmaps like in PHP:

1  
2  
3  
4  
for( key, value : hashMap) {
  key.this();
  value.that();
}


In Java 8 you can write
1  
2  
3  
hashMap.forEach((key, value) ->
    doSomething(key, value);
);


I'd like to see more stuff done in Java2D.
You know, built in gradients, anti-aliasing, etc.
That stuff is already in Java2D. But you could also use JavaFX.
It's now part of the standard Java distribution.

Scala is way too complicated - it actualy is insanely complicated and there are things that adds to this complications.
Scala is a wonderful language. But you can't expect to understand it on one weekend.
Also some of the features of the language are meant mostly for API developers.
You don't need to know or understand all of them to use Scala.
In fact there is a Scala "Learning Environment" designed to teach programming to children.
http://www.kogics.net/kojo
Try out the "Kojo Overview Story".

The default import for collections (immutable) is a horrible assumption.
Functional programming is good but not with the approach to immutability, people are really blind to this concept, which is not good for performance.
Making immutability the default was the right decision. It helps to reduce bugs and simplifies parallel programming.
The impact on performance is small in most cases. In the few cases where it actually causes a performance issue, it's very easy to switch back to mutable collections.
Offline ReBirth
« Reply #16 - Posted 2013-10-06 03:06:16 »

Sorry to disagree but I don't want operator overloading and new For loop. I want "private" as default modifier for variables.

Offline Jeremy
« Reply #17 - Posted 2013-10-06 05:29:01 »

Sorry to disagree but I don't want operator overloading and new For loop. I want "private" as default modifier for variables.

I agree with the default private access modifier.

I very rarely ever use the default access modifier.

JevaEngine, Latest Playthrough (This demo is networked with a centralized server model)

http://www.youtube.com/watch?v=rWA8bajpVXg
Offline quew8

JGO Coder


Medals: 29



« Reply #18 - Posted 2013-10-06 07:09:10 »

Sorry to disagree but I don't want operator overloading and new For loop. I want "private" as default modifier for variables.

I agree with the default private access modifier.

I very rarely ever use the default access modifier.

Yeah, I use the default access modifier so little that those few times that I actually need it, I assume that I'm mistaken and use one of the others anyway. Then my IDE shows a bug which I promptly ignore because there aren't any other access modifiers to use (other than none at all).

I get the impression that one of the reasons they used this as the default access modifier is that they couldn't think of another name for it.
Offline gouessej
« Reply #19 - Posted 2013-10-06 14:38:55 »

The removal/complete fixing of applets so the security 'experts' shut up about all of Java being dangerous.
I agree with you and it would be even better if Oracle stopped shipping malwares / useless toolbars with the JRE (like Runiter said).

I don't want to see any new language features in Java as it is already possible to use other languages on the JVM instead of trying to put all language concepts into Java. I don't want Java to become the new C++. I admit that Java may need some new ways of expressing things in parallel but changes of its syntax should be kept as small as possible. I would prefer obtaining improvements and security fixes in existing APIs. The bug I reported on OCSP has not yet been fixed.

Offline Danny02
« Reply #20 - Posted 2013-10-06 15:01:29 »

pls lukas, give me an example where break & continue are really needed.

back to topic: I would really like to see modularization of the VM come true.
Offline relminator
« Reply #21 - Posted 2013-10-06 15:08:33 »

+1 for operator overloading.

Also ability to allocate temporary objects to the stack.
Offline CommanderKeith
« Reply #22 - Posted 2013-10-06 15:40:37 »

Modularisation would be very cool. It's definitely coming, only a matter of time: http://mreinhold.org/blog/on-the-next-train

I'd actually prefer a protected default access modifier so that classes can be more easily extended and modified.

Java as a language is cool, but as a platform it really needs to get in the browser in a more satisfactory way than applets and webstart.
I'm hoping that with the incredible open-source movement in java and software in general right now and all of the associated language-converters/alternative VM's/compilers/transpilers popping up (GWT, RoboVM, Avian and so on) that we'll all be able to code in java using the standard java API library on any platform we want, whether it's desktop window apps, browser based applets, embedded devices, consoles or whatever.

Offline DrZoidberg

Senior Member


Medals: 15



« Reply #23 - Posted 2013-10-06 19:02:30 »

@lukasz1985
Optimization for functional programming is comming in Java 8.
https://www.youtube.com/watch?v=C_QbkGU_lqY
Scala may not be a good choice for a game engine but no JVM language really is.
Having to maintain shared state yourself is like having to manage memory yourself. For most kinds of software it's better to leave that to the compiler/runtime system.
I think immutable data is the perfect solution for multithreading. Compilers just have to get better at optimizing that stuff.
The lack of break/continue is not a big deal. The philosophy of Scala is that any loops that need break/continue should be written with recursion (Scala has nested methods and tail call optimization).
Offline Troncoso

JGO Coder


Medals: 20



« Reply #24 - Posted 2013-10-06 22:44:04 »

Everybody in the world of programming is used to look after the return statement at the end of the function.

Functional programming has been around just as long as object oriented programming ( Look up Lisp). Scala is just another functional language that has a different structure like the rest. Check out F#, Haskell, or even OCaml. To say things like "Scala will never ever replace Java with that weirdness" just goes to show that you are trying to talk for a general population when in fact you don't even know what you are talking about.

And there is the correct and the wrong way - it's coded in our brains and its called logic

All that says is that you are very close minded to new programming methods and techniques. There is, in fact no "right and wrong" way to program, outside of what gives you errors and what doesn't. From the sounds of it, you just dug yourself into a little hole of Java, and are too scared to come back out.

Thats why the return statement is in the end of method, why break and continue are present and why while loops exist


This applies only to object oriented and procedural programming. Again, get out of your little Java box and realize there are different ways to program that are just as viable and useful as OOP.
Offline DrZoidberg

Senior Member


Medals: 15



« Reply #25 - Posted 2013-10-06 22:59:32 »

... I seriously hate when people try to convince others to do things the wrong way.
I couldn't agree more.
If people simply wised up and started doing everything the "Right Way"™ many conflicts could by avoided.
http://www.asimovs.com/2012_08/ref.shtml
Offline sproingie

JGO Kernel


Medals: 202



« Reply #26 - Posted 2013-10-07 16:30:17 »

Scala is the Perl of the functional programming world: it's an ugly colossal mess with lots of warts and weird features from legacy versions, but still damn useful, and every language that professes to repudiate it will still find a feature from it they want to borrow.

If Scala doesn't turn your crank, maybe give Kotlin a try.  Or hell, take Clojure out for a spin.
Offline Mac70
« Reply #27 - Posted 2013-10-07 18:00:55 »

Scala is really good as it allow you to program (almost) literally as you like. Too bad NetBeans don't support it too well and I am forced to use (much worse) Eclipse when I want to do something in it. Sad

Check out my Devblog! Smiley
Offline Roquen
« Reply #28 - Posted 2013-10-07 20:03:15 »

Err..functional programming has been around MUCH longer than OOP.  OOP came from LISP.  I wonder if the original folks that working on OOP still want to bang their head on the wall when they hear people talk about "types", much less "strongly typed OOP..and the OOP 'way' of doing things.".

Scala is the Perl...
Comparing anything to Perl is cruel.

Got nothing new to say toward the topic that I haven't already ad nausem.
Offline Troncoso

JGO Coder


Medals: 20



« Reply #29 - Posted 2013-10-07 20:24:43 »

Both paradigms were realized in the 50's. Neither were fully implemented until the 60's (LISP was considered a multi-paradigm language). To say functional programming was around a lot longer isn't quite accurate.
Pages: [1] 2 3 4
  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.

TehJavaDev (17 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (68 views)
2014-08-11 02:49:23

BurntPizza (45 views)
2014-08-09 21:09:32

BurntPizza (36 views)
2014-08-08 02:01:56
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!