Pages

Thursday 25 August 2011

Difference between 3 programming language : C++, Java & python

For persons who wants to write program for computer, here are some 
programming language they can choose from :
 
C++ :
C++ is a superset of C. Meaning that C++ is C with more features. 
Kernel of Windows 7 was written in C. Linux kernel was written in C.
Here is a simple C++ program :
  
#include <stdio.h>
  
int main (void)
{
    printf("Hello World !\n");
    return 0;
}
  
C++ are very complicated.It needs to be compile 
into machine native code to be able to run. But it 
runs very fast and used very little memory. 
A C++ program in Windows will not be able to run on Linux and vice vesa. 
A program for AMD 64 cannot be run on Intel32 machine.
C++ program can deal directly with your hardware and the programmer
must manage the memory of the program properly.
Java:
Java is a great programming language by Sun (now belong to Oracle).
The syntax looks like C and it has automatic memory management. But 
C++ program runs 10 to 100 times faster then java. Here is
a sample Java program code :  
 
package helloworldapp;

public class HelloWorldApp {

    public HelloWorldApp() {
    }

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }

}
 
The  code must be compile to bytecode and load into 
your Java interpreter program to be able to run. But
the bytecode are portable across different OS and machine.
Java is simple but take a lot of writing to do simple thing and it 
is slow and take o lot of your computer memory.
 
Python :
Python is a cool programming language. It is very simple
and programmer can write a program in the shortest of time.
Here is a simple code program:
 
print " hello world !" 
 
 
Simple right ? Python code are no need to compile into anything.
You just run the text file with python interpreter program. Python
are slower then Java. But NASA and Wall street use it for their mission
critical application. 

No comments:

Post a Comment