Hacker News new | past | comments | ask | show | jobs | submit login
Go go java ... play catch-up with C# (jonasbandi.net)
12 points by jbandi on Dec 17, 2008 | hide | past | web | favorite | 37 comments

Looking at the cup half full, this is great news for Java, its evolving, its been open sourced, its eco system still growing, so many FOSS projects are Java based.

And nowadays the JVM gained so many new and interesting languages: Groovy, JRuby, Scala.

All in all, I find the Java platform more interesting comapared to .Net.

Don't forget Clojure! .NET has F#, which is pretty interesting too (more than Scala in my opinion). And IronPython/IronRuby.

Everything he lists is already available in Scala:

  * Properties, via Scala's Uniform Access Principle
  * A form of null handling, via the Option type (like Haskell's Maybe monad)
  * Indexers, via apply/update methods
  * Extension methods, via implicits (Scala's implicits are actually much more powerful/dangerous than C#'s extension methods)
  * LINQ[1], via for-comprehensions
  * Lambda syntax
  * Multi-line strings
  * Type inference
As for C#'s future features:

  * Scala already has co/contravariant typing
  * Scala will have optional and named parameters soon (maybe 2.8.0?)
In addition, Scala has:

  * Pattern matching and extractors
  * Lazy evaluation and call-by-name parameters
  * Mixin composition
  * Curried methods
  * Higher-kinded types
  * Equal footing for immutable data
  * An Actor library for concurrency
Scala's also adding virtual classes soon.

F# is also great language, I don't want to say anything bad about it as a language, but unfortunately you're trapped into the Microsoft platform and subject to Microsoft's rules. I'd much rather develop in open-source land.

[1] C#'s LINQ is actually more powerful than Scala's for-comprehensions, because Scala lacks C#'s Expression Trees. Hopefully this will be remedied soon.

Not to mention that the .NET platform is moving in an even more radical direction with F#, bringing functional programming to the commercial mainstream. Java is still philosophically crippled by James Gosling's original intent that its users would be people for whom C++ was too difficult. Now they are struggling to retrofit features in. In C# Anders Hejlsberg created a language that he could use himself, that's the big difference.

(Yes I know about Clojure but it's not Sun Clojure is it?)

Whereas .NET is still philosophically crippled by Microsoft's intent to create a platform for Windows development and not a true cross-platform development platform.

(Yes, I know about Mono, but it's not Microsoft Mono is it?)

I have to say, if Microsoft were to come out with an entirely new operating system based on the ideas behind Singularity and BeOS/Haiku, it would be game changing. Competitors like OS X wouldn't be able to match it for security and responsiveness. Everything, even including significant parts of the kernel could be implemented in C#.

Imagine something with the productivity leverage of the old Lisp machines, backed by a corporation the size of Microsoft. (People used to ask how big the development team was behind the Symbolics Lisp machine, and their jaws would drop when they found out it was an order of magnitude or two smaller than they thought.)

I agree, but I suspect it won't happen any time soon, unfortunately. Microsoft's strength has always been its backwards-compatibility with earlier software. They'll need at least a couple versions to get over Vista's stigma, caused in no small part by the lack of drivers. I doubt they're in a hurry to require another set of driver rewrites.

OSX doesn't match Win32 for security now, so I'm not sure this would be the category-killer you think it would be.

OSX doesn't match now, but it's lagging behind in the same league. Security wise, Singularity is in another league entirely.

http://www.apple.com/downloads/macosx/development_tools/silv... "NET Framework support with a rich base class library. This is a compatible subset of the full .NET Framework."

A subset of .NET, available as a browser plug-in that no-one actually uses, available on one single other platform proves my point wrong how exactly?

Two if you count Linux. Are you complaining that Silverlight doesn't run on BeOS or something?

And saying "no one uses it" is brainless. In 1996 did you dismiss Macromedia Flash 1.0 because no one used it?

Microsoft don't make Silverlight for Linux themselves.

J2EE is popular on numerous platforms, including Solaris and AIX.

They do provide direct support to the team who does build it for Linux, but can you really blame them for not doing it themselves?

It's a client side library. nix is predominately used in the server space. The market share isn't large enough. Besides, a significant number of nix desktop users hate Microsoft already and would refuse to install it on principle. Maintaining support for an additional platform is expensive. And even if they did officially support it, what's the point? Mono is actually quite capable if you exclude the Windows specific libraries (which Silverlight already does, even on Windows).

You're comparing apples to oranges. You could also say, "Whereas Cocoa is still philosophically crippled by Apple's intent to create a platform for Mac development and not a true cross-platform development platform."

But Apple never set out to create a cross-platform development, erm, platform. Java did set out to be a general-purpose language particularly suited to "enterprise" development. As did C#.

Two mix two points here: cross-platform and general-purpose.

Java & Swing == General-purpose and cross-platform

Objective-C & Cocoa == C# & WinForms == General-purpose and platform-specific

At least in terms of their ORIGINAL goals.

For nimble organizations, the support behind the language isn't the issue, but the support of the platform is. Anyone can easily fork Clojure, embed it within their application, and have it play nice on the huge Java ecosystem, perhaps even running on J2ME or Android (or even IKVM).

From what little I've seen, the technical fundamentals of .NET seem nicer, and the C# language certainly is. But following Microsoft's footsteps isn't the best way to remain flexible.

The premise that one language needs to "catch up" to another by adding more features is absurd. Languages are not like automobiles, which are better the more "perks" are added. A programming language should be as small as possible while still being able to express as many useful patterns as possible.

By this metric, Java and C# are both extremely poor languages. Java is not especially complicated, but it is far more complicated than is necessary for its (extremely small) expressive powers. C# is extremely complicated already (SQL as a first-class language construct? Really?), and is becoming more complicated, while still not reaching the expressive power of e.g. Scheme.

One of the things that appeals to me is that Java doesn't have all the extra crap piled on some other languages (yet).

I think there's a lot to be said for picking which features to leave out.

Maybe I'm alone with this viewpoint though.

Unfortunately Java has a lot of extra crap already. I liked the language and was competent in it once, but when version 1.5 added generics and autoboxing, I left for greener pastures. Same thing almost happened to JavaScript this year with ES4, thank god it was cancelled.

Same here, generics are so ugly! I used to think Java is cutting edge with annotations and aspect oriented programming, until I realized that dynamic languages don't even need to add extra "features" to support most (or all?) interesting programming techniques.

Any new features that make it into Java or C# will only make the tutorials longer and the learning curve steeper. Not a good thing.

No, there are serious deficiencies in the language, and I've had to work around them in fairly lamentable ways. The only disadvantage of amending it (from my point of view) is that it will obsolete my work-arounds.

What sort of deficiencies? I think all in all java (the original spec) was a pretty well thought out design.

It's not like several other languages that have to go and add unicode support on later as an afterthought.

  new Thread()
    public void run()
       System.out.println("I'm in a Thread");
In C#:

  new Thread (Go).start();

  static void Go() 
    Console.Writeln("I'm in a Thread");
...C# isn't especially elegant either, but the general uncleanliness of inner anonymous classes is one example of Java's problems.

The C# version would actually be:

  new Thread(() => Console.WriteLine("I'm in a Thread")).Start();

Silly example though, as threads are silly.

Is it really silly? Almost all the code I write day to day is either multi-threaded or event-driven, so the above difference means a very real improvement in my quality of life. The code is simpler, more compact, and easier to understand at a glance months later.

This isn't the only difference, either. C# is never going to be as terse as a scripting language, but with each release they are examining common workflows and streamlining them. Java may be adding in a lot of new features, but the syntactic integration seems awkward at best.

The little things count for a lot.

Gosling didn't leave out features because he thought you didn't need them. He left them out because he thought you weren't smart enough to use them.

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan

I'm a Java developer - naturally I think Gosling (for the most part) drew the lines in the right places.

Well I don't know about that. There have been a few times that I wrote code as cleverly as possible because I couldn't find a simpler way. And then when I found defects later I was able to debug it, although that took a while.

When I write code as cleverly as possible it's easier to debug, 'cos I've played knifey-spoony before!

Some needed features were left out just because they were going to take a long time to get right, and he had to ship. http://blogs.sun.com/jag/entry/closures

It's not just about being smart. It's about overcomplicating things, making things harder to debug.

Did he leave out unsigned types because he thought we weren't smart enough to cope with them? No, I'd say he left them out because it makes everything simpler. If a programmer wants an unsigned type, he can do it himself.

Java has a lot of crap, actually. Take a look at Java Puzzlers sometime.

Is there a guide spelling out precisely what each of the proposed changes actually mean? I think I know what they refer to, but hard to be sure if my intuition matches reality from just a terse name. The Colebourne blog post does not contain any description or links for the item labels.

'Nullable types' doesn't seem something to be proud about: it goes in the wrong direction. Much better to enable removing null, like Scala and OCaml.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact