Posted
by
Unknown Lamer
on Wednesday September 14, 2011 @03:45PM
from the almost-as-good-as-lisp-circa-1990 dept.

An anonymous reader writes "Microsoft's Neal Gafter, who was primary designer and implementer of the Java SE 4 and 5 language enhancements and now works for Microsoft on .NET platform languages, discusses the impact of Oracle's acquisition of Sun on Java, makes the case for adding segmented stacks and a meta-object protocol to Java, and offers some insights into how Java and C#/.NET compare."
The first couple of answers meander a bit, but after that the interview picks up and is a pretty good read.

At least he explains why. MS has way more resources than Sun ever could manage. It surprises me that Java even got out the door, honestly.
Also recall that MS hired the best and brightest away from Borland a few years before the inception of.NET. And look, the best of them (Anders) architects C# now.

At least he explains why. MS has way more resources than Sun ever could manage. It surprises me that Java even got out the door, honestly.

Also recall that MS hired the best and brightest away from Borland a few years before the inception of.NET. And look, the best of them (Anders) architects C# now.

It might also have something to do that when C# turned up, Java was already a mature language and approached the various problems. Of course, if you do something later, you learn from previous attempts, so it couldn't be worse just from that fact. Since C# never aimed to run on non-windows, it's also not a fair comparison of designs, because the goals were different.

The MSIL output is loaded with calls to win32 and COM/DCOM..NET was designed for Java initially. When talks with Sun failed C# was made to run only on Windows and use the.NET API instead.

In essence it was made to quickly be a defacto.NET language tied with Visual Studio. Sure you can use Mono C# but what is the point of not using.NET? The reason why C# apps can't be recompiled on Linux are simply winforms by their very nature are abstraction layers of Com/DCOM. Add then threading and networking and it probably has more ties to things like NDIS and VMS/NT style threads and other nasties. You have to emulate Windows to get anything done.

