Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

[ Create a new account ]

C# From a Java Developer's Perspective

Posted by timothy on Mon Nov 19, 2001 03:30 PM
from the curve-before-a-meeting-of-lines dept.
Microsoft's C# has raised eyebrows, interest and debate since its official announcement last year. The prolific Carnage4Life (Dare Obasanjo) has completed a detailed comparison of C# and Java, outlining the things that are identical, similar, nearly the same, or completely different between the two languages. If you're considering learning or applying either one, you might benefit by reading this paper first. There are some other excellent comparisons to be found linked from the Open Directory Project as well. Update: 11/20 03:35 GMT by T : Note: here's a mirror; interested readers who mirror the mirror get good seats in heaven.
This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • Some more information (Score:3, Informative)

    by nll8802 (536577) on Monday November 19 2001, @03:40PM (#2586214) Homepage
    There is a good, clean quick overview of C# here [genamics.com]. The also do some comparison of C# to Java.
  • Non Portable (Score:1, Funny)

    by Raven42rac (448205) on Monday November 19 2001, @03:40PM (#2586215)
    I doubt very seriously that any web designer is going to use a non portable language such as C# in which to code. Just an observation.

    Insert sig here.
    • Re:Non Portable by PylonHead (Score:2) Monday November 19 2001, @03:45PM
      • Ouch! by pi radians (Score:3) Monday November 19 2001, @03:58PM
        • Re:Ouch! by Scott Wunsch (Score:1) Monday November 19 2001, @04:35PM
          • Re:Ouch! by sg_oneill (Score:2) Tuesday November 20 2001, @02:48AM
          • Re:Ouch! by clebin (Score:1) Tuesday November 20 2001, @12:18PM
          • 1 reply beneath your current threshold.
        • Re:Ouch! by DrSkwid (Score:1) Monday November 19 2001, @05:39PM
        • Re:Ouch! by trilucid (Score:2) Monday November 19 2001, @07:11PM
          • Re:Ouch! by MaxVlast (Score:1) Monday November 19 2001, @10:57PM
            • Re:Ouch! by MaxVlast (Score:1) Monday November 19 2001, @11:50PM
            • 1 reply beneath your current threshold.
        • 2 replies beneath your current threshold.
      • 1 reply beneath your current threshold.
    • Re:Non Portable by brsett (Score:2) Monday November 19 2001, @04:50PM
    • Re:Non Portable by iacyclone (Score:1) Monday November 19 2001, @05:29PM
    • 2 replies beneath your current threshold.
  • how is it... (Score:3, Troll)

    by Lord Omlette (124579) on Monday November 19 2001, @03:40PM (#2586217) Homepage
    that Carnage4Life, the slashdotter's slashdotter, couldn't anticipate and survive a slashdotting?
  • The lesser of two evils (Score:5, Insightful)

    by Walter Bell (535520) <wcbell@bellandhB ... .com minus berry> on Monday November 19 2001, @03:44PM (#2586237) Homepage
    Disregarding the fact that Java and C# are both "closed" languages controlled by large corporate entities with their own self-interests in mind, they both do an admirable job of bridging the gap between general purpose scripting languages [python.org] and C++. Having used C# and Java on Win32 extensively in the past year, I have become accustomed to the automatic garbage collection, quick execution speed, and logically consistent design of both languages. The Windows compilers / runtime engines for both languages are quite amazing, and something for the fledgling gcj to aspire to.

    Although C# does deliver superior integration with Windows and .net (which is good for MS-only developers and bad for multiplatform programmers like myself), I'd have to pick Java if it was up to me just because of its sheer elegance. It seems like Sun did a better job designing a general-purpose language (applet "security" extensions aside), and Microsoft just tried to copy Java but add in proprietary extensions to hook C# into Windows. Thus, some of the C# features seem to be "bolted on", whereas most of Java came across as being very natural to me.

    Just my 2c...

    ~wally
  • by MarkWatson (189759) on Monday November 19 2001, @03:50PM (#2586266) Homepage
    Good summary of similarities and differences between Java and C#.

    I spend most of my time in the Java world (I have written 5 Java books, the latest of J2EE, and almost all of my consulting is done with Java.)

    That said, C# and Visual Studio.Net are very cool.

    Since Java is not my language of choice (hey, I would use Common LISP more if there were more consulting jobs requiring LISP!), I would not be too bothered if I had to use C# and the .Net stuff.

    Really, what really matters is finding interesting jobs to do, not the development platform.

    I also have high-hopes for interop between the Java J2EE world and .Net using SOAP. (I am working on SOAP support for Common LISP in my spare time so Lis can play nice with .Net and J2EE.)

    Best regards,

    Mark Watson

  • Correction (Score:2, Informative)

    by aspillai (86002) on Monday November 19 2001, @03:51PM (#2586267) Homepage
    Unlike what the article says, Java does have a byte keyword.
  • Standardization? (Score:3, Insightful)

    by mugnyte (203225) on Monday November 19 2001, @03:53PM (#2586279) Homepage Journal
    Language improvements have historicially opened the door to new productivity - in real terms - of apps getting cranked out. Higher and higher encapsulation in text or GUI worlds...but they don't all stick to the wall.

    One cannot always tell beforehand how big the impact will be. Small movements have exploded once given a niche to fill... and then die once it was swallowed up by a new contender.

    If the benefit of C# is only whats in this article, then I'm not convinced its going to change the world. I'll keep to my "unsafe" code blocks and maintain interoperability with non-Gatesian worlds.

    I'll wait for at least a committee for standardization to form for this mess.
    • 1 reply beneath your current threshold.
  • by GISboy (533907) on Monday November 19 2001, @03:54PM (#2586285) Homepage
    with C# that "cross platform" will eventually mean Win9X, ME, NT, 2K and XP?

    Or in some ominous "Morpheous" like voice:
    "The .NET-rix is everywhere...."

    Or maybe I'm just reading too much into it... after all, Microsoft is doing it for the good of the community and Developers (developers, developers, dev....).

    BWAAAAHAHAHAHAHA...I actually kept a straight face while typing that...heh.

    {sniff, wipes tear from eyes..heeeheee}
  • by Mentifex (187202) on Monday November 19 2001, @03:56PM (#2586292) Homepage Journal

    On SourceForge there are already a few rather ambitious Open Source AI [sourceforge.net] projects in the C# language, but there is not yet a Mind-to-C# liaison page, for several reasons.

    Since the various C# AI projects are also using a more open and more traditional language along with C#, the projects are being included in the liaison pages for the non-C# languages. Microsoft has such a tainted history of skulduggery, FUD (fear, uncertainty and doubt) and illegally monopolistic practices, that it may be not only unwise but unethical to jump upon any Microsoft bandwagon.

    Therefore it seems safer to include the polyglot C# AI projects in the Mind-to-VB [sourceforge.net] and other liaison pages.

    Since " Codito, ergo sum " types must give up waiting to trade in VB 6 for VB 7 and migrate instead to VB.Net (q.v.), we AI enthusiasts have some hope that the Microsoft .NET initiative will lead to Internet iMinds advancing the Technological Singularity [caltech.edu] and not merely the Final Take-Over of the 'Net by Microsoft.

  • C# is really kinda cool stuff (Score:2, Insightful)

    by CDWert (450988) on Monday November 19 2001, @03:57PM (#2586301) Homepage
    Language wars abound, and I have no interest in propogating another.But truth is Java has become bloated far beyond its original design as a tv box controller. The best comparison I heard was Java was C without the corners, just like basic is fortran without the corners. C# seems more to me like the best of Java and C++ without many of the sharpest corners. I work in a split development world 1/2 *nix and 1/2 Win32 , none of us slashdotter want to acknowlege it but most of the desktop world is on windows, so to write a Win32 app your most viable options have been C, VB or some other monstrosity on a Win32 box like Java, have you ever tried to run a half a million line Desktop Java app on windows. Or to throw a Java app together in a nice pretty IDIOT proof installer so that the person who thinks a CDROM is a coffe cup holder can install it with one of the nice pretty MS installers, Java in those aspects , well...it sucks
    ....
    Of all the MSVC programmers I worked with once they all had a good chance to work with C# they said theyll never write another line of C++ again. For the windows platform it may indeed be great stuff, the one thing that piques my interest is its cross plattform future. MS included help files and other pices parts refrence Linux, no whether its MS or someone like Ximian with their mono project. The C# stuff is definatley cool. native speed and you can writer in any of the dot net languages you want VB C# and yes TCL and PERL have ports to the Dot NET runtimes, heres the deal even M$ says it, from a performance standpoint on a Win32 machine they will all run the same the language choice will be a matter of style.

    Some slashdotters out ther perpetually bash MS and I do too from time to time, I run Linux at work and home, but the fact is Im in computers to make money PERIOD, If I could make a living out of racing my motorcycles full time Id never touch a computer again other than to surf for parts or events.

    To the ends of making money at computers, C# will do great I am sure , the coders I know that have actually worked with it on a daily basis love it, and to all the NAYSAYERS out there that say "Oh just another MS product to have bugs" sure probably but the wholde of the VS 7 IDE and tools are written in C# , Im sure by the time its released it'll be pretty good. And best of all it will make ME MONEY, I write desktop apps , if its quicker and easier.more interoperable, which it is it has full inheretence.Im all for it. The fact that 3rd parties are already vigilantly porting the runtime to *nix systems tells you its not another Bob

    MS languages for the most part run superbly on MS systems, they suppert both sides of the enviroment. Guess what C# is another example, in XP there are already kernel optimization routines for the DotNET stuff,

    If you HAD to program and app for a MS system in a MS language, which would you preffer, C++, VB, VFP, well..... Or C# that even C++ programmers who use it on a regular basis say , (and from experience it does) rocks as far as MS languages go.
  • C# doesn't make any sense... (Score:1, Insightful)

    by burtonator (70115) on Monday November 19 2001, @04:09PM (#2586353)
    I don't know why anyone would be excited about C# unless they were also excited about Windows (I don't have to explain to anyone here why windows isn't too exciting).

    C# basically is a clone (some would say rip-off) of Java with none of the benefits.

    The Java world is actually doing very well now. We have a lot of solid Open Source projects (Jakarta, Tomcat). The standards that do exist are very robust (Servlet, standard API, etc) and there is a lot of brainshare here.

    There are tons of JVMs available. Can I run C# on Linux? FreeBSD? Solaris?. And if so can I port this code to another alternative non-MS platform? Linux and FreeBSD have had modern JVMs for a while now.

    We are also making significant progress on Java integration with GNU/Linux (AKA not the proprietary SUN Java VM but a Free Software VM meeting the same spec level).

    GCC 3.x will include support for 1.2 class JVMs (except for AWT but we are working on this). This means that all newer modern GNU/Linux machines will be able to execute Java code.

    I liken this to the proprietary SSH vs OpenSSH relationship. There is the proprietary Java VM from SUN which can be used on Windows, Solaris, etc. The Free Software community now has GCC (with GCJ), Jikes RVM, Manta (all OSS VMs), that they can use and still remain free (all of these examples are under the GPL)

    No thank you. I will stick with Java.

    Kevin
  • by ClubStew (113954) on Monday November 19 2001, @04:17PM (#2586381)

    I admit that Microsoft is once again trying to dup Java, but, if you like Java and wish to work with platform-dependant API's that do more with Windows than Java, C# is your answer!

    As the article mentions, C# has almost the exact same syntax and keywords that Java has (plus PERL's foreach operator...kudos). There is almost no learning curve. You can leverage the functionality of Windows with C# however, and it has great XML support; so, if you've worked with the MSXML parser, you'll have no problems working with XML in C#.

    C# deserves a little more credit than many give, at least if you're working in a strict Windows environment. It's worth a look.

    That's all I have to say, but I'll pile on the on wood for the flames that will arise!

  • by jeffy124 (453342) on Monday November 19 2001, @04:17PM (#2586383) Homepage Journal
    .. hmm. 25hoursaday.com. They may need that extra hour to recover from the slashdot effect.
  • Access Privileges (Score:1)

    by inepom01 (525367) <inepom01.hotmail@com> on Monday November 19 2001, @04:19PM (#2586389)
    NOTE: The default accessibility of a C# field or method when no access modifier is specified is private while in Java it is protected. Actually, the default access modifier in Java if none is specified is package private, not protected.
  • But what if.... (Score:1)

    by CoolVibe (11466) on Monday November 19 2001, @04:20PM (#2586394) Journal
    the open-source initiative builds a C# workalike? If the language spec is known, and motivation is there, a C# for less restrictive environments (as in non-win32) is bound to pop up.

    It doesn't have to be based on Microsoft's code, you know. IANACW (compiler writer), but I think that sort of thing can be done. It's only a language. Look at python, or better yet, Jython (or whatever it's called nowadays). A Python byte compiler that creates java bytecode. Surely that can also be done with C#, I think

    Or even better (and probably harder to do) would be a C# compiler that creates machine code.

    Is this a good idea or is it just dead wrong?

  • Big companies... (Score:4, Insightful)

    by Eusebo (24544) on Monday November 19 2001, @04:26PM (#2586425)
    I work for a rather large international bank and I can say we've been moving away from Microsoft as fast as you can say "dot net". From what I've seen this is true of many of the other firms in the financial sector as well. I suspect a large part of the reasoning is not the superiority of Java, but rather is the "anything but Microsoft" syndrome in effect. I seriously doubt that C# will be considered here as a replacement for Java any time soon.

    I have a feeling that C# will be adopted by Microsoft's technology partners, but why would any firm that has spent time and money moving away from Microsoft products go running back because of a new product offering? Its not the products we're trying to get rid of, its the company.

  • I'm impressed by C# -- the language (Score:5, Insightful)

    by GCP (122438) on Monday November 19 2001, @04:29PM (#2586439)
    I've been a fan of Java since it was still in alpha, in early '95. I even wrote a piece of the Swing API. I'm still a Java fan (and developer), but sadly not for GUI apps. MS ("we own the client") and Sun ("we're not going to let this become just a better way to write Windows apps") collaborated to kill Java as a viable way to produce commercial-grade consumer GUI apps.

    We need a modern, productive system for producing new high-performance GUI apps: apps that look and feel as if they'd been written in C++ -- without the crashes and slow dev cycle. I'd give up some of the flexibility of C++ (you can write drivers, create an OS, build a browser, it's a dessert topping AND a floor wax) for something truly optimized for what matters most in creating superb GUI apps quickly and well.

    I've had high hopes for Eiffel and some others to evolve into the successor to C++ for GUI apps, but it never happens. The inertia of programming languages is immense.

    The next to step up to bat is C#. I like the language a lot and think it lends itself to great dev systems. I'm suspicious of the bytecode aspect, though. ("Faster than compiled!", "It actually is compiled!", etc. Yeah, so why isn't Solaris written in Java?) I'm afraid that aspect will still require that "serious" apps be written in C/C++.

    I like even less that it may remain Windows-only. If it does remain Windows only (for all practical purposes), I suspect the blame will belong just as much to MS haters dismissing it primarily out of bigotry as to MS for optimizing it for their own platforms.

    I'd like to see the open source community look at it with the same eyes as if it had come out of some smelly hacker's basement.
  • by GunFodder (208805) on Monday November 19 2001, @04:31PM (#2586454)
    It sounds like C# has some nice features that Java doesn't, but I have my doubts that Microsoft will make it multiplatform. And that is becoming more important as the range of computing devices widens.

    Servers tend to run Unix or legacy OSes. Embedded devices run Palm OS or a free Unix like Linux or BSD. Phones run all kinds of custom software. The only platform that Windows rules is the desktop, and that market segment just shrunk for the first time in history. How can C# dominate if it only runs on one type of device?
  • my $0.02 (Score:5, Insightful)

    by vscjoe (537452) on Monday November 19 2001, @04:32PM (#2586458)
    I think from the level of people who make decisions about what programming languages to use on commercial projects (this includes me), the technical distinctions between Java and C# are of little concern: the languages are so similar that they are basically interchangeable. What matters is who supports it, what libraries are available, how mature are the implementations, whether it's a single-vendor or mult-vendor solution, how well it integrates with the platform, and how many programmers are available.

    For pure Windows programmers, C# wins there and will probably be picked up by lots of VB and VisualC++ programmers. But people who live in that world are already not using Java. For everybody else, Java seems to win hands down. I think C# will neither be a complete failure nor will it do much harm to Java.

  • Java vs. C# (Score:1)

    by Glock27 (446276) on Monday November 19 2001, @04:34PM (#2586474)
    From a technical perspective, I'd like to see Java get some of the features of C# (only better of course;). Operator overloading and lightweight classes are both good ideas (although operator overloading can be done now with a preprocessor like jpp). Perhaps these features will make it into one of the Java clones like gcj.

    Regardless of the technical issues, I think everyone involved in software development should think long and hard before committing to a Microsoft-inspired approach. Microsoft's track record on getting people to buy into platform lock is clear. It is in your company's best interest to avoid Microsoft lockin in almost every case.

    One of the saddest things that's happened in some time is the Mono team's committing to C#. It should have been gcj. Shame on them for encouraging the use of Microsoft's platform. IMO, Ximian can be well assured that Microsoft will either change, patent or extend things until Mono is irrelevant in the end - after lots of Open Source energy has been expended on that dead end.

    On the other hand, Java continues to gain momentum in almost every area. There are good VMs available on every important desktop platform (as well as most embedded and server platforms). Go forth and code! ;-)

    299,792,458 m/s...not just a good idea, its the law!

  • Interesting, but there's an error... (Score:3, Informative)

    by ncc74656 (45571) <slashdot&alfter,us> on Monday November 19 2001, @04:46PM (#2586558) Homepage Journal
    From the linked article:
    In languages like C and C++, each subarray of a multidimensional array must have the same dimensions.
    I'm fairly sure you could do something like this in C or C++:
    int** foo=(int**)malloc(sizeof(int*)*2);
    int* foo[0]=(int*)malloc(sizeof(int)*3);
    int* foo[1]=(int*)malloc(sizeof(int)*9);
    That will set up a jagged array with the same dimensions as in the given C#/Java example. It will be addressable in the same manner. It won't have the bounds checking, but I suspect that the comment regarding Real Programmers and strong typing [google.com] could be extended to bounds checking. :-)
  • by sterno (16320) on Monday November 19 2001, @04:55PM (#2586605) Homepage
    Ultimately the people using these languages tend to base their decisions on the platforms they wish to use and less upon the language. If you are running a Unix/Linux environment you aren't going to seriously consider C#, and for the most part doing work in Java under windows is more trouble than it's worth.

    I think you'll see that in the long run VB, VC++ shops are going to use C#, and Java shops are going to run Java regardless of the inherent capabilities of the languages.
  • w00t? no dynamic class loading? (Score:4, Informative)

    by mnf999 (137795) on Monday November 19 2001, @05:09PM (#2586670)
    I did not know that (and couldn't read the full description as the site is totally /.ed :(

    I design JBoss, the leading J2EE server and at THE HEART of it is the capicity to dynamically deploy new applications on our application server. I mean that is what application servers are ALL ABOUT.

    in fact (plug) in JBoss we go the extra mile and allow you to hot-deploy (dynamically add classes) the server classes themselves, which neither IBM nor BEA, nor Oracle do.

    So I was curious to know who would win the .net webservices race but it is extremelly clear in my mind, J2EE frameworks will deliver with webservices easier than any C# framework will

    Why? well imagine that ANY time you change your class in C# YOU NEED TO REBOOT THE APPLICATION SERVER, yes, boys and girls that is the simple thing that "dynamic class loading" affords you, without it, the VM is tied to whatever you have at startup.

    GEEEEZZZ!
  • Having used .NET (Score:3, Informative)

    by f00zbll (526151) on Monday November 19 2001, @05:12PM (#2586682)
    I haven't used C#, but I am using .NET on a project. From my experience so far, the .NET platform has a long way to go. It's good that C# will make things easier for developers, but like all languages with wide adoption, bloat will inevitably occur.

    The first release of .NET will still be 2-3 releases from full fault tolerance and enterprise level computing. There are alot of complicated processes in enterprise computing and Microsoft's .NET platform as it stands today is far from meeting those needs. Microsoft has yet to define really useful modules and standards for complex processes that span multiple systems which include legacy VMS systems and modern solaris 8 applications.

    SOAP is great for simple processes, but it is far from adaquate to handle distributed and transactional processes. Using standards like UDDI is a great step towards easing multi-platform integration. Instead of having different divisions of the same company design different API for publishing resources, it will be easier to have a common way of doing those things. It is not uncommon for financial institutions to store information differently. Take a simple think like address. Some places may store the number in a separate field, while others may replace "jr" with "junior". Anyone who has worked with large mixed environments knows this fact. SOAP is a message centric way of doing things. It is not designed for complex processes. The stuff IBM is building around SOAP is more complete than Microsoft's offering, but then again IBM has been at services longer.

  • Java all the way! (Score:1)

    by dom_runner (536485) on Monday November 19 2001, @05:14PM (#2586690) Homepage
    Why choose a vendor locked in language, when you can have; write once run everywhere (these days this is more true than ever); program for the webb, 3G mobile solutions (J2ME), desktop, embedded systems etc etc and no vendor lock in! The day MS can show me something equivalent to this I will at least consider their solution!
  • My take (Score:5, Interesting)

    by nebby (11637) on Monday November 19 2001, @05:35PM (#2586805) Homepage
    I've been a Java programmer since JDK 1.0 came out, though I've really done most of my Java coding with server side servlet stuff since the GUI library has, and probably always will, suck the wanker.

    I just recently picked up C# about a month ago. The learning curve from Java was pretty damn low, only with a few different naming conventions and new language constructs. Things such as indexers, delegates, and the like (all of which I feel are positive additons to the language.) The event model, to my surprise, is better than Java.

    Then after learning the language itself I started looking into Windows Forms and nearly spooged my pants. Finally Windows progammers get a clean framework of GUI controls with a powerful modern language behind it (ie, not C++ or VB.)

    Usually if you wanted to make a powerful Windows app you were forced to use C++ since VB didn't really cut it. Now you can use C#. Complex Windows apps are going to be a whole lot easier to write now, nevermind the fact that they'll be able to do remote method calls via SOAP, and be deployed effortlessly (ie, create a Windows Installer in like 3 clicks or something.)

    I have to say, for the stuff I'm writing that I don't need cross-platform compatibility (which I did surprisingly find to work in the case of servlets) .. C# and the .NET framework wins hands down.
    • Re:My take by alext (Score:1) Monday November 19 2001, @08:29PM