For those who ask: "What programming language should I learn?"

  • Thread starter Thread starter pbuk
  • Start date Start date
Click For Summary
Choosing a programming language to learn depends on your goals. Python is recommended for machine learning, web applications, and data analysis, while JavaScript is ideal for web development. C# is suited for game development and Windows applications, whereas C++ is best for performance-critical applications like games and operating systems. Beginners are advised against starting with C++ due to its complexity and potential for confusion, with suggestions leaning towards Python or Java for foundational learning. Ultimately, the choice of language should align with the specific applications you wish to pursue in programming.
  • #91
Vanadium 50 said:
Use a common environment like the Java Virtual Machine upthread
How is this different from 1? The JVM is just a bytecode engine that runs Java bytecode; it's no different from the Python interpreter running Python bytecode, or any other interpreted language. You still have to have a JVM separately compiled for each platform. Yes, Java has historically had a core team that devotes attention to the JVM for multiple platforms; but so has Python, and so have other interpreted languages, like Perl.
 
Technology news on Phys.org
  • #92
PeterDonis said:
How is this different from 1?
There is more standardization.
 
  • #93
Vanadium 50 said:
There is more standardization.
In what way? Python code runs the same on every platform that has a Python interpreter.
 
  • #94
Thank you all!

It sounds like Python is the best choice for me, or maybe Java. I'm not really looking to make any money off of programming, just make fun little programs to send to friends.
 
  • #95
Algr said:
Thank you all!

It sounds like Python is the best choice for me, or maybe Java. I'm not really looking to make any money off of programming, just make fun little programs to send to friends.
I recommend javascript or java.
 
  • #96
I'm still researching for an improved answer for the question in the title and a couple of points that have been made in this thread and are put well here have come out as important so I thought I would jot them down here so they don't get lost:

Relevant considerations:
  • What should someone gain from their experience with a first language?
  • The first language learned is not the only language ever learned.
  • A first language should not force a particular programming paradigm (sorry Java: not everything is a noun).
Not relevant:
  • Is language X "better" than language Y? (Unanswerable without context.)
 
  • #97
I think your third point somewhat contradicts your second. While I am not 100% sure what you mean by "paradigm" or even "force" (is making it easy to accomplish a task in one way 'forcing'?) but if the thought is the student will eventually learn multiple languages, why is this a problem?

I've been thinking about what one expects students to be able to do. This is probably the upper limit:
  1. Read a text file of ~100 words. If there are more, read the first 100.
  2. Convert each word to a number by summing the ASCII codes for its letters.
  3. Drop the leading digit from each number, then square it.
  4. Sort this list.
  5. Write the sorted list to a file, and display the mean. median and mode.
If you think this is too easy, look at some of the questions we get. Look at people struggling with FizBuzz.

This can be done in C. C++, FORTRAN, Pascal, Ada, Java, BASIC and lots more. (I might try it in SQL, which looks like a fun project). The code - indeed - the approach - will be different in several of them, although it lends itself to block-structured procedural cide with several independent subroutines. Is this a problem?
 
  • #98
pbuk said:
I'm still researching for an improved answer for the question in the title and a couple of points that have been made in this thread and are put well here have come out as important so I thought I would jot them down here so they don't get lost:

Relevant considerations:
  • What should someone gain from their experience with a first language?
  • The first language learned is not the only language ever learned.
  • A first language should not force a particular programming paradigm (sorry Java: not everything is a noun).
Not relevant:
  • Is language X "better" than language Y? (Unanswerable without context.)
Funny, reading this post made me think about a similar question that could be asked:
  • When learning how to speak, what language should a child learn?
And then all of your points or questions would still be as relevant:
  • What should someone gain from their experience with a first language?
  • The first language learned is not the only language ever learned.
  • A first language should not force a particular grammar paradigm
And the answer to the original question would seem to be: The language your teacher best mastered.

This is how we learn how to speak: By watching our parents (and other people in our surroundings) how they speak themselves.

Do you move to another environment, with other people? You learn the local language by default. If it is vastly different, you may have some difficulties that will follow you for the rest of your life because of how you first learned how to speak. Maybe not.

You may even end up translating everything into your original language. It might not be as efficient, as trying to translate the variety of Inuktitut words for "snow" into Arabic, but it is always possible. One language was just not made for the reality described by another one. So is Inuktitut or Arabic the best first language? It could be either or maybe even neither. It depends on where you live and with whom you hang out with.
 
  • #99
