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

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
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 16 ·
Replies
16
Views
2K