Beginner's language : Python versus C#

Started by
12 comments, last by smr 18 years, 11 months ago
One of the most frequent topics in 'For beginners' is 'Where do I begin' (which seems sort of sensible[smile]), which inevitably leads to the question of which language to start with. At this point the holy wars break out. "C++" some people cry - "it's what's used in the industry, so why not start off with the only language you'll ever need!" "C" say some others - "it's not as complex as C++" "Python" say others - "it's a good learning language" I've tended to stay away from these topics, because I don't yet feel that I have the experience or knowledge to tell others where to start. I myself started programming at about the age of 8-10 (can't remember exactly when - it's not like it was yesterday[smile]), and broke my teeth on BASIC, programming my old man's ZX80, 81, spectrum and QL. Text adventures were my forte in those days - I remember writing a cracking murder mystery adventure based on Anne McCaffreys Dragon books, with real-time character movements (by which I mean that character A would be in location B during player commands 1-10, and location C after that). Now I'm not a programmer, but have used programming in my career (I do a lot of numerical simulation work, so need some programming ability). In the middle of last year I started my life at Gamedev.net, initially programming with Java and C++, before trying out into a couple of other languages as time went by. In all these cases my familiarity with basic programming structures (variables, loops, etc.) helped me immensely, although I also found there was a huge amount of programming skill to learn as well - I had no idea what a linked list, red-black tree or bubble sort was. I think my personal experiences reflect the following, non-contentious statements: As a beginner, you first need to understand the basic structure and functionality of programming - that is: variables, arrays, loops, functions, possibly objects, probably not pointers to begin with Once you have a good handle on one language, transference to another is much, much easier The general consensus seems to be that these are the important first steps to becoming a programmer (and reaching that MMORPG goal you've dreamed about). As such, shouldn't your first language give you the ability to build programs that meet those goals, without worrying about other factors (such as pointers)? This is what I felt like I got with BASIC, all those years ago. This also seems to be the primary motivator for the recommendations for Python. I spent some time over the weekend starting to dabble with Python, but have to say I found it rather confusing. I don't find the class structure particularly intuitive. I find the lack of type-safety scary. I dislike the use of indentation for demarcation of code blocks (yes, I happen to like brackets). It just didn't feel like the 'safe' language that I'd want to take my first steps with. Recently I've been using C# a lot more and, frankly ... I feel like I'm in love again. It just seems to make programming much more friendly. Admittedly, I'm not making bleeding edge apps so I'm not worried about GC (but this is a beginners question, remember), but in my opinion it would give the beginner programmer time to pick up the basic programming constructs without worrying about a whole lot of issues. Syntax is clean, the libraries are fairly intuitive - about the only thing I miss from C++ is the STL (or whatever it's abbreviated to now). So here comes the question. The recommendations of Python as a learning language tend to come from those whose opinions I have learnt to respect during my time here. My question is: why Python? What about C# as a beginner’s language? What makes you recommend Python over C#? Are there language complexities / subtleties that make one seem more preferable over another? Is it an issue of documentation? Does PyGame swing the vote? Is it an open-source thing? Should I just spend some more time familiarizing myself with Python before writing essays about why other languages might be better learning languages? Thanks for any comments, Jim.
Advertisement
cout << "Bumpety - Bump";
__________________________________________________________Maybe one day i can not be affraid of venturing out of the beginners section.
Well, I'm not fully aware of the C# development packages out there, perhaps there are free ones, but the amount is like just a few. I like the C# language, because it has Garbage Collection and is completely OO. Also, .NET is a great err.. library.
I would actually not recommend Python. It's a very clean and nice language, but it's standards are probably too different from C++, and (C++ being the 'final language') it would not be a good starting language. But that's if you were to learn C++.

Anyway, I find that both Python and C# have their better sides, but the lack of existing code really hurts. C++ has tons of APIs and SDKs ready to be used. And when the Python-newbee realizes that, he has to learn C++ anyway.

Hmm.. I have a headache.
Quote:Original post by Pipo DeClown
Anyway, I find that both Python and C# have their better sides, but the lack of existing code really hurts. C++ has tons of APIs and SDKs ready to be used. And when the Python-newbee realizes that, he has to learn C++ anyway.


You've got to be kidding, there are tons of libraries and random code samples out there written in Python and C#. There are also lots of ports/wrappers/bindings for popular libraries.
Ow.. My bad. But I do think that C++ has tons more than perhaps those languages added?

[edit] I was stupid to reply to this topic with my own opinion. Should've seen the fire coming.
I think c++ and python are both good learning languages. The both enable the user to write a program with minimal support code, as neither language forces a paradigm upon the user. I'm not so keen on C#, so I can't really comment on it.

# pythonname = raw_input("what is your name? ")print "Hello " + name


#include <iostream>#include <string>using namespace std;int main(void){    char name[100];        cout << "what is your name? ";    cin.getline(name, 100);    cout << "Hello " << name << endl;}
Personally I started off with BASIC on the spectrum at the age of 8, moving over to Visual Basic when I was about 15, and then C++ when I started uni at 18.

I would recommend python, but I might be biased, because I really like python. My last project used it as an embedded scripting language. It's really easy to learn, but at the same time, very powerful. To me, starting off by learning python seems to be the closest modern equivilent to starting off learning BASIC on the spectrum. Another bonus, is that if you're going to learn C/C++ eventually, then it's nice to have had experience of a language that doesn't have C++ like syntax. Experience of different languages is a good thing!

Does C# force you to code in an object oriented fashion like Java does? If so, then I'd say that's probably a bad thing for a beginner. While I don't think object oriented programming is a particularly hard concept to grasp, I don't think it's a bad thing to be able to start off coding procedurally. I'd argue that python is probably a lot easier to learn than C#.

That said, of all the languages to pick to learn programming, I could think of a lot worse than C#.

One thing I do think is extremely important though, is to get experience of more than one language when you learn to program. People who start off with C, or C++, and never try any other langauges, are more likely to become language zealots in my opinion. It's important that people learn that there is no one langauge that's the best solution for every problem.

I think it's especially important that beginners don't get into the way of thinking that all languages other than C++ are too slow.
I like python better as it's typeless and that makes code easier to write, that and I <3 pygame
Quote:Original post by eedok
I like python better as it's typeless


Python is a strongly, implicitely, dynamically-typed language.

Why do I advise it? Because from my experience, it generally doesn't get in your way, allowing your to concentrate on the problem to solve (or on learning how to program).
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Quote:Original post by Fruny
Python is a strongly, implicitely, dynamically-typed language.

yea that looks like the correct terms for what I severly contracted.

This topic is closed to new replies.

Advertisement