Out and ref was not a clean way to return multiple values - they are actually a pretty ugly way to return multiple values. (Tuple unpacking is the clean way, but that has only recently been added.) Out and ref was added because C++ API's had call by reference, and MS wanted to make integrating with windows API's easier. I suspect value types (structs) were added for the same reason.
That said, C# did end up a much better language than Java, especially with later improvements like generics and Linq.
This is an understatement, reading some of the antitrust documents you can clearly see that Microsoft was afraid that Java's ability to create rich programs that run regardless of OS would end up making Windows unnecessary since it wouldn't matter what OS you had. They saw Netscape as a distribution vector for Java and the JVM and was an important reason for why they made IE (one could say "and ActiveX" but that was already a thing they had anyway).
And FWIW i think they were partially successful in that their own MS Java did kill Java on the desktop and browser (the startup performance of Sun's runtime was also a factor, but the main thing i always remember developers being concerned around the turn of the millennium was compatibility with the VM that everyone had - the MS Java - both in terms of supported APIs and in terms of runtime performance - MS Java was way slower and contributed extensively to the idea of Java being slow).
Of course they failed to avoid making Windows unnecessary for a large number of applications, but instead of Java it was HTML, CSS and JavaScript. If that is a better alternative... well, i'm sure there are people who prefer it this way.
MSFT was even afraid of AOL, Oracle, and others teaming up to offer a home appliance (eg. a net PC) at low prices and undercutting the PC industry. Of course, those partnerships and alliances never did work out. Sun and Netscape hated each other, for example.
Microsoft was even worried Sony would "take over" the home since game consoles were becoming as powerful as PCs. Flash forward a few years: when I used my brother's PS3 in 2010, I couldn't believe how awful the browser was on such a powerful machine.
Hollywood and media companies were also afraid of Microsoft in the 90s. MSFT was making deals with Dreamworks, NBC (ie MSNBC), and others. It really did seem like MSFT had the cash to takeover the world and charge fees everytime a movie needed to be distributed. At one point, early on, Bill Gates suggested people would pay a nickel or dime to view a website.
Then, in the low 2000s, when .Net came out, there was a slide that compared the PC desktop to the WWW. MSFT wanted to offer APIs/languages/abstraction layers for the WWW that were analogous to the MSFT desktop.
The same paranoia people had of MSFT/AOL/Oracle, continues, but the names have change to different companies.
Ain't that the truth! The bitter irony is that a bunch of the Sun-hating Netscape programmers went over to AOL after the acquisition, just to be mis-managed into the ground by a bunch of "Alliance" managers from Sun.
https://www.cbsnews.com/news/aol-woos-netscape-employees/
>Case told the Netscape workers that after the merger is completed next spring, stock options will remain valuable, their sabbatical program will remain in place, and their corporate culture will remain intact.
>"Maybe you joined the company because it was a cool company," he said. "We are not changing any of that. We want to run this as an independent culture."
Pffff!!!
http://www.zdnet.com/article/a-year-ago-friction-behind-aol-...
>Netscape cancelled a project to develop a Java version of Netscape Navigator with Sun Microsystems Inc. because Netscape couldn't afford it, according to Kannegaard. Kannegaard's claims are at odds with the story Netscape told publicly about the reason it killed its so-called Javagator product. "It was explained to me that after Microsoft in their [Netscape's] words undercut their business, they could not afford to continue the project, so they had to reduce their engineering resources and cancel this project," Kannegaard said.
>That is not the story Netscape told the general public. According to a story in ZD Net's sister publication, PCWeek published Feb. 26, 1998, Netscape said it was pulling back on Javagator in hopes of getting help from Network Computer manufacturers such as Sun and Oracle Corp.
Meow!!!
https://www.cnet.com/news/aol-layoffs-slam-sun-netscape-alli...
>After the layoffs, iPlanet will largely be a Sun satellite. As of last July, only one-third of iPlanet's approximately 3,000 employees were from AOL, Sun Chief Financial Officer Mike Lehman said. Lehman has further said that Sun largely owns iPlanet's intellectual property.
Owch.
Oh, I agree with you there, but that doesn't change the fact that ref/out parameters were a much, much better than the way Java forced you to do it. I don't mean to imply that C# 1.0 was a good language even for the 90s, but it was a big practical improvement over Java.
I think C# 2.0 is the first point where someone could make the claim that it was actually a good language, at least for that era.
But i still prefer Java for simplicity and readability.
This is not viable. If I want to return e.g. an (error) code and string, the only Array you can put that in is an array of the root type (Object), losing all type-safety.
In C# and Scala multiple return values use a Tuple class, with some syntactic sugar to easy create and read them. It will eventually be in Java [1], it just takes decades.
It also has very little to do with the optimizer, there's not reason why the JVM couldn't support & optimize it.
Given C# designers, the goal was always to have a safe language, with enough features to go the extra mile in performance without necessarily being forced to use something else.
Something that Java designers are now catching up with, but we still need to wait a couple of years before Valhalla, Pananama and Metropolis are finally here.
Agreed: integrating with other languages was very important to Microsoft, but not to Sun with its "100% Pure Java" campaign.
See my other comment about that: https://news.ycombinator.com/item?id=16354176
That's both accurate and a little misleading. Tuples are ten years old, they were added in 2009/10. However, improvements in syntax and cleaner unpacking have been recent additions.
In general though ref and out have taken a back seat to Tuples for years now in C#.
I had always assumed that, initially, Sun was distracted by the Oracle acquisition. But there's also a philosophical / design principle in Java which tends towards being conservative about what features they add, for instance see this discussion thread [1,2] about adding a Pair class into java.util. Given the wide deployed footprint of Java across platforms, one can even sympathize with this.
There is also the central Java philosophy (which also influences the Pairs/Tuples discussion) that "names matter"[3]. I would argue that in my experience, in some contexts, especially in the server-side enterprise context where Java is very popular, names don't always matter, which is why developers keep asking for Pairs and Tuples and keep complaining about Java's verbosity -- because Java forces them to care about things they don't really care about (another great example is checked exceptions).
C# to me is like a "mirror universe" Java, where the underlying philosophy is to add features if they make a developer's life simpler. As a result, C# "feels" nicer to use and in the right hands can result in (subjectively) nicer code. In JVM land, this also explains why so many developers like Kotlin.
In reality, developers can write unreadable code in both languages. Although my main criticism of Java is that they probably shouldn't be that dismissive of Lisp, there are some good ideas there, as Kotlin has been demonstrating :-).
In any case, Java is now on a rapid-release cadence[4] where we should see more "features" added on a regular basis.
[1] http://mail.openjdk.java.net/pipermail/core-libs-dev/2010-Ma... [2] http://mail.openjdk.java.net/pipermail/core-libs-dev/2010-Ma... [3] http://cr.openjdk.java.net/~briangoetz/amber/datum.html [4] https://www.infoq.com/news/2017/09/Java6Month
Such structural grouping of values however went against OOP dogma at the time, which dictated that every type must have a name. Even after generics were introduced into Java, Sun refused to add even a pair class to the JDK (IMHO the bug report was amusing reading). Perhaps they were also similarly opposed to C#'s features?
You're passing along a variable which is then overwritten in the method to serve as a return value. Essentially just a somewhat formalized use of side effects.
multiple classes per file or partial classes in C# vs Java's one file=one class
Easy default way to build, debug and run apps
Familiar way to create GUIs
ASP.net (it wasn't perfect but hey) compared to JSP
No properties boilerplate
Enums
Visual Studio 2003 vs Eclipse or Netbeans at that time on the hardware at that time was no competition
That is what appealed to me back then.