Comparison of Programming Languages

Punch-M6.net

Baseband Member
Messages
37
I've started to compile a list of pros and cons of various programming languages, partially from personal experience and partitially from various sources scattered around the net. I found it a useful activity for myself, and thought it might help others as well.

Java
Programming in Java is very similar to C/C++ development. It is object-oriented and well structured. There is wide usage of Java, and therefore there are a lot of libraries around that can be used in your Java program.

Pros:
· Java is platform independent, it can be run on everything.
· It's free, you can just download the SDK and go.
· It's easy to learn if you know C or C++.
· Provides automatic memory management.
· Large library of pre-built classes and many more available from around the net
· It's quite safe. It's fairly hard (if not impossible) to damage your computer through programming in Java.

Cons:
· Speed. Java is quite slow, because it is essentially compiled at run-time by the system's virtual machine.
· Difficult to compile into a stand-alone application.
· Memory pointers not allowed.
· Some people dislike being forced into object oriented programming. But that's their problem. :p

C
C has been around for years and has a large following. It is used by many, many different people around the globe. Many other programming languages were written in C.

Pros:
· Large usage base. Easy to find help, other programmers, libraries etc.
· Simple core language, with further functionality being added through the use of libraries.
· Very powerful. If your computer can do it, it can do it through C.
· Low-level unchecked access to computer memory using of pointers.
· One of the fasted running languages.
· C code can be used in C++ applications.
· Programs are compiled and stand alone, no need for interpretters (sometimes external libraries will need to be installed on the target PC).

Cons:
· Relatively difficult to learn.
· Very little safety net. If you choose (accidentally or otherwise) to make a program that will access memory incorrectly and cause problems with your system, it won't stop you. It only pulls you up on compile errors.
· Non trivial programs could be hard to port. Programs have to be compiled for each specific platform.
· Not strictly object oriented.
· Code can get messy easily.

C++
C++ is a derivation of the C programming language. C code still works in C++ programs. It is an object-oriented language and very powerful.

Pros:
· As close to a universal programming language as you're likely to get at the moment. It's used everywhere.
· Object oriented technology included, highly supported and recommended, but not forced upon you.
· Programs are stand alone, no need for interpretters (sometimes external libraries will need to be installed on the target PC).
· Easy to port to other platforms if standard C++ guidelines are adhered to.
· Many libraries available for added functionality.

Cons:
· Quite difficult to learn. You'll never really stop learning new things about it (which is also a pro, I guess)
· Non-trivial programs aren't easily ported if they use platform-specific libraries (e.g. DirectX etc.)
· Programs can be slightly larger and slower than those programmed in C. (Note that in general you're never going to notice, but in theory it's true)

Visual Basic
Visual Basic is a very easy language to use. It's code is similar to Pseudo-code, and many times the developer can simply type what they think should work and it does. Which is cool.

Pros:
· Very easy to learn
· Quick to implement an application or algorithm
· Lots of in-built functionality
· Recently added complete OOP support with the .Net upgrade.

Cons:
· Not as flexible as other languages. Can't do as much.
· Runs slower than C/C++
· Purely a Microsoft product and Windows based.

.Net Environment
Not really a programming language, but closely related.

The .Net environment is a relatively new creation of Microsoft's. It adds an overall cohesiveness to various programming languages by compiling them into a standard form that is interpreted by an intermediate language between the code and the OS. In this way it is similar to Java. The creation of the .Net environment means that the method of programming basically comes down to personal preference.

Pros:
· Easy-to-use tools may increase programmer productivity
· Has a strong framework for building rich graphical user interfaces
· Gives developers choice of working in more than 20 programming languages
· Is tightly integrated with Microsoft's operating system and enterprise server software
· Has built-in support for Web services standards

Cons:
· Users of prior Microsoft tools and technology face a potentially steep learning curve
· Choice of integrated development environments is limited
· Getting older applications to run in the new .Net environment may require effort

I'll come back and add more as I update the list.
 
Java is quite speedy in some respects, but slower in others. the thing that slows it down is that it is compiled to an intermediat language that is run against the java runtime environmet, (JRE), which is why you need JRE before you can run Java applications).
The .NET framework is comparable to the JRE in this respect.

as it says in the article you linked to, Java has increased it's speed of execution dramitcally since it was first released, but is still slower than a compiled code.

One thing I will say about the arguments against C is that C is a completly portable ANSI language, programs written to compile under windows (Using ANSI functions) also compile under linux.
Memory allocation in C can either be set up to point to a specific location. (if you get it wrong this caused BSOD in windows 9x, or just an error message in NT systems) or it can be setup to allocate some free space. -causeing no problems at all.
So long as programmers take the time to write code that takes all possible errors into account (i.e checking the result of functions would be a start before just assuming they completed) the there should be no problem.
 
