Which Computer Language to Learn

Click For Summary
The discussion centers on the best computer languages to learn, particularly for someone with a background in physics and some knowledge of C++ and Java. Participants recommend learning scripting languages like Python, Perl, Ruby, or PHP for their ease of use in prototyping and server-side programming. Python is highlighted for its object-oriented capabilities and suitability for scientific applications, while Perl is noted for its utility in Unix environments. Java is clarified as a compiled language, not a scripting one, and while it has cross-platform capabilities, it is criticized for performance issues compared to C++. Ultimately, the consensus emphasizes the importance of choosing a language and mastering it rather than jumping between multiple languages.
  • #31
I agree with you. That's the sad thing about industry. Industry hardly ever adopts the correct platforms and such.
 
Computer science news on Phys.org
  • #32
graphic7 said:
It just seems that if I were going to learn a programming language, perhaps my first, I would want it to be very applicable for a number of situations.
You can do literally anything in Java. Literally. You can write operating systems in it.
You've failed to prove to me why someone should learn Java over C, C++ or other seasoned languages.
Pedagogically, it exposes a new programmer to object orientation, I/O and other concepts with as a little fuss as possible. Java does automatic garbage collection. Java doesn't have pointers, which cause C and C++ users with tremendous pain, but provides the functionality in a much cleaner way. Java provides a standardized and consistent API for thousands of classes which can be used in virtually any way you can imagine. Java runs anywhere. Java doesn't suffer from the annoyances of header files. Simply put, Java provides the cleanest OO with the largest component library of any language on the planet, by a very large margin.
As for my standards, I consider Java to be below my standards in terms of performance, applicability, and portability.
It literally cracks me up when you say that you prefer Perl for its performance, applicability, or portability. :smile: Everyone else in this thread is disagreeing with you -- why do you think this is so?
My first programming language was Perl, and you may be correct in the sense that learning Perl is better if you have a Unix background. By that point, I was proficient and Unix and it wasn't too bad. I did find it easier to take up C and C++ after becoming familiar with Perl, though...I don't have any experience with Python, so that may be why I'm still defending Perl.
This is, IMO, the heart of the matter here. You're an inexperienced programmer in the sense that you seem to have limited exposure to languages. You don't know Java, and you don't know Python, both of which are very important languages from both pedagogical and industry standpoints. You learned Perl first, which is virtually unheard of, and thus have some kind of emotional attachment to it, despite its, well, ugliness. If you actually gave either a try, I think you'd lose your irrational distaste for them. I strongly suggest that you actually have some competency in languages like Java and Python before telling other people they are, in so many words, unworthy. To tell a student they should avoid a language you don't even know is essentially intellectual dishonesty. Recognize the limits of your own knowledge, and stay within them.

- Warren
 
  • #33
Just as a review:


Perl, Python and Ruby are scripting languages while C, C++ and Java are not.

All of those languages except C and C++ are garbage collected.

Ruby and Python have the cleanest style of Object-Orientation. C is not at all object-oriented. Perl has OO in a very messy way. C++ has a somewhat ugly but reasonable OO system. The OO in Java is basically what you get when you take OO from C++ and clean it up and get rid of some of the nastier (mis?)features.

Perl, Java and C have the largest amount of libraries available. But Python, C++ and Ruby also have lots of libraries.

Comparing the speed of the languages is almost entirely worthless. For most cases, all of the languages are fast enough. In very special cases with limited CPU and/or memory, C and C++ may be needed, since they impose the smallest CPU and memory overhead. (All of the people I know who are actually competent enough to actually produce fast, secure C code are also smart enough to know not to waste their time doing so unless absolutely necessary)

Python is usually the easiest to learn. Then Ruby. Then Java. Then C. Then Perl. Then C++. And by learning, I mean learning how to take advantage of all the features of the language.

All of the languages can be used to write platform-independent programs. And all of them can be used to write platform-specific programs. Although C and C++ make it the easiest to make assumptions about what platform your program will be running on. The other languages make it more obvious when you're breaking platform independance.

Don't jump from language to language, learning as many as you can. You won't be good at programming in any of them. Don't learn only one language either, but put some effort into aquiring real skills at the language you are currently learning before moving on to something new. And when you do learn something new, try to make an effort to use something that's actually significantly different from what you already know, rather than just being a variation on your current skills.
 
  • #34
Chroot,

It's rather rude of you to engage in a personal attack on myself. I'm not going to make this a personal post about myself, but I assure my qualifications and expertise are valid when it comes to programming. I just choose not to take part in educating myself about languages "hot" in industry now, that's irrelevant. I've worked on plenty of operating systems, platforms, and have written many programs to know that Java is more of a "buzz" in industury. Everyone wants it, but that's not always the best is it?

Ask any experienced programmer (born before Java surfaced) that isn't an industry weener how decent Java's OO implementation is. You seem intelligent, so go Google, "java terrible language" or "java bloated" and see how many hits you come up with. You're right in some aspects - I haven't done much with Java, but I know where Java doesn't belong. You sure don't write operating systems in Java; I haven't seen one, nor would I use it. I don't know a sensible person that would write an OS in Java. Most sensible, serious OS developers would actually write their own memory management and garbage collection routines. Java is bloated, even a lot more than C++. Look at the sizes of a few Java binaries, compare those to C binaries that do the same thing. It's ugly. Java's a language more for a programmer who doesn't want to write (or trust C, C++'s memory management) a decent garbage collection or memory management routine(s). Garbage collection really isn't an issue with C++, anymore. Depending on the compiler and your skill to implement temporary variables correctly, you have nothing to worry about.

I don't see how anyone can claim security with it comes to the Java VM. I'd be willing to bet that I could rip off some Java application, compile it to native code, and insert some machine code via a hexadecimal editor. I'm rather certain the VM wouldn't detect that (try it). Unless Sun's programmers are a lot smarter than I think they are, the VM can't analyze machine code. Even if it did analyze *some* machine code, I doubt it could analyze machine code for every platform the JVM can run on. The only security features the JVM offers is protection from a 12 year old.

I'll say a few good things for Java, though. Java's excellent for web applications, and if that's your cup of tea then so be it. Java is standardized (type specifications are the same in any Java distribution, numerical precision varies, though); C and C++ are not. With Java it's *much* easier to put together a nice development environment; plenty of IDE's exist out there (not that I believe in that sort of thing, sit me down with vi, anyday). I know from experience how much of a pain it is trying to get a C or C++ development environment going, especially with GNU garbage. I'd much rather write code in a language distribution such as Java and Perl rather than languages that have attempted to be standarized by an enormous quantity of organizations, but when you want performance C or asm are the only alternatives.

Edit: By the way, how can you write an operating system in Java, given you don't have pointer arithmetic? Smooth one there Chroot (Talk about me being humurous, and don't refer to JOS.).
 
Last edited:
  • #35
I'd like to clarify that I don't think Java is a terrible language, but I don't think it's the second coming of programming languages. I just think that it's not the best thing in the world, given the application.
 
  • #36
graphic7 said:
I just choose not to take part in educating myself about languages "hot" in industry now, that's irrelevant.
Of course it's revelant -- YOU ARE TALKING ABOUT THE LANGUAGES.
I've worked on plenty of operating systems, platforms, and have written many programs to know that Java is more of a "buzz" in industury. Everyone wants it, but that's not always the best is it?
Yet you don't actually know the language.
Ask any experienced programmer (born before Java surfaced) that isn't an industry weener how decent Java's OO implementation is.
I've been programming since 1988, long before Java was invented. I learned C++ in 1991. Java is by far one of the best OO implementations ever created, and the vast majority of programmers agree with me. Why don't you present some cogent arguments on Java's flawed OO, rather than telling me to go google? You probably can't, since you don't know Java! :smile:
You sure don't write operating systems in Java; I haven't seen one, nor would I use it. I don't know a sensible person that would write an OS in Java.
You haven't seen one? There are several. Maybe you should do some research...
Java is bloated, even a lot more than C++. Look at the sizes of a few Java binaries, compare those to C binaries that do the same thing.
I beg to differ. Write up a graphical "Hello World" app in Java, and another in Win32 if you'd like, and show you the difference in file size. They're virtually the same. You obviously don't know what you're talking about -- again.
It's ugly. Java's a language more for a programmer who doesn't want to write (or trust C, C++'s memory management) a decent garbage collection or memory management routine(s).
Or perhaps it's for programmers who'd prefer to let a very talented algorithm designer develop a garbage collection algorithm and build it into the language.
Garbage collection really isn't an issue with C++, anymore.
:smile: Memory leaks remain one of the single largest issues in application development. Have you worked in any production software environments in your whole life?
I don't see how anyone can claim security with it comes to the Java VM. I'd be willing to bet that I could rip off some Java application, compile it to native code, and insert some machine code via a hexadecimal editor. I'm rather certain the VM wouldn't detect that (try it).
It most certainly won't work -- it'll fail the bytecode verifier immediately. Why don't you go read a book on the language before making stupid comments like this?
Unless Sun's programmers are a lot smarter than I think they are, the VM can't analyze machine code.
It doesn't, it analyzes bytecode. It runs bytecode. And apparently they *are* a lot smarter than you think they are. Of course, you don't know the language, so you are again handicapped and not really able to make any sensible arguments.
Edit: By the way, how can you write an operating system in Java, given you don't have pointer arithmetic? Smooth one there Chroot (Talk about me being humurous, and don't refer to JOS.).
Why would you need pointers? Your blessed language, Perl, doesn't include them directly.

Put a sock in it graphic7... you don't know your ass from a hole in the ground on this one, and you might as well let it rest. Go educate yourself before making comments about languages you don't know. It's simple, really.

- Warren
 
  • #37
graphic7 said:
I'd like to clarify that I don't think Java is a terrible language, but I don't think it's the second coming of programming languages.
Who the hell ever said it was? It's ideal for some applications. It has its place, just like C++, Perl, Python, Ruby, Icon, Scheme, Lisp, etc...

- Warren
 
  • #38
graphic7 said:
I don't see how anyone can claim security with it comes to the Java VM. I'd be willing to bet that I could rip off some Java application, compile it to native code, and insert some machine code via a hexadecimal editor. I'm rather certain the VM wouldn't detect that (try it).
You made comments about the Java VM in a previous post that lead me to think that you really don't understand it all that well.

Your comments here lead me to think that you don't understand it all that well.

You might find it interesting to read up on the Java Virtual Machines, and particularly on its security functionality.
 
  • #39
I agree with much of what Mr root said (though I'd say in less caustic terms:biggrin:)

Here's an OS created using Java JX

graphic7: There's been only one known Java virus and that one only alters class files. I believe Sun has since patched Java to prevent virii (is this a real word, always wondered but never looked into it) attacks such as this since 1999 BTW (when the only virus appeared). It is exceedingly difficult (not impossible, never is) to make a Java virus because the JVM simply won't allow it. The OS running a Java app doesn't execute the Java code per-say--the OS only hands the information to the JVM for execution. You can hide as much malicious asm code in a chunk of Java Byte code as you want because the OS will never see said asm code as anything other than information (not commands). The JVM OTOH looks at the byte code prior to execution and verifies that the code is 100% java code. If it's not a pure jar file then no dice--it won't run.

Moreover, Java apps CAN be infected by a virus (though difficult) but applets cannot. Applets run under a different mechanism and have no access to write to a file tree so if infected cannot spread said infection. Only Java apps can spread infection yet as stated twice this is very difficult to accomplish.

Java is pushed because it is cross platform. It is mature. It is safe. It is stable. It is just this side of C/C++. It is easy because there are 1000's of functions already available. It is moderately fast if the programmer takes the time to use proper import statements (no import java.util.*; instead only import the functions you need). As chroot said java bytecode is comparable to any GUI bytecode. As an example, write an array q-sort algorithm with GUI on your favorite OS and do the said in Java. Java's readily available q-sort algorithm is fast and small. Unless you full optimize your own algorithm the one you write will be the same size as the java version I dare say. Java is easy. It is useful for web applets. It is useful for enterprise RAD. It's forgiving. It offers different ways to implement GUI's (awt and swing). It is useful as a server side tool. Is has many modules that make the internet more useful. It enables one to write code that runs on win32 and a sparcStation in exactly the same manner (mono isn't 100% there yet and C# is an offshoot of Java to begin with). It is OO. It fixes some of smalltalk's flaws as well as C/C++ flaws.

It's not perfect by any means but at the same time your characterization seems based on second hand knowledge and is overly critical of a few aspects.

Graphic7:look into Java's "sandbox" scheme. This should help clear up some misconceptions about Java's JVM.

PS. PHP is a lovely language(my favorite in fact) for anyone who want's to learn a scripting language. PHP has a lot of built in tools and is very useful as a web tool. There is a project working on porting PHP to a system level tool in the same vein as Perl and Python. This is an off argument aside simply because I like PHP so much.
 
Last edited:
  • #40
For the most part, I quite agree with what you say. I just want to make 2 points.

faust9 said:
IMoreover, Java apps CAN be infected by a virus (though difficult) but applets cannot.
For this statement, you are assuming default security manager settings. These can and should be changed, at least for applications.

he programmer takes the time to use proper import statements (no import java.util.*; instead only import the functions you need).
Import statements do not import functions, but classes. As well, the use of import statements that you recommend only has compile time advantage; it has no run time advantage.
 
  • #41
Prometheus said:
For the most part, I quite agree with what you say. I just want to make 2 points.


For this statement, you are assuming default security manager settings. These can and should be changed, at least for applications.


Import statements do not import functions, but classes. As well, the use of import statements that you recommend only has compile time advantage; it has no run time advantage.

Thanks for the corrections. Not a 'true' Java guru myself--only a moderate dabbler. Had to learn it because I worked for a company that manufactured high end network equipment (backbone equipment) and the testing of said equipment was done using windows and sparcStations. Java was a perfect tool because the same app could do all that needed to be done on both OS's available from a central server. I had to maintain the code for a few months though so I only program java at a moderate level.

When I made my first statement I did assume default security settings because I've never trusted others to deviate from the default. Look at how many windows attacks in the past could have been alleviated by users altering the sloppy windows defaults. Programmers can be no better with this when a deadline comes down the pipe. I know, I've taken shortcuts to get a working app onto the floor in time just to get people off my back. I also know I'm not alone in doing this.

PS. I learned C as my first language so classes and functions are the same to me. I understand the terminology is wrong but it's hadr to teach an old dog new tricks.
 
  • #42
faust9 said:
PS. I learned C as my first language so classes and functions are the same to me. I understand the terminology is wrong but it's hadr to teach an old dog new tricks.
How lucky you are. I used a dozen languages before I learned C. I thought that I was in heaven when I found C, and I never wanted to give it up. Then, I discovered Java. I really like the OO paradigm (and the WWW), and now I don't code C any more.
 
  • #43
Prometheus said:
How lucky you are. I used a dozen languages before I learned C. I thought that I was in heaven when I found C, and I never wanted to give it up. Then, I discovered Java. I really like the OO paradigm (and the WWW), and now I don't code C any more.

Yeah, I got my first computer in 88--an Amiga 2000--after going to a friends house and playing some games on his dad's Amiga. Said friend's dad was an Amiga software developer who got me started. He gave me my first c compiler and a couple of c books. I was going to try and learn Amiga Basic was persuaded to go straight for C.
 
  • #44
faust9 said:
Yeah, I got my first computer in 88--an Amiga 2000--after going to a friends house and playing some games on his dad's Amiga. Said friend's dad was an Amiga software developer who got me started. He gave me my first c compiler and a couple of c books. I was going to try and learn Amiga Basic was persuaded to go straight for C.
Back in the olden days, every machine had its own version of Basic. All of them were easy, but they were, well, basic. I never learned Amiga basic, but I learned too many others. C is such a beautiful language compared to the others that I used.

Before C, the language that I thought was the most fun was called APL ("A Programming Langauge"). This was an IBM language, and it was fun.

In 1999, I had an offer to make 6 figures doing Y2K COBOL programming. One last fling, so to speak. Forget it. COBOL is one language that I don't mind if I never see again. Dinosaur code.
 
  • #45
chroot said:
I've been programming since 1988, long before Java was invented. I learned C++ in 1991. Java is by far one of the best OO implementations ever created, and the vast majority of programmers agree with me. Why don't you present some cogent arguments on Java's flawed OO, rather than telling me to go google? You probably can't, since you don't know Java! :smile:

I couldn't pass up this, even though this remark wasn't directed at me. There is a horrible, horrible thing in Java's OO design. It has "objects" which are not "Objects". Things like int and double and char and so on. It's not as much of a problem now that autoboxing is being added to the language; but it is an ugly wart on the language.

And arrays...why are they even in Java? Any language with a collection class doesn't need arrays. Arrays are just a special type of collection, and there isn't any benefit to making them a special case that works differently.


Of course, the OO in Java is a good, solid model. But I think it's stretching it to call it "one of the best OO implementations ever created". What does Java's OO model do that other models don't?
 
  • #46
And a nitpick on sorting: Collections.sort uses a merge sort, not a quick sort, because the specification requires it to be a stable sort. (I should compare it to SGI's implementation of C++'s stable_sort sometime)

I don't think Java has a quicksort built in... but I can hardly claim to know everything it has. :smile:
 
  • #47
master_coda said:
I couldn't pass up this, even though this remark wasn't directed at me. There is a horrible, horrible thing in Java's OO design. It has "objects" which are not "Objects". Things like int and double and char and so on.
Java has 8 primitive types. These are available because they reduce overhead and increase execution time. Each of these has a corresponding Java class.
 
  • #48
Prometheus said:
Java has 8 primitive types. These are available because they reduce overhead and increase execution time. Each of these has a corresponding Java class.

Even if it was true that they we a good optimization, that doesn't change the fact that it drastically reduces the elegance of the OO in Java. It wouldn't be so bad if the primitives were just an added speed feature that could be ignored, but they aren't. The primitive types are used in most of the core classes, and since the standard arithmetic operators don't work on the Java classes it's a pain to use them for arithmetic.

And it isn't a good optimization. A much better one would have been to just have the Java classes, and to represent them internally using primitives, converting them into full-blown objects only when necessary.
 
  • #49
What exactly is php...
i have been able to do some crazy stuff with it as far ascessing service information.
 
  • #50
php is one of the best (if not the best) webprogramming languages. i use it a lot (its the foundation of my website: www.dematrix.net). I like php for several things:

1. it is open source, and this makes it easy to learn plus all the valuable info is located at www.php.net
2. its syntax is similar to c++ (i think they took it from c++). this is good for me because my main programming language is c++.
3. it is powerful, in that you can perform many functions as you can see from php.net. i have done asp and coldfusion (not as indepth as php) but i think php has more functions

there are many more reasons why php is one of the best and if you use it for webprogramming you will see for yourself.
 
  • #51
graphic7 said:
If you're used to C syntax it's very easy to learn Perl.
Absolutely true.
faust9 said:
If you are not proficient with Unix programming then Perl has a very steep learning curve.
Not true.

In bioinformatics Perl is the main programming language, mainly because of the ability to use regular expressions when search DNA and protein files. So for bioinformatics I'd say definitely learn Perl, but before doing that I'd start with learning C. By learning C you get programmed yourself to write clean scripts and declare variables, write your own functions etc. so you get a more comprehensive understanding of programming. Learning Perl after that is a piece of cake.

But running a program written in Perl can take considerably longer to run than a program written in C. Thirty secs vs 2 secs. Probably because Perl is compliled while it is being run, while C requires compilation before it can be run?

Anyway.. I'm not a hard-core programmer, but I found that programming in C and Perl is simple and that running Unix is not a big deal either. There are some things I still need to learn though, like extracting data from online databases..

Two questions I don't quite get yet:
1. What's the difference between scripting languages and others?
2. What's exactly is object oriented? What I understand is that it allows you to bring units from different programmers together into a single program? What's the use of being object oriented?
 
  • #52
1. A program written in an interpreted language is interpreted by an interpreter when run :smile:

A program written in a compiled language is converted into machine code and can be executed directly by the processor.

2. Object oriented programming as opposed to procederal programming uses objects to represent things. For example:

class person {

string name;
int age;

};

main () {

person david, linus;

david = linus

cout << david.age ;

}

This is a rather simple example of OOP, but it shows you how you basically organize stuff into objects. In procedural programming you would need to do something like this:

string person1_name;
int person1_age;
string person2_name;
int person2_age;

person1_name = person2_name;
person1_age = person2_age;

cout <<person1_age << endl;

You can easily see how OOP is easier to understand.

----------------------

On other note, I've recently been doing some work in Python and I must say it is one of the tightest and elegant programming language I've worked with. Although I would probable always recommend C as the best language to learn first because it forces you to actually understand memory and other aspects of programming, Python really makes programming every so more enjoyable. Especially when you don't need to remember to put semicolons at the end of each line.
 
  • #53
A scripting language is essentially interpreted. With Perl, once your script is executed, it's passed through the Perl interpreter, the Perl interpreter reads the script and calls the necessary libraries and functions, just as the script would suggest.

This is a tidbit you may find useful - Perl scripts can also be translated to C code. Take a look at PerlCC. I've seen performance increases, but it's difficult to compile it if you're using tons of modules.

Object oriented programming is a much more structured way of programming. It's a little bit more intuitive than creating a subroutine. You can sort of actually create a subroutine that holds lots of other subroutines.

I'm sure you've exercised Perl's object oriented structure before:

$a = Some::Module->new();

etc. etc.

Any time, you're using a module, you are exercising the object orientation Perl features. If you call some module like Net::FTP, we know that we're calling Net, but we really want to call the FTP function. It would be funny finding the FTP function in some module; for instance, Math::FTP. I said earlier, that it's like "creating a subroutine within a subroutine," however we know Math or Net isn't a subroutine - they just hold lots of other subroutines.

There's a lot to OOP, like polymorphism, classes, etc. etc. Objects themselves are just skimming the surface of the OOP ocean.

I had no idea that Perl was used in your line of work. You mentioned regex; take a look at `awk' in UNIX. It's basically an interpreter that can accept regex's from the terminal. It might save you a few minutes the next time you're wanting to search through something, instead of having to hack up a Perl script with some simple regex, which is unneccessary.
 
Last edited:
  • #54
Which is the best language for graphics.
 
  • #55
thats a hard one.

Many here might say C++.
I would rather say C# than C++ (but that is because i bloody hate C++)

Altough, whilst i was still programming 3D games i do remember having seen a Delphi 3D engine once, and it was remarkable. But that was almost 3, perhaps even 4 years ago. So i have been out of the professional game dev loop for a while so i am going to leave this to others to answer.
 
  • #56
chound, it depends on what you mean by graphics. Any high end game is going to be written in C++. If your doing simple 2d or 3d drawing you can get away with slower languages.

Bah C#. I would never recommend locking your self into the .NET framework. This is just another way Microsoft can force you to pay their tax. I've never written anything in that language and I don't plan on doing so anytime soon. I'll stick to python thank you very much.
 

Similar threads

  • · Replies 44 ·
2
Replies
44
Views
5K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 10 ·
Replies
10
Views
674
Replies
86
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 102 ·
4
Replies
102
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 25 ·
Replies
25
Views
738
  • · Replies 15 ·
Replies
15
Views
3K