tags:

views:

6804

answers:

31

Why is C# suddenly so popular? There's been like a repeat explosion in the blogs lately about it; It reminds me of the earlier part of this decade when all of those frameworks for Java came out like Spring, JSF, Hibernate, Struts, Struts2, Tapestry etc...

I've actually been thinking about learning C#, and it seems to contain a lot of qualities that it has gotten from Java (aside from it being completely cross-platform)

But, it almost seems like a step backwards to me...its not totally multi-platform, a language that's run by a corporation rather than a community...

(But, knowing this isn't the case, I've come here to find out why it isn't...)

P.S. And yes, I am aware of the Mono project so that you can run it on Linux, but isn't it always behind the curve? A new version of Java would be supported on all the platforms.

+48  A: 

It's popular because it's now Microsoft's first-class supported language, and Microsoft steers a very large ecosystem with a lot of inertia.

Ben Collins
+1, Microsoft really does try hard. And it has paid off.
Jonathan C Dickinson
Indeed, the reactions to this topic cannot be explained by the language alone.
CurtainDog
+31  A: 

How about a "corporation of smart people that also listen"?
The guy who designed C# is very smart, I'd say.

And personally, I've switched to C# because of LINQ and the semi-functional programming support. IMO I think that is what "wow"-ed most corporate developers and made them switch over from other languages.

chakrit
@chakrit What's semi-functional programming support, does that have to do with writing assembler code?
leeand00
@leeand00 No, I mean you can pass function as arguments and use some lambda functions and lambda calculus in C#. But C# isn't a functional language in its entirely so I used the term semi-functional. Not sure if it's the most appropriate though.
chakrit
No doubt they're very smart, but that's also its curse: the language is huge, and the stdlib is huge^2. I tend to find it much easier to work with systems designed by someone of moderate intelligence but good taste and humility.
Ken
I take it you switched from Delphi?
CurtainDog
@CurtainDog VB.NET ... but I write mostly in javascript these days.
chakrit
@Ken stdlib is huge?? Have you tried some of the beginning tutorials? I think the "stdlib" from .NET (and Java) are wayyyyyyyy easier to grok than... say... Python or PHP... but maybe that's just me :-)
chakrit
+9  A: 

I prefer coding in C# over Java. They feel so similar to me that its the IDE that makes the biggest impact between the two. Visual Studio over Eclipse any day of the week

Duncan
Yeah, Eclipse sucks...
quant_dev
Eclipse actually has two features I wish we'd see in VS. 1) When you open a parenthesis '(' or a curly brace '{' it automatically closes it for you. 2) Spell checking for comments.
BFree
VS does actually have #1, kind of. it's called snippets. Type "class" then hit tab twice. Or type "for" and hit tab twice.
Mystere Man
Try NetBeans, it's much nicer experience than Eclipse.
cdmckay
@quant_dev: Although I prefer coding C# over Java, Eclipse doesn't suck! It has excellent code assist and refactoring support, something that VS still currently lack unless you have CodeRush or Resharper.
Spoike
@Mystere Man: I use snippets all the time, and trust me, I love it. I've created quite a few of my own. It's just when you're calling a method for example, and you want to pass in params, when you start typing "MyMethod(" Eclipse automatically closes it for you, VS doesn't.
BFree
Mine are 1) CTRL+SHIFT+R - Find resource/class and 2) CTRL+O - goto member. They are adding #1 to VS2010, not sure about #2 though.
Richard Szalay
+16  A: 

What do you mean suddenly? C# has been around for a while now and it is continually being enhanced. The new features actually make it a quite unique language.

Also .NET offers a very good alternative to doing Win32, MFC or the like. It is much easier to use and while the feature set may not be complete, it will suffice in most cases.

Additionally C# and .NET may be used for both embedded systems as well as entertainment devices such as Xbox 360 and Zune.

Brian Rasmussen
Not to mention cars, watches, phones and robots.
Richard Szalay
@Richard: that is what I was addressing with the "embedded systems" part but good examples.
Brian Rasmussen
@Brian, 2007 was a rough year, I had to leave my job due to health reasons. Then I got a job in 2008 at a place that still uses VC 97". I'm trying to find out where things are presently...
leeand00
+9  A: 

Suddenly? It hasn't suddenly become popular. I don't know where you have been, but it's been pretty steadily gaining momentum for quite a few years. You may be hearing a lot of buzz about it, because they are introducing a lot of new features to the language, whereas languages like Java have been pretty stagnant in the feature department for the last few years.

Kibbee
@Kibbee see my comment for Brian Rasmussen.
leeand00
+23  A: 

Well, my completely subjective view is:

C# pro's

  • Best IDE ever (Visual Studio)
  • Best documentation (I luv msdn :) )
  • Really easy to learn
  • WPF is awesome.
  • Usable for a lot of deployment projects (silverlight, windows compact and ofc "ordinary" windows programming
  • As you said - tons of nice blogs
  • MS is really doing a great job enhancing .NET all the time

C# con's

  • Not completely cross-platform

.. So, in my view, the pro's outweight the con's by a large margin. So as long as I'm not doing anything that requires a total cross-platform design and which needs a window-based GUI, I wouldn't consider other languages as it is right now. :)

