Which programming language should I learn?

A friend asked me, on behalf of her brother, what language(s) I would recommend a beginner learn. My answer follows; if you have any comments to make, feel free to e-mail me, and i'll see if i can't add them to this page. Thanks!

Update!

Tuesday, 1999-06-08: The first addition is here! A friend on EFNet IRC disagreed with my views slightly, and wrote up a quick response. I've added his comments below; he was a little flustered when I said I would add them without much editing, so I'm keeping it anonymous for now. He has offered to write a more detailed and professional evaluation. For now, if you want to talk with him, I'll forward any requests I get.

The Request

>>>>> "Alisa" == Alisa writes:

My brother is looking to break into the computing world.. and wants to know whether to start with Java or C++.

ok...

Being that I've lived in academia my whole life

*smirk*

& all we use is C/C++, I figured you could help him out..

I'll see what I can do.

>>>>> Alan writes:

I've finally gotten into the C++ book. I've set up the bundled application, which is a scaled-down version of Turbo C++ for DOS (so I'm able to run it on my laptop).

Two questions

What was that C++ book that you thought was so good?

I don't know which one Alisa was recommending, but the 3rd edition of Bjarne Stroustrup's _The C++ Programming Language_ can be considered definitive, and has comprehensive coverage of the current state of the art in the language. (Not surprising, since Stroustrup is the creator of C++ and has been involved in the language ever since). It might be pretty heavy reading for someone just beginning to learn programming, though.

Is there still a reason to learn C++ or are JAVA and PERL taking over?

Just to nitpick -- it's "Java" and "Perl"; neither are acronyms. (Well, ok, "perl" originally was an acronym, but its author and maintainers use "Perl" to refer to the language, and "perl" to refer to the implementation.)

In my opinion, each of these three languages has a different area where it works best. As Alisa can attest, Fortran still has its application domains; C still has its very important uses as well (think operating systems). Between the three you mention, here's what I see:

Summary

So to answer the question, which language to learn... I suspect that you need to ask yourself what you want to do with it. Learning to program for the sake of learning to program probably won't work very well, but if you insist, then I'd recommend C and then C++; that gives you the best feel for "algorithms + data structures = programming", and you can always use that knowledge in other fields.

If you're going to be doing web development, then I'd strongly recommend you learn Perl. Microsoft has made inroads with their "Active Server Pages" (.ASP) which generally call VB routines; but Perl (running behind Apache servers) still owns the web by a healthy margin. Perl has many features which make it wonderful for CGI implementation, and the Apache web server has been modified to allow for fast, persistent Perl programs.

If you're looking at a mid-sized to corporation-sized system, and contemplating working on some sort of distributed solution, then consider learning Java for the front-end/client work (this will make most people happy, since they can stick with whatever workstation they have on their desk) and then look at databases and C++ or Perl on the server side.

If you're looking at small-office development, then Visual Basic might be the way to go. This is particularly true if you're looking to do some sort of small application that is designed to be used inside the office for one specific task.

If you're doing scientific analysis or visualization, then Fortran and C or C++ are the ways to go -- but note that Perl does have a fairly powerful numerics extension which will do lots of the hard stuff for you. This is similar in spirit to languages dedicated to mathematics and visualization, such as Mathematica, MatLab, IDL, etc. Alisa could probably tell you more about those then I can, however.

Hope this helps. If you have any questions, please feel free to write me back.


Comments

From Anonymous (for the moment):

Forget the preamble.

I suggest learning C first, always. It's orthogonal, can teach good habits, and teaches programmers how to think in foreign terms (i.e., pointers). It also is quite portable, and has enough holes to help force programmers to learn good habits. In addition to these finer points, it's available on fairly every system with 8 bits or more.

After C, it's a tossup. My favorite languages are Java and Perl, depending on what I'm trying to do; Java has the advantage of being easier to deploy over the web (i.e., applets), it's clearly object-oriented, it's orthogonal, and while it's missing templates and multiple inheritance it's nowhere near as inconsistent as C++ is. (Incidentally, the Pizza compiler DOES have templates. Still no multiple inheritance, though.)

Perl, on the other hand, is simply amazing. Perl is by far my favorite language to actually do things in, since it models how you think about your problem domain better than any other language I've ever seen. If you can think about a problem a certain way, Perl will be able to reflect that in how you code. This is both a boon and a pitfall - a boon because you can code working and accurate solutions in short times, and a pitfall because, after all, how you think about things changes over time and sometimes you might not remember why you expressed something a certain way.

(Case in point: coding perl while drunk is not a good idea, because it may actually work; C just wouldn't compile.)

I don't know him very well; I asked him to include a bit about himself, so we would know where he was coming from. This is what he added:

Who am I? I'm a professional programmer/analyst/system designer for a real estate company, doing primarily web MLS work. I've been programming for nearly 16 years, ranging from BASIC, COBOL, and FORTH to C, C++, Perl, xBase, Java, Pascal, and others. I've designed my own languages, all of which sucked save one, which was remarkably like Ada so it was abandoned. I've worked on the TS/1000, the C64, Apple IIs, PCs, Amigas, Suns, and others with various OSes such as TRS/DOS, XENIX, SunOS, BSD, HP/UX, and Linux. I'm an op on Undernet #linux, sometimes in horrid standing because I like rapid change. :)

Tkil
Last modified: Tue Dec 21 19:43:41 MST 1999