Hmmm.... I've got to disagree on a couple of your points. First, I've never seen a program from any language "horribly break" a computer. It will, to the best of my knowledge, overwrite other files on a boot drive and make you re-install and cuss a lot. Second, Java is slower only when the source is compiled to an applet that runs on the virtual machine, but can be compiled to a program that will be natively executable. Third, I don't know what comparison or timing trials you ran to find that C++ is slower than C. It could be, if the code you are using calls on a lot of extra objects to run for its execution. I'll have to do some snooping before I swallow these three. But thanks for the comparisons :)
You might also add to the pros for C++ that you can extend Java object libraries with it ;)
 
Also about the .NET Environment; it can run on all computers - that is the idea and why it creates an intermediate language (MSIL). Obviously the other computer/Mac or whatever must have the .NET Framework Installed but most should anyway.
 
Thanks for the replies! I'm still learning all of this stuff, so it's not really a surprise that some 'facts' were incorrect.

Lord Kalthorn: Thanks for that. The research I did lead me to believe that it was a Windows-only environment, but maybe the site was old. I don't really have much interaction with PCs outside of my Windows machine and the Linux boxes at uni.

Griz803: Yeah, ok. The 'horribly break' was a bit of an over-exaggeration. I'll change it. All I meant was that things can go wrong if you start messing around too heavily with your memory addresses (especially if you do it just to see what happens). And I wasn't aware that you could compile native executables from Java. I've been trying to work out how to do that for a while. Got any sites that would give pointers on that?

C++ is technically slower than C, but conceptually you're never going to notice the difference. This is just because C is a lower level language than C++. It was more something that I found interesting than an actual con.

root: That's pretty much what I said. C programs have to be compiled for each specific platform. And if you use specific Windows programming then some modifications will probably be required before it can be compiled under a different platform. That was my understanding, anyway.

Thanks for your replies. If anyone else has knowledge of other languages, or further points for the ones that are there, please post them. I'm using this to get a wider knowledge of programming in general, and to help others with the same. :D
 
If you want information, have you tried the horse's mouth? java.sun.com/docs/books/tutorial/ There should be a tutorial included with your Java compiler that gives information on compiling to an application instead of an applet also. I haven't done much with Java lately, so I can't recall the compiler invocation offhand, but I know it existed in Java v.1.2.X. Hope this helps.
 
I'm not sure you can get programme opinion straight from the horses mouth, or at least I'm not sure you can get accurate comparrison.

Go ask someone at ATI who makes the best graphics cards, then go ask someone at Nvidea (you get my point).

te best way to get good opinion is to trawl sites that offer help, then you'll see first hand the problms people have and the weaknesses of the languages.
 
Randolpho on another forum added these items to the list, and I thought they should be added here as well:

Python:
Pros:
- One of the easiest to learn fully object-oriented language on the market.
- Both functional and object oriented; caters to both sides of the design methodology debate.
- No curly braces for code blocks: blocks are determined by indentation.
- Very rich, both fully OO and fully functional set of libraries
- Easy to use native invocation
- Slicing, Lamda functions, and Lists, oh my!
- Named for Monty Python, and they're damn cool.
Cons:
- Comparitively slow (but still faster than VB! w00t).
- No curly braces for code blocks: blocks are determined by indentation.

PHP:
Pros:
- Speed -- fastest web-application scripting language out there, bar none. Yes, faster than ASP, faster then ASP.NET, faster than JSP, faster than the Python web aps (Zope, Twisted), faster than Coldfusion.
- very rich very fast library of functions
- library functions are mostly thin wrappers of mature c functions.
Cons:
- OO is tacked on, and kludgy at best.
- syntax (especially for OO) can get in the way.
- library functions are mostly thin wrappers of mature c functions.
- Poor error handling support in the library (PHP 5 finally introduced try/catch blocks, but they're not implemented to my knowledge in the library. Yet.)

C#:
Pros:
- Properties syntax makes EJB specifications look stupid. pwned
- Autoboxing
- Operator overloading (something Java is sorely missing)
- Function delegates
- All the pros of .NET, including easy deployment
Cons:
- Autoboxing -- overhead for wrapping primitives in an object can severely hamper even well-written programs.
- Namespaces suck compared to Java import methods.
- Function delegates are nice to have, but the implementation is cludgy (takes like three steps to create one, and they're actually separate objects, which means more overhead).
- Poor use of symbols when a keyword would suffice. Does replacing ":" for "extends" really do anything other than "woo" c++ programmers? Yes it does, it makes the code harder to read.

The Java Being Slow comment seems destined to be argued about forever, so I guess people should just take it as personal opinion and have a play to see what they find themselves :D
 
Back
Top Bottom