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 [1], JSF [2], Hibernate [3], Struts [4], Struts 2, Tapestry [5], 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).
It almost seems like a step backwards to me...it's 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...) I am aware of the Mono [6] 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.
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 [1]. 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:
It's constantly evolving, both in terms of library support and new language features. For example:
It has broad reach across the Microsoft platform:
It has broad reach outside the MS platform:
And now in C# 4 [2]:
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 [3], 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.
[1] http://developers.slashdot.org/article.pl?sid=09/04/20/128246I 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.
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.
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.
As other people have said, the word "popular" needs to be defined in some context.
I would point you to one measure of popularity, that is the Tiobe Programming Community Index [1]. In about 8 years, C# has only gained about 5% popularity. Surely you can see it rising [2] (when compared to itself), but when viewed within the grand scheme of things, it seems that it is too slow when compared to other languages. At 5%, it's well behind the next language (PHP - 8.8%). Even it's increase rate (+0.55%) is about half that of C (+0.98).
It's certainly gaining popularity, but I don't see it gaining so much as you see it.
For quick reference, here are the graphs I'm referring to:
[1] http://www.tiobe.com/index.php/content/paperinfo/tpci/index.htmlWell, my completely subjective view is:
C# pro's
C# con's
.. 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. :)
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.
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).
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.
I prefer coding in C# over Java. They feel so similar to me that it's the IDE that makes the biggest impact between the two. Visual Studio [1] over Eclipse [2] any day of the week.
[1] http://en.wikipedia.org/wiki/Microsoft_Visual_StudioI 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 [1] engine managed to get out of using Mono [2], 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 [3], 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.
[1] http://en.wikipedia.org/wiki/Unity_%28game_engine%29C# 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.
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.
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).
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# [1] and the .NET [2] platform's public life Microsoft 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.
[1] http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29Re: 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.
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.
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.
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 [1]?)
And I kind of liked Visual Studio [2]/C#, and I love XNA [3].
[1] http://en.wikipedia.org/wiki/Swing_%28Java%29It'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.
Reasons for C#'s popularity:
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 Stack Overflow community is one that is slightly more favorful towards .NET [1] 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 Stack Overflow with the following tags:
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 [1]) probably helps some, but the LAMP [2] stack is far more popular on Linux, so I don't think this is a very good reason for the popularity of C#.
[1] http://en.wikipedia.org/wiki/Mono_%28software%29I think it's the way Microsoft has nurtured the developer community personally - ever since Steve Ballmer [1] 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. It all might sound like a bit of who-ha, but it's working to a certain degree.
[1] http://en.wikipedia.org/wiki/Steve_BallmerIn 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.
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.
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)!
The time has come to mention the new async methodology [1] and other new features [2] in the upcoming C# 4.5. While Java 7 showed a very unobtrusive update list [3].
[1] http://reedcopsey.com/2010/10/28/c-5-async-part-1-simplifying-asynchrony-that-for-which-we-await/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.
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.
In addition to the other benefits listed above, one key difference between Java and C# is the amount of examples and support you can get. It is fantastic!
It's had slow growth and is approaching C++ now. See C, C++, C#, Java, Ruby, PHP, JavaScript job trends [1].
Also, see TIOBE Programming Community Index for May 2010 [2].
[1] http://www.indeed.com/jobtrends?q=c,%20c%2b%2b,%20%20c#,%20%20java,%20ruby,%20%20php,%20%20javascript&l=