They've "implemented" a few choice sort algorithms as dances at Sapientia University in Hungary. There's a YouTube channel for it!
Awesome.
Thoughts about code, the software industry, and basically anything else that comes to mind.
Thursday, April 21, 2011
A Few Things I Wish Java Had
As I switch back and forth between Java and C# there are a few things I wish Java had that C# does. Almost all of my gripes are related to syntactic sugar, but I think they are nice to have.
- Nullable types - I think they're cleaner than using Object wherever a null reference might come into play. I know that they are still boxed under the hood in .Net (into Nullable<T> struct), so the performance is probably similar, but I think they are nice to have. May have a future post here...
- Lambdas - again, really just syntactic sugar for anonymous functions and can get quite ugly, but these are nice to have the majority of the time. (I suppose anonymous methods might be the start for Java. Java 9?)
- Unsigned types - can o' worms? Perhaps. See below for a quote from Gosling
- Implicitly typed variables - At first, I thought that var was not the greatest idea. But now, I love it. So easy and clean and totally type safe.
- Generic containers that accept value types - Hashtable<Integer, Integer>. Really?
On the unsigned types front... Having signed bytes doesn't make any sense to me. Here's a quote from James Gosling on the topic:
Gosling: For me as a language designer, which I don't really count myself as these days, what "simple" really ended up meaning was could I expect J. Random Developer to hold the spec in his head. That definition says that, for instance, Java isn't -- and in fact a lot of these languages end up with a lot of corner cases, things that nobody really understands. Quiz any C developer about unsigned, and pretty soon you discover that almost no C developers actually understand what goes on with unsigned, what unsigned arithmetic is. Things like that made C complex. The language part of Java is, I think, pretty simple. The libraries you have to look up.
I'm all for simplicity, but signed bytes seem over the top. Maybe he should've had all signed types except bytes or have signed and unsigned bytes. I totally agree with him on the complexity of signed/unsigned arithmetic in C as well, but it's not that hard to grasp (or lookup).
Don't get me wrong - Java is nice, these are just a few things that I think C# did really well.
Subscribe to:
Posts (Atom)