Comment by xigoi
2 months ago
C# is specifically designed for enterprise-style OOP, so if you want to avoid that, why use C# at all?
2 months ago
C# is specifically designed for enterprise-style OOP, so if you want to avoid that, why use C# at all?
You're thinking of Java, which is Enterprize Buzzword Compliant to the maximum extent possible.
C# is Java-but-with-lessons-learnt, and is significantly less verbose and "enterprisey" in typical usage.
Modern .NET 9 especially embraces compile-time code generation, a "minimal" style, and relatively high performance code compared to Java.
Even if the JVM is faster in benchmarks for hot loops, typical Java code has far more ceremony and overhead compared to typical C# code.
> Even if the JVM is faster in benchmarks for hot loops, typical Java code has far more ceremony and overhead compared to typical C# code.
Can you give an example? I don't think this is true anymore for modern Java (Java 21+)
It's a heavily gamed benchmark, but TechEmpower Fortunes is pretty good at revealing the max throughput of a language runtime for "specially tuned" code (instead of idiomatic code).
Java currently beats .NET by about 40%: https://www.techempower.com/benchmarks/#hw=ph&test=fortune&s...
I judge more idiomatic / typical code complexity by the length of stack traces in production web app crashes. Enterprise Java apps can produce monstrous traces that are tens of pages long.
ASP.NET Core 9 is a bit worse than ASP.NET Web Forms used to be because of the increased flexibility and async capability, but it's still nowhere near as bad as a typical Java app.
In terms of code length / abstraction nonsense overhead, have a look at the new Minimal APIs for how lightweight code can get in modern C# web apps: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/m...
1 reply →
How's modern Java in a game/sim scenario? C# has value types to reduce the GC load, for example. Do Java records close the gap there?
2 replies →
> C# is specifically designed for enterprise-style OOP
Then why would they add Span<T>, SIMD types and overhaul ref types in the first place?
Because some people wanted to use C# for low-level programming, so they added these things as an afterthought.
You’ve clearly never used it and have no idea what you are talking about.
6 replies →