TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why Java folks should stop looking down on C#: differences in similarities

60 点作者 pankratiev将近 14 年前

12 条评论

old-gregg将近 14 年前
Some Java folks are looking down on C#? I don't believe it :))<p>In my experience it's always been the opposite: C# guys have always looked down on Java folks. And rightfully so: the language itself is nicer, the standard library is much nicer, and the CLR+CIL are vastly superior to JVM, especially in memory management department.
评论 #2574562 未加载
评论 #2574109 未加载
评论 #2574206 未加载
评论 #2574436 未加载
guard-of-terra将近 14 年前
After reading about "Explicit virtual methods" I lost all my interest in C# forever.<p>I don't want this, seriously do not want. I don't want a language "with lovely features from C++". Explicit virtual, structs - please take those and leave me alone.<p>Lambdas are nice, some syntax sugar is nice, but not that creep.<p>Please don't take this as flamebait. I know a handful languages, I do backend development and I just absolutely don't need some language features and I fear that somebody would use them in their little library and would POISON the lifes of anybody who touches it.<p>Java has some "do not want" features too, like checked exceptions, but those are more or less solved these days.
评论 #2574494 未加载
评论 #2574705 未加载
评论 #2574451 未加载
tzs将近 14 年前
Considering that for the last several years nearly every significant improvement to Java has come from them copying from C#, if anyone should be looking down it is the C# folks.
评论 #2574131 未加载
评论 #2574061 未加载
评论 #2574357 未加载
评论 #2574356 未加载
评论 #2574588 未加载
MartinCron将近 14 年前
Once you hit a particular point in your personal/professional development, you'll stop looking down on just about everything.
rudiger将近 14 年前
It'd be tough to argue that Java is better than C# (the programming language). The benefits of Java come not from the programming language, but from the ecosystem, the JVM, the libraries, and the platform.
评论 #2574125 未加载
teyc将近 14 年前
Credit has to go to Anders Hejlsberg, who keeps innovating upon C#. Microsoft in this case has played to their strengths because<p>1) it does not have to worry about language standardization and the various community processes that accompany Java.<p>2) Anders is exceptionally good at deciding what language features are go/no go.
评论 #2574951 未加载
评论 #2575707 未加载
SemanticFog将近 14 年前
If Java could be redesigned from scratch, with no concern for backwards compatibility, it would probably look a lot like C#.
评论 #2574043 未加载
评论 #2575203 未加载
_Daniel_将近 14 年前
The author makes some fair points. Java generics are a bit clunky. C#'s more liberal application of autoboxing can be nice. Some other options for string literals would be helpful, especially for writing regular expressoins without a ton of backslashes.<p>Checked exceptions are not something that I'd happily give up. We do have unchecked exceptions (RuntimeException), and the JRE generally uses them where appropriate. But what about methods like Inflater.inflate, ImageIO.read, or Class.getMethod? If these didn't throw checked exceptions, we would sometimes forget to catch exceptions which should almost always should be caught. It would be a step in the direction of a weaker type system, unhelpful errors, and less graceful recovery.<p>Regarding initializers, we can do the same thing in Java by giving an initializer block to an anonymous class:<p><pre><code> List&#60;Integer&#62; L = new ArrayList&#60;Integer&#62;() {{ for (int i = 0; i &#60; 10; ++i) add(i); }};</code></pre>
评论 #2575567 未加载
Niten将近 14 年前
Too bad he didn't get into any of the stuff that really makes C# nicer than Java, in my opinion: lambda expressions and closures, LINQ, expression trees, dynamic typing, type inference, P/Invoke vs JNI.<p>Also the event / delegate thing makes C# really nice for GUI stuff.
评论 #2574241 未加载
评论 #2574599 未加载
thepumpkin1979将近 14 年前
Delegates + Events are another innovation in C#, is a much cleaner approach than Java anonymous classes + interfaces IMHO. I think anonymous classes are good in both compilers but Java is really missing a delegate/event standard system.
jschrf将近 14 年前
Suprised that reflection wasn't really mentioned outside of the concept of generics. Reflection in .NET (and C#) is extremely powerful and useful.<p>All those other things that people have already commented on like Lambdas, expression trees, events and delegates, are incredibly nice to have.<p>Here's the first thing I write when I start a Java project, followed directly by an abstract class based on it:<p>public interface ICallback&#60;T&#62; { public void Invoke(T state); }
评论 #2575098 未加载
jhpriestley将近 14 年前
I always enjoy these Java vs. C# threads. They are like dispatches from a world where there are only two, absolutely terrible, languages. It makes me happy that I live in a world where I can choose between dozens of languages, some of them actually decent.