Ask HN : Which should I learn : C# or Java
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.
86 comments
[ 5.6 ms ] story [ 200 ms ] thread"every java 'engineer' I've known has been a siv"
It depends if you're learning a language to build stuff, or to work with good people (community). As a language, I'd say java rocks most of the time and does a good job of things.
It's similar to javascript. A large number of people who program javascript are really pretty poor programmers, who just program by trial+error, or copy+paste code they found on the web. This doesn't mean javascript as a language is bad though. It just attracts a wide range of users.
C# is similar -- F# is a much better way of interacting with .Net libraries. It is even "fully-supported" by Microsoft from what I've read, so it is definitely a good alternative to C# if you prefer its functional style. (And who doesn't?)
Finally, if you don't need Java or .Net libraries, SBCL is a very nice Common Lisp implementation. It's fast, and if you like emacs, the tools are great. It is quickly becoming my favorite environment. (Perl is my other favorite.)
Despite what others say, you can write maintainable and well-performing code in any of these languages. So pick one and get started... that's the hardest part.
Rejecting a language just because it is popular seems just as misguided to me as choosing a language just because it is popular.
Can't you just ignore the boi's and use Clojure anyway, if it's a good language?
I also like CL's conventions better, and not having CLOS is a huge downside.
Rich Hickey has recorded several hours of video describing Clojure in comprehensive detail from talks at various user groups and such. I really don't understand how it is so hard to ignore the "noise from the kids" and get the information you need to decide if you want to use Clojure or not. Are you implying that the kids will take the language in the direction they want it to go? I very much doubt that. Mr. Hickey seems very committed to his language and I don't see any indication that he might let go of the reins any time soon. One of the benefits of the benevolent dictator model.
Distinctions with Common Lisp are certainly rational reasons for choosing CL over Clojure, though. For myself, the easy availability of Java libraries trumps whatever else I might like about CL. I work at a university and take classes part time, and even in this environment there is a Java library for pretty much everything. The one time I tried to get a CL library working on SBCL that was developed for LispWorks, I suddenly had to understand pretty intimately almost everything about those two dialects on a deep level if I were to have any chance of porting it over. It was a pretty terrifying experience.
I definitely respect that you have a different set of priorities and opinions about why Common Lisp is best for you. But I remain unconvinced by your arguments referencing the Clojure community. I'm guessing that's where we'll agree to disagree.
You thought well enough of it to mention it by name; I don't see a ton of difference between you mentioning it and someone else saying it's good.
I can't really say I've seen anything bad coming from Clojure's community either; it's not anything like the old C.L.L flame-fests from the 90's.
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.
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.
On the other hand, I'm never putting faith into Microsoft's development tools again, as nice as they are, because in recent history, Microsoft has killed off programming languages and tools at will, even their most popular ones. Microsoft makes developers depend on Microsoft's ability to update and improve their programming tools, in order to make the case they should charge for them, but has killed off popular programs or languages in order to concentrate on new ones, given that they themselves don't have resources to support all of them at once.
Microsoft also recently killed scripting and macro support in the latest version of Mac Office, so I imagine if you're a developer on either the Windows or Mac platform and want to script an Access Database, Excel spreadsheet, or Word Macro, you're screwed. It means you can't functionally use previously-created files any more, or use files from Windows users that use scripting. It's almost like Microsoft is helping users and developers migrate to other tools and platforms.
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.
Though Python is used more and more now, you can definitely get jobs in languages other than Java and C# and such... But sadly, not Lisp or Ocaml though, at least not easily.
Oh, and learn Objective-C!
Once you can get through Java, everything else you learn will feel immensely superior...
"The least painful" is what I would say.
Of course, these are all really .Net problems, but more often than not, C# and .Net are used interchangeably.
I think that "constantly balooning specification" is an overstatement. Look at the release timeline:
Four versions over that span is hardly "constantly balooning". The .NET framework revs slightly more often with SPs, but major versions are on about the same pace.Version 1.0 of the C# specification clocks in at 405 pages. There was an addendum in 1.2 that I'll leave out, because it was a respecification of 1.0.
2.0 came along and added 117 pages of specification - including generics, partial classes, iterators, and a handful of other things. On pure specification, that's a growth of 25% to the core language. (I know this isn't really scientific, but I think you get my drift).
Then in 3.0, just 2 years later, the spec is back to over 500 pages (just for the language!). This version added a bunch of functional paradigm stuff to the language, lambdas, linq and the like.
And now in 4.0, they're talking about making C# essentially a dynamic language.
Now, all this being said, I really do like C#; but I think that it behooves everyone who likes C# to admit that it's a large and evolving language; the paradigms that Microsoft keeps adding to the language don't really seem to fit from one version to the next.
4.0 will not essentially be a dynamic language. They're making it much easier to interop with dynamic languages by adding some dynamic constructs, but it's still as statically typed as ever. 'dynamic' is a shortcut to save you time, not re-invent how you work with C#.
Java seems to be no exception: http://en.wikipedia.org/wiki/Java_version_history
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.
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.
The last time I used VS was with VC++ 6.0, so no clue how IntelliJ compares.
I wouldn't consider using VS without it.
Imagine you get accepted by PG into Ycombinator and you have your $15000 in hand to start. Using MS technologies you have to pay ~$700 per developer for a Visual Studio license: http://www.amazon.com/dp/B000WM04HU . As you are now a commercial enterprise you can't use the cheapo student version for $50 anymore. Plus you need to pony up a IIS license for each developer to test on, and Windows Server 2008 license for each developer, and an even more expensive OS license for your multi-processor multi-core server ...
So off the bat you've already spend more than a month's rent for that studio in Sommerville your going to be camped out in ...
Whereas if you go the freebie Open Source route all you need to buy is hardware. Maybe your labour is more, but it's your blood, sweat, and tears which at an early point in the game is cheap. VS is a lot of .99c noodles! ;)
Or, if you can find a Network Partner, join the BizSpark program and use their stack for free for $100 after 3 years: http://www.microsoft.com/BizSpark/
The argument of Java is better because it's cheaper tends to fall apart when you look at that.
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.
Please explain further. MS isn't suing Mono (and supports them in many ways) and is increasing their cross-platform capabilities with Silverlight. These are not cure-alls, but they are progress.
Hint: I know the answer to all the above. That's why I'm asking the question.
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,...).
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.
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.
And don't forget, they can interop very easily with SpringFramework and XML-RPC.
In terms of employability, they both have enclaves of popularity around the world.
Java would be my recommendation, if limited to those two.
However there are better languages around today including those already mentioned.
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 (http://www.jboss.org/envers/) which does exactly what we need for free.
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.
.NET build and CI tools suck, there is nothing to compare with Maven.
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.
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.
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.
The main other issue on the .Net side is if you get in the way of MS - the will just run over you and make you irrelevant.
I am thinking of selling a somewhat unconventional and new (for the mainstream, like Lisp) programming tool. I thought that the .NET community will be less reluctant to try such a thing because MS is pushing new things like F# too. What do you think?
At my company we needed a simple CSV reader for a file submission. That's it--just something that could read CSV files. We figured that had to be available in classic .NET We look around, dug into forums, and finally got in touch with the local .NET user group guru. The ideal solution? Use MS's communication tools to open the CSV file in excel and read it there. Or? Roll your own.
We ended up doing the thing in python and imported the csv lib.
I would go with Java, out of the two. It's as verbose as C#, but has, in my experience, much better support for pretty much everything.
Where should the framework end? People complain all the time about the size of the framework, but then when their pet feature is missing, they cry foul.
Sounds like a fantastic platform/market, if you want to write great components and sell them.
Not as much, now that Java is open sourced.
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.
I've been doing this with Scheme and Erlang using SICP (http://mitpress.mit.edu/sicp/) and it has definitely helped me understand better both the languages and the material.
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.
Then you should stop programming and start hacking (in the spare time of your day job).
Seriously: what exactly do you expect from the only 2 languages left with exactly no fun?!
Man, learn C/C++ first, I beg you!