Differences between programming languages

  • Thread starter Avatrin
  • Start date
  • Tags
    Programming
In summary: Language A may be better for one task, but not for another. In summary, I think the languages are essentially the same, but there are some subtle differences that can make one better or worse for a particular task.
  • #1
Avatrin
245
6
Hi
So, I know programming in Python. However, I am considering learning Java and C++. I know it's easier to learn a new language if you already know a programming language. However, how similar are the different languages?

The impression I get from skimming through online resources is that they are essentially the same thing written in different ways; For instance, they all have for-loops but they are written differently.

What I am asking is this; If you know a programming language, and are trying to learn a new one, how much of learning the new language is just memorizing new syntax? How much is learning entirely new features? I reckon it will vary from language to language. I know Python, and am considering Java and C++.
 
  • Like
Likes sukalp
Technology news on Phys.org
  • #2
There is a big difference between procedural and object oriented languages, but moving within one of the groups is usually quite straightforward.

One difficulty is learning the idiosyncrasies of a language. One often finds programs written in language A by someone very familiar with language B that look very messy for someone used to language A, because the programmer basically transliterated a programming style from B to A. There are often an approach that will be better suited for a given language.
 
  • Like
Likes BeardedPapa
  • #3
For an actual comparison, you can look at the site rosettacode.org where a collection of algorithms and tasks have been implemented in quite a few different languages.

The languages that I've used that are markedly different have been:

Java which has similar features to Matlab, Scala, Groovy, C/C++, Fortran, Basic, Python, Ruby... with respect to statement constructs like if/then/else or for loops. Fortran uses do loops

Scripting languages Groovy, Scala, Awk, Python, bash, csh, ksh... (a lot of similar function but implemented differently.

Prolog

Lisp

Forth a kind of reverse polish notation lisp

Most languages fall into the Java C/C++ camp with common OO and procedural features.

However the devil is in the details as Dr Claude has said where math function names maybe different or the arguments to these functions maybe different. As an example, two languages may have a sin(x) function but one requires it to be in degrees and another in radians. Most now use radians.

Java uses the dot notation to call methods on an object instance whereas C/C++ may use dot in dot or may use -> if its a pointer or if its a struct.

C/C++ often intermix use of new versus malloc()/ calloc() to initialize a variable based on whether its an object instance or some variable that's a pointer.

Dometimes its useful to see an evolutionary tree for programming languages as often a lngauge creator had a love/hate relationship with one language and so developed a new language. Onse such example was from awk to perl to python to ruby. The awk authors wanted a text processing language and based it off of C, the perl author added more text features to create perl over a period of time, the python author didn't like the use of braces and semicolons, the ruby author didn't like the python indentations and so it goes...

Anyway, to see the paradigm changes Java vs Prolog vs Lisp vs Forth should give you a wide variety of comparision.

ANother language to look at is Elm which is a function programming language with OO features. Its author didn't like the unstructured mess that is javascript and so created a much tighter language that right now compiles to javascript. I think it may become the next big web development language.

Here's some more resources to look at:

https://en.wikipedia.org/wiki/Generational_list_of_programming_languages

and

https://commons.wikimedia.org/wiki/File:Genealogical_tree_of_programming_languages.svg
 
  • Like
Likes FactChecker
  • #4
Languages of a similar nature are often relatively easy to move between -- just some syntax changes. But there are such a large variety of concepts and languages, both general purpose and special purpose, that they can be almost incomparable. There are specialized languages for database maintenance, statistics, simulation, graphics, mathematics, artificial intelligence, web pages, etc., etc. A professional programmer may end up using one or several of these at different times because the languages are so good for their particular application.
 
  • #5
My first three languages were Honeywell 200 Machine language (not assembler), COBOL, and Fortran. Those are very different languages, but still, what one codes is conceptually generic. The syntax of the code is secondary to understanding what you want the computer to do. It was couple decades (and many languages) later that I ran into Forth - definitely different.

Since then, I have picked up all sorts of coding languages to the point where I don't even really pick them up any more. If I run into another language, I just examine some sample code and start coding myself - occasionally using compiler error messages and a reference manual to keep me going.

What you end up doing is picking up the features that come along with the language. The libraries that come with php, Matlab, MSDev. The processor structures that come with different assemblers. But you end up looking for things with each language - "they must have a way of doing ...".
 
  • Like
Likes FactChecker
  • #6
.Scott said:
If I run into another language, I just examine some sample code and start coding myself - occasionally using compiler error messages and a reference manual to keep me going.
I agree with one caveat -- You need to be careful to get good examples that take advantage of the language features. Many programs are written by people don't use any of the essential new features of the language. For example, I have seen a lot of Perl programs that look just like C programs. I often ended up rewriting them.
But you end up looking for things with each language - "they must have a way of doing ...".
Again I agree but have the same reservation. For instance, it's easy to program loops in MATLAB that look very similar to C. But the results are so much slower than using the built-in matrix calculations that the program may be unusable.
 
  • Like
Likes jedishrfu
  • #7
First you make it work then you make it work fast then you make it work right. A programmers mantra

We never have time to make it look beautiful though.
 
  • Like
Likes FactChecker
  • #8
jedishrfu said:
I don't see a logical path from APL (A Programming Langauge - 1962), a high level language, to C, a mid-level language, as shown in that tree. APL went on to become APL 2, and some specialized versions with extensions such as Dyalog. Granted that some conventional language aspects have been added to some versions of APL, it's my impression that most APL programs are significantly different than conventional languages, relying on powerful operators that can work with multi-dimensional arrays. Here's a youtube example showing a step by step explanation of an implementation of Conway's game of life, showing how a small amount of code handles a moderately complex algorithm.



Wiki article:

http://en.wikipedia.org/wiki/APL_(programming_language)
 
Last edited:
  • Like
Likes FactChecker
  • #9
rcgldr said:
I don't see a logical path from APL (A Programming Langauge - 1962) to C as shown in that tree.
Wow! I also see no similarity at all between APL and C. If anything, I would have put it much closer to MATLAB. And even that is quite a stretch.
 
  • #10
jedishrfu said:
First you make it work then you make it work fast then you make it work right. A programmers mantra

We never have time to make it look beautiful though.
There are few occupations/professions where time-management can be more easily usurped by the individual contributor than with software engineering. I like to leave "beautiful", easily maintained, text-book code in my wake. And, especially if you're involved in safety and mission critical systems, the organization will give you the time to do that.
 
  • #11
.Scott said:
There are few occupations/professions where time-management can be more easily usurped by the individual contributor than with software engineering. I like to leave "beautiful", easily maintained, text-book code in my wake. And, especially if you're involved in safety and mission critical systems, the organization will give you the time to do that.

What happens where i work is we are funded to add a feature and once done we must stop. Any chnages means we must test it completely again before we ship it. Beautification means a retest and it may introduce a bug then a fix then a retest. We sneak it in anyway because not to means confusion in the future.
 
  • #12
jedishrfu said:
What happens where i work is we are funded to add a feature and once done we must stop. Any chnages means we must test it completely again before we ship it. Beautification means a retest and it may introduce a bug then a fix then a retest. We sneak it in anyway because not to means confusion in the future.
And who gets to declare it "done"? Bear in mind that the process of "beautification" can uncover programming and design flaws.
 
  • #13
.Scott said:
And who gets to declare it "done"? Bear in mind that the process of "beautification" can uncover programming and design flaws.
Just to describe how it is in many programming environments: To get budget for the additional work, someone would have to convince a project manager that there was a project benefit in terms of cost, schedule, or risk. That would be difficult to do if the software has already passed tests.
 
  • #14
FactChecker said:
Just to describe how it is in many programming environments: To get budget for the additional work, someone would have to convince a project manager that there was a project benefit in terms of cost, schedule, or risk. That would be difficult to do if the software has already passed tests.
I was going to say that every programmer has his own tests before he declares his work "done" and submits it for formal testing - but I (and I expect you) have run into programmers who declare "done" without ever executing significant portions of their code.
Even in the extreme case where a manager is literally sitting behind your shoulder waiting for the first glimpse of acceptable performance and declares "done", you can still register an incredulous "you have way more confidence in me than you should", and lobby to clean things up before calling it a candidate. Or you can say, "OK, take it. You go test it while I continue finding bugs, fixing bugs, and making this manageable.".
I don't deny that there are situations where it would be a disservice to the employer to pursue tidy code. It could be one-off code with no future. Or it could be part of a critical path that's holding back other development. Or you could be in a situation where a defective but demonstrable release is better than a late release.
But more often than not, it is the programmer that is short-changing the project. He's buying into urgency when deliberation is called for, or he wants to move onto more glorious tasks, or he's worried that he isn't as fast as the next programmer, etc.
 
  • #15
Since the OPs question has been answered and we are starting to coopt the thread with other programmer issues, I think its time we close it and thank all who contributed.

Thread is now closed.
 

1. What is the main difference between high-level and low-level programming languages?

The main difference between high-level and low-level programming languages is the level of abstraction. High-level languages are closer to human language and are easier to read and write. They also have built-in functions and libraries that make coding more efficient. On the other hand, low-level languages are closer to machine code and require more detailed instructions, making them more difficult to write but giving the programmer more control over the hardware.

2. How do scripting languages differ from other programming languages?

Scripting languages are typically interpreted rather than compiled, meaning the code is executed line by line rather than being converted into machine code. This makes them more flexible and easier to use for tasks such as web development and automation. Other programming languages, like Java or C++, are compiled before execution, making them faster but less versatile.

3. What are the differences between object-oriented and procedural programming languages?

The main difference between object-oriented and procedural programming languages is the way they organize and structure code. In object-oriented languages, data and functions are encapsulated into objects, allowing for easier code reuse and organization. Procedural languages, on the other hand, use functions and procedures to manipulate data, which can make code more difficult to maintain and modify.

4. How do dynamic and static typing differ in programming languages?

Dynamic typing, also known as run-time typing, allows for variables to change data types during execution. This makes coding faster and more flexible, but can also lead to errors if the wrong data type is assigned to a variable. In contrast, static typing, also known as compile-time typing, requires variables to be declared with a specific data type and cannot be changed during execution. This can make coding more time-consuming, but also helps catch errors before execution.

5. What is the difference between functional and imperative programming languages?

Functional programming languages focus on the evaluation of expressions and the use of functions to manipulate data. This approach allows for easier parallel processing and can help avoid errors caused by mutable data. In comparison, imperative programming languages use statements and instructions to change the state of a program. This can make code more difficult to read and maintain, but can also be more efficient for certain tasks.

Similar threads

  • Programming and Computer Science
Replies
22
Views
2K
  • Programming and Computer Science
Replies
8
Views
866
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
15
Views
1K
  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
12
Replies
397
Views
13K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
Back
Top