4 ms·
I think the analysis leaves out the most important aspects for non-C#/.NET developers. My analysis: C#, the language: Pros: * The most elegant of this family
by alkonaut 13y ago
I think the analysis leaves out the most important aspects for non-C#/.NET developers. My analysis:
C#, the language:
Pros:
* The most elegant of this family of languages (statically typed curly bracket imperative).
* If you are coming from C++: C# is Feature rich but still not too large to make it "choose your own sublanguage" like C++ (yet). You can actually learn this
language from the inside out. There are few undefined implementation details and quite few quirks.
* The tooling is fantastic if you can agree to using windows and shell out some money.
Cons:
* It was designed to rival C++ and Java with a nice learning curve for C++/Java devs. If it was designed today, I think it would have a lot more modern/functional features built in such as tuple deconstruction, algebraic data types/pattern matching (instead of Null) and so on. Now when you use F#, C# feels old with its only half-decent type inference, null keyword and so on.
* Performance (This is actually more .NET than C#): While it can be quite performant, idiomatic C# is still often quite slow. Especially in the hands of non experienced developers. There are often hidden allocations and boxing calls that are hidden behind syntax sugar, that end up taxing the garbage collector (example: A simple foreach call often allocates an object which later gets eligible for GC). So writing high performance code is possible in C# but still very hard. You'll find yourself either making the code look like C (for example: arrays of structs rather than lists of objects which was the idiomatic solution), or simply calling to C/C++ for performance sensitive bits. In comparison to C++ for high performance code, I'd say C# offers free reliability/conciseness etc., and you have to struggle with perf. With C++ you'd get a lot of perf for free because idiomatic C++ is fast (array of structs may well be an idiomatic solution!), but instead you may struggle with leaks, overruns, token salad... Bottom line: C# can often be as fast as C++ but when it is, it's no easier than just using C++ because you have to make allocation free code basically (which is HARD, especially as an afterthougt).
.NET, the platform:
Pros:
* It feels like they looked at java and just corrected a lot of the problems. Sane dependency/versioning is just one example.
* The community is very much alive. Stackoverflow has become the center of it in later years.
* Frameworks evolve at a stunning pace. If you blink you missed two versions of ASP.NET MVC.
Cons:
* Same as above. Hard to keep up with things if you aren't working full time on it. The webpage you did last week is now two frameworks away from the latest
version. You spend a lot of time upgrading code to newer frameworks.
* The GAC is a horrible implementation of a good idea. The fact that you can't really use signing in a useful way without it also feels like a mistake.
* The free versions of everything (compiler, IDE, servers..) feel like second class citizens. You can't code up a prototype webpage in the latest framework and
expect it to run on an OSS server under linux. It's hard to know what subset of language/tools/frameworks actually work under e.g. Apache+Mono. A clear disadvantage compared to Node/Python etc.
* It feels like Microsoft has a bit of a weird relationship with .NET, or rather, it feels like the OS division of microsoft never really accepted .NET while it has stayed the pet of DevDiv. The worse examples has been the slow death of Silverlight (I can see how it should die, but the silence from microsoft has been remarkable). Now it also seems that MS don't really have a plan for how .NET should be a first class citizen for both desktop and "modern" application development under Win8, instead pushing C++. That to me is extremely worrying.