Why C#/.NET? Why not Java/J2EE?

I haven’t kept up with either of these developments lately. Isn’t C#/.NET just Mr. Bill’s answer to Java/J2EE? Is this another one of Mr. Bill’s shifty maneuvers to rule the world?

Because Java is too ungodly slow to actually use for applications? .NET is really more of a global domination/trusted computing/Digital Rights Management morass than anything else. Quite scary.

C# and .NET have a nicer toolkit that supports faster development. .NET stuff is compiled while Java is usually interpreted. The two systems are similar and have competing feature sets. Competition is good for the customer.

The reason for MS not continuing their great Java are political and legal and financial, not technological.

MS has put a lot of really nice stuff into .NET, but has tied it very tightly to the Windows Operating System.

Yeah, but how much of .NET did MS “innovate” and how much was stolen from J2EE? I find MS definitions of innovation and competition a bit skewed to their favor, to say the least.

Depends on your audience. Can’t build an application using C#/.Net if your audience is using Macs/Unix Workstations and so on. I used to work for a large networking company and we had thousands of employees using Sun workstations, and several hundred using Macs. We pretty much had to use Java (although C# wasn’t around then).

C# is Java with the serial numbers filed off. :wink:

Does MS have an R&D department innovating new ideas in the realm of computer science? Or do they dedicate all their brain cells to engineering ingenious ways to crush their competitors?

However, Java is a lot more portable, and it is safer. The reason it is slow is because it is an interpreted language and isn’t compiled until you run it. (the interpreter runs from start and just continues through the code until either an error is found (runtime error) or the program terminates.
However, because of JIT compilers, Java is highly portable. The GUI’s are cleaner, easier to program, and Java wakes up in the morning. :stuck_out_tongue: :smiley:

Microsoft’s R&D department. :wink:

No offense, cc, but are you here to ask a legit question or to bitch about Microsoft?

My question about Java is, did it ever become widely adopted for real-world applications? The hype for it was incredible, but the only place I really see it in use is in teaching situations. Many universities use it to teach programming, for example. Most Java applets on the web, that I’ve seen, have been pretty lame, frankly. There are a few games done in Java, but Flash games have largely dominated this category. Back-end stuff is usually done in some other way, database integration is done other ways, etc, etc, etc.

So where does Java fit in?

Most of the uses of Java I’ve seen (and developed) tend to use it heavily on the back-end – database access, user session validation and management, that sort of stuff. I also do a fair amount of JSP to generate dynamic content for front-end pages, and I’m not hurting for work. Where do you get the notion that Java isn’t being widely used?

I used Java for 2 years, and C# for the last 2 years. I hated Java. I love C#. They’re so similiar though, it’s really down to the little things.

[ul]
[li]C# has enums. I hated the fact that Java didn’t. I was in heaven when I was able to use enums again.[/li][li]While both are based off C++, C# is closer. You can still use pointers if you want. Can’t remember if you could in Java[/li][li]You can write code in C#, C++, or VB and have them easily talk to each other.[/li][li]The IDE. I never found a Java IDE that was anywhere as close to as good as Visual Studio. So I always used the command prompt. And print statements to debug. Life in hell.[/li][li]Easier interface development. But I was using the Java strictly for server stuff.[/li][li]A lot easier to use COM objects.[/li][li]Faster.[/li][li]Stupid, but I really hate that Java methods start with a lower case letter. [/li][/ul]

It’s really easy to port stuff between the two too. We were using the Jetty web server, which uses Java, to serve up servlets for our app. It used a 3rd party application to talk to COM objects we needed and it was buggy as hell. I wrote a web server in C# to replace Jetty. Another person on the team then ported all the Java servlets into C# in a couple days. (I developed the server to use servlets like Jetty and pretty much copied the Java servlet structure) Made things a lot smoother. We could now talk to the COM objects directly, and could debug in the IDE. He had been using print statements in Jetty too.

Java is heavily used for cross-platform, enterprize-level applications. It is now fast enough to use smoothly when well-written, and most OS companies (read: Not Microsoft) have optimized the shit out of their JVMs.

To take a couple of Modian’s points:
You can’t use pointers in Java, because accessing memory directly is one of the things Java is purposefully avoiding. This lack only limits your ability to write bad code.

You can use JNI to let Java and native code talk to each other. I’ll grant that it isn’t easy.

Eclipse and IntelliJ are both much better than Visual Studio for working on large projects. Eclipse is free. Both may have come into their own after you left Java.

-lv

Looks like both C# and Java are in high demand:

http://jobsearch.monster.com/jobsearch.asp?q=c%23%2C+java&lid=&fn=&sort=rv&vw=b&cy=US&re=14&brd=1%2C1862%2C1863

HA!!! rjung I finally decided to clink on your link :slight_smile:

After reviewing the job posts on Monster, it looks like about a page and a half of C# and over 85 pages of Java. So maybe people aren’t jumping on the C#/.NET/Microsoft-centric world as fast as I thought they were.

http://www.fuckmicrosoft.com/

kputt: That’s definitely true. However, the set of circumstances in which Java-level portability is necessary yet performance doesn’t matter is small enough to make Java rather useless in the big picture. Quite frankly, most of the actual Java applications I’ve used, rather than just tiny web applets, have been so slow as to be practically useless. You’re looking at, say, 15% of the performance of a good compiled application, which really, really hurts.

Alereon, you’re way off on this 15% performance on modern Java code. Some of the stock graphical widgets aren’t up to speed, but it’s certainly possible to have a well-performing GUI. Heck, just look at what IBM did with their Eclipse IDE (written in Java), you can’t even tell you’re in a non-native application.

-lv

Many programs in Mac OS X are written in the Java language, but they are natively compiled and make Cocoa calls. Java on OS X is another option, next to Objective-C, for programmers to consider.

Many of Apple’s programs, including its Sherlock Internet utility, are written in this form of Java.

What about actual code speed? It doesn’t take too much to make a GUI seem responsive, but I’m having trouble believing that a Java app is actually going to be executing at near the speed of a native application.

I do a lot of development in both Java and C/C++ (along with ASP, VB, MS-SQL, and tons of other stuff). Right now, I’m working on an enterprise information application written entirely in Java.

I hate it. I hate applets. I think the applet technology sucks for business use. I hate Java’s garbage collection. Even large commercial Java apps like JBuilder sometimes freeze for half a minute when a full GC goes off. We’ve had to do a ton of work to keep garbage collection from causing fits in our messaging system and elsewhere.

C# is nice, because you can mix managed code with unmanaged code. So if you want to do real-time software, you can write the real-time part unmanaged, and then use managed code for the GUI or other non time-critical parts. In this area, Microsoft is ahead of Sun. Real time Java is coming, but it’s not ready for prime time.

One thing Java really has going for is is that there are a lot of great open source development tools. If you want to do large-scale enterprise applications using Microsoft’s solutions, it’s mucho dinero. $1200 for Visual Studio Enterprise Edition, a couple of grand for SQL Server 2000, thousands more for their other server products, etc.

Our application has over a million bucks invested in it, and yet all the tools we use are free. Tomcat, MySQL, Eclipse, Ant, etc. Anyone can download all that stuff tonight and have all the same development tools we use in our shop.

But I think Microsoft’s stuff is more mature. Watching a debugger step through C# code into Visual Basic, then into C++ is pretty cool. If money were no object, and cross-platform wasn’t a requirement, I’d choose Microsoft’s development environment.