Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 10 of 10

Thread: Ongoing C# vs Java Debate

  1. #1
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Ongoing C# vs Java Debate

    There has been (and still is) an ongoing debate between Java and C# programmers and fans
    about which language is superior. (It has turned quite heated between some people I know.)
    I just thought I would post my views on it - and I welcome your own on the matter too

    1. People debate that Microsoft(R) only created C# because their other language, J# was a failure
    out of the box - and they wanted to rival Java and Oracle.

    -> This is total rubbish in my view - C# is an independent language - which borrows syntax
    and features heavily in some cases, from C, C++ and Java. The fact that it is a fully OOP does
    allow that Java has a fierce rival in terms of what language the programmer wants to use.
    Microsoft(R) created C# as a support language for their .NET Framework. It was never intended
    to port to Linux and MacOSX - but the fact the Mono project has taken off I feel is a great thing.
    If I was an employer - and I wanted a Java programmer - I would almost certainly consider a
    competent C# programmer as well.

    2. People who value C# do not like the "separate file per class" feature of Java, and point to
    languages like C and C++ which use "header files" to store class implementations and declarations.

    -> Again - I have to personally disagree here. Let's look at an example.

    // C# program
    namespace Sample
    {
       public class Dummy
       {
          public Dummy()
          {
              // .....
          }
     
          private int PropertyDummy()
          {
              set { // .... }
              get { return //... }
          }
       }
     
       public class MainClass
       {
          public static void Main(string[] args)
          {
             Dummy dum = new Dummy();
          }
       }
    }

    To me - I do not see the point of placing two working class in the same file.
    Now I know you can place them separate files using namespaces, but the
    fact than the above is legal to me just breaks the idea of data hiding.
    If I am working on a large project - I do not want other class's methods
    and instances to be visible near other classes. I respect the fact Java
    does not allow this - and implicitly declares classes should belong to their
    own package. Again - just my personal view.

    3. Pointers and References - It is well known that pointers are available in C# and in Java
    through external libraries. Ideally, pointers are not an issue with most people as GC does most
    of the work within both languages pretty well. In C# you can place pointer notation anywhere in
    a program as long as it uses the "unsafe" wrapper.

    unsafe
    {
       int *ptr = NULL;
       int total = 100;
       ptr - &total;
       System.Console.Write("{0}", *ptr);
    }

    In Java, everything is passed by value. There are no references in Java - apart from the
    possibility of mirroring references using arrays. C# people I talk to tell me that Java is
    "stupid" for not allowing data to be passed by reference. I think it is a great idea. It
    protects the original data in the method from accidental modification. This is all part of
    the design of Java - safety.

    Well I have rambled on enough. Hope you found it a good read - again post your own views on the
    two languages and the ongoing debate between programmers.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)


  2. #2
    Member Abhilash's Avatar
    Join Date
    Jun 2014
    Location
    Kolkata, West Bengal, INDIA
    Posts
    108
    My Mood
    Busy
    Thanks
    5
    Thanked 10 Times in 10 Posts

    Default Re: Ongoing C# vs Java Debate

    Actually, the problem is Java is replacing C# (this is happening in India, I don't know other countries). C# is still in use but in most of our schools (nearly all), java has been accepted and is taught because it is easier. I don't know any school that teaches C#. Obviously, C# users will protest because of its decline and Java users will protest because of their protest. Please let me know if I'm wrong, because I'm not good at debates but as far as I've seen, java is being accepted widely.

  3. #3
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Ongoing C# vs Java Debate

    Actually, the problem is Java is replacing C# (this is happening in India, I don't know other countries). C# is still in use but in most of our schools (nearly all), java has been accepted and is taught because it is easier. I don't know any school that teaches C#. Obviously, C# users will protest because of its decline and Java users will protest because of their protest. Please let me know if I'm wrong, because I'm not good at debates but as far as I've seen, java is being accepted widely.
    Java has been around for a lot longer than C# has - that is one of the reasons it is used in colleges. Another reason is that for the last
    couple of years, Java courses have been replacing C courses. When I went to college - I started out learning C and Assembly. Nothing
    wrong with that - I was exposed to the machine level abstraction that is hidden from higher-level languages like Java and C#. However,
    as time has moved on, professors are seeing (as you stated) that Java is a widely used extremely popular language in industry today.

    The fact it is 100% object-orientated is a major plus in their books. Managed languages seem to be where the future is heading
    (Android development). A student with Java on their CV is a good thing to have. The old suggestion was the every programmer
    should know C to be a good programmer. That statement is still very valid however, and I would personally encourage anyone
    who as not looked at C to at least give it a peak - having some idea of what is happening when memory is allocated and why
    Exception are thrown in Java is a great confidence builder.

    Wishes Ada xx
    Last edited by Ada Lovelace; June 6th, 2014 at 04:11 AM. Reason: Escaped sentence
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  4. #4
    Member Abhilash's Avatar
    Join Date
    Jun 2014
    Location
    Kolkata, West Bengal, INDIA
    Posts
    108
    My Mood
    Busy
    Thanks
    5
    Thanked 10 Times in 10 Posts

    Lightbulb Re: Ongoing C# vs Java Debate

    Quote Originally Posted by Ada Lovelace View Post
    Java has been around for a lot longer than C# has - that is one of the reasons it is used in colleges. Another reason is that for the last
    couple of years, Java courses have been replacing C courses. When I went to college - I started out learning C and Assembly. Nothing
    wrong with that - I was exposed to the machine level abstraction that is hidden from higher-level languages like Java and C#. However,
    as time has moved on, professors are seeing (as you stated) that Java is a widely used extremely popular language in industry today.

    The fact it is 100% object-orientated is a major plus in their books. Managed languages seem to be where the future is heading
    (Android development). A student with Java on their CV is a good thing to have. The old suggestion was the every programmer
    should know C to be a good programmer. That statement is still very valid however, and I would personally encourage anyone
    who as not looked at C to at least give it a peak - having some idea of what is happening when memory is allocated and why
    Exception are thrown in Java is a great confidence builder.

    Wishes Ada xx
    That's perfectly true. Java has also a wide range of applications in programming. It is an easy language for beginners to start with and that is what is happening now. People want easier language to program with when it comes to programming, and I have seen many people stick to the programming language once they learn it. This is what happening in schools and collages and this is the reason for the popularity of java i.e. more number of users.

  5. #5
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Ongoing C# vs Java Debate

    Quote Originally Posted by Abhilash View Post
    That's perfectly true. Java has also a wide range of applications in programming. It is an easy language for beginners to start with and that is what is happening now. People want easier language to program with when it comes to programming, and I have seen many people stick to the programming language once they learn it. This is what happening in schools and collages and this is the reason for the popularity of java i.e. more number of users.
    Again - I do agree with what you say. I forgot to mention in my previous post that C is still (according to some stats) is still the top dog
    in used programming languages. Operating Systems, device drivers, micro-processors and Kernels all used embedded C as the language.
    Because it is close to the metal. For beginners - yes, Java is a great language to learn. Even if you do not come from another language
    background that uses procedural programming methodologies such as standard BASIC or PASCAL - you can learn the syntax quite easily
    over a period of time - and the thing with Java that I have found, is that it sticks with you.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  6. #6
    Member Abhilash's Avatar
    Join Date
    Jun 2014
    Location
    Kolkata, West Bengal, INDIA
    Posts
    108
    My Mood
    Busy
    Thanks
    5
    Thanked 10 Times in 10 Posts

    Lightbulb Re: Ongoing C# vs Java Debate

    Absolutely correct. But could you please explain this part:-

    Quote Originally Posted by Ada Lovelace View Post
    I forgot to mention in my previous post that C is still (according to some stats) is still the top dog
    in used programming languages. Operating Systems, device drivers, micro-processors and Kernels all used embedded C as the language.
    Because it is close to the metal.

    I don't understand why C is the Top dog and why it is Close to metal.

    Thank you.

  7. #7
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Ongoing C# vs Java Debate

    C is used everywhere - you can write an operating system, video game, desktop application, another language compiler, even a web browser in C. All
    of these things cannot be done in Java - but most of them can. C is used for much more low level mechanics than Java because it is nearer to the
    machine level instruction code that the computer understands.

    For example - if you wanted to write an Operating System - you would use C, assembly and C++. Why? Because they are closer to the binary
    of computer language. An Operating System is a huge complex application - it also needs to run incredibly quickly and be able process many
    commands at once. C and assembly in particular are best suited for this job - because they execute at a lower level, the instructions are
    executed faster and the results are generated quicker.

    Another reason why C is used more widely than Java overall is due to the many cases of old legacy code that exists. It would be extremely
    tedious and in most cases completely unnecessary to re-write all the old C code in Java. If it works - then leave it be. C programmers are
    also very much in demand for this sort of low-level operation. Having said that, with the ever increasing popularity of Android development
    for smart phones - and Apple's IOS based Objective-C language, there are many jobs and doors opening for Java developers than there
    were before.

    As long as Oracle continue to support and update the Java standard - it is not going away anytime soon

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  8. #8
    Member Abhilash's Avatar
    Join Date
    Jun 2014
    Location
    Kolkata, West Bengal, INDIA
    Posts
    108
    My Mood
    Busy
    Thanks
    5
    Thanked 10 Times in 10 Posts

    Default Re: Ongoing C# vs Java Debate

    So you cant write an operating system in java?

  9. #9
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Ongoing C# vs Java Debate

    Not as far as I know - and like I said, you need multiple commands methods to execute in parallel
    at a high speed. Being close to the machine binary using languages such as C and assembly will
    give you that speed. Java could be used to create a layer above the execution that the assembly and
    C would give - but almost certainly it would not be possible to write an entire Operating System in
    Java.

    You could prove me (and a lot of others) wrong - if you were to achieve the same speed and ability
    of creating operating system in a managed higher level language. As technology stands right now -
    C and assembly will always be used for such low level infrastructure.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  10. #10
    Member Abhilash's Avatar
    Join Date
    Jun 2014
    Location
    Kolkata, West Bengal, INDIA
    Posts
    108
    My Mood
    Busy
    Thanks
    5
    Thanked 10 Times in 10 Posts

    Lightbulb Re: Ongoing C# vs Java Debate

    Thank you. Maybe one day I'll try to make a new version of Java in which you can write operating system, but in the very distant future if possible. (Like I said, I'll try.)

Similar Threads

  1. Java program for election voting machine
    By bruint in forum File I/O & Other I/O Streams
    Replies: 15
    Last Post: May 20th, 2009, 10:07 PM