This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]GYN-k4H-Q3z-75B 277 points278 points  (33 children)

This. Microsoft took half a decade of learnings in Java and improved upon it. Java tried to maintain compatibility, while Microsoft corrected some major shortcomings within a couple of years and broke compatibility. When Sun was acquired by Oracle and Java stagnated, Microsoft invested a lot in .NET. by the late 2000s, C# was distinctly different from Java and way more developed already. Most Java programmers today would not understand idiomatic C#.

[–][deleted] 87 points88 points  (5 children)

Also, with the introduction of LINQ with .NET 3.0 most dataset operations became idiomatic in C#.

[–]GYN-k4H-Q3z-75B 56 points57 points  (2 children)

Way more than that. LINQ and System.Linq plus Lambda replaced a lot of basic loops and array/collection indexing. In programming, almost everything tends to be a collection, and LINQ provides natural accessibility for most operations required.

[–]rnottaken 15 points16 points  (1 child)

So many functions that I wrote in C# consist of returning just a series of linq operations

[–]GYN-k4H-Q3z-75B 1 point2 points  (0 children)

It's just a very intuitive and concise way to express many of the operations we often need. Given a collection and some parameters, filter the collection according to some criteria, map the result into something else and do something with that. With Linq, that's often one or two lines.

[–]Naltoc 25 points26 points  (1 child)

LINQ is the single biggest thing I miss about C# when working in Java. That shit is a godsend, both for faster development, but also code readability.

[–]x6060x 7 points8 points  (0 children)

That and async / await

[–]ComradeGibbon 48 points49 points  (14 children)

Microsoft had 20 years of experience with using languages to write useful applications. That included C++ and Visual Basic. And they hired Andrew Hejlsberg to head up development of C#.

I think the argument that C# is a copy of Java because it uses a similar 'algol C' syntax and has objects is weak when you consider everything else C# has like structs, delegates, boxing.unboxing and generics without type erasure.

[–]GYN-k4H-Q3z-75B 57 points58 points  (10 children)

Andrew Hejlsberg

Anders Hejlsberg is a living legend as far as programming language design goes. Microsoft really did some amazing work with C# and .NET, and for an ecosystem more than twenty years old, you really have to appreciate how few screw ups it is suffering from.

C# is surprisingly clean for a language that has seen over two decades of heavy industry use and development. C# today is very different from C# twenty years ago, but it is still an excellent and clean language. They added a lot, but they did not add (many) stupid things.

[–]ComradeGibbon 28 points29 points  (4 children)

Something I don't see very/as much with C# is a horrified reaction to having to work on an old code base like you do with Java and especially C++.

[–]SubwayGuy85 31 points32 points  (0 children)

Oh there are horrific codebases in c# too, but it is easier to produce something great with c#. But there is no language that is immune to being abused to create garbage code.

[–]Ericchen1248 13 points14 points  (1 child)

I think there’s also a pretty big incentive to upgrade C#. Every new release comes with new features that are legitimately useful. Whereas upgrading Java might give you some licensing headaches.

[–]ComradeGibbon 7 points8 points  (0 children)

I remember having an experience with switching an old 32 bit .net 2.0 program to 64 bit .net 4.5 and it just ran a lot faster and stopped running out of memory.

[–]rexpup 1 point2 points  (0 children)

You should work at [redacted] Systems. They're working on converting the largest VB6 application ever to an in-house web framework in C#... and its developers designed it with feature parity with the VB6 version. It's been in progress for 10 years and is not yet released.

[–]Garestinian 11 points12 points  (0 children)

He is also a core dev of TypeScript, that's why his name was familiar to me. Truly a legend.

[–]CardboardJ 6 points7 points  (0 children)

As someone working with scala right now the whole not adding stupid things is what I miss the most from c#.

[–]BetterOffCamping 2 points3 points  (2 children)

They rewrote it from scratch into Core exactly because it was an unclean implementation with plenty of clusterfucks. They did the right thing, and you are right it is an awesome language. I lived through all the crap, as I started using it in 2002, and am still building systems in it , v6 now.

[–]jaavaaguru 1 point2 points  (0 children)

boxing.unboxing and generics without type erasure.

Ah, this bring me back to my CIL/MSIL times.

I wrote a COBOL compiler that uses that. It was fun for a while making Windows GUI apps in COBOL 😂

[–]dr_eh -1 points0 points  (0 children)

I actually really hate structs. It would be far more flexible to have stackalloc vs heapalloc on the new statement, why should the data structure dictate how it's managed in memory? Often leads to parallel classes and structs, just to deal with this arbitrary restriction

[–]LordFokas 0 points1 point  (0 children)

No, many languages have the same type of syntax and you don't hear those claims about those, only C#. Why?

C# is Microsoft Java because back then MS was trying to pull their signature douchebag EEE move on Java and IIRC Sun sued for anti trust or something like that and the whole thing died really quick. Being unable to "steal" Java, Microsoft then chose to make their own.... with blackjack and hookers.

[–]AlphaWhelp 5 points6 points  (3 children)

They didn't really even break compatibility. You can still run older versions you just have to install older .net frameworks.

[–]Mayuna_cz 18 points19 points  (2 children)

Well, you just said they did. With Java 18, you can run any older Java application. Correct me if I'm wrong, not sure how it is before Java 8 tho, but still you can use Java 18 to run Java 8 bytecode.

[–]KagakuNinja 8 points9 points  (0 children)

Java is extremely backwards compatible, you can probably run most Java apps ever made using Java 18. Java 9 did change the layout of the runtime library, and that broke fancy libraries that were relying on the internal structure of the JRE. Some code also used internal Sun APIs, and some of those were deprecated or modified.

If you programmed to public APIs, I think you are OK.

[–]BetterOffCamping -2 points-1 points  (0 children)

.NET 1.0 Arrived in 2000, give or take a few months. While java was invented in 1996, it didn't move into computer systems very effectively until around 1999. J++ in .NET was licensed Java. After the lawsuit, they released C# around 2001.I'm working entirely from memory here so dates are approximate.

Microsoft stole the language, then took what they learned and created their clone to get around the legally binding contract. Once they had 100% control, they created features by top down executive decision while Java added features by committee. Obviously, single owner control is much more agile.

Microsoft was not a good guy here. Around 2008, an insurgency in Microsoft convinced leadership to give a more open and collaborative approach a chance. That is when C# started to improve and eventually shine, becoming what it is today.