5
\$\begingroup\$

I want to start developing in XNA. As of now, I do not know C#, but I would consider myself "good" at Java. I have looked at some C# code and it looks almost identical to Java. After looking at Java and C# Comparison, it looks like they are basically the same. Obviously some function names are going to be different, but I think I can handle it. Now if I want to learn game development in XNA, do I really need to "learn" and master C#, or can I just jump right in and learn along the way? I should also mention, I also know PHP which looks very similar.

\$\endgroup\$
13
  • 2
    \$\begingroup\$ It doesn't really take any energy going from Java to C#. Why worry about mastering C#? Just follow the XNA tutorials and you'll get there. \$\endgroup\$
    – Sidar
    Sep 17, 2012 at 23:45
  • 2
    \$\begingroup\$ PHP doesn't look similar. Its syntax is similar to both, because all three of them use what's called C-style syntax, i.e. they all deliberately have syntax which resembles that used in the language C. Except for that shallow similarity, PHP is extremely different (and extremely bad). \$\endgroup\$ Sep 18, 2012 at 0:09
  • 2
    \$\begingroup\$ I believe there is no better way to learn than by doing. Get started and learn as you go. You're just wasting time wondering about it :) \$\endgroup\$
    – Amplify91
    Sep 18, 2012 at 2:37
  • 2
    \$\begingroup\$ -1 and voting to close, for the general theme of (and outright quote) "do I really need to "learn" and master C#, or can I just jump right in and learn along the way?". The question is meaningless. If you're trying to choose between learning the language and learning the language, the obvious choice to make is to learn the language. I don't understand why you need strangers on the Internet to help you make that choice. And I certainly don't see why you should be earning rep for asking it here. \$\endgroup\$ Sep 22, 2012 at 3:21
  • 1
    \$\begingroup\$ -1 This question is arbitrary and serves no benefit to anyone on GDSE. Voting to close \$\endgroup\$
    – ChocoMan
    Oct 16, 2012 at 16:45

5 Answers 5

21
\$\begingroup\$

You don't need to master any language before jumping right in an making something. Jump right in and learn on the way. It's likely your best option for learning the relevant parts of the language anyway.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ +1 - this is how I even became interested in programming to begin with. \$\endgroup\$
    – Cypher
    Sep 18, 2012 at 0:03
  • 2
    \$\begingroup\$ This. Most of my programming knowledge (excluding theory learned in college) came from starting something, realizing I didn't know how to do it, then learning how to do it. \$\endgroup\$
    – Mike Cluck
    Sep 18, 2012 at 3:34
  • 3
    \$\begingroup\$ Don't leave it at jumping in and doing it though. While you're doing it and solve day-to-day problems, also read up on the new language to learn how to do do things better with features you wouldn't find out by trial and error, such as LINQ. \$\endgroup\$
    – Hackworth
    Sep 18, 2012 at 9:22
  • \$\begingroup\$ You don't need to master the language, but do your homework first. Jumping right in is just a waste of time. \$\endgroup\$
    – Karl
    Sep 18, 2012 at 17:44
  • \$\begingroup\$ @Karl I wouldn't say it was "a wast of time". Certainly a little prep will help things go smooth, but getting in there and trying things really lets you know what you don't know. \$\endgroup\$
    – House
    Sep 18, 2012 at 23:57
42
\$\begingroup\$

C# and Java are not "basically the same". A lot of basics are just similar, and it's not a coincidence: C# was influenced by Java and they were both influenced by C++.

Whilst this means you'd already recognise a lot of stuff, it doesn't mean you suddenly know C#.

  • Do you know much about its standard library? A lot of the collection classes are named completely differently in C#.
  • Do you know about the features C# has that Java doesn't? C# has delegates, LINQ and lambda expressions, and is in part a functional language, not just an OOP language.
  • Do you know how C#'s OOP works? C# uses properties instead of Java's get/set, for starters.
  • Do you know the basics? Probably, a lot of them.

So can you use C# right now without trying to learn it?

Yes, you can use C#, but you'd be using C# like you'd use Java, which would be pretty poor use of the language and would be making things hard for yourself. For instance, earlier I mentioned getters and setters. Let me give you an example of why you should actually learn C# and not presume you already know it:

Java:

private int score;

public int getScore() {
    return score;
}

protected void setScore(int s) {
    this.score = s;
}

// Usage:
int x = derp.getScore();
derp.setScore(x + 1);

C#:

public int Score { get; protected set; }

// Usage
int x = derp.Score;
derp.Score = x + 1;

I'm sure you're glad you know that one now.

So SHOULD you learn C# before using it?

Yes. Right now, there are a lot of concepts offered by C# (and not Java) you are probably unaware of which you should be using; properties are one example. You don't need to master the language before you begin programming in it, but you should definitely look through some tutorials to get an overview of the language and to be introduced to those features.

Since those features are ones you don't know about, you can't actually just research them on the fly. You don't know about them, so you can't research them! So by all means, research them later to get a better understanding, but at least make sure you're aware of them now.

It will make your life easier using C#.

\$\endgroup\$
7
  • 2
    \$\begingroup\$ I know that I do not know EVERYTHING about C#, not even ALL of the basics, but for those few things that are different and I am not sure about, I could just google them as I need them. Right? \$\endgroup\$
    – CJ Sculti
    Sep 18, 2012 at 0:09
  • 12
    \$\begingroup\$ @CJSculti No, you can't. How could you google them if you don't know about them? You would only know about them after incidentally hearing about them. The point of taking some time to learn C# first is tutorials would introduce you to all the concepts C# has, and anything missing would show you what it doesn't have (like checked exceptions). \$\endgroup\$ Sep 18, 2012 at 0:12
  • 2
    \$\begingroup\$ @CJSculti To be clear: I'm not saying you have to master the language either. Byte56 is quite right: you can just learn it as you go, and you should. It's just that you should do some tutorials to learn what the language has to offer, so they can introduce you to concepts you didn't know about (and since you didn't know about them, you couldn't look them up to learn about them, since to do that you'd have to be aware of them even existing). \$\endgroup\$ Sep 18, 2012 at 0:26
  • 1
    \$\begingroup\$ I appreciate your input and will learn the basics of C# :) \$\endgroup\$
    – CJ Sculti
    Sep 18, 2012 at 1:25
  • 6
    \$\begingroup\$ Good programmers can pick up a new language very quickly. Learning C# isn't that big of a leap from Java. I would venture to say that it will be learning .NET that will make a huge difference in how productive you are with the language. \$\endgroup\$
    – Cypher
    Sep 18, 2012 at 3:08
3
\$\begingroup\$

If you know Java real good(understand how to use it, understand your basic data structures), and know how to solve problems(programming/software engineering). You should have no problem picking up C#. The language is only a tool.

\$\endgroup\$
1
\$\begingroup\$

If you know core java language , C# seems to be easier and you can learn it more fast Lets look in to the detail

C# and Java are actually quite similar, from an application developer's perspective.

  • all Objects are References
  • there exist Garbage Collection
  • both are Type-Safe Languages
  • they rely on pure OOP
  • have Unicode Support
  • Execption handling is there and lets compare some of the keyword

C#keywords Java keywords namespace package Base super Bool boolean Is instanceof
lock syncronised using import internal private and lets look some differences also the keywords in C# that have no equivalent base support in Java In C# there is "as" keyword
In C# there is "decimal" keyword
In C# there is "enum" keyword
In C# there is "delegate" keyword
In C# there is "fixed" keyword these keywords have no atomic support in java there are also some keywords in java that are not in C# like "native", "transient" lets look on a example

in java a sample hello world program

package hello;
public class HelloWorld {
   public static void main(String[] args) {
      String name = "Java";
      System.out.println("Hello world in , " + name + "!");
    }
}

in C# it look like

using System; 
namespace Hello {
   public class HelloWorld {
      public static void Main(string[] args) {
         string name = "C#";
         Console.WriteLine("Hellow world in , " + name + "!");
      }
   }
}

In a mere look both are similar , so i prefer you to learn C#

\$\endgroup\$
1
  • 3
    \$\begingroup\$ Saying all objects are references in C# without mentioning value types is a pretty dangerous simplification. Your sentence may be true on a technicality, but the existence of struct types is one very fundamental improvement that the CLR provides over the JVM. Unfortunately, it's also a source of confusion for developers new to C# (especially from Java, but even from C++ because the usual queues that distinguish reference from value types aren't visible (-> vs . for member access, e.g.)). \$\endgroup\$
    – sblom
    Sep 18, 2012 at 13:29
1
\$\begingroup\$

I am doing just this in my current job. Previously, I was doing J2ME and Android development. I am now in an environment where C# is used for Windows desktop development with a bit of Office interop. I have no experience with XNA specifically.

You should be able to dive in and get productive quite quickly. The similarities in the languages meant that my early java-like code didn't incur performance hits (like it might have in Python for example).

C# does have some fabulous new developments such as Properties, Delegates, and LINQ. I have found it easy to pick these up on the fly. It may have helped that I was already a bit cranky about java's callbacks and getter/setter situation beforehand.

Overall, I'd say that learning my way around Microsoft's extensive libraries/apis is a much larger job than picking up the language. You might as well get started coding.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .