Jump to content

Which to learn first? Python or C++?


Klapaucius

Recommended Posts

I've been video editing for a long time, but am now diving into Blender and eventually noodling around in Unity. Blender has options to do Python scripting.  Unity....some C#.  But I get the impression that C++ is all around useful and a good foundation for the logic of programming.  This is not professional, I am just quite interested in getting my feet wet. So longterm, both are on the menu. The question is:  which first?  I have no illusions I will become a star coder anytime soon, but I've got time and self-discipline.

 

I've read a lot of varying opinions online and am no closer to an answer. Some indicate that once you understand C++, all new languages are much simpler since C++ forces you to learn a lot of concepts and keep your code clean. Others argue Python because it is more forgiving for a beginner.  What do you all think?  Since there are so many coders here with heaps of experience, and folks tend to be very helpful, it seemed a good place to ask here on the forum.

 

Just to clarfiy: I simply am asking where to begin.  've got Udemy courses on both, so it is just a case of finding the better roadmap.

 

As background: I have very little coding experience...absolute beginner Javascipt and CSS via the Khan Academy and (showing my age here) Turbo Pascal in college.  So basically I am starting from scratch.

Edited by Klapaucius
Link to comment
Share on other sites

If you aren't going to go into heavy things writing, Python is enough for a beginner, for a casual programmer, for not few of jobs.

In C++ also a framework choice is important, as pure standard C++ coding is a headache (though is often required in software development for the code compatibility).

Say, Qt framework which I'm fond of, is very friendly to the beginners, has wide possibilities and can run JavaScript code in the program, includes both LGPL and GPL licenses (the free license version with same possibilities but some license restrictions), cross-platform (W/L/M), but I'm not sure if there is a lot of vacancies compared to, as I would say, much less friendly but more "standard" MS  frameworks.
Also, Qt has Qt/Python port, so it's in some degree three-in-one.

Edited by kerbiloid
Link to comment
Share on other sites

lua is pretty straightforward though i think its really limited in terms of available libraries (lua calls them modules). there are a few good ones but most are really out of date. this limits its usefulness as a standalone language, so its mostly used as an extension to an application written in an entirely different language (which is why its popular for use in games).

python is extremely popular but its such an oddball language that i just cant make sense of it.id rather use c++ myself.  

Edited by Nuke
Link to comment
Share on other sites

Well, it really depends on why you want to learn to program. If you're just looking to get something done and don't really care about doing it right, Python is the better choice. It was practically designed to make it easy to slap stuff together. However, if you have any intention of actually learning something, don't start with Python. The language is syntactically dissimilar to most others in a way that makes it hard to switch to writing something else, but that's not the problem. The problem is that it's extremely abstracted - the contents of a Python program, as understood by the programmer who wrote it, bear little resemblance to what your computer actually ends up doing when running said program.

C++ isn't much better here, unfortunately. The language is less abstracted, but it's also extremely complicated, syntactically and semantically, and if you're not taught it just right you'll come out more confused than you were before you started. If you're looking to really learn something, I would recommend with starting out by learning some C. C is the canonical non-abstracted (or low-level) language, having been described as being a thin veneer over the raw machine instructions it compiles to. Conveniently for us, however, it's human-readable (where machine code is not), and the language spec itself is quite simple. It's got a small standard library and a very small number of language constructs, all of which are easy to describe, and in most cases easy to understand. I don't recommend getting far enough to actually write big programs in C, since it's quite hard to do that and keep your program sane, but it's a good foundation to have for learning C++.

But that's the strong opinion of a guy who writes C professionally, so take it with a grain of salt.

Link to comment
Share on other sites

Thanks for the feedback, but a few are missing the question. The question is between C++ and Python and which to learn first.  I have no interest in learning Lua.  I'm interested in Python because it is the scripting language for Blender. And I am interested in C++ because I may eventually be diving into Unreal Engine (or it will help--I think--) with C#, which is Unity. If it was simply about learning a coding language, I would go back to Javascript, but I don't have an interest in web design. This is solely to support creative interests.

 

@IncongruousGoat..Your point about C is interesting, however.

Edited by Klapaucius
Link to comment
Share on other sites

You’ll get a lot of “I program in X, pick X” answers. I’m not sure if that will help you.
 

My feeling is that if you have no experience with programming at all, starting with Python will pretty much reduce your challenge to one problem—learning to program. Python is pretty easy to pick up.

If you do have experience in programming (you mention Turbo Pascal at college), then you might jump into C/C++ if you want. Expect a lot more struggles but also deeper insight in how a computer works. It never hurts to get confronted with the finer nuances of memory allocation and pointer arithmetic, even if you won’t touch that for the rest of your life; just like it pays to know how a combustion engine or a gearbox works, even if you’re not a mechanic.

Either way works, and the second language is always easier to learn than the first one, because you only have the language to learn. Do keep in mind that different languages have different paradigms you will need to master too; writing C++ as if it’s Python will fail equally as miserable as writing Python as if it’s C++. It’s like writing a TV show for different languages; grammar and vocabulary are not enough, you also have to consider cultural differences.

In the end, as @Cydonian Monkmentioned, the only way you learn to code is by coding. Consider the answer to the question “I’m going to work as an expat for two years. Should I learn Spanish or Chinese?

Most likely it’s “well, where are you going?

 

Link to comment
Share on other sites

21 minutes ago, Kerbart said:

You’ll get a lot of “I program in X, pick X” answers. I’m not sure if that will help you.
 

My feeling is that if you have no experience with programming at all, starting with Python will pretty much reduce your challenge to one problem—learning to program. Python is pretty easy to pick up.

If you do have experience in programming (you mention Turbo Pascal at college), then you might jump into C/C++ if you want. Expect a lot more struggles but also deeper insight in how a computer works. It never hurts to get confronted with the finer nuances of memory allocation and pointer arithmetic, even if you won’t touch that for the rest of your life; just like it pays to know how a combustion engine or a gearbox works, even if you’re not a mechanic.

Either way works, and the second language is always easier to learn than the first one, because you only have the language to learn. Do keep in mind that different languages have different paradigms you will need to master too; writing C++ as if it’s Python will fail equally as miserable as writing Python as if it’s C++. It’s like writing a TV show for different languages; grammar and vocabulary are not enough, you also have to consider cultural differences.

In the end, as @Cydonian Monkmentioned, the only way you learn to code is by coding. Consider the answer to the question “I’m going to work as an expat for two years. Should I learn Spanish or Chinese?

Most likely it’s “well, where are you going?

 

THAT is the answer I was looking for. Very helpful.  I know what I want to use them for, so it is about how to go about it. Thank you.

On 11/5/2019 at 6:10 AM, Cydonian Monk said:

There is only one programming language: Logic. 

My advice? Use whichever tool is easiest for you to pick up. Doing is more important than endlessly analyzing which tool is best. By writing code you will learn the one true language, and can then branch out to others. 

I just realized I misread your quote. Since I work with Logic Pro X (a digital audio workstation) I read "Logic" (with a capital L) to be the name of another language. :confused:

Link to comment
Share on other sites

Whenever I've dabbled in programming (I am not a programmer) the biggest issue has been needing a purpose.   I'm reasonably competent in VBA and KOS as I have things I want to with them,  but when I had a play with python I found it hard to keep interested as I didn't have a purpose. 

Hence I'd say learn python as you have an immediate application for it.   However there is a KSP mod called KRPC that lets you program your ships in C++....

Edited by RizzoTheRat
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...