cwap
C# cons: VS might be a nice IDE, but it's not free (I know there's an Express version but you can't have integrated source control with that version).
cdmckay
@cdmckay:Even still, Visual Studio Express is really nice - especially for being free.
kitchen
@cdmckay: Bah! You can still run source control such as subversion or mercurial just fine without VS integration.
Spoike
@cdmckay - re integrated source control; personally, I vastly prefer it separate to the IDE (tortoise, etc)
Marc Gravell
I'm talking about myself, but I find Visual Studio intrusive and very poor in refactoring. I certainly prefer Eclipse as long as I'm writing code (which is 99% of the time; I don't do GUI). As for documentation, I still find MSDN much lacking compared to Java IMHO.
Hosam Aly
I'm not convinced VS is the best IDE ever! Eclipse, Netbeans and Intellij in the Java space are all far superior.
Fortyrunner
+1 on Tortoise. VS Express is amazing for the price.
Jonathan Webb
@Hosam; you need to extend VS with ReSharper if you want to be happy and sleep well at night!
Henrik
@Henrik: So you have to pay about $800 for VS Pro, $150-250 for ReSharper, some more money for for a good profiler, and still pay for upgrades every year. For me, that's a hefty sum of money, while I have all the goodness of Eclipse and TPTP for free! And it runs on Linux too. ;)
Hosam Aly
@Jonathan Webb: I don't see how VS Express provides a good value for price, when compared to Oracle JDeveloper for example!
Hosam Aly
@Hosam Aly: any free software that allows you to get stuff done is good value :-)
Jonathan Webb
@Jonathan: maybe, but to be "amazing" it has to be truly amazing ;) :D
Hosam Aly
ReSharper > MSDN :)
Jacob Stanley
I probably wouldn't say VS is the best IDE, but since there's nothing much better, VS is the one I spent most of my time on. Qt Creater is pretty cool and cross platform, but it's only for Qt.
Hao Wooi Lim
Personally, my favorite IDE is a bunch of xterms running vim and assorted development tools (like gcc, gmake, gdb, gprof, etc.), but Visual Studio isn't really bad.
David Thornley
+26  A: 

There is nothing about C# that is not platform independent. C# is entirely platform independent, and it exists on multiple platforms. The .NET framework has parts of it that are more oriented towards windows, but that is not C#.

Unlike Java, there is a clear seperation between the languages used, and the runtime. In Java, both the language and the runtime are "Java" and are inextricable. Yes, there are various 3rd party languages developed for Java, but none of them have Sun's blessing, nor was the runtime designed to facilitiate this.

Consider that C# and the CLI/CLR are both ISO standards, fully documented, with royalty free licenses. Java is (mostly) GPL'd now, but is not an international standard. C# 3 is not yet a standard though, and probably will be skipped with 4.0 being resubmitted for standardization.

Plus, C# is a better language than Java in many respects. It's easier to work with, and none of that Checked exception BS. And it has extension capabilities that Java just can't match, not to mention versioning and whole raft of other features.

Mystere Man
While what you say is true, c# in most people's mind is intimately tied to .NET. When people think c#, I think they mostly think of .NET, not c#.
Giovanni Galbo
That's a ridiculous argument. Mono can use C# without any part of the .NET framework. You can stick to C#/CLI/CLR and write in GTK# and other non .net libraries.
Mystere Man
Argh, "that checked exception BS" is what I miss most in .NET you insensitive clod!
Wim Coenen
what's a ridiculous argument, I'm agreeing that what you said is true. That doesn't take away from the fact that most people are really thinking about c#/.NET rather than the language when they discuss c#.
Giovanni Galbo
Reguardless, this is about the language, Giovanni Galbo, and not about .Net.
TraumaPony
True, but the question is "Why is C# suddenly so popular," and a huge (probably the biggest) is because of the enormous library behind c# - .NET.
Giovanni Galbo
+4  A: 

Wasn't Java "corporate driven" until very recently, if I'm not mistaken?

Also, (lets forget about Mono just for a minute), multi-platform just doesn't matter to a lot of people.

As for why its so popular; he language looks like c++ and java (so less learning curve), the library is awesome and Visual Studio is considered the best IDE by many people.

Giovanni Galbo
And the language has pointers, mind you. Java locks you into a safe pointer-less world. C# lets you delve down to that level if you see so fit.
Jonathan C Dickinson
So pointers are there if you need them, but if you don't, you're not forced to use them either? Hmm that does sound pretty good.
leeand00
+3  A: 

It's popular because it's just like Java, except evolving and adding useful features at a pace faster than the utterly glacial pace of Java. This means you get most of the advantages of Java, such as a good VM, tons of libraries, the backing of a large corporation, etc., and the same general feel of the language. However, you don't have to deal with lack of properties, closures, and just about every other modern feature that Java eschews.

dsimcha
c# never had a VM. It's always been jitted.
SnOrfus
You can be jitted and have a VM. VM does not mean "interpreted". Java was created to be Interpreted, and a VM, .NET was created to be compiled and have a VM
Mystere Man
@SnOrfus. You should read up on what a VM is. C# has a JITting VM, which is (after the first, say, 2 minutes) superior in every way to the interpreting Java VM. And Java doesn't have IL emit.
Jonathan C Dickinson
almost every currently available non academic java VM is Jitted.
ShuggyCoUk
Yes, please remember folks that Java has JIT compilation too. Let's keep our facts straight.
Randolpho
@Jonathan C Dickinson, do you have a link to any benchmarks that compare the most recent VMs?
Hosam Aly
+1  A: 

In my opinion, its the gaming aspect of it. Using C# with XNA, I can without a ton of effort start geeking out some games that'll run on an X-box or my PC. I've tried game programming before using C++ and OpenGL and it required a lot of heavy lifting (my back still hurts). Other than that, I think its just preference. Both Java and C# help push each other along, I know the object for loop was a C# thing that Java incorporated. So for me at least, in the game programming realm I love C#, but at work, I"m a Java guy.

Nick
+136  A: 

There's nothing "sudden" about the popularity of C#, it's been quite popular since its birth at the turn of the century.

Also, I don't understand how you can consider C# to be a step backwards from Java; if anything, C# is several steps ahead of Java. The cross-platform "issue" you mention is only an issue of politics and not one of technical capabilities; Microsoft (erroneously, IMO, but that's neither here nor there) sees no value in doing the work of bringing the .NET platform to non-MS platforms. The other issue... "a language that's run by a corporation rather than a community" is actually more of an issue with Java than it is C#; Sun still controls Java with an iron fist, despite IBM's continual pleas. Edit: Not anymore. Now IBM has to beg Oracle to modify Java...

So, to the actual question, why is C# popular?

Because:

It really is a great platform for programming. There are numerous improvements over Java, such as:

  1. Value Types
  2. Properties
  3. Delegates and Events
  4. Global Assembly Cache
  5. Runtime Generic Support

It's constantly evolving, both in terms of library support and new language features. For example:

  1. LINQ (it will change the way you iterate a collection!)
  2. Lambda Expressions
  3. WCF
  4. WPF
  5. Closures

And coming up in C# 4:

  1. Dynamic types and the DLR (i.e. runtime type binding, like python)
  2. Named and Optional arguments
  3. Covariance and Contravariance

In terms of IDEs, Visual Studio is pretty darn good. I'll admit that there are features of Eclipse I'd like to see in Visual Studio, but there are features of Visual Studio I'd like to see in Eclipse, too. There's also MonoDevelop, which is shaping up nicely.

