C# seems to be popular these days. I heard that syntactically it is almost the same as Java. Java and C++ have existed for a longer time. For what reasons should I choose C# over Java and C++?
The question should be "Which language is better suited for modern, typical application development?".
Edit: I addressed some of the comments below. A small remark: consider that when you have a lot of things natively, as idioms, it's a big difference than implementing or downloading and using them yourself every time. Almost everything can be implemented in any of these languages. The question is - what the languages natively provide you with.
So off the top of my head (some arguments apply to both languages)...
C# is better than C++ in that:
C# is better than Java in that:
Edit - Addressing comments
|show 16 more comments|
.NET Framework and Windows clients
Windows is the dominating Operating System on client computers. The best GUI frameworks for Windows applications is Winforms and WPF together with .NET Framework. The best programming language to work with the .NET Framework and it's APIs is C#. Java is not an alternative for this. And C++ is an older language without automatic memory management. C# is similar to C++ but has automatic memory management and you don't have to work with pointers, which make you more productive. C++ can still be the best option for some cases, but not for form-intensive database applications that is common in business.
IIS and Windows Server
If you are used to work in the Windows environment and with C#, you will need the least investment to learn IIS for server programming and Windows Server for basic administration.
Active Directory and Windows Server
If you are developing software that is going to be deployed in company networks, it's likely that they use an Windows centered environment using a Windows Server with Active Directory. In such an environment it's easist to integrate and deploy an solution made in C# and .NET Framework.
Personally, I'm a Java developer, not a C# developer, but I work with the web. I would switch to C# if I were developing network applications for Windows network. But I prefer Java for Linux based web servers. I would choose C++ for embedded systems were I don't won't many dependecies.
Yes, C# is a better language with more modern features than C++ and Java, but that is not the most important thing for choosing C#.
The environment for your software is most important for choosing C#. If you work in an environment with Windows clients, Windows servers, Active Directory, IIS and maybe SQL Server then C# is the far best language with the .NET Framework.
If you work in a Unix environment with e.g. web services, Java would be my choice. And if you work with embedded systems or have to integrate with hardware devices C++ would be a good choice.
C# and Java
C# is a very good language if:
C# as a language is nicer than Java in various ways (better syntax for properties, value types, reified generics etc.). I prefer C# as a language to Java but in the grand scheme of things they are fairly similar languages and suitable for similar applications.
On the other hand, Java has some big advantages as well:
So Java vs. C# is a pretty close call and it really comes down to whether you want to be in the Microsoft camp or the Open Source / cross-platform camp.
Personally, I prefer Java because:
C/C++ is basically a different beast entirely. I would not recommend it for general purpose application development nowadays for the following reasons:
However it is undoubtably a great choice in a certain limited number of special domains, in particular:
So basically, C/C++ is a great choice if and only if you are focused on one of the domains where it is particularly well suited.
|show 1 more comment|
Syntactically? Who gives a flying monkeys about syntax? Syntax is good for only one thing: allowing faster migration from syntactically similar languages. That's it.
C# is vastly better than Java. Consider their generic and functional programming support- C# is way ahead of Java. Not to mention operator overloads, and other good stuff- C# is vastly better featured. There's no way that Java could possibly be considered better than C#.
C++ and C# is more of a contest. C++ has an incredibly annoying archaic compilation model and a bunch of legacy diseases from C, but it's templates are vastly more powerful than generics, and it's resource managing approaches are much more flexible and powerful in general, as
|show 7 more comments|
But I like the
|show 8 more comments|
According to some sources (see e.g. http://www.indeed.com/jobtrends) C# is still less popular than Java, and as popular as C++.
C# does provide features that Java lacks, e.g. direct support for certain programming idioms like properties, functional programming style, and so on. C# has a higher level of abstraction than C++, which is an advantage when development time is more important that program speed.
Personally, I still prefer the Java / C++ worlds. As Petar Minchev said, Java has more open-source frameworks and applications, it runs everywhere, is less tied to a particular vendor and operating system. C++ has similar advantages, even though code often needs adaptations going from one platform to another. Since I prefer to develop on Linux and, to my knowledge, I cannot have fully fledged C# on Linux, I never got a real interest in C# because my programming needs are covered by C, C++, Java, Scala.
On the other hand, for many developers being tied to a particular vendor is not a problem: Microsoft has a dominant position in the operating system market and C# gives lots of job opportunities. Therefore, IMO many developers adopt C# because, besides being a feature-rich language, it is also a good investment.
What about "Which Software Development Framework, that includes a programming language" its better ?
You forgot to include other stuff, like the "environment" you will work with.
Just my 2 cents.
A couple of things that have not already been mentioned:
C# is better than C++ because:
It does away with header files, which translates to great simplicity.
C# is better than Java because:
It supports both reference-type (class) and value-type (struct) user-defined types, which, if you know what you are doing, can yield significant performance benefits.
It supports delegates, which are like single-method interfaces, thus greatly simplifying the coding of frequently occurring constructs that involve single-method objects.
|show 3 more comments|
If you do a search you are likely to stumble upon discussion on top programming languages. Here is one of the search results - http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html - Java still seems to be the most popular language.
Java tried to remove some of the shortcomings of C++ (and making the programmers life simpler for non-real-time and non-critical applications). C# being the late-comer to the party, avoided some of the shortcomings of the Java language. C# has made a lot of progress (as Microsoft has lot of control over it) while advances in Java were blocked for a considerable period of time due to conflict between it's stakeholders.
You should chose the best language for your expected environment and your expertise.
Chose C# if you are working in a Microsoft only environment. While C# is standardized under ISO/IEC 23270:2003, Microsoft's version remains the only complete implementation. Several key parts of the language are not covered by the standard and are thus subject to Microsoft's patents. No one else will implement a completely compatible version of the language for other systems, so in effect, you are vendor locked to Microsoft Windows and .Net for as long as you use the language. If you are looking for skills to use in the mobile market, best to look to another language.
Java works, but has a good deal of overhead, in part due to such features as garbage collection. Java is also not standardized by ISO/IEC, so you have no guarantees if you switch platforms and versions of Java, only Sun/Oracle's best intentions. If you are eventually planning to work with Android, this is definitely the way to go. Android's programming is basically Java, with a few changes.
C++ is standardized and almost all compilers follow the international standard, so you have guaranteed behavior BUT the language does not protect you from yourself. You have to perform cleanup and overflow checking on your own. This is not hard. C/C++ programmers have been doing these for many years. Apple uses Objective C for everything, so if you want to aim for Apple, I recommend you try this instead.
If you see yourself leaving Windows behind at some point, I'd suggest learning both C/C++ and Java - both of which are marketable at this time.
In relation to C++ vs C# (as i'm not proficient enough in Java), what i'm missing here is the ability to access lowlevel stuff on Windows. For example, you cannot develop a native display driver in C# (yet), but you can with C++. This does not make C++ better. I see C++ versus C# as Assembly versus C.
C# is in my view much more efficient if you look at the time it takes to actually implement a feature. The performance penalty of the .Net runtime is negligible for 99% of the applications developed. It may be of significance if you are running a tight loop, yes by all means, but most of the time an application is idle, waiting for any kind of input, signal or interrupt (disk IO, button click, network, animation completion).
The CLR library with all his functions has another big benefit. When i was training C# to junior developers, most of them said they liked the logical naming convention of classes, members and namespaces. Finding a feature of method was logical across the SDK, something that Visual Basic 5 was seriously flawed at. This has helped them tremendously in adopting the library. After learning the syntax of a language, getting to learn a new library is significant into getting a good grasp of any SDK. It saves you from reinventing the wheel.
protected by World Engineer♦ Jul 13 '13 at 8:20
Thank you for your interest in this question.
Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?