Why did Microsoft create C#? Wasn't Java good enough in the 1990s?
quora.com
quora.com
I think much of the difference comes from the nature of the language designers and the timing of the language's creation. Joy had the handicap of going first, and Java has some choices that reflect that. Hejlsberg got to look at the weakness of Java to make C#. Overall, I think the practical approach to C# makes it a more useful language than Java, where Joy has some definite philosophical baggage he's carrying around that is reflected in Java.
Note we're talking a fairly fine gradation here. If you need to work in either, you're not slumming.
My work computer has Java 9, .NET 4.7.1 and C++17 compilers installed.
Usually I get to deploy on Java 8 (only allowed last year), .NET 4.5 (as of last year) and C++ enterprise code looks mostly C with C++ compiler.
So I don't mind the slow pace, given that I can only use the very latest features on private projects.
This seems to be the dirty little secret of C++ programming. It seems any corporate site that decides to go serious with Object Orientation also decides to do Managed Memory, and switches to Java or C#, and lately maybe even Go.
Apparently they're now moving to a 6-month release cycle.
Not only that, but Sun actually had a culture of refusing to look at what other companies like Apple and Microsoft had done because of their pre-conceived notion that it was inferior, and proudly scoffing at and ignoring other technology instead of carefully studying it and learning from its strengths and weaknesses like Microsoft shamelessly did.
When I worked at Sun in 1990, Macs were considered useless toys (while PCs were considered useless, but not fun enough to be toys), and you had to get special permission to bring a rented Mac into the building to work on -- they wouldn't buy them, so you had to buy one yourself and keep it at home if you wanted to know what Apple was up to.
And then Apple supplanted Sun as the biggest Unix workstation vendor on the planet, pretty ironic!
Back in the 90s I did most of my Java on Mac, using the excellent Metrowerks Codewarrior environment. It was considerably more productive than NetBeans (or whatever it was called then, I forget) on the Ultra-10 I also had on my desk. Writing was on the wall for Sun even then...
Netbeans was always called like that I think. I just remember before version 3.0, the UI was quite different, and there was this strange concept of having to mount directories to see them on the IDE.
So Sun's JNI and applet web browser integration languished while Microsoft integrated COM and CLR for seamless interoperability with the web browser and other languages like C++ into Java and CLR.
Sun also had an unholy obsession with code generation, since their attitude was to breed as much 100% Pure Java Code into the world as possible (see AspectJ, JAXB, etc). While C# took a much better approach of supporting code annotation and metadata and reflection and bytecode generation at runtime so you didn't actually have to generate and compile a huge pile of boilerplate source code (see PInvoke).
https://docs.microsoft.com/en-us/cpp/dotnet/how-to-call-nati...
Even the Go crowd has made the first step towards quantum computing, leaving behind errno in favor of returning both a possibly invalid return value and an error that can be nil and non-nil at the same time! ;-)
First, the backwards compatibility is a key feature. You can open a project written several years ago, and add a new feature to it using the latest language syntax without being forced to rewrite all the old code.
I'm not quite sure about stock visual studio (since I don't use it), but Resharper (and their new Rider IDE, which I've played with a bit) is pretty good at highlighting code doing things the old way and even automatically rewriting it for you. This seems to be getting better as they take advantage of what the Roslyn compiler can help with.
.NET Core, native, and the work of Xamarin only means more cross platform support, which allows broader use beyond just the Windows world. The ecosystem is starting to get caught up now, and between most popular libraries being available and the feature parity reached with .NET Core 2.0, things are looking great for it to grow even more popular.
As a sidenote: Microsoft actually willfully copied some of those to their side, too (e.g. covariant arrays).
Having worked with C++ (which has its own set of problems, of course), I repeatedly find language design decisions that strike me as inelegant hacks in both of them (getting rid of `const`, for example).
From today's perspective, I'd say that the biggest contribution both languages have made for the future are their respective runtimes and that they allow new languages to adopt those (Clojure, Scala, Kotlin, F#...) without having to throw away all of your codebase at once.
I'd say that's true of the JVM, where independently developed high-adoption languages Kotlin and Scala have flourished, but not so of the CLR, whose only "new" language of any import is F#, developed by Microsoft themselves and kept in step with C#.
I'm glad they don't throw everything and the kitchen sink into Java. There's so many keywords in C# that are really not necessary, yet you need to learn them, because you can be sure, you'll run into some codebase where some advanced C# dev used all of those features anyways. This is the reason why people find C++ intimidating and why there's probably hundreds of unofficial subsets of it, which are supposedly better.
It slows down people who are new to the language, is annoying for people switching back and forth between languages and adds additional mental complexity even for people who frequently use the language.
And as for the IDE, that may be true, if you happen to like Visual Studio (and don't want to dev on Linux), but if you don't like it, then your options are rather limited.
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.
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.
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.
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#.
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
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.
That is what appealed to me back then.
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
They created C# because they wanted a native language for their .NET runtime that integrated seamlessly with Windows. It was obvious that cross platform runtimes were going to be the future and Microsoft couldn't depend on an outside company to drive the technology platform they would be relying on.
Only the companies that are willing to sponsor ANSI C++ work, do have anything to say to what happens to C++, same applies to any other ANSI language, including C.
https://www.youtube.com/watch?v=ZYw3X4RZv6Y&feature=youtu.be...
I always thought that prior to C# 1.0 being released, the Java language was stuck. There was no generics, annotations, enumerations, for/each loops or auto boxing which made programming in Java not only painful but dangerous (especially with the lack of generics and for/each). I personally, never considered anything before Java 1.5 "good enough".
I was always under the impression that these language change were in response to what C# and many of these language concepts were practically copied from C#. Is this actually the case?
https://stackoverflow.com/questions/31693/what-are-the-diffe...
https://stackoverflow.com/questions/355060/c-sharp-vs-java-g...
http://www.jprl.com/Blog/archive/development/2007/Aug-31.htm...
http://www.artima.com/intv/generics2.html
https://blogs.msdn.microsoft.com/ericlippert/2009/07/30/what...
http://pizzacompiler.sourceforge.net/
But then only part of it was taken back into Java.
It is an open platform. You are just as productive as a developer on Unix and Mac OS X as you are on Windows. The "toolchain" with things like Maven, build and dependency management, is well-defined and not buggled into a big IDE like it is on C#.
Deploying on Unix is a standard thing, not an experimental feature. And finally there is Android.
Sure Java as a langage is more conservative but the differences are not that big. And there are alternatives like Scala or Kotlin for those want and they seem to be a minority.
How is that any different from .Net core? Open platform, check (1) productive on those platforms, check (2)
> buggled into a big IDE like it is on C#.
Nope. dotnet cli is fine standalone (3)
> Deploying on Unix is a standard thing, not an experimental feature.
Um, it might be fairly new but I would not call that platform target "experimental" any more. It's in version 2 now
> And finally there is Android.
Yes there is. I know teams that write in C# for Android and iOS. (4)
C# is late to the party in this regard. But what you are saying isn't correct.
2) https://code.visualstudio.com/
3) https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet?ta...
Can I run Visual Studio on my macbook? Does any of the companies developing webapps in C# actually deploy on Unix?
MS might aspire to have that broadness of platform but it is not actually there. It is in the Java world.
Visual Studio Code, yes. People do that. I see it at my employer.
But ultimately it's not tied to a particular IDE. You could e.g. use JetBrains Rider (1) on your mac. You could use the likes of Sublime text, the command line tools and a plugin (2) if you want.
> Does any of the companies developing webapps in C# actually deploy on Unix?
Some of them do yes, and more of them will. AWS Lambda functions too. (3)
I see both of those (.Net core web apps and lambda functions) at my employer.
> MS might aspire to have that broadness of platform
Correct, this a fairly new aspiration
> but it is not actually there.
You know, it's ok to say "I don't actually know that particular technology very well, I'm not keeping up to date with recent developments in that space." Nobody tracks everything. You don't have to make strong statements about things that you don't know much about.
1) https://www.jetbrains.com/rider/
3) https://aws.amazon.com/blogs/developer/aws-lambda-net-core-2...
I didn’t want to go into a detailed argument. Just look at the broad lines of what happens in practice. On one side you have a diverse environment with different development machines, deployment machines and so on. On the other side you don’t have diversity. It is as simple as that.
But did you miss the three other development options listed for .Net on mac? : Visual Studio For Mac, Jetbrains Rider, and bring your own editor.
> didn’t want to go into a detailed argument. It is as simple as that.
Things are usually only simple from a distance. How much time have you spent up close to .Net in the last 2 years?
For my part, I have spend no time close to Java lately, and that is why I don't hold forth strong opinions about Java: because I would be a fount of ignorance. I'd rather listen to those who have more experience with it.
> On the other side you don’t have diversity.
That might have been universal a while back, but it really is not any more. Facts have been laid out above and you keep repeating your assertion. It's just prejudice. Is this something that you want to be true?
Look, the .Net ecosystem is changing for very valid reasons, and in a great direction. It has changed a lot at a sustained pace over the last few years, and that will not stop. Some employers and industries have not changed yet, and that's fine, many places are happy in their niche, be it .Net and Windows or Java and Linux. However your universal assertions are outdated, and will be increasingly irrelevant.
There is Visual Studio For Mac [1], though I'm unsure how it compares to Visual Studio "proper".
Kind of.
First Google pulled an old style Microsoft move, by only implementing what they cared about.
With Android Oreo, they finally added proper support for most of Java 8, but given the fragmentation history, one only gets to use it fully when targeting Oreo or better devices.
Then now with Kotlin adoption, their silence on Java 9 support and the 6 months release plan for Java, I have this feeling Android will be stuck at the current level of Java 8 support.
I suggest you update your knowledge before spreading blatantly incorrect information like this.
- Boxing
- annotations
- StringBuilder
- LINQ
- var (coming with 10)
Edit: this is not correct. My bad.
Java annotations started to be discussed in 2002, with JSR-175, finally delivered with Java 1.5, released in 2004.
So how come it is a Java innovation?
http://www.dotnettricks.com/learn/linq/understanding-express...
A Linq expression can be translated at runtime to allow the same code to be tranlated to Sql for an RDMS , MongoQuery, or anything else that you write a provider for.
Both the languages and platforms are very good. But right now there is more influential OSS (HBase, Cassandra, Kafka and many others) stuff in Java. However, I wonder with Oracle's new stance, if C# will become the preferred language for Open Source. Or Maybe Go will leave both Java and C# behind.
The bi-annual releases aren't for companies to upgrade to every 6 months but for power users who like to experiment and try out new bleeding edge features. Same as with Ubuntu releases for example.
Without generics, GUI toolkits, good quality SQL drivers from the vendors themselves, enterprise frameworks and the IDE quality of Java and C#, Go will never be an actual threat to them.
Go 2.0 might be, if it ever happens.
According to Wikipedia [2] same period for JDK 7 to JDK 8 was 1 year. Also on the same Wikipedia page, you can see how many bugfixes JDK 8 received in that 1 year.
So JDK8 to JDK 11 release is also going to be a little bit risky as people will need to depend only on 3-4 months stability reports to upgrade their production deployments to JDK 11.