Personal context: I’ve been learning C++ formally the last 6 months at university. Prior to this I dabbled in JavaScript for a year. Now I am considering learning Python during a month off school.
By splitting my focus early in the learning process am I degrading the efficiency of my learning? Should I spend the month off continuing in C++? Or is it never too early to learn a new language?
4
My experience with Python is limited to some play code only slightly more complex than hello world, so this won’t be a very in-depth answer for python specifically, but I can tell you this:
The differences between the languages is in details like the syntax and certain language specifics will be different (like the different ways errors are handled, I/O capabilities and how compilers convert your input into something executable), but C++ and Python both offer the same paradigms, so problem solving can be done in much the same way with both languages. Both C++ and Python are Imperative and Object Oriented, so you’re probably going to pick up python quite fast if you’re comfortable with C++ once you’ve mastered the new syntax using problem solving techniques you’ve picked up with C++. If you want to, you can use Python for functional programming as well, but I’ve never touched that part, so I can’t tell you much about it.
Is it too early? I can’t really tell from your story in a definitive yes or no.
Are you already confident enough to write full (GUI) applications with C++? (i.e. use libraries, more complex language features like generics and/or templating etc.)
I think that learning a new language paradigm is much harder than learning a new language in the same paradigm family. When you step out into new paradigm territory, you’ll have to spend much more time for getting a good idea of how to solve problems with that paradigm.
Between OO languages there are differences as to how inheritance is dealt with, and how data is passed in the memory when you pass a parameter/argument to a function affecting performance. But to get going these are usually of minor concern at first.
My guess is that if you’re confident enough with C++ to do something more than hello world in a fancy way, you’re ok for launch.
Learning many languages superficially will help you understand code samples regardless of the language used, but creating your own code requires a bit more understanding of how the languages work and how they differ from each other.
P.S. When I want to learn how to use a new language superficially, I’ll usually try the following things to get a feel for the language syntax and superficial workings:
- Hello world (Text on screen)
- Hello world written to a file (teaches you the basics on file I/O for that language, and very often other kinds of I/O as well)
- Doing some standard calculations with different bases (10, hex, octal), both integer and floating point. (teaches you about truncation and number notation)
- Try to use some graphical library to show hello world in a fancy dialog. (teaches you how to use libraries and external code)
1
Well of course it is.
No doubts about it, it is sometimes too early to learn a new programming language.
The simplest case is if an el-stinko language comes out and before anyone points out its unsuitability, by learning it you damage your brain. A couple that come to mind include BASIC, FORTH, and APL.
For a more complicated case, one of the great computer scientists has described this problem which very briefly stated is that practice makes permanent, and there are many disciplines that should be learned before learning computer languages so that the language does not distort the more fundamental understanding. In his words:
The tools we use have a profound and devious influence on our thinking
habits, and therefore on our thinking abilities.
The opponent of just diving into to programming is named Edsger Dijkstra and he had a very distinguished career. He was awarded the ACM Turing Award with the following citation:
For fundamental contributions to programming as a high, intellectual
challenge; for eloquent insistence and practical demonstration that
programs should be composed correctly, not just debugged into
correctness; for illuminating perception of problems at the
foundations of program design.
The paper where he blasts premature learning of programming languages is:
“On the Cruelty of Really Teaching Computer Science”
http://www.cs.utexas.edu/users/EWD/ewd10xx/EWD1036.PDF
Also, please don’t flame me, I am just the messenger.
2
Is it ever too early to learn a new language?
I would say yes. If you’re still wrapping your head around the very concept that the computer might actually do what you tell it, then learning a second language will probably just confuse you.
But if you are past the point where you realize that the computer does exactly what you tell it to, no matter how stupid it is, then chances are that you have a reasonable enough grasp of your first language that looking at a second (and third!) language doesn’t break your focus.
Can’t you do both??
I would do a project in C++ and learn bits of Python (just because it is so awesome), you could solve problems at ProjectEuler.net using Python
In general, I think its a bad idea to learn a language, leave it and start learning a new one. One should be flexible working with different paradigms at the early stages. But that is just what I think.
1
To a practicing programmer I would unreservedly say learning a new language is almost never a bad idea. To a university student, I would urge a little caution, depending on what classes are coming up. The reason is, in a school exam you frequently have to recite language details without the benefit of a compile/execute environment that will easily point out your mistakes.
Especially when you only have a few month’s experience, it’s very easy to mix up the details in your mind. If you care about your grades and are taking a class with exams like that, I would be careful. In the real world, that’s not a concern.
edit: I originally said syntax, but non-syntactic details are just as important to professors, and there are a lot more of those.
2