Plus, there's a great community of fellow programmers who are always willing to help out. This site is the perfect example of that.

Randolpho
+1 on the bit that C# has numerous improvements over Java. Delegates/events is what sold me. C# 3.5 also has automatic properties which I've found indispensable. C# 4 is filled with a bunch of excellent improvements as well.
Spoike
FYI, it's C# 3.0 that shipped with .NET 3.5.
Richard Szalay
+1 for the Sun controlling Java comment. Reason why there is no Microsoft JVM anymore: Sun told them to bugger off. Same reason why there is C#. Same reason why Java is loosing ground to C#/Groovy/Clojure. Oops. Nice one Sun. Microsoft has actually *helped* out with Mono (Moonlight IIRC).
Jonathan C Dickinson
I have used eclipse probably 5 times. Every single time, I have exited the program by it crashing. Visual Studio has not done this. Not that IDE is all that matters, but seriously... how about those sln files for VS? How about manually doing a whole bunch of crap in eclipse just to get started?
jle
@jle: That's a good point about solution files; *big* benefit of VS. That said, I've worked with Eclipse many many times and never experienced a crash. Eclipse is not a bad IDE, it really isn't. When I program in Java, it's the IDE for me. I just prefer to do it in C#/VS. :)
Randolpho
@Jonathan: Actually, Microsoft was already in the "extend" phase of the three-E plan before Sun sued them to make them stop. Remember J++ and J#? http://en.wikipedia.org/wiki/Java_(programming_language)#Implementations
Michael Myers
@Randolpho and jle: Maybe your problem is that you were using Eclipse and not NetBeans. ;) Actually, NetBeans is slower than Visual Studio (in startup time at least), but it seems whenever I use VS I find something that I could do in NetBeans but not in VS. (That could be because I use C++, though.)
Michael Myers
J# came with C#, but you're correct regarding J++. However, you are incorrect in your apparent assumption (by your invocation of three-E) that Microsoft was trying to kill Java. On the contrary, they tried very hard to get their changes (particularly delegates) added to Java by Sun. Sun sued instead
Randolpho
@mmyers: I seem to remember defending Eclipse in my comments. I rather like it, in fact. I haven't used any recent version of NetBeans so I cannot comment, but Eclipse is a very solid IDE. I just happen to prefer C# to Java.
Randolpho
@Randolpho: OK, I don't want to spread misconceptions about Microsoft(since I wasn't paying attention to such things in 1997, it's likely that I'm wrong. Plus there's a lot of people doing that already). I did read that they tried to put OS-specific things in, so maybe that's what I was thinking of.
Michael Myers
@Randolpho: Sorry, I misread your comments as favoring VS over Eclipse, not favoring C#/VS over Java/Eclipse. My mistake.
Michael Myers
@mmyers: No problems. As I said, I do prefer VS over Eclipse in some things -- particularly solution files -- but find Eclipse better for other things. When it comes to language, I prefer C# for the reasons I listed in my post. It's not to say that Java is bad, just that C# is better. IMO.
Randolpho
@spoke When you say automatic properties, do you mean you don't have to write all those setters and getters?
leeand00
@leeand00: Yes, with automatic properties, a backing storage variable is created for you for properties that only get/set a variable. So string MyString {get;set;} compiles for a class as well as an interface.
Randolpho
http://msdn.microsoft.com/en-us/library/bb384054.aspx
Randolpho
Try http://www.groklaw.net/articlebasic.php?story=20070108020408557 for the details of that 1997 court case, MS doesn't come out well at all, especially when they discuss MS's anti-java strategy memo.
gbjbaanb
Perhaps the line that stands out most from the court transcript is (from a document by Aaron Contorer to Bill Gates): "The third choice is to make major innovations to our platform so people still prefer to write to us instead of some tepid cross-platform Java layer. This is our only real option. "Sounds just like what C# is! (and the 3Es are a microsoft term, they use it a lot).
gbjbaanb
woohoo, 60 votes! Only 40 more to go for a nice shiny gold badge. Let's have some votes, people!!!
Randolpho
+1 can't beat the speed of loading up devenv.exe...
m_oLogin
I thought the JSR was an open process...
fortran
It may be, but the Executive Committee has the final say. Not exactly easy to get things fixed or changed.
Randolpho
Only one vote for a gold badge! Anticipation............................
Randolpho
@Randolpho: here you go!
Ken Browning
Thank you Ken! Here's a few random reps for you from me.
Randolpho
+16  A: 

