• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
stein102

Differences between C# and Java

18 posts in this topic

Right now I am programming in Java and enjoy it, I've made some decent progress, but in no manner would I refer to myself as a master. I would like to transition over to C# sometime, and would like to know some of the similarities and differences between the languages. I am mainly switching so I can use XNA. I'm not sure if now is a good time to switch or if I should stick with Java for a bit longer.

opinions?
Thanks.
0

Share this post


Link to post
Share on other sites
[quote name='stein102' timestamp='1328343637' post='4909455']
Right now I am programming in Java and enjoy it, I've made some decent progress, but in no manner would I refer to myself as a master. I would like to transition over to C# sometime, and would like to know some of the similarities and differences between the languages.[/quote]

You could look at [url="http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java"]here[/url].

[quote name='stein102' timestamp='1328343637' post='4909455']
I am mainly switching so I can use XNA. I'm not sure if now is a good time to switch or if I should stick with Java for a bit longer.

opinions?[/quote]

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.

[quote name='stein102' timestamp='1328344634' post='4909458']
Or would you suggest to just move onto C++, which is my final goal?
[/quote]

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.
0

Share this post


Link to post
Share on other sites
I have only used Java briefly so I cant really comment for the whole language but from what I saw it was a lot like C#.

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 :D

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
0

Share this post


Link to post
Share on other sites
[quote name='stein102' timestamp='1328344634' post='4909458']
Or would you suggest to just move onto C++, which is my final goal?
[/quote]

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)
0

Share this post


Link to post
Share on other sites
[quote name='SimonForsman' timestamp='1328352201' post='4909479']
When it comes to learning C++ i strongly advice against learning C first as you risk picking up some very nasty habits that way.
[/quote]

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]
In the continuing debate on whether one needs to learn C before C++, I am firmly convinced that it is best to go directly to C++. C++ is safer, more expressive, and reduces the need to focus on lowlevel techniques. It is easier for you to learn the trickier parts of C that are needed to compensate for its lack of higherlevel facilities after you have been exposed to the common subset of C and C++ and to some of the higherlevel techniques supported directly in C++.
- Dr. Bjarne Stroustrup
[/quote]

Someone else had rightfully said, [i]"The more experienced C programmer you are, the more time you will take to become a C++ programmer."[/i]
0

Share this post


Link to post
Share on other sites
Ah, I guess I should have left that C first comment out, truth be told when I checked out C it was really only to get my head around pointers, its hard to explain but I couldnt seem to make much sense of pointers in C++ and when I thought I did references popped up, pointers oddly enough then made sense from a C text.

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 :D, well 1 week and 1 day (decided to check out C++ for the sake of DX)
0

Share this post


Link to post
Share on other sites
[quote name='stein102' timestamp='1328343637' post='4909455']
and would like to know some of the similarities and differences between the languages.
[/quote]

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.
0

Share this post


Link to post
Share on other sites
Not to mention the obvious fact that Java is entirely cross-platform (And by the way, converting java code to an exe file seemse counter productive to me, as perhaps the biggest advantage to using java IS its cross-platform nature), where-as C# is Microsoft only (unless you take into account Mono, which is another argument all together).
0

Share this post


Link to post
Share on other sites
[quote name='Telastyn' timestamp='1328384658' post='4909626']
[quote name='stein102' timestamp='1328343637' post='4909455']
and would like to know some of the similarities and differences between the languages.
[/quote]

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.
[/quote]
Ditto.
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 [img]http://public.gamedev.net//public/style_emoticons/default/laugh.png[/img]
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.
0

Share this post


Link to post
Share on other sites
Thanks for all the great advice and suggestions. I think I will jump into C# as soon as possible. Does anyone know of any good resources for learning C#? Such as books/online tutorials?

Thanks
0

Share this post


Link to post
Share on other sites
This is a nice tutorial cum presentation on the C# language. Check it out: http://www.jaggersoft.com/csharp_course/index.html
0

Share this post


Link to post
Share on other sites
[quote name='jonbonazza' timestamp='1328416999' post='4909732']
Not to mention the obvious fact that Java is entirely cross-platform (And by the way, converting java code to an exe file seemse counter productive to me, as perhaps the biggest advantage to using java IS its cross-platform nature), where-as C# is Microsoft only (unless you take into account Mono, which is another argument all together).
[/quote]

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.
0

Share this post


Link to post
Share on other sites
The C# from Java Orange Book, [url="http://www.robmiles.com/c-yellow-book/"]here[/url] is essentialy a list of the main differances between the language. Might be useful.
0

Share this post


Link to post
Share on other sites
You could also just jump into Visual Studio and try to recreate a small program you did in Java. You would be surprised to see how easy you will get around. However after a while, as someone said above, you will notice things start to get a bit different, but in a good way (they get easier IMO :) ).
0

Share this post


Link to post
Share on other sites
[quote name='ranakor' timestamp='1328452229' post='4909818']
[quote name='jonbonazza' timestamp='1328416999' post='4909732']
Not to mention the obvious fact that Java is entirely cross-platform (And by the way, converting java code to an exe file seemse counter productive to me, as perhaps the biggest advantage to using java IS its cross-platform nature), where-as C# is Microsoft only (unless you take into account Mono, which is another argument all together).
[/quote]

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.
[/quote]

Most populate linux distros come with java pre-installed. No OSs come with Mono pre-installed.
0

Share this post


Link to post
Share on other sites
[quote name='jonbonazza' timestamp='1328589632' post='4910404']
Most populate linux distros come with java pre-installed. No OSs come with Mono pre-installed.
[/quote]
I don't believe that is true, as I believe both Ubuntu and Fedora are distributed with Mono. I really have not bothered checking other distros for this though.

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.
0

Share this post


Link to post
Share on other sites
[quote name='Telastyn' timestamp='1328384658' post='4909626']
[quote name='stein102' timestamp='1328343637' post='4909455']
and would like to know some of the similarities and differences between the languages.
[/quote]

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.
[/quote]

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.
0

Share this post


Link to post
Share on other sites
[quote name='Serapth' timestamp='1328643171' post='4910604']
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.
[/quote]

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.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0