6

Java is a popular language & platform, having a huge ecosystem. Are there any features that C# 4.0 onwards and its platforms should have, to make you completely switch to C# programming?

CPerkins
  • 8,968
  • 3
  • 34
  • 47
NT_
  • 2,660
  • 23
  • 25
  • 1
    See also http://stackoverflow.com/questions/1594917/what-features-should-java-7-onwards-have-to-encourage-switching-from-c – Mike Two Oct 22 '09 at 10:35
  • 8
    I think this should be community-wiki, as it's definitely subjective. – Joey Oct 22 '09 at 10:36
  • 2
    @Johanes: .. And argumentative. I must confess prior to StackOverflow, I thought C# was not worth it ( but that was just ignorance from my side ) After reading C# questions and answers here, I realize I was completely wrong. C# is awesome. Now I think C# was the best thing Microsoft could have done for its developers; because it is almost like Java! ;) :) – OscarRyz Oct 23 '09 at 20:42

9 Answers9

24

Make it run on as many platforms as Java?

Otherwise it is completely irrelevant to us.

.

.

.


Edit: For a discussion about Mono making .NET "cross platform", see https://softwareengineering.stackexchange.com/questions/20275/mono-is-frequently-used-to-say-yes-net-is-cross-platform-how-valid-is-that


Edit 2015: Microsoft has decided to open source the backend part of .NET, which will enable community to port this to even more platforms than Java runs on. I consider this the ultimate move against the oracle approach to Java evolution.