Just a suggestion: I wouldn't confuse "popular with bloggers", "popular with programmers who can choose their own tools", and "widely used in some specific environments". (Especially beware of the first of those. Based on what some bloggers like to write about, Rails has taken over the world, Java is dead, and COBOL never existed... ;-)

Instead, I'd look at my current environment (or the one I'm trying to break into), and ask "What tools and techniques are emerging in that area?" and ignore marketing hype and blog rants (pro or con).

joel.neely
Interesting thought Joel, I'll have to keep that in mind. I used to base my option solely on blog posts. What other things can I base my option on? Job listings?
leeand00
+1  A: 

MS has made some good frameworks for C#.On top of the frameworkds, you can build different applications EASILY from frontend to backend.

C#'s syntax combined Java and other C alike languages so that it is easy for programmers to jump on.

codemeit
Not only that, their frameworks are easily implemented through VS. Want to set up a web service in C#? No problem. Want to do one in Java? You'll prob need a plugin first, and then you'll have to read some specs.
Cuga
+3  A: 

The thing is that the parts of the .NET Framework that are not cross-platform (such as WPF, System.Management namespace, etc.) are usually things that you couldn't get with Java anyway. There aren't many things in the .NET Framework that are not supported by Mono but a similar concept exists in Java/JRE.

DrJokepu
WPF isn't intrinsically tied to Windows. Just hasn't been implemented elsewhere ;)
TraumaPony
TraumaPony: True, what I've meant by not being cross-platform is "not being implemented on other platforms"
DrJokepu
+33  A: 
Hosam Aly
Awesome graphs. The top one also shows that Java is in a decline, which would help with the perception that C# is becoming more popular than Java.
Cameron MacFarland
There are lies, damned lies and statistics. Caveat emptor
Spence
I don't find Tiobe to be all that useful. For instance, they don't break out VB versus VB.NET, nor do they break out C++ from C++/CLI. Also, C# is one of the few languages to consistently grow year after year.
Mystere Man
Also, if you go back and look at the feb ratings, C# grew by 2.88% while C and C++ both dropped, so over the last two months, C# grew by 3.3% wile C++ and C both had net negatives.
Mystere Man
@Mystere Man: When looking at the long term trends, I invision 2011 with Java still above 15-17%, C almost stable at 14-15%, C++ dropping to about 8%, and C# rising to about 7%. That's still a huge difference between C# and C or Java.
Hosam Aly
Only because you're looking at C# as a single language. People who use .NET often program in several different languages depending on the requirement. The same project can even have VB and C# and F# and J# code in it. Java is primarily a single language for the entire platform.
Mystere Man
Well, you may be right, but the question is specifically about C#. :)
Hosam Aly
Mystere Man - http://en.wikipedia.org/wiki/Java_Virtual_Machine#Support_for_dynamic_Languages
toolkit
Interesting graphs, but I think that they are too "toothy" to be truly accurate. It can probably say something about relative popularity, but I'd be careful when using them to talk about trends.
erikkallen
I can't trust a graph that is made using keyword searches show me the popularity of a particular language, especially in the case of C#, where "tons" of searches are made without "C#" but instead contain MSDN or .Net, or simply class names.
Pop Catalin
Pop Catalin makes a good point. I seldom include "C#" in my search strings when I want to look up how to use some part of the .NET framework.
Joel Mueller
"The popular search engines Google, MSN, Yahoo!, and YouTube are used to calculate the ratings"How can you rely on something based on query result from search engine? Suppose you've the best programming language with no bugs and excellent offline documentation, since is perfect as is you will probably not found anything on the net, so this made this language unpopolar?Meaningless.
kentaromiura
See this about TIOBE: http://blog.timbunce.org/2008/04/12/tiobe-or-not-tiobe-lies-damned-lies-and-statistics/
Alexandr Ciornii
@Pop: and who adds C or even C++ to their keyword searches? You're suggesting C is far more popular than it appears in the graphs.
gbjbaanb
why doesn't this chart have Delphi?
Paulo Guedes
@Paulo Guedes: That's because it's not in the top 10. The graph only shows the top 10 languages.
Hosam Aly
O'Reilly's analysis of the computer book market shows the same broad trends. See http://radar.oreilly.com/2009/02/state-of-the-computer-book-mar-22.html, in particular the graph at http://radar.oreilly.com/languages_all_5yrs.png
Nelson
@Nelson: Nice graph! Thanks.
Hosam Aly
I like this data. But my interpretation of it is: See how much internet search you need to do to get your work done on the different languages!!Or "IDE sophistication reduces the need to search online".Or "Don't name your kid C# because each of his teachers will call him a different thing (csharp, c-sharp, cs, .net dotnet) and he'll look like he missed school!"Or "The C# community is not such a net-chatty bunch afterall."Or "Empty vessels make the most sound."
Pita.O
+2  A: 

