Syntactic sugar for properties for example in C#:
private int x;
public int X{
get { return x; }
set { x = value; }
}
or simply
public int X{ get; set; }
I am missing verbatim strings in java... @"C:\My Documents\" instead of "C:\\My Documents\\"
Do you agree Java needs more "sugar"? Any one knows is there is sugar coming in next Java versions?
"Syntactic sugar causes cancer of the semicolon."
-- Alan Perlis. Epigrams on Programming.
While I don't necessarily agree with Java's philosophy, I think that adding lots of syntactic sugar to Java would go against its philosophy. Java is supposed to be a very simple, easy to reason about language with few constructs, kind of a lowest common denominator lingua franca in the programming community. It was largely a reaction to the complexity of C++. There is supposed to be very little "magic" in it, beyond what is needed (garbage collection, mostly) to make it a memory-safe language.
If you want more sugar, etc. in a reasonably high-performance, statically typed language, I would say that Java is just the wrong language for you. You're probably better off just using C#, or maybe D.
Sounds like you want Groovy... Apparently properties are on their way, although not in Java 7 (as @erickson helpfully corrected me about in a comment).
Groovy does have nice string sugar.
I've also developed in both Java and C# the last few years, and find C# a superior language with regards to expressiveness and powerful language constructs. The Java language does not undergo the same degree of changes and updates as C#, atleast not at the same pace. I still don't necessarily mean that Java should be drastically updated, but we need a powerful and expressive statically typed language on the Java platform. I think Scala is going to develop into this replacement language, which we Java developers can switch to when ordinary Java does not cut it.
C# is an absolutely fantastic language; probably the "best" statically typed language these days, but Java is still in my opinion a superior platform. I like Java the platform, and I like C# the language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With