Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69

    But which is better, Java or C#..


    Hi all,

    I have been reading through this forum and 'C# is Java' came up a lot in one particular thread, so which is better :S. I'm quite up for learning and so.. Java or C# is my question. There both looking pretty interesting.

    Have fun everyone,
    mark.
  2. #2
  3. Perl Monkey
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    May 2003
    Location
    the far end of town where the Grickle-grass grows
    Posts
    1,860
    Rep Power
    108
    I would say, at this point, it depends on your platform. If you're okay with MS and their products (many people have religious-like zeal against anything the corporation is so much as loosely affiliated with) and plan to run on a windows platform, then I'd say you'd be hard pressed to go wrong with C#. It has VB's renouned forms for increadibly easy interface creation, and really looks a lot like java at the code-level. It is a fully-functional and featured language, and once you get the hang of the Visual Studio IDE, you can have very rapid development quite easily.

    On the flip side, java is ported everywhere, will run on any system. Characters are always two bytes to insure that it supports any language's character set. It's been around longer and is more mature. As for the internet, JavaScript is an easy pick-up and a must for almost all client-side activity. Applets and Servlets are at your disposal, as well. They support XML web services, too, but it's more costly licensing for a company (I think, really not very sure).

    If you get to know one language, you will have absolutely no problem picking up the other. I'd say it really boils down to platform. If you need stuff to run in something other than windows, stick with java. The open C# compiler (mono?) has been mentioned, but if you're developing a significant portion in *nix, forget C# for now. Language maturity can be worked with, but couple that with compiler maturity issues, too, and it's likely to get hairy.

    I should also mention that I've only loosely worked with both languages and am as far from an authority as could be. I've done background research on the two in the last six months, but haven't spent more than a few weeks programming in either. I'm a man of C/C++/Perl (especially that last one).
    Andrew - Perl (and VB.NET) Monkey

    Never underestimate the bandwidth of a hatchback full of tapes.
  4. #3
  5. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    Ah, I think i'll stick to Java then. A, because of as you mentioned its ported to ever platform and B, simply because it seems to be alot more desirable on the job front .

    Thanks a lot for your help, easy to understand and got the point accross.

    Ta,
    Mark.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Portugal
    Posts
    106
    Rep Power
    11
    Well saying that Java advantage is that it runs in all platforms is mostly true but everyone knows that ensuring your Java applications/applets/etc work on each platform is an absolute nightmare.
    To me C# is better than Java. Sun was the pioneer of Java and microsoft looked at its records and said, let's keep this, enhance that, and get rid of this and so on, making C# a modern new language. And things you take 2h to do in java takes 15 minutes with C#....
    Where's overloading, pointers, preprocessor directives, delegates and deterministic object cleanup in Java?
    I'm starting to think that the only real advantage of Java is portability(although it can be a nightmare).. because with C# you can do everything Java does and do it easier and in less time(and maybe better). And I won't even mention JSP6Servlets Vs. ASP.NET because every independent study have said everything about it...

    One of the first things I saw in C# that got me interested in it: read/write properties:

    Code:
    Java:
    
    public int getSize() {
    	return size;
    }
    
    public void setSize (int value) {
    	size = value;
    }
    
    C#:
    
    public int Size {
    	get {return size;
    	}
    	set {size = value;
    	}
    }
    "relationship between a get and set method is inherent in C# while has to be maintained in Java." It just makes your life easier

    you can find more examples like that here:
    http://genamics.com/developer/csharp_comparative.htm

    if you just want the conclusion:

    "I hope this has given you a feel for where C# stands in relation to Java and C++. Overall, I believe C# provides greater expressiveness and is more suited to writing performance-critical code than Java, while sharing Java's elegance and simplicity, which makes both much more appealing than C++."

    About the job market if you have been paying attention lately you'll notice the fast increase of jobs asking for C#/.NET skills, thus giving you a hint where the future is heading
  8. #5
  9. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    You make a good point, especially with the development time, although Python still beats both hands down on that front.

    Your code snippets were very interesting, I did note that C# seem's to use less code than Java which is always a good thing! Another thing I seem to have picked up is that compiling C# is easier than using the command line to compile Java?

    Maybe when Mono is more mature it will make sence to use C# for multi platform development..

    I've looked at ASP.Net and JSP before and the one advantage I've seen is that JSP has over ASP is that ASP.NET can only be run on windows servers where JSP runs on multiple server on multiple OS. If only Microsoft would make a cross plaform version of ASP then i'd consider using it, simply because it looks very interesting!

    As for jobs I havn't seen any advertised but i'll look into that more closely before I make the final choice over which one to learn next!

    Thanks alot for the advise!
    Mark.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    109
    Rep Power
    11
    Iíve done a fair bit of programming in both Java and C# and Iíd have to say that the only reason Iíd ever consider using Java is for cross platform compatibility. C# is faster to develop in (especially GUI design), has a better IDE then any of the various Java IDEs out there, can perform lower level operations (fixed statements and unsafe code), is a hell of a lot faster and comes with one of the most comprehensive runtimes Iíve ever seen. Quite literally anything you could ever want to do is built into the .NET framework. All this with the beauty of OOD that is Java and you canít go wrong.

    I think C# definitely has a bright future and if you already know Java you should have no problem picking up C# in no time so if cross platform compatibility isnít an issue Iíd say give C# a try.

    Comments on this post

    • BaronVonDoppleG agrees
  12. #7
  13. No Profile Picture
    Demonic Swordsman DGQB
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Apr 2003
    Posts
    1,043
    Rep Power
    83
    fetcher: I never understood the PROPERTY thing. You wrote:

    Code:
    C#:
    
    public int Size {
    	get {return size;
    	}
    	set {size = value;
    	}
    }
    but where does the variable value come from?

    In java, it's clear because it's passed on as a parameter (int value).

    I am still confused about the property property of Microsoft languages, and frankly, I really don't like it. But maybe I will like it once I understand it
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    109
    Rep Power
    11
    'value' is a keyword in C#, when you set a property in C# 'value' contains the value that was sent to the set procedure, it can be anything (value or referance).

    Usually you declare a variable and a property to control read write acces such as:
    PHP Code:
    private int iSize;
    public 
    int Size
    {
        
    get
        
    {
            return 
    iSize;
        }

    This will allow you to only read the iSize variable outside the class.

    It's also very useful for when you want something to happen when a variable is assigned to. ie:
    PHP Code:
    private int iID;
    public 
    int ID
    {
        
    get
        
    {
            return 
    iID;
        }
        
    set
        
    {
            
    iID value;
            
    lblCurrentID.Text iID.ToString();
        }

    The above lets you get or set the current ID, but when you set the ID the label lblCurrentID is updated to display the current ID.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Portugal
    Posts
    106
    Rep Power
    11
    in C# a property may have a get and/or set accessor associated with it. C# automatically provides the variable value which holds the new value to which the property can be set

    Code:
    class Car {
    
       int size;
    
       public Car(int size) {
          this.size = size;
       }
    
       public int Size {
          get { return size; }
          set { size = value; }
       }
    }
    to use it...

    Code:
    Car c = new Car(10);
    
    Console.WriteLine("Car size is: " + c.Size); // displays 10
    
    c.Size = 12;
    
    Console.WriteLine("Car size is: " + c.Size); // displays 12

    vb.net:
    I hope that now the property property of Microsoft languages isn't confusing anymore. It is simpler once you get it
    Last edited by fetcher; June 30th, 2003 at 04:24 PM.
  18. #10
  19. No Profile Picture
    Demonic Swordsman DGQB
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Apr 2003
    Posts
    1,043
    Rep Power
    83
    Thanks guys. It cleared up a few things for me.

    The thing that gets me the most is this:

    Code:
    get
        {
            return iID;
        }
    get return iID? Why not just GET ID or RETURN ID? Two consecutive verbs = bad programming syntax!
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Portugal
    Posts
    106
    Rep Power
    11
    vb.net:

    get return iID? Why not just GET ID or RETURN ID? Two consecutive verbs = bad programming syntax!
    dude..... you must be kidding right? Or you are another one of those people that get blind with their anti-microsoft way of living?

    inside the get you can have many more stuff than just a return.....so ummm where's the problem?

    people say Java is an "evolution" of C+ and C# is an "evolution" of Java => C# kicks Java a$$!! in an elegant, beautiful, simple, eficient way
  22. #12
  23. Perl Monkey
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    May 2003
    Location
    the far end of town where the Grickle-grass grows
    Posts
    1,860
    Rep Power
    108
    As a language, I think C# is better than Java, but there's more to programming in something than just the language itself. Platform is a big thing. No, I'm not spouting off about java's super portability, though that is part of it. It's the whole package, the compiler, the runtime, support, following...and there's a lot more subjective points in there. No one language is completely better than another. Cobol is worlds better than Java/C# for what it did.
  24. #13
  25. No Profile Picture
    Demonic Swordsman DGQB
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Apr 2003
    Posts
    1,043
    Rep Power
    83
    Or you are another one of those people that get blind with their anti-microsoft way of living?
    In fact, you couldn't be more wrong. I am a huge supporter of Microsoft, probably the biggest you will find in these forums.

    inside the get you can have many more stuff than just a return
    Like what? show some examples, because the books made it look like RETURN was the only thing to do.
  26. #14
  27. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69

    Platforms..


    Ok i never got this about Java, The idea seemed to be that Java apps run the same on all platforms but.. Java can only run where an VM will run, and then you get problems with VM types, versions, memory etc. surly it isn't any more platform indepent than, well i would say perl but i know sometimes you have to chnage code so it will run on other platform. so that aside, if C# is better than Java language wise, and has a growing following, why use Java?

    Mark.
  28. #15
  29. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Portugal
    Posts
    106
    Rep Power
    11
    I agree 100% with netytan

    vb.net:
    I'm sorry I thought you were all anti-microsoft.

    Anyway about the get accessor, I couldn't find any example so I posted the question in another forum and someone posted this:



    Definitely can. For example:

    Code:
    protected override RenderPathID RenderPath
    
    		{
    
    			get
    
    			{
    
    				if (IsDesignMode)
    
    				{
    
    					return RenderPathID.DesignerPath;
    
    				}
    
    
    
    				if(RenderType==RenderType.Default)
    
    				{
    
    					if (_BrowserLevelChecker.IsUpLevelBrowser(Context))
    
    					{
    
    						return RenderPathID.UpLevelPath;
    
    					}
    
    					return RenderPathID.DownLevelPath;
    
    				}
    
    
    
    
    
    				if(RenderType==RenderType.Uplevel)
    
    				{
    
    					return RenderPathID.UpLevelPath;
    
    				}
    
    				else
    
    				{
    
    					return RenderPathID.DownLevelPath;
    
    				}
    
    			}
    
    
    
    		}
    So there you go vb.net
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo