Which programing language should I learn first?

  • Thread starter battousai
  • Start date
  • Tags
    Language
In summary, the conversation discusses the best programming languages for beginners and the advantages and disadvantages of each. It is suggested to start with Python due to its simplicity and versatility, but also recommended to learn some assembly language for a better understanding of how programs work. Other languages such as QBASIC, C++, and Java are also discussed, with their respective pros and cons. Ultimately, it is recommended to start with a simpler language and then move on to more complex ones.
  • #1
battousai
86
0
I'm interested in learning how to program, however there so many ones (C++,Python,Java) and IDK which one is the best one to learn for beginners.

Suggestions? Also would it be good to get a book or find a guide online?
 
Physics news on Phys.org
  • #2
I know this is off topic, but that username of yours is from Rurouni Kenshin right?
 
  • #3
I'd recommend starting with Python and then going for C++ additionally.

C++ is well suited to build and manage (i) medium sized to large programs (>100k lines of code. Most of both Windows and large Windows programs are written in C++) and (ii) to build programs which are as fast as they can (if you know what you are doing). It is also by far the most complicated programming language practically used and takes many years to master. Python[1], on the other hand, is bad at both (i) and (ii), but good for everything else. It is simple to learn, very powerful, and has "batteries included", meaning, it comes with lots of tools and packages for doing stuff you might want to do.

Being good at (only) Python will already allow you to do an immense number of programming tasks you might stumble across, say, data analysis, text processing, graphics, all kinds of scripting, so it is a more useful skill to have than knowing only C++.[1] Actually: Currently existing Python implementations, but there are few reasons to believe this will ever change.
 
  • #4
This might not be the answer you're expecting but it depends on how much understanding you want to get and what kind of programs you intend to write.

If you only want to do mathematical simulations then you might be better off learning the language that comes with industry standard programs. Things like Mathematica, Maple, and MATLAB for applied math and things like R and SAS for statistics.

If you want to work you're way to writing production quality code again it depends. To get to this stage you need to understand why the languages that are out there are there. If you look at particular paradigms of certain languages or even run-time environments (like Java and .NET) you'll notice certain patterns that have emerged that take coding to a new level.

If you are serious about learning programming, I would learn a little bit about assembly programming. You don't have to necessarily program in it, but become aware about how programs go from high level language (like C,C++,Java,Python etc) to something like you would see in assembler. Once you get a basic idea of what happens in assembler not only will you understand what is actually going on, it will help you when you are debugging those hard to find bugs.

I'll give you my take on pros/cons of learning a few different languages as your first

1) QBASIC (Procedural not VB series)

QBASIC or QuickBasic is a runtime environment created by Microsoft that interprets, compiles and runs QBASIC code. You can get the free compiler and editor (it compiles code but doesn't interpret code like the original QBASIC did) which works on any version of windows (and maybe linux).

Pro's:

The syntax is pretty easy to deal with
Easy to get simple programs up and running (ie disk access, user input, simple drawing commands)

Con's
Allows programmer to use variables that are not explicitly defined
No real "pointer" capability

A note for the above two cons:
1) The reason this is bad is because this sort of coding leads to bugs: You might say use a variable in different ways and if it is not declared then it doesn't have a type and if you use the variable in the wrong way you might get a crash and it may end up being hard to find the bug if you have some code doing things it wasn't intended to because the program was not told that a variable should be an integer or something else.

2) Although pointers can be considered an "advanced" topic, they are essential to programming. When you learn about pointers, you will be able to understand how stuff really works and it will help you pick up assembly programming a lot quicker. Some people might say that I'm wrong in suggesting for someone to learn assembler language early on, but it does have the advantage of giving the student a little extra understanding of how everything simply "comes together and works".

2) C++

Pro's:

Good paradigms to learn early for beginner (OOP structures, templates, operator overloading, interfaces, other OOP features (eg. polymorphism))
As close to assembly as you can get without being an assembly language
Used quite a lot in industry
Allows you to pass callbacks to functions (Can't do this QBASIC ignoring CALL ABSOLUTE which is not supported in QB64)

Con's
Very demanding on beginners

There are a lot more features of C++, but as the con says, it is something that is very demanding on beginners. On one hand you have the task of learning a procedural language (most procedural languages have more or less the same basic features) and on top of that you have to learn about object oriented paradigms and templates as well as worry about variable declaration, memory management, pointer management and so on.

One suggestion that you could do is to first learn the language C and then when you are comfortable with the procedural aspect, to then get a C++ compiler and IDE (Integrated Development Environment like say MS Visual Studio) and then learn the "C++ specific parts". In a standard C++ compiler, C code should compile with no problems, so the transition should go ok in that respect.

3) Java

Pros:
In some respects a lot like C++ without the memory management or need for pointers, so easier for beginners

Con's
Not good when you want your own "standalone binary"

The one thing you should know about Java is that it is actually a virtual machine. When you have a language like C++, what happens is that you have a compiler that turns the code you write into binary code that the computer can understand. As long as you supply the executable and the appropriate data to any computer it will run on any operating system that supports that code.

