[QUOTE=SiPlus;39201551]I'd prefer manual memory management over cerebral reference counting.[/QUOTE]
Good. Now keep that advice to yourself when trying to help newbies.
I think it's better to 'master' one language to be comfortable enough to make anything you want in it before moving on.
[QUOTE=Perl;39202211]I think it's better to 'master' one language to be comfortable enough to make anything you want in it before moving on.[/QUOTE]
I don't see any problems learning something like C# and java in parallel though. They are so similar that almost everything transfers between the two.
If you think manual memory management is hard, I can't imagine you having done it more than once or twice. When I learned C++ I sure as hell didn't go "oh damn it's so hard to free things I allocate".
At most it's a bother, but it's not difficult.
But c# does it for you so you don't have to.
[QUOTE=SiPlus;39200946]I've never had any difficulties using manual memory management, but with GC, when I need a long-term object that I'm going to delete at some place (for example, current level structure), I have to count references by myself, and I have to explicitly null out any possible references, even though I know that those references will not be accessed until I load a different level (where they get updated), and I find that much harder.[/QUOTE]
Even if you're releasing memory manually, you should explicitly null out those references anyway, because dangling pointers tend to be a source of bugs. Having to do it in a GC language isn't really any more work compared to best practice in a non-GC language.
Garbage collection has its disadvantages, but ease of releasing resources isn't one of them. One [i]actual[/i] disadvantage is that you generally can't predict when an object will be collected, so you can't rely on it to automatically run cleanup code at a reasonable time. Predictable cleanup code is important for releasing non-memory resources, such as mutex locks and network sockets. (Recent versions of Java and C# allow objects to run cleanup code when they go out of scope from a "using" block, but that's something you have to utilize explicitly; it's not part of the GC.)
[editline]14th January 2013[/editline]
Addressing the thread's original question:
Java and C# are pretty similar. If you already know C#, switching to Java won't really teach you anything "new", so I wouldn't spend much time on it unless you specifically need Java experience for a job. C# has some things that Java lacks, such as lambdas, so going the opposite direction could be valuable.
It doesn't really matter that much which language you start with, though, because all the basic concepts (such as variables, loops, functions, and classes) are essentially the same between most languages. If you can find better resources for learning Python, feel free to switch to Python. You'll find it much easier to come back to C# later.
There are some significant differences between various "categories" of programming languages, though, and it's beneficial to understand those differences and how they affect the design of a program. I'd recommend learning at least one interpreted garbage-collected language (such as Python, Perl, or Lua), at least one compiled VM-based garbage-collected language (Java or C#), and at least one language that compiles to native code and doesn't use garbage collection (C or C++).
[QUOTE=Wyzard;39221905]Even if you're releasing memory manually, you should explicitly null out those references anyway[/QUOTE]
It's good to do this, but you don't really have to. You need to ensure that an outdated pointer cannot be accessed anymore. If you null the pointers but don't make your code try to use it, your program will try to access a null pointer and crash. It's better to use state variables than simply checking if a pointer is null.
[QUOTE=Wyzard;39221905]One [I]actual[/I] disadvantage is that you generally can't predict when an object will be collected, so you can't rely on it to automatically run cleanup code at a reasonable time.[/QUOTE]
Yeah. That, along with unneeded performance drop, is exactly why I hate GC.
[url=http://www.robmiles.com/c-yellow-book/Rob%20Miles%20CSharp%20Yellow%20Book%202012.pdf]Rob Miles CSharp Yellow Book 2012 PDF[/url]
Free book that teaches you the basics. I like having everything in one place instead of reading lots of small, potentially crap tutorials
C# is pretty bad, it's like Java with some extra, useless, syntax sugar and inconsistent implementations across various OSes. Unless you have some sort of weird love for visual studio, then it is always a bad choice, especially if you want cross-platform compatibility.
[QUOTE=gay_idiot;39295117]C# is pretty bad, it's like Java with some extra, useless, syntax sugar and inconsistent implementations across various OSes. Unless you have some sort of weird love for visual studio, then it is always a bad choice, especially if you want cross-platform compatibility.[/QUOTE]
It's faster than Java, and it's pretty cross platform with Mono. It's also a really amazing programming language.
[QUOTE=gay_idiot;39295117]C# is pretty bad, it's like Java with some extra, useless, syntax sugar and inconsistent implementations across various OSes. Unless you have some sort of weird love for visual studio, then it is always a bad choice, especially if you want cross-platform compatibility.[/QUOTE]
Even though I truly love Java, what you said there is just not true.
[QUOTE=gay_idiot;39295117]C# is pretty bad, it's like Java with some extra, useless, syntax sugar and inconsistent implementations across various OSes. Unless you have some sort of weird love for visual studio, then it is always a bad choice, especially if you want cross-platform compatibility.[/QUOTE]
this is a horrible and inaccurate post.
[editline]21st January 2013[/editline]
(also cross-platform compatibility is over-rated and you all know it)
[QUOTE=BlkDucky;39296074]this is a horrible and inaccurate post.
[editline]21st January 2013[/editline]
(also cross-platform compatibility is over-rated and you all know it)[/QUOTE]
No it isn't. C# doesn't present any advantage over java, besides maybe unsigned types (every language needs unsigned types, what the fuck). I shouldn't have to be forced into using windows (or writing against buggy mono), especially when the entire reason for intermediate languages (bytecode, etc) is so you can run the code across multiple platforms.
[QUOTE=gay_idiot;39296253]No it isn't. C# doesn't present any advantage over java, besides maybe unsigned types (every language needs unsigned types, what the fuck). I shouldn't have to be forced into using windows (or writing against buggy mono), especially when the entire reason for intermediate languages (bytecode, etc) is so you can run the code across multiple platforms.[/QUOTE]
Have you tried using Mono? I've never had any problems with cross-compatibility. In terms of the benefits of C# over Java; the standard library is excellent, lambdas and LINQ are something I sorely miss when using Java, and the little things like being able to override operators just make it so much easier to write programs in a way that is pleasant to read. Also things like using the compiler as a service allow you easily make flexible but speedy software.
I wish I could think of a phrase that would accurately describe my opinion of you, gay_idiot.
[QUOTE=gay_idiot;39296253]No it isn't. C# doesn't present any advantage over java, besides maybe unsigned types (every language needs unsigned types, what the fuck). I shouldn't have to be forced into using windows (or writing against buggy mono), especially when the entire reason for intermediate languages (bytecode, etc) is so you can run the code across multiple platforms.[/QUOTE]
Structs, Stack allocation of user-defined structs, the ability to pin structs and arrays and work with pointers, built-in delegates and events, LINQ, the DLR (and the dynamic keyword), the async/await keywords, even purely syntactic stuff like properties, the var keyword, etc.
[QUOTE=robmaister12;39296483]Structs, Stack allocation of user-defined structs, the ability to pin structs and arrays and work with pointers, built-in delegates and events, LINQ, the DLR (and the dynamic keyword), the async/await keywords, even purely syntactic stuff like properties, the var keyword, etc.[/QUOTE]
There is literally no reason to use structs and pointers in languages like c#, everything else you said is syntax sugar and replicable in java.
It's faster, too.
gay_idiot, rating people dumb just because they disagree with you is childish.
[QUOTE=Mozartkugeln;39296514]It's faster, too.
gay_idiot, rating people dumb just because they disagree with you is childish.[/QUOTE]
Only faster if you use the option to compile straight to native code, which bloats your executable because it still keeps the bytecode.
[QUOTE=Mozartkugeln;39296514]gay_idiot, rating people dumb just because they disagree with you is childish.[/QUOTE]
Hold on, let me try something...
[QUOTE=gay_idiot;39296536]Only faster if you use the option to compile straight to native code, which bloats your executable because it still keeps the bytecode.[/QUOTE]
Yes you are right gay_idiot, you were right all along. Java is much better in every way. Oh the irony, it is we who are the idiots and not you.
[QUOTE=gay_idiot;39296506]There is literally no reason to use structs and pointers in languages like c#, everything else you said is syntax sugar and replicable in java.[/QUOTE]
Structs are just value-based classes. They can be really nice sometimes, since values are immutable by default.
[QUOTE=gay_idiot;39296506]There is literally no reason to use structs and pointers in languages like c#, everything else you said is syntax sugar and replicable in java.[/QUOTE]
Game programming or just math in general. The option to use structs and pointers comes in handy when you need that extra speed in a tight math loop and you don't want to interop with native code for it.
And though everything else is replicable in Java, you're going to spend a lot more time replicating it than you would be working on the important stuff.
[editline]21st January 2013[/editline]
[QUOTE=gay_idiot;39296536]Only faster if you use the option to compile straight to native code, which bloats your executable because it still keeps the bytecode.[/QUOTE]
What? There's no option to compile C# straight to native code... You can run NGen on .NET or AoT with Mono to do all the JIT compilation in advance, if that's what you mean. The speed boost you'd get from being able to use structs and pointers is far greater than the extra boost you'd get from ngen.
And there are CIL bytecodes specifically for structs, pointers, etc.
[QUOTE=supersnail11;39295307]It's faster than Java, and it's pretty cross platform with Mono. It's also a really amazing programming language.[/QUOTE]
And slower than C/C++.
LOL, I was wondering when you'd show up.
[QUOTE=SiPlus;39301851]And slower than C/C++.[/QUOTE]
If you're smart about your optimisations you can get pretty similar speeds.
[QUOTE=robmaister12;39301439]Game programming or just math in general. The option to use structs and pointers comes in handy when you need that extra speed in a tight math loop and you don't want to interop with native code for it.
And though everything else is replicable in Java, you're going to spend a lot more time replicating it than you would be working on the important stuff.
[editline]21st January 2013[/editline]
What? There's no option to compile C# straight to native code... You can run NGen on .NET or AoT with Mono to do all the JIT compilation in advance, if that's what you mean. The speed boost you'd get from being able to use structs and pointers is far greater than the extra boost you'd get from ngen.
And there are CIL bytecodes specifically for structs, pointers, etc.[/QUOTE]
You might as well just write your game in C or C++ if you want structs and pointers.
[QUOTE=BlkDucky;39296074](also cross-platform compatibility is over-rated and you all know it)[/QUOTE]
I've actually begun to agree with this. I've begun to wonder if I should exclusively program for Linux, along with consoles.
[QUOTE=gay_idiot;39304537]You might as well just write your game in C or C++ if you want structs and pointers.[/QUOTE]
I work way faster in C# and I don't need them for 95% of the code I write. It's just that 5% of code that's run every frame that you absolutely need to be as fast as possible, and it's nice to have access to structs and pointers for that.
[QUOTE=gay_idiot;39296506]There is literally no reason to use structs and pointers in languages like c#, everything else you said is syntax sugar and replicable in java.[/QUOTE]
listen kid
just because Minecraft was made in java doesn't mean it's the best language ever
come back after you finish middle school
[QUOTE=lavacano;39309638]listen kid
just because Minecraft was made in java doesn't mean it's the best language ever
come back after you finish middle school[/QUOTE]
'Hi, I can't give a good reason for drinking the MS kool-aid, so I'll just insult you!'.
The kid's a troll, just ignore him.
Sorry, you need to Log In to post a reply to this thread.