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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Switching from C# to Java

31 点作者 amitshah大约 15 年前

6 条评论

rit大约 15 年前
Totally reactionary, prejudiced statement.<p>But my first reaction on headline before reading the article was "Ugh. I'm sorry". (I will read it in a second, I felt this obdurate urge to rant BEFORE I read it).<p>I coded in Java for work (After being hired to do Java) for years, then went over to Python, and worked with some C# for about a year. Now I'm back working with Java, and Scala (for which I have lots of love - it has a lot of what I love about Python but in many cases better).<p>There are little things in C# that just really give it an edge over Java. Among other things relating to Generics (Which are awful to begin with in that the JVM currently erases type information at compile time [Scala has a few clever hacks to get around it]) - as I understand it, C#/CLR automatically generates multiple specialized paths for all possible primitive types with generic collections.<p>And being a fan of closures, anonymous functions, etc. Java is just painful. C# has these, and more.<p>Now Off to read the article :)
评论 #1261652 未加载
评论 #1261643 未加载
评论 #1261629 未加载
bruceboughton大约 15 年前
I can understand porting C# code to Java code, but what I don't understand and what the article doesn't explain is how they handled their dependencies, i.e. System.* libraries.<p>They clearly didn't port the CLR libraries to the JVM, so they must have modified their code to work with Java libraries, e.g. Swing, etc. To me, it seems like this would be the bulk of the work, not language translation from Java to C#.
评论 #1261584 未加载
Tichy大约 15 年前
How does the converted code look, though? Is it viable to continue working on that, rather than fixing the original C# code? (Ie comments would be carried over in the conversion).
评论 #1261943 未加载
tzs大约 15 年前
It sounds like they rejected Grasshopper, the .NET to Java converter that works at the bytecode level, without doing a test to see if it would have worked, on the grounds that they wanted to be open source.<p>They probably should have given it a try, because if it had worked, it would have opened up a possibility that they seem to have completely overlooked. Use Grasshopper to convert at the bytecode level, then use a Java decompiler to go from bytecode to Java source.<p>You'd lose comments in the source code that way, but I bet it would not be hard to write a tool to transfer the function level comments from the C# source to the Java source. Subsequent hand editing to translate any C#-isms to Java-isms in the comments, and restore any crucial sub-function level comments, would probably have only taken a few days.
CWuestefeld大约 15 年前
As with many HN articles, the headline is misleading. Really, the language switch is a symptom, and not the driver of the decision.<p>From the article, their requirements included:<p><i>one of the first tasks we got was to make the management application cross platform, well this was expected considering the fact that the acquisition was done by RedHat.</i><p>And:<p><i>Sticking with C# requires technologies to help us run it on Linux. We found Mono ..., and the second option we found was Grasshopper which is a project of Mainsoft to compile MSIL to Java Bytecode. ... These 2 solutions were taken off the table ... we wanted to use a technology supported by Red Hat.</i><p>So it appears to me that the decision had nothing at all to do with technical strengths of the language. Moreover, it had nothing to do with the platform as such -- whether its technical strengths or any end-user demographics -- but purely politics driven by Red Hat.
评论 #1262195 未加载
plesn大约 15 年前
I wonder why they couldn't use Mono. I can't really grok how they managed library usage, and how difficult it will be to maintain the java one when on platform updates etc.