Results 1 to 8 of 8

Thread: java vs c#

  1. #1

    java vs c#

    hi mates
    im all confused,right now iam on c#
    i wanna something that can get me nice job
    c# is good but it makes me stuck to microsoft windows
    java is portable
    both of them offers powerful features
    i just wanna ur advice
    ur point of views
    to help me to figure it out

  2. #2
    er0k
    Guest
    c# has vm's too..

  3. #3
    My personal opinion would be C#. Do to the fact that it is 'completely' compilable into machine code where as java is still interpreted (don't argue it really is true). Anyways, C# is basically and extension to C++ just with the new .net framework built-in. It had java similarities, but only in the syntax....

    Scat
    If the scatman can do it so can you.

  4. #4
    Ninja Code Monkey
    Join Date
    Nov 2001
    Location
    Washington State
    Posts
    1,027
    it all depends on what you want to do and for who. Both are good candidates for keeping you employed.

    However c# is not an extension of c++. The .net version of c++ is managed c++. c# is a c syntax language that has some neat features such as vb style property procedures (ish) but is very different overall from c++ (such as inheritance, which is more like java style inheritance.....and the lack of explicit pointers and memory allocation).

    Both can be used for creating applications, web services, etc. Both use a virtual machine, tho java uses bytecode and c# is compiled to the .net intermediate language.

    If you go java there are some very good environments out there to code with including the sun one studio that is a visual basic style interface (including drag and drop ui design) and is written with java. There are some better ones too.

    Visual studio.net is a great improvement over the old visual studio and handles c#, vb.net, etc. It is a great environment to work with and all forms of development (console, web application, web service, windows service, component library, regular app) goes pretty quickly. You can do the same drag and drop style of ui design as you'd do with vb 6 but with stronger code. There are also many excellent time saving features as you'll see if you do any web service development or if you work with any of the validation controls. c# will also let you work with old school com components which can be handy and a useful skill.

    It also depends on where you live since some areas tend to be more *nix prone and others more windows prone. Here in seattle, .net skills are in high demand.

    If you pick up c# or java it isn't much of a stretch to pick up the other language. Syntax wise the languages are very similar. The biggest differences are in implementation, code libraries, etc. And all that isn't too hard to pick up with time and practice.

    Oh, and is it goes with portability..... .net has the mono project to bring it to linux. Java is useful on both windows and *nix but as it goes with business in my experience it is used far more on *nix.
    "When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
    "There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
    "Mischief my ass, you are an unethical moron." - chsh
    Blog of X

  5. #5
    Banned
    Join Date
    Sep 2001
    Posts
    852
    Do to the fact that it is 'completely' compilable into machine code where as java is still interpreted (don't argue it really is true).

    wrong again c# isnt machine code its MSIL which is compiled into machine code by the VM but anyway
    rioter

  6. #6
    Senior Member
    Join Date
    Jan 2003
    Posts
    120
    I know this is a lil off subject but RiOtEr, that is the funniest sig ive ever seen; common wood screws, ROFL

  7. #7
    er0k
    Guest
    you gotta love the new avatar as well.

  8. #8
    Senior Member
    Join Date
    Jan 2002
    Posts
    1,207
    I can't really respond to the machine-code compiling guys without starting a flame war, but I'll try

    C# - is compiled into machine code by the runtime when it loads an assembly (or shortly afterwards). This means that unless you deliberately execute it in the interpreter, it is not interpreted. It is "usually" run natively.

    Java - is compiled into machine code on a method-by-method basis, as decided by the JIT compiler. This means that during the running of Java program, typically some methods are interpreted and others run in machine code. In a loop that runs the same methods repeatedly, the JVM will quickly compile all the methods into machine code and run them as machine code.

    So in fact, both will tend to run code natively.

    I only speak from using many JDKs, the Microsoft .NET framework and the Mono implementation of the .NET framework.

    IMHO, C# does have some advantages over Java. It is a bigger, more complicated language. This may be a problem for purists, but it can enable you to create shorter programs.

    C# has that Java does not
    - explicitly declared "Property" setters / getters
    - structs
    - automatic boxing / unboxing (Java has boxing and unboxing too, but you have to do it manually most of the time)
    - Operator overloading
    - The ability to use method pointers for events (not sure what this feature is called)

    Java has that C# does not
    - Checked exceptions
    - Anonymous classes
    - (in 1.5 which hasn't been finalised yet) Generics (it seems likely that M$ will add generics to a future version of C# in response)

    ---

    Well essentially C# is a response to Java, so you'd expect it to have more features, that programmers requested. That's why they made it.

    Java has more maturity, but also more crud built up in its libraries. There are a lot of deprecated methods.

    The libraries are comparable. The Java one has bits that the C# doesn't, and vice versa.

    In a way, C# should definitely be better, because the developers attempted to "fix" everything they felt was wrong with Java. Some of the points were debatable, but some were ok.

    As you'd expect, a lot of the .NET libraries are very Windows-centric and inherit design problems from Windows. In particular, expect to have to use COM for some things.

    I used the native interfaces for both, and I have to say, in C# it's *much* easier to interface most libraries. In Java you have to write lots of messy wrapper code (in C)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •