TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN : Which should I learn : C# or Java

33 pointsby anikethover 16 years ago
I have been lurking on HN for some time now, and I have noticed that the languages of choice are python, lisp and ruby. However, I would prefer to learn either C# (and thus asp.net) or java. which one would be better? For the record, I have used php a lot, and code in c, c++ on the day job.

30 comments

bdittmerover 16 years ago
I think as a language C# is superior to Java. That being said, learn Java. The open source community alone makes it a much more attractive platform to build apps on. The number of choices in terms of frameworks + no vendor lock in makes it a winner. If you're serious about learning it pick up a copy of Effective Java by Joshua Bloch -- by far the best general Java book out there.
评论 #366198 未加载
评论 #366159 未加载
评论 #366300 未加载
mikeryanover 16 years ago
I'm in Silicon Valley - so this skews me a bit, but Java by far.<p>It does depend a bit on what you want to do, but most everything I see is sliding towards java. You can do web development, mobile (except iPhone) and though it hasn't fully caught on yet, I'm seeing more apps on the desktop in Java than in the past.
micktover 16 years ago
I've noticed that no-one has talked about the cost of using either.<p>Yes the Java IDE's are somewhat inferior to MS's, but you can get everything you need to write, develop, manage, and host Java applications for free compared to MS; the OS, IDE, Web Server ... all cost money which can be a substantial amount for commercial purposes.
评论 #366487 未加载
评论 #366390 未加载
评论 #366380 未加载
评论 #366495 未加载
评论 #366263 未加载
donniefitz2over 16 years ago
I would go with C#. There are lot's of people who say that you are subject to Microsoft's directing of the language, but if you go with Java, you are subject to Sun/OS direction just the same. C# is a great language and ASP.Net is great for the Web. It's not popular to advocate a Microsoft product here but I'm very happy with C# and ASP.Net. Your goals will be the ultimate factor in your decision though.
评论 #366593 未加载
delanoover 16 years ago
You're not going to find a clear answer one way or the other. If you enjoy working with Microsoft products, including Visual Studio, go for C#. If you like, or would like to learn, using other platforms, go for Java.<p>Keep in mind a lot of the value of Java is the JVM. It's everywhere now so it's kind of like a perl for enterprises.
tzuryover 16 years ago
Once you said ASP.NET it is clear that you are heading to the web.<p>If you insist not to develop web applications using the greatest open source platforms which serve today all the largest sites, then C# would be better than Java simply because ASP.NET has much more to offer than Java in the web field.
rbanffyover 16 years ago
If those were my only choices, I would consider changing my career. Maybe learn to cook and open a gourmet restaurant.<p>Now, seriously, I would go for Java because, at least, it can run cross-platform without the danger of Microsoft suing you out of existence.
评论 #366347 未加载
speekover 16 years ago
C# has got a bunch of neat functional stuff in it (Microsoft's researchers have seen the glory of functional languages), but Java might be easier to start off with.<p>Once you can get through Java, everything else you learn will feel immensely superior...
评论 #366190 未加载
SapphireSunover 16 years ago
My startup was recently looking at platforms to target windows effectively. We just spent a lot of wasted time looking at .NET. Perhaps because it was because we are very cheap, but we couldn't find decent (well written) documentation. Also, visual studio is a bit confusing after working for a while in a linux development environment.<p>I then remembered that I was already familiar with Java syntax, and that if we needed speed, we could always code subroutines in C/C++ and link them through JNI. The thing that is nice about Java is the amount of documentation and tutorials (and source!) lying around. Of course, working with a big IDE like Eclipse will be a big change as well, but we are going to go with Java.<p>By the way,does anyone here know if it is possible to create a salable client side application using something like Python? It is my impression that it is a bit too easy to disassemble without including some sort of heavy duty DRM scheme that wouldn't be worth the effort. If it isn't, does Java suffer from the same problem since you compile to bytecode?
评论 #366852 未加载
kstensonover 16 years ago
I would recommend looking at c#, or more interestingly the .net framework and the CLR. Once you've learn't the framework then you can also look at the other .net languages. Ironpython, IronRuby and F# give you a width breadth of languages and ideas but with the benfit of the shared .Net framework and the object inter opt that comes with the CLR/DLR
DomesticMouseover 16 years ago
As a ten year veteran of Java, currently learning C# (the world is full of irony), I can say that Java is a simpler language. There are a bunch of bones thrown to c++ and assembler focused guys in C# making it a more complex language to master. And I dispute that VisualStudio is a better IDE than IntelliJ. So, my honest opinion is start with Java.<p>Spend time writing code, and just as importantly, reading it. Read through Spring, Hibernate, et al. Understand the architectures, the trade offs, and the code tricks.
ensignavengerover 16 years ago
You should look at doing C# and learning .NET, and as has been stated, you could then use .NET with all sorts of languages (IronPython, IronRuby, etc.) You could also look at the Mono project for Open Source development, and as you are doing web apps, take a look at Silverlight/Moonlight. Silverlight has very impressive capabilities and potential.
causticover 16 years ago
From my experience of working with both Java and .NET I can say that: the weakest part of the .NET technology stack is community, and the strongest part of the Java world is community which produced the huge pool of quality, free and open-source frameworks. Currently Maven repositories count for more than 14,000 unique artifacts and almost 60,000 versions (<a href="http://www.mvnbrowser.com/faq.html" rel="nofollow">http://www.mvnbrowser.com/faq.html</a>).<p>C# is a nice language, but when you have to develop a real-world application, it does not help much. .NET simply lacks too many essential tools and frameworks. You can do basic things with it, but when you have a non-standard task at hand, you are alone to implement the solution by yourself or pay for crappy third-party closed-source component. Even for trivial tasks. Want a decent HTML parser to sanitize HTML documents? Write it by yourself or pay for crappy third-party closed-source component. Want to read email messages from the server? ... you got the idea. The list goes on and on. I am currently working on a C# project which has integration with source control systems. We had to invest a lot of time to write our own framework and providers for several most widely adopted tools, such as Subversion and Perforce. If we based our project on Java, we would saved lot of time on development by choosing Maven SCM providers, which are free and open-source. Another example is that we needed a decent audit history for the documents in the database. Again, we had to develop somewhat working home-grown solution. If we based our project on Java, we would simply pick open-source Envers framework (<a href="http://www.jboss.org/envers/" rel="nofollow">http://www.jboss.org/envers/</a>) which does exactly what we need for free.<p>And I hate Visual Studio. It offers a little more than a notepad with syntax coloring and debugger. It is horrible for coding and those variegated wizards and diagramming tools don't make me productive either. Being unable to attach third-party source codes is a huge PITA. Eclipse in size is just a fraction of the VS installer, but still is feature-packed, better for refactoring and has a plenty of plugins. Speaking of IntelliJ Idea, it's simply the best IDE ever.<p>.NET build and CI tools suck, there is nothing to compare with Maven.<p>If you like to learn new languages, I think there is nothing to beat JVM in terms of variety programming languages running on top of it. Just for example, the most notable ones are JavaScript, Python, Ruby, Groovy (Python-like language with Java-friendly syntax), Scala, Clojure (Lisp-like), CAL Language (Haskell-like) and many more. By the way, JVM by itself is quite a decent piece of engineering.<p>My experience makes me think that Microsoft is trying to be popular at any cost, targeting inexperienced programmers, intentionally oversimplifying their solutions, making simple things trivial, complex things impossible. The Microsoft culture is to give you a big bright flashy button, which does a lot of things under the hood, but when accidentally it breaks, you are unable to guess what is going on and how to fix it. Living in the world of closed-source .NET code makes me cry.<p>So the conclusion is: choose Java over .NET, but learn more uncommon programming languages as well. Haskell, Lisp and Prolog were huge "brain-washers" for me.
评论 #367226 未加载
评论 #366805 未加载
评论 #366376 未加载
webwrightover 16 years ago
Would probably be good to specify your goals. Long term job security? Payscale? Building your own startup/app?
johnsover 16 years ago
One important thing I think is being missed in this conversation is the vibrancy of the .NET community, much of which is C# focused. There's a very active community of .NET devs out there that aren't doing things the Microsoft way, creating useful and popular open source libraries and sharing that information with other devs. The Dev Div at MS is extremely active in the community as well. If you look at how the new ASP.NET MVC Framework is being rolled out (open source, multiple rounds of community feedback) and the inclusion of jQuery AS IS (not extended or modified) in the MS stack you'll see a big difference from the MS you think you know.
ricky_clarksonover 16 years ago
Go for the one with lambdas.
评论 #366791 未加载
gillsover 16 years ago
Have you considered learning both? They have a lot in common, and 'which one is better' is a decision you need to make for yourself in the context of your project.<p>Oddly enough, geography might matter. For example, Seattle seems to have a bunch of consulting shops and even a few product startups using MS tools. (There are also startups using the usual suspects...Java, PHP, Python, Ruby,...).<p>Both languages' VMs are accessible to a number of other languages if you decide to branch out later. As many have said already, Java gets a slight leg up from open source.
jimflover 16 years ago
C# and Java are very similar. Learn one, and the path to the other is quick. The languages have essentially the same feature set, though some of the advanced concepts (reflection metadata, generics) are easier to learn on C#. XML in C# makes Java seem like a major pain in the 455.
newsitover 16 years ago
Learn both. Seriously. Pick a good book about algorithms or data structures, open Visual Studio and Eclipse, load the Java and .NET docs in your browser, maybe pick some introductory books on both and start coding the examples. It might take a little longer to start, but it will pay out tremendously in the end.<p>I've been doing this with Scheme and Erlang using SICP (<a href="http://mitpress.mit.edu/sicp/" rel="nofollow">http://mitpress.mit.edu/sicp/</a>) and it has definitely helped me understand better both the languages and the material.<p>In your case you have two very similar platforms, object-oriented, garbage collected, with a very similar syntax. The big strengths for both are their libraries and their VMs, learning them in parallel makes lots of sense.
vladover 16 years ago
So you've learned C, and C++. Of Java and C#, you may as well continue learning them in that order to see how one tries to improve on its predecessor, though by now it's likely that Java has adapted some ideas from C# as well.<p>Oh, and learn Objective-C!
xefyrover 16 years ago
Why would you only learn one of them? Learn every language you can. Learn them well enough to love and hate each for 5 different reasons. Learn them well enough to know which should be used when.<p>IMHO: they are very similar languages with converging library offerings. I think Java is ahead of the game in this regard because it's been "in the wild" longer and has more of an open source following.<p>And don't forget, they can interop very easily with SpringFramework and XML-RPC.
dreurover 16 years ago
Grails !! Works with java (and uses professional java tech) but has the dev speed of rails or django.<p>Check the case studie of Wired : <a href="http://www.springsource.com/files/Wired.com%20Case%20study..pdf" rel="nofollow">http://www.springsource.com/files/Wired.com%20Case%20study.....</a>
raover 16 years ago
Java was a great choice of language to learn 10 years ago. c# was a mediocre choice to learn 5 years ago.<p>In terms of employability, they both have enclaves of popularity around the world.<p>Java would be my recommendation, if limited to those two.<p>However there are better languages around today including those already mentioned.
ruslanover 16 years ago
It seems, we are pretty close to epoch where C programmer to be treated as assembly guru nowadays who can read machine codes right out of hex dump.<p>Man, learn C/C++ first, I beg you!
评论 #366533 未加载
NonEUCitizenover 16 years ago
Yes, learn C# OR Java, where OR != XOR:<p><pre><code> TRUE == OR(TRUE, TRUE) </code></pre> When it comes to programming, be language, platform, vendor, and ideology agnostic.
13renover 16 years ago
What's your purpose? That is, "better" for what?
time_managementover 16 years ago
Java, then Clojure. I've never used Clojure, but my understanding is that it's a Lisp dialect that targets the Java VM.<p>Do learn a language like Lisp, Ruby, or Ocaml, though. Once you get used to the functional paradigm, you'll realize how much more powerful these languages are, and you'll never go back.
评论 #366152 未加载
lstover 16 years ago
You ask seriously?<p>Then you should stop programming and start hacking (in the spare time of your day job).<p>Seriously: what exactly do you expect from the only 2 languages left with exactly <i>no</i> <i>fun</i>?!
MaysonLover 16 years ago
Component Pascal: available in both .NET and JVM versions, as well as a native Windows app. Reasonably well-chosen splashes of OO, functional, and meta programming in a spare, Wirthianly simple language.
geuisover 16 years ago
If you are looking to only program for windows, C#. Stay away from java at all cost. Java is a career trap, and more importantly a destroyer of intellect. My roommate is a C# programmer and a system architect. Really smart and he makes close to $150k per year. Java would qualify you to flip French fries in comparison. Also, keep Objective C in mind. That opens up Mac and iPhone development to you. Macs are at 20% marketshare now, iPhones the best selling smart phone. Plus programming for Mac/iPhone is just <i>fun</i>. Further afield, look at languages like Erlang. The future of computing is hundreds and thousands of parallel cores and parallel languages like Erlang are in many ways increasingly important.
评论 #366162 未加载