I think we're back to the audience question. It seems that there are three kinds of people who ask this question:
  1. Those who want to learn multiple languages and are picking their first
  2. Those who want to learn exactly one language
  3. Those who want to learn exactly zero
You might not think there is anyone in #3, but there are - it may even be the biggest. In the last few weeks we had two people (at least) on PF who asked how to do something and the answer was one line* - one line! - and they complained it was too hard. Why do people still use FizzBuzz as a test of programmers? Because people still fail it. It provides real, actionable information. Fortunately, we can disregard these people from this question: if you can't program in any language, you can't program.

The people who want to learn exactly one usually do so because they inherited a pile of code that they need to maintain and modify. It might be Python, FORTRAN. C/C++. or others. They are largely uninterested in programming - they just want to change the axes on these plots. And here the answer is easy too - learn what you need to maintain.

Which leads us to Category #1. And does it matter? If you are filling your toolbox, does it matter if you buy a flathead and then a Phillips screwdriver or do it in the other order? I probably wouldn't start with C++, just as I wouldn't start my tool collection with a Swiss Army knife, but I don't think someone who did would be scarred for life. I would consider C, but probably wouldn't either, because it lacks an enum and its pointer handling sacrifices logic for convenience. (Example, if x[5] is 10, what is 5[x]? I'd argue it shouldn't be anything at all!) There's a lot to be said about Ada, and if it weren't designed by people who had ambitions to be hall monitors in grade school, people would use it today. We mentioned Pascal, and despite its age, there are lots worse choices. But my point is that for this target audience, it's less important.

* I'm not counting includes or declaration of input or output variables,. Just the line that did the work.
 
  • #100
Been busy elsewhere so catching up...
Vanadium 50 said:
I am not 100% sure what you mean by "paradigm"
https://en.wikipedia.org/wiki/Programming_paradigm
Vanadium 50 said:
"force" (is making it easy to accomplish a task in one way 'forcing'?)
No, forcing is saying you can ONLY accomplish a task by jumping through non-intuitive hoops. For instance in some functional programming languages you can only create a loop by writing a recursive function and having the compiler sort out the fact that recursion is a really bad way for a computer to execute code and convert it to iteration.

Vanadium 50 said:
I think your third point somewhat contradicts your second ... if the thought is the student will eventually learn multiple languages, why is this a problem?
  • Because making something harder than it needs to be is detrimental to progress.
  • Because bad habits or misconceptions learned early need unlearning later.

Vanadium 50 said:
The code - indeed - the approach - will be different in several of them, although it lends itself to block-structured procedural cide with several independent subroutines. Is this a problem?
It becomes a problem when the student has to spend more time struggling to implement the algorithm in the target language than they spend working out the algorithm.
 
  • #101
Vanadium 50 said:
I probably wouldn't start with C++, just as I wouldn't start my tool collection with a Swiss Army knife.
And that is the whole point of this thread. For some reason, many people choose to start their tool collection with that Swiss Army knife - even if they are only interested in painting pictures or writing novels.

Currently PF doesn't exactly help that picture: of the 4 sticky posts in this forum, the only language (or instruction set) specific titles are "Guide to C++ Programming For Beginners" and "AVX-512 Programming: Extracting Column Subtotals from a Table". AVX-512 FizzBuzz anyone?
 
  • #102
Well, PF has gone a bit sticky crazy. But that's neither here nor there.

If the argument is "C++ is not the best starting point", why not argue that? Don't try to pick the optimum alternative for every case.

I happen to agree that it's not the best starting point, but don't think this is the Biggest Problem We Face Today. Not where I would start, but it doesn't permanently damage people either. And I don't think the people who jump to it will be swayed by a PF post or even an insight.

My advice to "what language should I learn" has consistently been "it is more important that you learn to program than what the language you first learn" and this advice is fairly consistently ignored.
 
  • #103
Vanadium 50 said:
My advice to "what language should I learn" has consistently been "it is more important that you learn to program than what the language you first learn" and this advice is fairly consistently ignored.
what he said (very small).jpg
 
  • #104
Vanadium 50 said:
My advice to "what language should I learn" has consistently been "it is more important that you learn to program than what the language you first learn" and this advice is fairly consistently ignored.
I had the great good fortune to be taught this from the very start many decades ago. At the time there were relatively few computer languages but even so the prof was emphatic that programming was not about syntax, it was about clearly thinking through the problem and how to solve it before worrying about how to do it in any particular language.
 
  • Like
Likes Vanadium 50 and Klystron
  • #105
1688400085154.png
 
  • Haha
Likes bigfooted, suremarc and Mark44
  • #106
Vanadium 50 said:
If the argument is "C++ is not the best starting point", why not argue that? Don't try to pick the optimum alternative for every case.
Agreed.

Vanadium 50 said:
My advice to "what language should I learn" has consistently been "it is more important that you learn to program than what the language you first learn"
Agreed.
 
  • #107
DaveC426913 said:
As it happens I might refer to JavaScript as my "favourite" language, in the sense that it is the one I most enjoy working in*. It also has one significant advantage: almost anyone that has a web browser already has a JavaScript compiler.

However with today's easy access to beginner-friendly IDEs and online compilers for other languages this is less of an advantage than it used to be, and besides this is PhysicsForums and Python is much better than JS for physics (or any other computational science).

* However I usually force myself to use TypeScript which avoids the problem in the picture.
 
  • #108
I can't say this is the wittiest or funniest toon, but man is it on the nose when it comes to my dev career and its ultimate demise.

1688785914723.png
 
  • Like
  • Haha
Likes Ibix and pbuk
  • #109
Hey,
If you are confused about which programming language to learn first, i would suggest start with Python because it is very easy to learn and read and has a great future in AI and machine learning. It has a huge community so if you get stuck or have a doubt, so you can find the answer very easily. It has tons of tutorials like many free videos, guides, websites and courses from where you can learn Python.
* If you are interested in making website then learn JavaScript.
* If you want to make Android apps then learn Kotlin/Java
* If you want to make games Go for C#
* If you are interested in making video games, operating systems and robotics then choose C++.

So, in the end choose the programming language according to your interest and what you want to build.

I hope this will help you.
 
  • Like
Likes FactChecker
  • #110
I would suggest processing for people starting out who want interactive games or visual effects. It comes with everything you need to succeed.

Python is also a good choice for one-off tasks you have to complete, as well as general-purpose programming, data science, and machine learning projects. It's not well-suited for production because it scales poorly.

In any event, programmers don't really discuss which language is better. They have a few that work for what they need to do, and they explore others, like guys going to Home Depot looking for the latest time-saving tools.
 
  • Like
Likes FactChecker
  • #111
"When she was good she was very very good but when she was bad it was horrid."

By gum, Henry Wadsworth Longfellow wrote that. I had no idea.

There was a little girl,
Who had a little curl,
Right in the middle of her forehead.
When she was good,
She was very good indeed,
But when she was bad she was horrid.
That's all there is to it.

Whoops, I wrote over my post! It was about C++.
 
Last edited:
  • Like
Likes FactChecker
  • #112
Hornbein said:
My fave is C++, but the trouble with that is that bad C++ is pretty bad. "When she was good she was very very good but when she was bad it was horrid."
Ha! One of my gripes is that some people given a simple task to program are tempted to create their own language to do it. They overload every operator. They are infatuated with OOP concepts that they have just learned.
 
  • #113
FactChecker said:
Ha! One of my gripes is that some people given a simple task to program are tempted to create their own language to do it. They overload every operator. They are infatuated with OOP concepts that they have just learned.
I never overloaded an operator or any of that fancy stuff. If you don't use it then it's harmless.
 
  • Like
Likes FactChecker
  • #114
Hornbein said:
I never overloaded an operator or any of that fancy stuff. If you don't use it then it's harmless.
Good! There aren't that many programmers who do that now because I have killed a lot of them. But the bodies are getting harder to hide. ;-)
 
Last edited:
  • #115
The two most annoying things in trying to maintain other peoples C++ code was people not realizing how short circuiting worked so you ended up with syntax like function(x) && function(y) which is obviously bad when you're expecting function(y) to always run. The other is related in that you'd see logical and bitwise operators interchanged sometimes.

There's a lot of good stuff about C++. Easylogger++, nlohmann/json and all the other random C++ libraries floating around that make life easy. I would disagree with some of the stuff I've read in this thread and just suggest C++ as what you should learn on. Syntax is syntax, C++ will teach you how to structure a program. Plus you get real threads and parallelism, instead of just parallelism and fake threads.
 
  • #116
