Question:
whats the difference between programming languages?
anonymous
1970-01-01 00:00:00 UTC
whats the difference between programming languages?
Five answers:
anonymous
2012-09-18 06:15:29 UTC
The differences between the C++ and Java programming languages can be traced to their heritage, as they have different design goals.



C++ was designed for systems and applications programming, extending the C programming language. To this procedural programming language designed for efficient execution, C++ has added support for statically typed object-oriented programming, exception handling, scoped resource management, and generic programming, in particular. It also added a standard library which includes generic containers and algorithms.



Java was created initially as an interpreter for printing systems but grew to support network computing. It is good for beginner programmers because it is easier to see how things work, with the already made methods(functions) being more like real words and it being very object-oriented. Sun Microsystems used to use it for the basis of their "HotJava" thin client system. It relies on a virtual machine to be secure and highly portable. It is bundled with an extensive library designed to provide a complete abstraction of the underlying platform. Java is a statically typed object-oriented language that uses a syntax similar to C++, but is not compatible with it. It was designed from scratch with the goal of being easy to use and accessible to a wider audience. It includes an extensive documentation called Javadoc.[vague] It is usually 1X - 4X slower than C++.
anonymous
2012-09-14 17:25:10 UTC
Some are a lot easier to work with. I personally prefer programming in C#. The syntax is pretty easy to learn, and you can use Microsoft's visual studio programming environment, which checks your code for errors as you program and offers code hints.



Most of the popular programming languages these days are based on a C-like syntax. Java and C# are the big players right now, and Java is definitely the most popular.
satish
2012-09-14 17:24:35 UTC
i will explain one part of it.



Different operating system have different representations of data. So when compiling or writing C or C++ applications.

when you write an application in C or C++ an compile it to and elf object in linux.This is very much has data representation only understood by linux os.So these applications won't work on windows.



when it comes to java -- all java application are compiled to an intermediate byte code independent of this data representation .

execution of this byte code on linux is made by jvm on linux machines.

Conversion of this byte code on windows executable is made windows jvm.



jvm on linux and jvm on windows takes the same byte code and interpret accordingly.

this make the byte code independent of platform like linux and windows.
Mahyar
2012-09-14 16:58:49 UTC
C++ programs work faster than Java.
?
2012-09-14 17:58:52 UTC
tl;dr There are too many similarities and differences, especially when you take your domain in acccount. Learn many languages and paradigms.



****************************



That is not simple to answer and it depends on how you look at it.



From a turing complete point of view, there is no difference, if two languages are turing complete they are equal in what they can do.



But that is not a useful metric because it doesn't say anything about how easy or hard it is in a given language. Something simple like an accumulator is very simple something like Lisp or Ruby, writing it in Python will be slightly more complex and trying to do it in Java will result in a relatively massive amount of code.



Some languages can say more with less code. That reduces complexity and eases maintenance Compare Ruby or Python with Java or C++ and Ruby and Python will have a much smaller code base compared to equivalent Java or C++. Syntax matters in regards to code size but people often pick the more verbose C style syntax(C, Java, C++, PHP, C#..) over other styles that are more expressive(Lisp, Smalltalk,Ruby, Eiffel, etc) because they are less familiar.



Some languages are mathematically precise in their design like Haskell, some are sloppy and downright inconsistent like PHP. Most are somewhere in the middle between these two languages.



But that doesn't tell you the whole story.



Some languages provide support for powerful techniques that make your code more flexible and less verbose(Lisp, Python, Ocaml, Ruby). These features include anonymous functions with closure support and meta-programming. Some are downright dumb in that can;t tell you much about itself(C, C++ and to a lesser extent Java)



There is also the paradigm(s) that a language supports. Some some pure functional(Haskell), some mix functional( to some extent) with OO and are executed imperatively(Ruby, OCaml, Python), some have little to no functional support(Java, C++), some are logical(Prolog), few has more or less equal support for anything(the Lisp family). Each of these approaches require completely different approaches(and therefore thought processes) to programming.



I know programmers that only work on tiny embedded devices with no OS. All they use is C, and they look at any other language with horror because they are all "bloated". I know programmers who work exclusively in "enterprise" environment and shudder of the thought of using C to solve their problems.



Who is right? They both are!



But that doesn't tell you the whole story.



You can look at standard libraries. Java's is absolutely huge compared to most anything, except perhaps C and C++. The more quality libraries you have access to the less work you have to do.



Performance is a bit of a red herring. Java is often lambasted for being slow but for long running programs it can often out-perform C++ and even C. Blanket statements like Java is slow are flat-out wrong. Performance is also relative. Is what you are going to do CPU, IO, or memory bound?



If a program is IO bound, using a language that generally performs better isn't going to do you much good, especially if it is harder to write and maintain. Why write a web app in C when a managed language, while slower is fast enough and is easier to maintain? A web app spends most of its time waiting on a user request or a database response(thus IO bound).



If your program is CPU bound using those languages typically used for the web and small scripts would be as foolish as using C to write a web app.



At any rate, saying a language is fast or slow is meaningless. I could write an interpreter for C, and trust me it would be the slowest thing you ever saw. :) Does that make C slow? I could also write a C program using no care in my algorithms and it would be slower then an equivelant, but well written program in say, Python.



Portability is often misunderstood. Is there a more portable language than C? You lose portability when you start using libraries that depend on the OS, and aren't part of a standard, such as POSIX. Does portability matter when you are writing a program that will only ever run on one platform. If you are writing a desktop application something like Qt will give you portability with C++.



There are other ways to differentiate various languages. Another important way is how a language/runtime handles concurrency if you need it. Your best bet is to learn multiple languages that cover the spectrum. That way you will be able to intelligently choose between them.



****************************

To reply to the person saying Java is interpreted via byte code. It is not and has not been for a long time. During runtime the byte code is optimized when possible and compiled to native machine language.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...