Differences between C# and Java
#1 Members - Reputation: 119
Posted 04 February 2012 - 02:20 AM
opinions?
Thanks.
#3 Members - Reputation: 108
Posted 04 February 2012 - 03:18 AM
stein102, on 04 February 2012 - 02:20 AM, said:
You could look at here.
stein102, on 04 February 2012 - 02:20 AM, said:
opinions?
Imho they are two languages which are close from a programmer's point of view. There are differences, but the main concepts are the same, so the transition shouldn't be hard.
stein102, on 04 February 2012 - 02:37 AM, said:
Obviously it depends on many factors, the transition to C# should be easier than the C++ one, and you're also considering XNA, which is another element that might help you. So, it depends on your will and your constraints (time, for example): you can do an intermediate step (with some result) or an harder one. Imho, if your final goal is C++ and you've no time constraints and no need to produce results to keep up your motivation, you can avoid learning C# and XNA and jump to C++, imho.
#4 Members - Reputation: 116
Posted 04 February 2012 - 03:27 AM
As for C#, it is a great language and the .net framework is amazing but then I havent really tried out other languages outside .net (minus PHP). Sadly if you did a google search you will likely come across hundreds of outdated threads where the languages are compared and degraded, I would avoid reading them simply because the internet in flooded with comparison wars (not just C# / Java) making it really frustrating finding 'real' comparisons and all you really find are "join my club, its better!" threads / articles.
Same applies to C++ vs ??? and well MS vs Apple and whatever else, I would stay clear away from those threads, because if anything they will be outdated and put you off, if you like Java, stick with it, if you want to try C#, go for it and if you want to play around with C++ then by all means do. Be weary of the "unmanaged languages are bad" that follows literally every C++ vs ??? thread / article, if the language was so bad millions of people wouldnt put their blood and sweat advancing in it.
Sorry if that sounds like a rant but I felt it was necessary to say with the amount of comparison articles / threads around
As for C# (.net) itself, theres many many features, Linq, EF, XNA, WCF, WPF, SL5 (which now has many features of XNA), ASP.NET MVC (which made all my web related work simple and easy in ways I couldnt imagine) and in the next few months massive improvements to Async programming. Theres many features about .net that havent been mentioned here and really I could go on and on, but tbh if you want to try then try it, theres no reason why a person couldnt advance in every language, learning something in one language will likely benefit you in the other.
In regards to limitations, the main one really is .net is for MS machines only, there mono which helps overcome this limitation, to me this is hardly a limitation, I have never used an apple product, no criticism to apple but I have never had any desire or need to use or buy an apple product.
One thing I will say about C++ though, you may want to check out native C before doing any C++, the learning will be relatively quick and straight forward since most of the language could be easily compared to Java and definitely C#, I did a little bit of reading back in the day with pointers on C++ and oddly enough it was only when I started learning about native C that I actually understood pointers and memory management in general
#5 Members - Reputation: 1199
Posted 04 February 2012 - 04:43 AM
stein102, on 04 February 2012 - 02:37 AM, said:
If C++ is your final goal then need to reconsider what your final goal should be. (C++ is a good language to know but you're fooling yourself if you think its the only language you need as a programmer), I did consider C++ to be my final goal when i started out and as such it was the fourth (i covered BASIC, Pascal and x86 asm before that) language i learned, now i know over 15 languages and got 2 languages on my "to learn" list, (C# and Python and i'm working on C# atm).
When it comes to learning C++ i strongly advice against learning C first as you risk picking up some very nasty habits that way.
As for C# vs Java, the main differences i can think of is LINQ which is just pure awesome and the platform support, (Java is required for Android development while C# is required for WP7), on the desktop it really doesn't matter which one you go with allthough running .jars on Windows can be a bit of a pain since some stupid applications (WinRAR) insist on stealing the extensions by default. (Packaging them in an .exe or using a launcher solves that problem though)
The voices in my head may not be real, but they have some good ideas!
#6 Members - Reputation: 142
Posted 04 February 2012 - 12:31 PM
SimonForsman, on 04 February 2012 - 04:43 AM, said:
Cannot have agreed more. I had C background and I never thought I would lug around so much excess baggage when I started C++. Even the programming paradigm is different. I took my much effort to get rid of all that baggage and really start to think in C++ rather than think in C and code in C++.
Even the great man himself says --
Quote
- Dr. Bjarne Stroustrup
Someone else had rightfully said, "The more experienced C programmer you are, the more time you will take to become a C++ programmer."
#7 Members - Reputation: 116
Posted 04 February 2012 - 01:44 PM
Oh also I should mention my comment was purely todo with pointers only, I have like a max of 1 week experience from 2010 on both C / C++ and that really was to find out the usefulness of pointers
#8 Members - Reputation: 1858
Posted 04 February 2012 - 01:44 PM
stein102, on 04 February 2012 - 02:20 AM, said:
C# up to 2.0 was essentially 'Java with lessons learned'. It does away with checked exceptions, has a concept for interfaces, a sane DateTime instance, and good generic support. It shared the same sort of OO approach, garbage collection and bytecode ideas.
Since 2.0 (around the same time Java stagnated) C# has added support for dynamic variables/execution, extension methods, generators, expression trees, concurrent data structures in the standard library, and better use of methods as data (including better anonymous method syntax),
This last one is the big day to day difference you'll see between modern C# and Java. Modern C# tends to make fairly heavy use of in-line anonymous methods which are antithetical to the Java way of doing things.
#9 Members - Reputation: 110
Posted 04 February 2012 - 10:43 PM
Bonafide Software, L.L.C.
Fairmont, WV 26554 US
#10 Members - Reputation: 590
Posted 04 February 2012 - 11:11 PM
Telastyn, on 04 February 2012 - 01:44 PM, said:
stein102, on 04 February 2012 - 02:20 AM, said:
C# up to 2.0 was essentially 'Java with lessons learned'. It does away with checked exceptions, has a concept for interfaces, a sane DateTime instance, and good generic support. It shared the same sort of OO approach, garbage collection and bytecode ideas.
Since 2.0 (around the same time Java stagnated) C# has added support for dynamic variables/execution, extension methods, generators, expression trees, concurrent data structures in the standard library, and better use of methods as data (including better anonymous method syntax),
This last one is the big day to day difference you'll see between modern C# and Java. Modern C# tends to make fairly heavy use of in-line anonymous methods which are antithetical to the Java way of doing things.
As a beginner writing trivial small programs you may be forgiven for thinking C# is just Microsoft's version of Java since they are so similar
After you learn more and use them for a while you'll start to see they really are different though.
For example, C# has the keyword unsafe which allows you to use pointers which is the a big difference between the languages.
C# being able to use the .Net framework classes allows a lot easier integration with other languages and is tied a lot more with Windows via Winforms, WPF, etc...
On a practical level as a beginner I found C# easier to learn just because Visual Studio helps so much when writing C# code.
Java is just as easy to write from command line but I never found Eclipse to be as easy, enjoyable to use myself.
Also C# seems to be evolving way faster than Java that some of the new stuff like LINQ wasn't even around when I started learning C# that there might be quite different ways to do stuff now.
#12 Members - Reputation: 142
Posted 05 February 2012 - 04:28 AM
#13 Members - Reputation: 247
Posted 05 February 2012 - 08:30 AM
jonbonazza, on 04 February 2012 - 10:43 PM, said:
I don't know, i wouldn't consider mono being another argument. While it makes sense not to equal mono's other platforms with java platform everywhere, it also has the upside of providing cross platform "without" the cost of "no base platform", because while java may run pretty much anywhere, it doesn't run anywhere by default, most windows computers i know off don't have java installed, but have .net installed.
#15 Members - Reputation: 221
Posted 05 February 2012 - 02:58 PM
#16 Members - Reputation: 110
Posted 06 February 2012 - 10:40 PM
ranakor, on 05 February 2012 - 08:30 AM, said:
jonbonazza, on 04 February 2012 - 10:43 PM, said:
I don't know, i wouldn't consider mono being another argument. While it makes sense not to equal mono's other platforms with java platform everywhere, it also has the upside of providing cross platform "without" the cost of "no base platform", because while java may run pretty much anywhere, it doesn't run anywhere by default, most windows computers i know off don't have java installed, but have .net installed.
Most populate linux distros come with java pre-installed. No OSs come with Mono pre-installed.
Bonafide Software, L.L.C.
Fairmont, WV 26554 US
#17 Members - Reputation: 436
Posted 07 February 2012 - 09:53 AM
jonbonazza, on 06 February 2012 - 10:40 PM, said:
Edit: It looks like GNOME requires Mono, as some of its components use it, especially Tomboy. So any distro that uses GNOME is going to require Mono by default.
#18 Members - Reputation: 856
Posted 07 February 2012 - 01:32 PM
Telastyn, on 04 February 2012 - 01:44 PM, said:
stein102, on 04 February 2012 - 02:20 AM, said:
C# up to 2.0 was essentially 'Java with lessons learned'. It does away with checked exceptions, has a concept for interfaces, a sane DateTime instance, and good generic support. It shared the same sort of OO approach, garbage collection and bytecode ideas.
Since 2.0 (around the same time Java stagnated) C# has added support for dynamic variables/execution, extension methods, generators, expression trees, concurrent data structures in the standard library, and better use of methods as data (including better anonymous method syntax),
This last one is the big day to day difference you'll see between modern C# and Java. Modern C# tends to make fairly heavy use of in-line anonymous methods which are antithetical to the Java way of doing things.
C# has aged much better than Java, I think there are few that would argue that. With very few exceptions ( non-generic datatypes like ArrayList ), their are very few legacy warts in C#, unlike Java, while it has implemented new language features, like generics, much cleaner than Java.
That said, I don't know if C# just commited a cardinal sin implementing dynamic. For such a safe language, it seems like such a glaring and horrible hole smashed into the design. I can't help but wonder if Anders suffered a bit of language envy of Ruby or Javascript at the time and tried to make C# a be-all language. I guess only time will tell.
#19 Members - Reputation: 221
Posted 07 February 2012 - 02:34 PM
Serapth, on 07 February 2012 - 01:32 PM, said:
Well, the tools are there, you can use them or you can pass. I currently work at my job with WPF, WCF, Entity Framework and some other "modern" .net stuff, however using them has a lot of drawbacks, especially performance wise. So I'm glad they keep adding new stuff, but then none is force to use it.


