i like C# a LOT more than java

it feels more natural to me and has more features

also i find the GUI classes' names to be more logical (pane...swing?)

and i kinda liked VSC#...and i love XNA

jimi hendrix
+7  A: 

Specifically answering the question "There's been like a repeat explosion in the blogs lately about it"

Microsoft have added a significant language change in each major release rather than just the addition of new libraries (only including the major ones in the list).

  1. 1.0: first release 2000
  2. 2.0: Generics, generators and lexical closures added 2005
  3. 3.0: Lambdas (and expressions though most coders don't use that directly) that allow Linq in 2007
  4. 4.0: Dynamic programming planned for 2010

This change causes changes in the preferred way to do things, the idioms of the language need reinterpretation or complete redefinition. This generates a rich source of content for discussion.

It helps that in the same time frame of c# and the .net platform's public life MS has become considerably more supportive of blogging within the organisation to the extent that they host them and provide a means for teams rather than individuals (who may not be able to sustain such an effort on their own) to provide one.

The discussion of why c# is popular has been dealt with in many other questions and restated here too.

ShuggyCoUk
+3  A: 

WHy is C# suddenly popular? If you think suddenly means for the past few years, then I guess it is rather sudden. Considering we did not have a release of C# (.NET) until 2002, that is not surprising, however.

Despite Mike's comment, Visual Studio is considered a good UI, but the IDE is not the main reason someone picks a language. The fact Microsoft is pushing C# (and has been) and the fact that there are many Microsoft shops in the United States helps the popularity.

The fact that C# is cross platform (with Mono) probably helps some, but the LAMP stack is far more popular on Linux, so I don't think this is a very good reason for the popularity of C#.

Gregory A Beamer
+1  A: 

I think its the way microsoft has nurtured the dev community personally - ever since Ballmer shouted out "developers developers developers!!!". They're working hard to get followers, and in a lot of cases it's working. In aus - the user groups are great, and Microsoft (until recently because of budget cuts) even paid for free food and drink - gave away prizes, etc, etc. It all might sound like a bit of who-ha, but it's working to a certain degree.

billfredtom
>> It might sound like a bit of who-ha.Let's face it, the same corporate strategy that drives the plan to bring food to community meetings would drive a determination to go beyond throwing features into the SDK and actually investing into the right developer experience built around that feature.Microsoft invests heavily on dev tools user experience and it pays off in followership. Until recently, one of the founders of Java was quoted as saying something to the effect that Intellisense is non-hardcore devs. How can you win with that?!
Pita.O
A: 

In my opinion, C# is popular because it is as easy as VB and more powerful than Java. If you think of a Java as a reaction to C++, C# is a better reaction to C++ because it didn't strip almost any features from the language, but did them right (for example, operator overloading). The only thing I really miss when I code in C# is using const and mutable to enforce logical const-correctness.

Eduardo León
+5  A: 

C# behaves like I always wanted java to behave.

It generally "feels" like I write less code to achieve the same outcome than the equivalent in java. Java seems to force you to be "enterprisey", c# just gives you the option. (totally subjective "vibe" based opinion)

Cross platform is a non issue for me, there are enough windows machines out there to make a living writing for windows, one day, that may change, but probably not this year.

seanb
+33  A: 

I have ranted on about how poor Java is all along in the comments here. The truth is that C# is what Java should be today, if Sun were not so short-sighted and, might I say, 'frightened' to evolve. The opposite side of that coin, is of course, C# wouldn't exist were it not for Java and Sun with their corporate strategies with Microsoft. So yes, C# owes a lot to Java.

To me one of the most pertinent features of C# is the whole IL emit scenario. I don't think there is another language which will let you emit a JITted IL (not interpreted code, like Ruby etc.) at runtime. Remember, machine code is a lot harder to work with than IL: so saying you could do it in C/++ doesn't count :). The whole IL emit scenario has opened the language for some amazing frameworks; and these frameworks allow the developer to gather momentum at the start of a project without the usual performance penalty to worry about.

The typing and versioning system is second-to-none (if used properly). Sure most modern languages have their reflection systems, but none of them feel as intuitive as C# (hell you can reflect the reflection classes if you see fit) - most (Java is an exception here) have built-in keywords which just seems alien when you use them. C# reflects classes using classes - it's insane!

And there is the framework. The namespacing system (which is something so subtle) makes a huge difference. When I did Java I spent my life importing types and resolving conflicts - the system was nearly there, it just took Microsoft to perfect it. The Java/C++ standard libraries are a mess when compared to the .Net BCL. Since when does that namespace of something start with the name of the language in use, that's redundancy. Or for that matter: org.joe.my.controls. This means that to use Joe's controls you must know that they are free and know the spelling of his name.

Much of this thread is about Java VS C#, and that's exactly the point. Java redefined the programming landscape, and C# has done it again. That is why the blog buzz around C# has had similar properties to the one around Java. Java was a great language and C# is a great language. The rest pale in comparison.

Jonathan C Dickinson
I don't think this is worth the downmods; it certainly tells it like it is. +1
Randolpho
Why did people downvote? It's a good answer. +1 compensation vote
erikkallen
Definitely +1! a very good answer.
Pop Catalin
A couple of points: 1) Java has been JITted for about ten years; please stop calling it interpreted. 2) Judging from http://en.wikipedia.org/wiki/Reflection_(computer_science), C# and Java reflection are roughly equivalent. I don't see that C#'s system is a major advantage over Java.
Michael Myers
@mmyers, the key word in the sentence about reflection was most. I made it bold.
Jonathan C Dickinson
@mmyers, I did state that Java was int IL, my bad. The argument still stands. I stated that you can't emit raw Java Bytecode at runtime and have it load and be JITted. .Net is the only platform AFAIK that can do that.
Jonathan C Dickinson
@mmyers thanks for the comments though. My answer was lacking.
Jonathan C Dickinson
Although I don't agree with you, +1 for a well written answer. As for emitting bytecode in Java, can't you create new classes in runtime, and have them optimized when they are passed to the class loader and JIT later?
Hosam Aly
@Hosam, thanks. I don't think you can create new classes at runtime. From what I have read C# is the only runtime capable.
Jonathan C Dickinson
You *can* create new classes at runtime in Java, but it's a major pain.
Michael Myers
+1 the remark about c# being where java should have been is, IMHO, right on the money.
Colin
Most of what you said isn't C#, though, but .Net. Reflection is a .Net API that has nothing to do with C#. The same for namespaces, versioning, IL emit, the BCL and pretty much the whole post. ;-) OTOH, you do not have C# in the Java VM, so .Net features kinda count as a pro for C#.
Robert Giesecke
@Robert: You do realize though, following the argument, that the implicit meaning attached to the 'Java' and 'C#' refers to the stacks not just lexicons. Otherwise, it will be a silly point to talk about platform agnosticism as a property.It makes no sense to describe a pure higer-level language as cross-platform if you are not speaking of the available compilers, interpreters, class library, and utilities ... especially enterprise frameworks
Pita.O
+4  A: 

re: java vs c#

C# has the advantage of being released after Java and thus the designers were able to improve upon Java's syntax and libraries. And I think Java had the disadvantage of early widespread adoption, which made it harder to evolve the language early on.

I like C# because I think it has a very practical set of features in comparison. For example, C# has properties, which you could say are "syntactic sugar" for basic getter/setters. But you can use them to semantically separate get/set operations from other methods. And you can do this with one line of code in 3.5.

Also in C#: string.IsNullOrEmpty(string s)

When I do work with Java, it seems like I need to have giant books on my desk to be able to do really basic things. I don't mean to say C# is better than Java. You can definitely do amazing things with Java and the time I got to use WebMethods, I loved it. However, I think C# is nicer to work with. Perhaps the recent surge in popularity (if it exists) is due to people switching over and liking it (the iPhone effect). Also, the C# language is moving in a pretty exciting direction (for geeks).

NB: I do not work in situations where cross-platform is needed.

danimal
And what's the excuse of Java not to improve even if they released several versions after C#? (Well they did improved, here and there, but those attempts are shy compared to what C# did every version)
Pop Catalin
+5  A: 

I am an anti Microsoft guy and I have recently gotten quite interested in .NET and C#, so they must be doing something right ;-)

A couple of things have caught my attention. Just seeing what the guys making the Unity3D engine managed to get out of using mono, convinced me that mono is not a second class product. Ok .NET is still better but mono is good enough for real commercial usage.

