Thread: C,C++,Perl,Java

  1. #1
    brusli
    Guest

    Unhappy C,C++,Perl,Java

    What is the different among C,C++,Perl and Java ? I have learnt C, but I don`t understand what is actually C for.

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    11

    Post Your Answer

    C and C++ are languges that COMPILE your code once ,that means you COMPILE it once and use the .exe\.com file any time you want...

    but Perl and Java are languges that INTERPERT your code whenever someone activates the script, that means you put them on a website and whenever somone acceses that page, it INTERPERTES it over and over...

  3. #3
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    C/C++ FOREVER!!!

    Java and Perl NEVER!!!

    linuxman is correct. Compiled languages are always faster, but system dependant. Java is good for server-side client programs, otherwise C/C++ is the greatest!!!

    --Garfield
    1978 Silver Anniversary Corvette

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    C and C++ are great languages and widely used in embedded systems. Though at the moment also Java is coming up in embedded systems. Many modern consumer electronics is equipped with Java support.

    A great thing of Java is that you can, for example, perform a remote update of software in your mobile phone or TV. Another application of Java in TV's is downloading applications in your TV so that you can for example play games real-time with others who are watching TV or who are in the TV-studio. These are just a few examples of Java nice applications.

    But note that for time-critical systems or very small systems it is not prefferable to use Java and C and C++ are still the languages to use. In larger systems mostly a mix of Java and C/C++ is used.

  5. #5
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Java is a one-time hit. C is always going to be here. Java is an immature language. C is fully developed and open for mastery.

    --Garfield
    1978 Silver Anniversary Corvette

  6. #6
    Registered User zahid's Avatar
    Join Date
    Aug 2001
    Posts
    531
    C is much more open (for programmer) than any other except Assembly.
    [ Never code before desk work ]
    -------------------------------------:-->
    A man who fears Nothing is the man who Loves Nothing
    If you Love Nothing, what joy is there in your life.
    =------------------------------------------------------= - I may be wrong.

  7. #7
    aurė entuluva! mithrandir's Avatar
    Join Date
    Aug 2001
    Posts
    1,209
    Originally posted by Garfield
    Java is a one-time hit. C is always going to be here. Java is an immature language. C is fully developed and open for mastery.

    --Garfield
    Spoken like a person who knows nothing about Java.

  8. #8
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    I know you didn't ask for it, but I need to briefly mention assembly to explain C.

    Assembly:
    Assembly is basically the language of the computer. The instructions sent to your processor are encoded assembly instructions. Technically, this means that assembly offers the most direct route to achieve any task. There are two problems with assembly however. First, it takes a LOT of code to get anything done when your instructions are so microscopic. Second, assembly is very platform dependent. If you wrote a program in assembly for an Intel processor, and wanted to have the same program for an Apple processor, you would have to rewrite all of the code.

    C:
    C is pretty much high level assembly. If you add enough macros to assembly, you end up with C syntax. Happily, this saves a lot of time, and as it works out, it ends up using commands that makes C syntax a lot more understandable than assembly... consider the two following code snippets... the first in C
    Code:
    if (isempty()) doSomething(int x);
    The second in assembly...
    Code:
    push ax
    call isempty
    pop ax
    or ax, ax
    jz skip
    push [x]
    call doSomething
    skip:
    In all fairness, the assembly code could be shorter, although it's still not going to have the nice semantic meaning of an if statement. Still, C is similar enough to assembly that translating from C to assembly is pretty easy. Still, code written in C theoretically shouldn't be able to match the efficiency of assembly.

    Assembly also has the problem that memory addressing in it (especially in DOS) is complicated. C hides memory addressing from the programmer.

    Second, C has the C Standard Library, which provides some portability. The C language is a standard; all C compilers need to a able to compile (roughly) the same code. So any machine that you have a C compiler for... an Intel, an Apple, your calculator, your toaster, you'll be able to compile your code on any of them. Also, the C Standard Library makes it so that you don't need to know how to implement say, a random number generator, in order to get a random number, since it's included with the library.

    C++:
    Well, just as C is high level assembly, C++ is just high level C. Like C did to assembly, C++ has a lot of stuff to save you typing. Just as C hides the memory issues of assembly, C++ hides the memory issues of C. Just as it's not too difficult to translate C to assembly, it's not too difficult to translate C++ to C. Correspondingly, C++ code shouldn't be as efficient as C code (this is not so true).
    C++ also has a larger standard library, and all that entails... you need to know less details of how to build the aspects of a program in order to build a program.

    So, C++ is pretty much just an expansion of C. It's not so terribly huge a difference as between assembly and C, but it is a difference, and for high level programming, C++ seems to be the language of choice.


    Java:
    Then come Perl and Java. They're scripting languages. I don't know much about Perl, but I can discuss Java a bit...
    Java is an offshoot of C++, in a lot of ways, you can think of Java as the language that comes after C++ in the assembly, C, C++ vector...
    Java has the notable difference however in that it's a scripting language. With Assembly, your code can only be compiled on a few computers. With C and C++, your code can be compiled on most any computer. With Java, you can compile the code on your computer, but since it doesn't compile into a binary, it can be run on any computer. In one hand, this is wonderful. On the other hand, it's slow as hell. Scripting works well for some cases, webpages use it, your computer runs quite a few when it boots, and every .bat file in the world is a script. For speed intense applications however, it just doesn't work. For applications where it's important that any computer in the world can understand what you're making (think webpages), it's wonderful.

    And what C is for... it's a very versatile tool. You can write an AI with it, you can write an operating system with it, you can write a compiler with it, you can write a game with it. In truth, C++ is more commonly used I believe, C's real value is that it's standard, and hence academically useful.

    If you want to discuss programming, you're either gonna have to use pseudocode, or use a conventional programming language. C is pretty much the lingua franca of programmers. C compilers exist for every machine out there, so while C will not be the language of choice for all programmers, all programmers should understand C, or at least have a compiler that supports C.
    Callou collei we'll code the way
    Of prime numbers and pings!

  9. #9
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Perl is a good server side language, but it seems like php is replacing it. A couple of the earlier posts make java sound like a scripting langauge. Java (as well as c#) are a bit different than scripting language. Java is ran on the "java virtual machine" which is kind of a java emulator.

    Anyways, it is important to note to brusli that c/c++ are actually being ran by the pc's hardware. Perl, html, python, php, javascript, vbscript, java, c#, etc. are actually ran by another program. In java, for example, when you say "drawCircle()" you are telling the virtual machine that you want a circle drawn. Or if you have a <font color=#ff0000> tag in your html you are telling the browser to make the font red. The easiest way to explain the different kinds of languages to a newbie is to say either your language controls the computer, or the computer controls your language. Not that i'm saying that is actually what is going on, however, I think brusli can understand a bit better now.

  10. #10
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    >Java is a one-time hit. C is always going to be here. Java is an
    >immature language. C is fully developed and open for mastery.

    The main disadvantage of Java is that it is slow, especially when run on a virtual machine, though there are currently Java processors which are able to process Java bytecode.

    When looking at the future, I think that internet technologies will become more and more important. When looking around, I see electronics being equipped with internet technology. And Java is the language which is used in these electronics (car electronics, TV's, mobile phones, etc.)

    Since it is platform independant a great application of Java is remote updating of electronics or even changing functionality of electronics.

    At this moment new applications in embedded systems often written in C/C++. But since communication and internet will become very important, many applications in future will be a mix of Java and C/C++.

    For example: the MCP, multimedia car platform is for a big part written in Java.

    Every language has something that make's it most suitable for certain applications. So I don't think there is a "best" language. I think when creating applications, one should consider more than one language to implement certain functionalities.

Popular pages Recent additions subscribe to a feed