The above means that if I compiled a program for Windows, it won't normally run on linux unless you have an emulator that emulates the windows environment on linux.

With Java it is not compiled into the form that is done when you compile C++. It is compiled to an "inbetween" state which the virtual machine runs.

The Java VM has been written for many different operating environments like Windows, Linux, different Unix environments and even for mobile computing environments and embedded devices.

The good thing is that once you write the java code it should work on all target environments or in the case that it doesn't, it should be easy to make it work on another target environment.

The bad thing is that you need the Java Runtime Environment to run any Java code, so you are depending on Java.

Another related consequence is speed. The Java Runtime has to act like a CPU: It has to fetch instructions and then turn those into instructions that the CPU can understand: this is slower than compiling the code to the "CPU language" and running it directly.

.NET is in a way similar to Java in that it is compiled into "intermediate code" which the .NET compiler compiles code into.

The last first language suggestion I will give is assembler

4) Assembler

Pros
Once you learn this, you should understanding everything about procedural programming
You will more than likely become highly skilled in debugging
You will understand how computers actually work

Cons
Not a gentle introduction to programming
Easier to get confused especially when things go wrong (This is debatable)

When I talk about assembly, I am talking about the lowest level of code just higher than the actual binary code that the CPU can read. In assembly you will write with instructions and you can have labels and data like you do in high level programs (like for example arrays and strings), but the difference is the relation between the instructions and the code: for assembler most instructions map straight to an instruction byte whereas a statement like "int a = 100" will require the compiler to make space for it somewhere (on the stack, register or a heap).

In assembly programming everything is precise down to every instruction and it can be hard to keep track of things, but if you stick it out, you'll become very very skilled in procedural programming.

If you have any other questions, I'll try to answer them
 
  • #5
I agree with cgk. Learn python first and then go for C++.

If you know these two languages, then I'd consider you a pretty good programmer already...
 
  • #6
C++ is a timesink. Only devote yourself to it after you're moderately good at another language, and know for certain that C++ is a necessity for the kinds of things that you want to build.
 
  • #7
Very good post chiro, I agree with a lot of it. Just as a condensed piece of confirmation, I think I would go for a language like Java. It's really easy and similar to C and C++ but it's easier because you don't worry about things that you won't really understand if you try to learn it now. Once you get accustomed to thinking about how computers really work and how languages really work in relation to the hardware and things like that, you'll be ready to tackle things like garbage collection (in Java, at least), memory management, all the technical stuff. Python may be a good language to learn too, but I've only got limited experience with.

See the great thing about languages is that they're all usually pretty similar in structure (they kind of have to be really). Once you learn a language or two, you can tackle anything. I'd say learn a real programming language first because once you do, Mathematica and MATLAB are just syntax weirdness to deal with for the guys who don't know programming. MATLAB's better about this, Mathematica is weird but becomes intuitive somewhat over time. I'd say Mathematica is the best at symbolic manipulations and expressions but for everything else, use MATLAB (or C/FORTRAN if you're worried about speed).
 
  • #8
If you learn C first, in a Linux environment, you will not regret it in the end. However, this is a long, difficult road. Start small, learning about Linux, then go to programming, maybe get a book like The Art of Unix Programming.
 

1. What are the most popular programming languages?

The most popular programming languages currently are Python, Java, JavaScript, C++, and C#. These languages are commonly used in a variety of fields and industries.

2. What are the differences between programming languages?

Programming languages differ in their syntax, purpose, and use. Some languages are better suited for certain tasks, such as web development or data analysis, while others are more general-purpose. It's important to research the specific features and uses of each language to determine which one best fits your needs.

3. Which programming language is the easiest to learn?

This can vary depending on the individual's learning style and background. However, many beginners find Python to be a good language to start with as it has a relatively simple syntax and is widely used in data analysis and machine learning.

4. What programming language should I learn first if I want to become a web developer?

If you want to become a web developer, it's recommended to start with HTML, CSS, and JavaScript. HTML is used for creating the structure of a webpage, CSS for styling and design, and JavaScript for adding interactivity and functionality. These three languages are the building blocks of web development and are essential to learn before moving on to more advanced languages and frameworks.

5. Should I learn multiple programming languages at once?

It's generally not recommended to learn multiple programming languages at once, especially as a beginner. It's better to focus on one language and become proficient in it before moving on to another. Once you have a solid understanding of one language, it will be easier to learn others as many concepts and principles are transferable between languages.

Similar threads

  • STEM Academic Advising
Replies
12
Views
1K
  • STEM Academic Advising
Replies
5
Views
809
  • STEM Academic Advising
Replies
3
Views
860
  • STEM Academic Advising
Replies
1
Views
1K
  • Science and Math Textbooks
Replies
7
Views
526
  • STEM Academic Advising
Replies
3
Views
810
  • Programming and Computer Science
Replies
11
Views
1K
Replies
40
Views
2K
  • Programming and Computer Science
12
Replies
397
Views
13K
  • Programming and Computer Science
Replies
8
Views
835
Back
Top