Secondly C# has grown to quite a respectful language. Especially with all the concepts from functional programming being added like type inference, lambda functions, LINQ etc it has become quite powerful.

I am a Mac user, but now I am considering embedding Mono in my applications and using it as a script language, like Unity3D. I think that gives some really cool opportunities.

Adam Smith
Yeah, I'm an anti-M$ guy from way back, I've always been a bit skeptical only because I can't be guaranteed that I can port my applications to some other platform other than windows. But other than that everything else I've read here about C# sounds really great, and I'm starting to lose my initial skepticism about the language.How good is the support for exporting an application into Mono in your experience?
leeand00
Not sure what you ask. But I answer based on guess ;-) My impression is that to be certain of being cross platform it is best to actually stick with mono as the runtime on both Linux and Windows and target Mono rather MS .NET.
Adam Smith
Given that .NET has a more mature IDE and better support, if your first project targets windows, you should use .NET; but get a hold of unsupported .net namespaces from the Mono website and decide how to architect such pieces or even avoid them altogether in case you have to migrate in future.
Pita.O
A: 

Because it's an elegant, mature language that lends itself well to object-oriented programming. It is also the defacto choice for new developers working within the .NET framework and this has seen a big growth in the last few years. I quite like Java, but Sun have never really focused on providing a next-generation web development platform like ASP.NET (especially MVC). Because more and more apps are going online now, I think Java is losing ground here.

And I also would say 'hats off' to Microsoft for recognising the best parts of Java and incorporating them into C#, rather than re-inventing the wheel (badly)!

Andrew Corkery
+2  A: 

Reasons for C#'s popularity:

  • backing by major corporation
  • easier app development, as compared to C++/MFC, for eg
  • flat learning curve (coming from language like C++ or Java)
  • lots of language constructs that s/w devs like
  • continuing support by MS of language
  • popularity often begets more popularity (of anything, incl language)
Garrett
+2  A: 

I have about equal parts experience in Java and C#. I will say that for anyone who wants to pick up a language, C# generally is easier. That, taken with many of the reasons listed above will account some of the perception noted.

As for the rest, I feel that the SO community is one that is slightly more favorful towards .Net than Java. This likely contributes to much of your perception as well. At this moment, these are the counts of questions listed as "new" on SO with the following tags: C#: 20,902 Java: 10,881

Cuga
A: 

I think C# is a respectable language since it has come up in the world. Java is a great language but has the same situation as C# with respect to its future because both languages are controlled by very-closed corporations (SUN&MS).

Open sources languages are growing up nowadays, maybe in the future there will be an open C# controlled by the community and running over mono.

Felix Guerrero
java is almost open source: http://www.sun.com/software/opensource/java/
Ray Tayek
A: 

How about if a C embedded programmer wants to move to C# programming how easy would it be and is there a market for a person with C and C# as skill set?

met
A: 

it's had slow growth. approaching c++ now. see http://www.indeed.com/jobtrends?q=c%2C+c%2B%2B%2C++c%23%2C++java%2C+ruby%2C++php%2C++javascript&l=

see TIOBE Programming Community Index for May 2010

http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

Ray Tayek
A: 

'Cawse it rawks!!!

Igor Zevaka