Edit 2019: .NET Core is now available for Linux, and therefore as Docker images. Our experiences so far has been very nice. We have a mission critical application which runs nicely in Kubernetes, and we have no particular preference for writing microservices in either .NET or Java.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
  • Yes, and full stack please, not just the core. – NT_ Oct 23 '09 at 09:35
  • 4
    +1 being tied to Windows is the Achilles heel of .Net. .Net on Linux would be a game-changer. – cletus Dec 29 '09 at 10:42
  • 1
    It is available on Mac and Linux through Mono: http://en.wikipedia.org/wiki/Mono_(software) – awe Sep 06 '10 at 09:05
  • 2
    @awe, that's only two... – Thorbjørn Ravn Andersen Sep 06 '10 at 09:17
  • 2
    @awe: We have found Mono to be so unreliable that we wouldn't touch it with a barge pole. The single biggest problem with Mono is the lack of a decent GC. I mean, they don't even have a *working* accurate GC. JVMs have some of the best low-latency GCs in existence... – J D Jan 05 '11 at 18:59
  • @Jon, in what context and platform? Prebuilt or compiled your own? – Thorbjørn Ravn Andersen Jan 05 '11 at 21:03
  • @Thorbjørn Ravn Andersen: Kubuntu Linux on x86. Compiled myself from stable source releases. See these posts: http://flyingfrogblog.blogspot.com/search/label/mono – J D Jan 06 '11 at 09:06
  • @Jon, interesting. Is the official Ubuntu version you can install with apt-get any better? – Thorbjørn Ravn Andersen Jan 19 '11 at 10:35
  • @Thorbjørn Ravn Andersen: I think its the same but more out of date. – J D Jan 19 '11 at 19:27
  • 1
    @Jon, according to http://mono-project.com/DistroPackages/Ubuntu Mono is supported by Ubuntu and is installed by default. Perhaps you should try again with a distribution containing the Mono version you want? – Thorbjørn Ravn Andersen Aug 05 '11 at 08:39
  • Interestingly, Richard Stallman [warns the Free Software Community](http://www.fsf.org/news/dont-depend-on-mono) about the use of Mono and sets clear that [while Microsoft keeps in control of patents](http://www.fsf.org/news/2009-07-mscp-mono) for some of the class libraries (i.e. ADO.Net, ASP.Net, etc., etc.) it is simply impossible to implement a trully compatible opensource version of the .Net Framework. – Edwin Dalorzo Jun 30 '12 at 15:10
  • @JonHarrop Did you get around to try a distribution with a suitable prebuilt Mono? – Thorbjørn Ravn Andersen Jun 30 '12 at 16:17
  • @EdwinDalorzo OpenSource, yes, Free, no. – Thorbjørn Ravn Andersen Jun 30 '12 at 16:20
  • @ThorbjørnRavnAndersen No, I didn't. I don't even have a working Linux install any more. – J D Jun 30 '12 at 20:41
15

The general uptake of C# in the marketplace has nothing really to do with language features, which I understand are now superior to Java. Adopting C# requires a complete organizational strategic shift in the main:

  • You already have a gazillion Java applications and a host of Java developers. Why switch C#? You'll need new staff and suddenly all of your applications are legacy by definition. This is a huge deal! Undergoing this change puts a huge risk on your company for what may be only slight benefit: why bother?

  • You are used to at least the option of many large providers of operating system and middleware which support your Java ecosystem. This disappears overnight and you expose yourself to a monopoly pricing model (i.e. you are pretty much tied in to Microsoft, to all intents and purposes). Being subject to monopoly pricing is bad! Most organizations would rather have a slight technological disadvantage to avoid monopoly pricing because the pricing will almost certainly take away any extra revenues anyway.

oxbow_lakes
  • 133,303
  • 56
  • 317
  • 449
  • 1
    I think Mono is far enough along now that you don't have to worry about being tied to Microsoft. I don't really understand what you mean by monopoly pricing, as the .NET Framework and C# compiler are free. – Joren Oct 22 '09 at 11:26
  • I guess I'm talking about big companies. Really big companies purchase support and want to use a *big* provider like IBM or Oracle or whoever. You may be correct about mono (as I'm from the Java side of things) but I believe that mono doesn't quite fit what they need. Of course for small companies, this is not really an issue. – oxbow_lakes Oct 22 '09 at 11:37
  • 1
    Mono sounds good, as long you you don't try to use mono on windows or .net in linux :P The former won't run if us use using mono.linux and every one use that and the later won't run if you use any advanced features. While some products that fit in the middle may work, it is not the same to have to look at both sides than just developing int the latest release version ( where you have to look at both sides also, but less frequently ) – OscarRyz Oct 23 '09 at 20:15
  • As always, use the best tool for the job. – Thorbjørn Ravn Andersen Jul 13 '10 at 10:36
  • +1 For the monopoly explanation. Also Microsoft still keeps control of several patents that make impossible to implement a fully compatible version of their framework. See [Microsoft Empty Promise](http://www.fsf.org/news/2009-07-mscp-mono). – Edwin Dalorzo Jun 30 '12 at 15:01
6

I don't actually think that C# has anything less going on for itself than Java, except for the ecosystem like IDEs, frameworks, etc. In terms of features, it is well ahead at the moment at least.

Nikolaos
  • 1,449
  • 2
  • 15
  • 19
3

I think .NET is great, but don't use it, because it lacks the #1 mandatory feature : portability. Yeah, there is Mono...

bobflux
  • 11,123
  • 3
  • 27
  • 27
  • 1
    Actually, I know official games for the Wii and/or PS3 written in C# running on Mono, can't recall a similar thing for Java... – Dykam Oct 22 '09 at 11:30
  • Dykam, would those official games for the Wii/PS3 run on any other platform? In other words is this a platform specific game anyway? – Thorbjørn Ravn Andersen Oct 24 '09 at 05:56
  • 1
    Eh. By and large, portability is overrated. I find most people demand portability for portability's sake. – Erik Forbes Dec 09 '09 at 15:24
  • 1
    @Erik Forbes - Win16 programs do not run on 64-bit Windows 7. My Java programs does. Portability is crucial to maintainability. – Thorbjørn Ravn Andersen Apr 27 '10 at 08:16
  • @Thorbjørn - does your Java program run on Win16? – Erik Forbes Apr 27 '10 at 18:42
  • @Erik, not mine but others do. There are JVM's available from Microsoft and IBM (plus the one in Netscape). However, the major difference is whether new programs run on old systems, or old programs run on new systems... – Thorbjørn Ravn Andersen Apr 28 '10 at 09:04
  • @Thorbjørn - I know there are situations where that's a concern, but incredibly old software isn't likely to be portable in the first place, and the old systems designed to run such software aren't likely to require new development. This isn't nearly as compelling an argument as *nix / Windows / Mac / Embedded / etc. cross-platform portability. – Erik Forbes Apr 29 '10 at 12:36
  • @ERik, portability means having a choice to switch out platforms in case you need it. It is very common these days to host Java application on Google Application Engine. Can't be done with .NET. – Thorbjørn Ravn Andersen Jul 02 '10 at 11:03
  • @Thorbjørn - only because Google chooses not to support it. To say it *can't* be done is misleading - it *could* be done, it just *isn't* being done. – Erik Forbes Jul 06 '10 at 12:57
  • @Erik, no need for splitting hairs. It is not possible today to deploy .NET-code to the Google Application Engine. – Thorbjørn Ravn Andersen Jul 06 '10 at 13:54
  • @Thorbjørn - I'm not splitting hairs; it's an important distinction, especially if Google plans to integrate .NET via Mono at some point. – Erik Forbes Jul 07 '10 at 12:26
  • @Erik, it is splitting hairs. Perhaps Google will eventually, perhaps some day, in some future implement .NET in GAE. Point is, they don't do it now, and no plans has been announced to do so. Perhaps they would consider it if Mono was blessed by Microsoft. Perhaps they will make it based on Mono simply to MAKE it blessed by Microsoft. All this is, however, speculation, and if you need to have something in the Google cloud NOW or within the forseeable future, .NET is simply not an option. – Thorbjørn Ravn Andersen Jul 07 '10 at 12:36
2

Another thing that really pushes Java is Eclipse (*): it is the most successful and complete free development environment to date. And, together with a huge amount of (mostly free) plugins available, the cost/benefit is unbeatable.

The pair VisualStudio C# + Reshaper can get close but it's not quite there yet...

(*): Some even say Eclipse is the main reason why Java found so widespread use.

Chuim
  • 1,983
  • 3
  • 17
  • 20
  • The reason I won't really even look into languages without Eclipse support is that Eclipse is also PORTABLE!!! I don't need to install a billion gigabytes worth of software to get my code compiling, I can stick Eclipse to an USB drive and take it with me to any computer I want to. – Esko Oct 22 '09 at 19:16
  • @Esko, how do you handle your workspaces? Have them on the stick too? Is the JRE "inside" Eclipse? – Thorbjørn Ravn Andersen Oct 23 '09 at 15:43
  • 14
    Eclipse is my guiding light. If my program is ever slower or more cluttered than it, then I know I have reached rock bottom in my ability to program. – Sam Harwell Oct 23 '09 at 18:46
  • @Oscar, how do you do the "look this method up in the superclass"? – Thorbjørn Ravn Andersen Dec 09 '09 at 16:00
  • I think he's just hardcore. Eclipse for me is indeed in the Top 3 reasons why I love Java. I use many shortcuts and it really cuts down on the time needed to get from A to B. – Buffalo May 20 '13 at 11:35
1

My answer is a litle about why I think so many use Java, but want to use c# in schools:

At my university, Java is the first language we learn, and is the language that we learn most about later also. I guess this is common.. But even tho we learn some python, c, c++ and already know a lot java, most students use C#. This is because everyone is told that C# will give them a job :) The school knows this, and I know one feature that would make C# the new primary choice for the school: make it run on all platforms =)

Gareth Davis
  • 27,701
  • 12
  • 73
  • 106
0

We were taught on college that there is nothing engineerical in MS Windows. How many people can (dis)agree with that?

How can we as developers answer to questions of stability, robustness, scalability, availability, transactional isolation, concurency when building some serious software system by working on an OS which is pale of 'something' and just anywhere you can expect some nonstandard behaviour surprise and potential source of problems which you can solve only by calling MS and pray God they will find a fix for you not in a long period.

Open Source is our only salvation.. Java respects standards, invests much energy in security model, keeps WORA, and it is rather simple language.

I can think of C# having unsafe pointer, thats just enough for me to give up on doing serious business with it if there are many people working on it. ..

ante.sabo
  • 3,141
  • 6
  • 28
  • 36
  • 1
    In here I think you will start to understand why Java is used in enterprise applications. A large enterprise will have a few rock star developers, mostly though they have developers with vary degrees of experience and skill. With Java all of their developers can be productive. Take for example checked exceptions. Java has them, C# doesn't. In an enterprise they make the code safer and hence more productive. Sure the rock star doesn't need them but they force the junior developer to write safer code. – MrJacqes Oct 22 '09 at 17:53
  • It is unbelievable how religion programmers get. I love C# but it is not my deity. – ChaosPandion Oct 27 '09 at 16:02
  • have you tried other programming languages than C# and Java? – Thorbjørn Ravn Andersen Jul 02 '10 at 11:01
  • yes, it was C, long time ago... apps were crashing because of mine inexperience, it was an art to get the software working stable.. – ante.sabo Jul 05 '10 at 05:47
0

I would definitely consider using C# when Microsoft buys Novell and gives official support to Mono.

Then, the next .net release will have to run on Windows and Linux ( OSX wil still left behind - like today with Java but with Java is because they wanted that way- )

Until then, Mono is behind the latest .NET version, and is still adding to it's core some Linux specific features ( like the Mono.Linux "module" ) that obviously doesn't run on Windows.

Language features are great, but if I want something more "dynamic" to work with, I would rather use Ruby or Python

But, that's just me.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
OscarRyz
  • 196,001
  • 113
  • 385
  • 569
0

Come on guys, if you do real serious software and would like to have kind of multiplatform support, NET will never be the thing you need or you would want to.

It wasnt even designed to support that.

Cisjokey
  • 11
  • 1