Mamta25 said:
If you are confused about which programming language to learn first, i would suggest start with Python because it is very easy to learn and read
Why do you say that? I have found learning Python very unintuitive versus the half-dozen other languages that I have learned and used in the past. Especially the spacing rules and non-intuitive requirement of using lists instead of more flexible arrays.

In your response to my question, please be careful not to use AI to help you respond; I will be checking your response with AI detection algorithms. Thank you.
 
  • #117
berkeman said:
I have found learning Python very unintuitive versus the half-dozen other languages that I have learned and used in the past.
Just to give a different viewpoint, my experience has been the opposite. After I had been programming in Python for some years, I found it extremely painful to go back and code in any other language. I find Python easier to write by far.

berkeman said:
Especially the spacing rules
Do you mean the indentation rules? To me that was one of Python's best design decisions: use something that everybody does anyway to indicate the structure of the code, so that the programmer doesn't have to waste time typing delimiters.

berkeman said:
non-intuitive requirement of using lists instead of more flexible arrays.
I'm not sure how arrays are "more flexible" than Python lists. Can you elaborate?

Note also that Python does have thingies that it calls arrays, although they might not be what you're thinking of as arrays.

https://docs.python.org/3/library/array.html
 
  • #118
PeterDonis said:
Do you mean the indentation rules? To me that was one of Python's best design decisions: use something that everybody does anyway to indicate the structure of the code, so that the programmer doesn't have to waste time typing delimiters.
I never tried it, but the indentation seems to make it hard to cut and paste code whose indentation was at a different level. How would that work? Do the editors modify the indentation when the code is pasted?
 
  • #119
FactChecker said:
the indentation seems to make it hard to cut and paste code whose indentation was at a different level. How would that work?
If you have an editor where you can highlight a set of lines of code and indent or dedent them all at once, it makes it a lot easier.

FactChecker said:
Do the editors modify the indentation when the code is pasted?
There are probably some that try to do it automatically. I use the Kate editor on Linux (on Trinity Desktop, which is a niche Linux desktop system, but a version of Kate is also shipped with KDE, I believe, which is much more common), which doesn't do it automatically, but which has the feature I described above, where you can highlight a set of lines and indent or dedent them all at once. I've never found doing this to be a significant impediment to cutting and pasting code.
 
  • Informative
Likes FactChecker
  • #120
When I first tried Python in the early days, I had given up on Perl. I sometimes used tab and sometimes used space, and it would complain about those lines, so I switched to AWK and had a lot of fun writing one-off programs.

My mainstream history is more like FORTRAN to C to C++ via Cfront to Objective-C and back to C using Turbo C. Turbo C was a great IDE before there were IDEs. It allowed us to debug our programs quickly and efficiently.

But sadly, all things come to an end, as MS bowls over competitors, and Borland succumbs. After several years of C/C++, I jumped to Java 1.0, which was released in a small book with Duke, the Java mascot, on the cover.

The book was terrible, and I couldn’t get its Java implementation to run, but Java was a godsend. IBM quickly adopted it and made plans for an enterprise-level api, which was far too heavy for most Java developers.

I liked the single class inheritance. In C++, you had to worry about what attribute you were accessing. It was a known issue that some inherited attributes were present in both parent classes, so you had to be extra careful which one you used. It introduced a host of problems. Java solved this by using single inheritance—Java’s cross-platform support and base libraries with everything you need. No more searching for a library that the tour C program used, which was different on every platform.

Still later, i needed some one-off cmd line tools and used AWK until AWK became too large and unmanageable.

I switched to Python. I like how its evolved into an everyman’s tool with books on python one-liners. Its great for interactive apps and cmd line apps, anything you want to prototype. Not so happy about the 2.7 to 3.^ fiasco. I got burned by the division operator meaning switch but beyond that there's been few issues.

Its not about the language. If you’re new then pick one language based in what your friends and internet savvy family recommend as they’ll be there to help.

So its C/C++, Java and Python. Pick two and see where it keads you.
 
Last edited:

Similar threads

Replies
86
Views
1K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 397 ·
14
Replies
397
Views
19K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 16 ·
Replies
16
Views
2K