Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Differences between programming languages

  1. Sep 29, 2016 #1
    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++.
  2. jcsd
  3. Sep 29, 2016 #2


    User Avatar

    Staff: Mentor

    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.
  4. Sep 29, 2016 #3


    Staff: Mentor

    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.



    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 thats a pointer.

    Dometimes its useful to see an evolutionary tree for programming languages as often a lnguage 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:



  5. Sep 29, 2016 #4


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    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.
  6. Sep 30, 2016 #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 ...".
  7. Sep 30, 2016 #6


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    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.
    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.
  8. Sep 30, 2016 #7


    Staff: Mentor

    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.
  9. Oct 1, 2016 #8


    User Avatar
    Homework Helper

    I don't see a logical path from APL (A Programming Language - 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:

    Last edited: Oct 1, 2016
  10. Oct 1, 2016 #9


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    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.
  11. Oct 1, 2016 #10
    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.
  12. Oct 1, 2016 #11


    Staff: Mentor

    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.
  13. Oct 1, 2016 #12
    And who gets to declare it "done"? Bear in mind that the process of "beautification" can uncover programming and design flaws.
  14. Oct 1, 2016 #13


    User Avatar
    Science Advisor
    Gold Member
    2017 Award

    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.
  15. Oct 2, 2016 #14
    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.
  16. Oct 3, 2016 #15


    Staff: Mentor

    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.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Differences between programming languages
  1. Programming Languages (Replies: 19)

  2. Programming language (Replies: 10)

  3. Programming Languages (Replies: 1)

  4. Programming Language (Replies: 2)