Sure the spec is free and I think Moto (can't remember exact name) was made for FreeBSD that was an acutal C# compiler but it did not create MSIL or use.NET.

If free software advocates are serious they need to invent an alternative to.NET and some tools to make it competive before Mono can be taken seriously as a cross platform tool. Reinventing.NET and Winforms is a losing battle that will make many programmers switch to Windows and stay there for development costs.

If I remember correctly, the project was code-named Motor, and Microsoft partnered with Corel to release a commerical version of it.Didn't go very far.

The compiler did create MSIL (it was targeted for the CLR, and MSIL is the low-level assembly language of the CLR), and had the basic.Net libraries, which were much smaller then. This core is still quite portable, but it is a much smaller part of the the whole.Net platform now.

The basic point does remain, that there is a significant effort in bringing the w

Plain wrong. C# is a platform-agnostic language with a standards-defined specification. The CLR and CIL specifications are also 100% platform independent.

Agreed, but only in a theoretical sense and only if you're talking about the language specifically. Microsoft's.NET efforts were focused on Windows (at least until XNA and compact framework came along). That's reflected in the API and development tools (hello VisualStudio). You've got to think that Sun might have spent more energy on innovation if they

Not even Microsoft uses WPF. Why should Mono bother implementing something that's not their goal. Most of.NET code is business logic, back end, etc. with boring UI just like Java (up until they introduced Silverlight).

And Mono implements many things that Microsoft.NET does not implement. Language concepts are fully supported, APIs are not. Do I care about the Windows API on Linux? No, I care about GTK# bindings, Unix bindings, etc.

Kinda right, kinda wrong (I guess you might not be a developer or might not have been in the enterprise software field when Java and later.NET first emerged, which would explain why you don't understand the considerable limitations of.NET). What actually matters is the millions of lines of code in the libraries. The language and language implementation is meaningless in comparison. Basically the.NET libraries only work on Windows and Mono have essentially declared that some libraries will only ever work

The ECMA specification dates back to version 2.0 (in 2006, 5 years ago) and even back then, it didn't cover the whole standard library for C#, which is more important than the language itself. C#'s de facto standard library,.NET, is not standardized and has plenty of links to Windows.

The current version of C# (4.0, from 2010), has no standard defining it, besides its Windows-only implementation.

Since C# never aimed to run on non-windows, it's also not a fair comparison of designs, because the goals were different.

Plain wrong. C# is a platform-agnostic language with a standards-defined specification [ecma-international.org]. The CLR and CIL specifications are also 100% platform independent.

You honestly think that Microsoft never making a non-windows part of the VM wasn't part of the Microsoft intention to make it a Windows language? The reality is that C# IS a Windows language. You're either very

Erm, great - so where's that 100% compatible version of the CLR and libraries that can seamlessly run any.Net app built making use of the 'official' libraries on windows, linux & unix (x86, x86-64, ARM variants of both),

Oh, right. Java is still the only place to get that. If you build using standard.Net 3+ libraries, you're limited to Windows platforms. At least you'll get ARM architecture back under Windows 8...

The CLR and CIL specs were submitted for standardization for PR purposes only. If they

At least he explains why. MS has way more resources than Sun ever could manage. It surprises me that Java even got out the door, honestly.

Also recall that MS hired the best and brightest away from Borland a few years before the inception of.NET. And look, the best of them (Anders) architects C# now.

It might also have something to do that when C# turned up, Java was already a mature language and approached the various problems. Of course, if you do something later, you learn from previous attempts, so it couldn't be worse just from that fact. Since C# never aimed to run on non-windows, it's also not a fair comparison of designs, because the goals were different.

I've been a Java/EE developer for the last 12 years, and Java has given me a good way to put food on the table, but even I have to say that this is just not true, and that is not the case here. C# has become a superior language over Java because C# has been lead by more pragmatic PL designers than Gosling ever was. Not to take away from Gosling's genius, but his major contribution by now has become the VM, not the primary high-level language running on top of it (Java.)

Sun had lots of capital in the 1990s and made billions in revenue when Java was in development. It was before NT slaughtered them and before the great recession and when Wall Street had faith to invest in Sun. I think Java was very well designed for its time in the early 1990s. Sun's obsession with making sure it had to be run on a VM with no executables killed it. Sun wanted software to run on Solaris more than having it mult-platform in a successful way, as many would write java programs but make sure the

Java and.Net (that's.Net the runtime library, not ASP.Net or any of the confusing array of other stuff called.Net) have been leap-frogging each other for a while now. C# with.Net 4 was "everything in Java 6, and some better stuff". I hope Java 7 is "everything in.Net 4 and some better stuff", but I haven't studied it yet.

Certainly the competition between these languages has been great for developers using either!

Java will exist as Cobol exists for many decades on crappy intranet apps for IE 6 and for newer mainframe and as/400 apps. I learned true object oriented programmimg on it after I had issues with C++. Java takes millions of lines of code to get anything done in any moderately complex web apps vs PHP and even ASP.Net.

It is a shame as it hurts Linux, but many companies are willing to drop down $100,000 in licensing fees for IIS, SQL Server, and Windows Serve

Java will exist as Cobol exists for many decades on crappy intranet apps for IE 6 and for newer mainframe and as/400 apps.

What does IE 6 has to do with intranet apps, COBOL or Java? And what's wrong with enterprise computing in big-iron hardware? And who the hell develops in AS/400 anymore? Do you really know what you are talking about?

I learned true object oriented programmimg on it after I had issues with C++.

Strange, I thought one learned OO modeling (not just programming) on a language agnostic way. Also, as a person has worked with C++ (and C) and Java and other OO and non-OO languages, this statement makes no sense to me at all.

Java takes millions of lines of code to get anything done in any moderately complex web apps vs PHP and even ASP.Net.

Java will exist as Cobol exists for many decades on crappy intranet apps for IE 6 and for newer mainframe and as/400 apps. I learned true object oriented programmimg on it after I had issues with C++. Java takes millions of lines of code to get anything done in any moderately complex web apps vs PHP and even ASP.Net.

It is a shame as it hurts Linux, but many companies are willing to drop down $100,000 in licensing fees for IIS, SQL Server, and Windows Server over free Linux and Java because of the productivity gains and pro MS inertia by the MBAs in I.T. departments.

Me I am ready to abandon Java on a website I am creating and I am seriously considering C# or PHP if licensing is too expensive. There is no need to start a new project in Java as it is like starting a new project in cobol. Why?

This is a clueless post.

Indeed. It has 'i-know-only-makes-little-web-appz' written all over it.

* Better tooling support (ant, maven, grandle, open source plugins),* free IDEs (Eclipse, Netbeans, IntelliJ, for C# you only have VS),* more open source libraries, and more active open source community* simpler language that doesn't change with each version,- checked exceptions- no struct/class- no op-overloading* it's cross-platform (I can run my applications on all Windows versions, all Linux distributions, on MacOS and on the BSDs if need to, while developing exclusively on Linux).* support for multiple

I would add that.NET has much better multiple language support as Scala and Jython are not mature as Lambda is going to be added in Java 8 officially. Iron Python is python for.NET and I believe more languages too have.NET support. That makes it sweet as anyone with a different language can share code as one executable with.NET. Some people were hoping gnome shell 3 would be.NET based a few years ago on Mono as it would help multiple language support and finally give C# apis so it is

> VS is effectively free. You only pay for the professional version which isn't needed by most people. There's also MonoDevelop though it's not at the same level.

Yes most stuff from MS is "effectively free". But you are always a second class citizen if you use the free stuff. With Java and Linux I have the first class software for free, the same software that Google, Amazon and FB is using.

For me it's more psychology. If I use the crippled versions, I always feel that I'm missing something and always to

My feeling with MS stuff was always that I'm a second class citizen, only because I don't have money to buy the full version. Yes, the limitations are not "unreasonably" but they are in place. You always have the feeling in the back "and if I build something awesome, I have to buy the full version". Or "in the end I have to buy the full version anyway".

What me struck with Linux was that I have all the enterprise ready tools and all are free and without any limitations. Lampp server, email server, Java EE se

I gather he drank the kool-aid when he went through the door. I'm halfway through the interview and its basically ".NET is better than Java"

.Net was designed after Java, and with Java's mistakes in mind. Java has.Net beat on cross-platform functionality, but that's about it. Personally, C# just seems a cleaner language, and a has a MUCH cleaner API.

I gather he drank the kool-aid when he went through the door. I'm halfway through the interview and its basically ".NET is better than Java"

Java and Lamp's advantages have more to do with deployment simplicity then quality of language. C# is a better language, but there's so much more to a development platform then the language or even the VM. With PHP you can just open the script in any text editor and change it without having to recompile. Java has a much more robust open-source / Linux deployment scenario compared to Mono.

Having used PHP, C#, and Java, I'll gladly state that even though C# /.Net is the best language and VM; Java and Lamp ar

I gather he drank the kool-aid when he went through the door. I'm halfway through the interview and its basically ".NET is better than Java"

Java and Lamp's advantages have more to do with deployment simplicity then quality of language. C# is a better language, but there's so much more to a development platform then the language or even the VM. With PHP you can just open the script in any text editor and change it without having to recompile. Java has a much more robust open-source / Linux deployment scenario compared to Mono.

Having used PHP, C#, and Java, I'll gladly state that even though C# /.Net is the best language and VM; Java and Lamp are often a better fit for what people are trying to make.

Bingo. Finally someone who summarizes the Java/C# state of affairs rather well. I've been doing Java for so long (and tired of its verbosity) that I'm just enamored with C#'s way of doing things. It is simply a better language. But as you said, language itself is not the only factor to take into account when creating and deploying solutions.

I cannot say that Java and LAMP-based solutions are often a better fit for what people are trying to make (since I've seen truly large scale MS-based solutions that w

Why does that require drinking the kool-aid? It's actually the truth nowadays.

Java has stagnated in recent years, not least because of the Oracle takeover of Sun..NET has kept moving at a better pace, and because of that it has left Java behind in a few areas. It also had the advantage of being built after Java such that it could avoid some of Java's shortcomings in C# - operator overloading, cleaner method of integrating unmanaged code etc.

I do crossplatform stuff on Java every day, literally. And I'm not even making any effort to do so, in fact I have never experienced a situation where the OS made any difference. Which isn't saying that differences don't exist, just that they're tiny. It's also not saying that the software is necessarily cross-JVM compatible (different vendors), but that's hardly surprising.

Pedantry, but there was no Java SE 4. Confusingly it is Java2, version 1.4. Then they went to Java 5, 6, 7, but kept the internal version number as 1.5, 1.6, 1.7, and it's still "Java 2 platform, standard edition".

Pedantry, but there was no Java SE 4. Confusingly it is Java2, version 1.4. Then they went to Java 5, 6, 7, but kept the internal version number as 1.5, 1.6, 1.7, and it's still "Java 2 platform, standard edition".

Yeah, but with respect, while Slashdotters may be pedantic on occasion (and gratuitously so), you can normally argue that there *might* be a point.

Whereas Java's stupidly inconsistent naming and numbering scheme over the years reflects nothing more than a succession of pointless changes made by stuffed shirts in marketing to justify their jobs, cosmetic changes for changes sake that did nothing but confuse things. (*) Actually worrying about the "correct" nomenclature when everyone knows what is meant see

I've had several nasty experiences with Java, and while I am onboard with the concept and will support java initiatives in the enterprise.. the stunts they have pulled over the years does not help. Not at all.

And yes, if you are 'in the know' then you are FINE. If you are not, or are not technical.. it's really confusing and does not help when presenting technology options to a bunch of PHBs.

So, I'd mod leenks up.. this is a good point to discuss and is very relevant. Consid

The Ruby/Scala/Python/Erlang/Hipster crowd wants closures, and they're the most important thing in the world. Oh and operator overloading. Oh and no checked exceptions. See other languages don't have those things. And we want all languages to be the same. So Java needs those things.

All this engineering mubmo jumbo about segemented stacks is for weenies. Languages Features are the most important part of a language, how it runs isn't important anymore.

Yeah i am still waiting for that. And after scouring through message boards, old blog posts/interviews from java designers of old and looking at other people wanting to do the same thing, the reason that java still does not allow or never intended you to overload operators? Simply because they say so and that's that. That's not a very good way to handle things in my opinion. Is the '+', '-', '*', '/' etc good enough for most people? Sure. Obviously if you just search 'java overload operators' you will clear

Java was designed to be cleaner than C++ and easier to develop and read. Operator overloading can be abused just like pointers and casting. What Sun did was write down a list of things bad in C++ and make sure they were gone in Java.

You can use pointers and casting in Java, but you need to use the api to do it for you.

How is operator overloading any worse than creating a member function that does something contrary to what the name says? Eliminating something entirely because someone could do something wrong is idiotic.

I don't know D well enough. What I saw it was nice.I've programmed quite a bit in Prolog, and it has custom operator precedence, and I think it has it's place in creating DSL-s, but I don't see it's value for general purpose programs. Also, Prolog has Lisp style macros, and it can make things much harder to understand, when used liberally.

Also, Java is simply a good enough enough language. And in it's time it was pretty innovative (i.e. stealing for the right places and packaging it nicely). C# is awesome,

What Sun did was write down a list of things bad in C++ and make sure they were gone in Java.

I feel operator overloading is one of those features that is mis-categorized as being fundamentally bad when in fact it was only temporarily bad. I suspect that a lot of people got giddy when the feature was popularized by C++ and wrote a lot of bad code as a result, but with time and maturity people have learned how to handle this feature sensibly. My evidence? C# supports operator overloading and I've never seen

Java has operator overloading it's just taken away from the programmers. String concatenation with + is done through oppressor overloading. Unfortunately the java designers think no one else should be able to do so to stop them from doing.bad things. But then again these are the same people who develop the jvm which is doing its best to pass flash as being the most exploitable piece of software running on your system so maybe they aren't the best to be.lecturing others on bad practices.

No, the + operator implies commutivity. Not all do. Division doesn't. >, >, don't. I agree that you shouldn't use + for string concatenation because it isn't commutitive, but there's no reason other operators can't be overlaoded, or that + couldn't be when the result is commutitive.

You're right, strictly speaking, but what I was referring to was commutivity of the algorithm, not necessarily the result. You want to know that whatever decides (a gt b) is also going to decide whether (b gt a).

the reason that java still does not allow or never intended you to overload operators? Simply because they say so and that's that.

The reason Java does not allow operator overloading is to make it harder for rookies to shoot themselves or others in the foot. Same as Java's typing; duck-typing is more powerful, but more subject to pebkac errors.

but there are a lot of things besides operator overloading that can shoot you in the foot. Do we scale down the language to the point of developers not having to debug their errors or perhaps no mechanism for a program to even crash? If you are a rookie there is no way to put a value as a noob to a language making mistakes, debugging your code, stepping through it, finding the errors and learning from your wicked ways.

Do we scale down the language to the point of developers not having to debug their errors or perhaps no mechanism for a program to even crash?

Not in all cases. There is a time and place for a language like that. Squeak comes to mind; an outstanding environment in which to start kids off with programming. But I don't think most production languages should be like that.

I think production languages should run the spectrum from Squeak to pure Lisp (or whatever is on the "OMFG that's peculiar and powerful" end o

to make it harder for rookies to shoot themselves or others in the foot.

It's amazing how few geeks understand why this makes Java so successful. So many languages are written for the right tail of the programmer-quality bell curve, while Java aims for the large area in the middle. That, and it works reliably - one time I ported a network analyzer to Linux using JNI and the damn thing just worked.

Compare to Smalltalk - once you decide that everything is an object, you pretty much have to either support operator overloading, or not support operators at all.

Java on the other hand has both primitive and object types, each with a distinct set of operators. That is, aside from the awkward case of '+' for string concatenation, and the effects of auto-[un]boxing, and maybe some other bits and bobs I've forgotten about.

But note that the operators provided for primitives are all 'numbers'-related, since the

please give me the link where they gave a specific reason other than "because that's the way we wanted it". you want to know what i read straight from gosling about this very subject? How about look at this interview with Gosling himself [thehill.com].

And i quote: "There are some things that I kind of feel torn about, like operator overloading. I left out operator overloading as a fairly personal choice because I had seen too many people abuse it in C++" - In other words no operator overloading because he himself d

they worded it differently but Gosling was less mysterious. It is clear that Gosling had a "personal choice" about not including operator overloading based on C++ mechanism that he saw were bad things. His personal choice can easily be converted down to what i said at the top of this thread. No operator overloading allowed 'because i say it isn't good for you and because i say so'. That, as I said before is not the right path to go down. Software developers should learn when to use a part of a language and

Yes a very stupid reason since they overloaded the + operator themselves. Apparently they are the only people who are allowed to do so bring such gurus. Especially since it's just as easy to do the same bad things with regular member functions as can be done with an overloaded operator.

I lost ALL interest in developing in the java platform (certainly a painful decision as it was my weapon of choice), I truly belive Oracle will be harmful to java, they will twist everything that's good about the platform for the sake of near-sighted business. They are the new AOL (remember winamp?), they will kill every piece of code in the sun ecosystem that depends on the community to survive. They just dont get it.

Please, you are just spreading FUD and garbage just to stir crap up, so shut the F up. The only way Oracle can be harmful is to simply not update Java. It's GPL'd, so Oracle can't close it off. Please educate yourself.

You know it is frustrating because if Java looses so does Linux and Windows wins and becomes more entrenched. Php is the only choice left and web servers are the only servers left running Unix as Windows is eating up everything else in site.

I like to daydream what an alternative universe is like if the DOJ got their way and split MS into 3 companies 12 years ago. C# and.NET are really great and if they existed on Linux the world would be a better place. If they were split my guess is today we would have la

I hear there's this new thing called mono that brings c# and.net to linux.

You really only just "heard" that of this "new" Mono, or you were just being so wittily sarcastic and implying that it's a good solution?

It's a great solution!... If you don't mind it being condemned to being perpetually behind the curve, that is, catching up to Microsoft's current version and almost getting there (if they're lucky) around the point that MS release the next one, which they- of course- have a head start on.

And if you don't mind all the bits that are- in the real world- needed for compati

mono brings a partial (and buggy) implementation of.NET to linux, that no corporate IT department will let near their systems because it is practically impossible to get any meaningful support for, and is not endorsed by MS as a.NET implementation. Wake me up if that changes.

The guy seriously thinks about some hanging-on-by-bleeding-fingernails edge case stuff.
I just don't see it being relevant to any real world situation.
From the part where he says "I work with compilers..." and, you know, just do int i = 1+1+1+1 a few thousand times... and it will blow the stack. Help me understand why anybody cares if that doesn't compile?

Here's the quote (emphasis added):

I work with compilers and it's easy to crash the Java compiler just by writing, you know, int i = 1+1+1+1 and just do that a few thousand times. And the semantic analyzer will be trying to analyze that, or the parser will be trying to parse it and it will just blow the stack.And what happens is, the process crashes.
You know, there's no good recovery from that. And you can fix it by [saying], "Well, we start over again but I'll just allocate more stack". The problem is, you can't necessarily know ahead of time how much stack to allocate to any given thread.

People don't write that kind of stuff, it's still an issue from a VM design standpoint because in some cases code geneneration tools might. This can be frustrating and/or introduce extremely difficult-to-trace runtime bugs into your system if, for example, your framework du jour does runtime code generation/modification deep under the hood in order to implement AOP or a scripting language or something.

Segmented stacks is an implementation issue. Java on z/OS has had segmented stacks from the very beginning because it runs on LE (the z/OS Unix layer) and that's what LE does.
You still have a problem with thousands of threads though because you have to choose an initial stack segment size. Too big and you still consume loads of memory, too small and there is an overhead associated with crossing the segment boundary (e.g. page fault).

Java has its place. If I had to do a quick-and-dirty application I'd probably throw it together in Java SE/Swing, provided that it doesn't have to work with the bare metal or do lots of computational heavy lifting. That said, Java was the first real language I learned (I did lots of VB6 back in my teen years, but I don't want to even speak of the coding abominations I built with that) and looking back on my earlier long-term Java projects there's lots I would have done differently. (or used C++ and QT inst

I'd be careful with compiler-only changes to Java. Given the proliferation of frameworks that do dynamic magic with the VM, the VM should in many cases be altered. I may remember the exact details of the below slightly wrong, but you get the point.

In Java there are basic types and classes, and there are equivalent basic types and class. There is bool and there is Boolean. People got a little tired of boxing bools in Booleans and unboxing, so Sun added auto-boxing and auto-un-boxing. When writing code, my bo

I am not sure I agree that it is backwards compatibility Sun has been aiming for, it is more like forwards compatibility. Future Java should function on past JVMs. I am not sure that it is in anybody's interest to be that meticulous. Software should be forcefully updated regularly. Best way to do that is to break compatibility. Now, on the other hand, Microsoft in general have spent significant resources on backwards compatibility. More so than most, but with some very public divergences. Hell, you can stil

Disclaimer: I'm experimenting on a Java compiler with reified generics. It seems to be possible to have reified generics on the current JVM, but it's neither pretty nor quite as powerful as in.NET.

You have to mangle type names - just storing type arguments in a variable is not enough to make inheritance work correctly (so you can inherit both from IList and IList interfaces, for example). And if you open the name mangling can of worms then you have a whole lot of problems:1) When should be parametrized cla

Sun wanted generified *and* non-generified code to coexist and interoperate on the same JVM, without requiring two different code bases. Apparently it was important to their customers of the time. That's why they chose type-erased generics, IIRC.