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!
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.
>>>>> "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:
Used for new, large-system development. Microsoft products use this heavily, especially their MFC portion. While I personally dislike Microsoft, Windows is currently the largest audience that can be targeted by programmers. So learning C++, MFC, and at least one of the interface builders (Visual Studio from Microsoft, whatever Borland is offering these days) is probably the best way to go here.
If you're just looking to write small, business-oriented applications, you might actually have better luck with "Visual Basic" from Microsoft. With Visual Basic and the GUI builders, you can often get a basic application done within a day, and the learning curve is probably shorter than for C++. On the other hand, VB doesn't scale nearly as well as C++, and relies heavily on a problem that can be split into very well-defined chunks, with any "hard stuff" done by custom controls. There's a huge number of these controls available, and VB programmers spend most of their time figuring out how to glue the components together.
Finally, if you are doing an application where speed and size are a concern, then C++ (or C or Fortran) are the only reasonable options. All the other languages I've mentioned (Perl, Java, VB) are all going to be slower than well-written C++. Also, a true feel for the "heart and soul" of programming can only be had in a language that allows you to get close to the hardware -- in this case, C or C++.
The main advantages of Java are (1) fully buzzword compliant; (2) nominally multi-platform (although watch out for the Microsoft java products -- they only run on Windows, at which point you might as well have used VB); (3) the language was designed, instead of evolved.
As an environment in which to learn programming, Java has some strengths. It allows programmers to learn good habits and encourages good ways to think about problems. Some of this, however, leads to limitations, and a feel that you're "far from the metal". See my comment at the end of the C++ section.
It has other advantages: threads, graphics, and networking are built into the language, while they can require a bit of jumping through hoops in the other two languages.
The place I see Java really being useful is to replace the old mainframe systems. Not on the heavy iron side -- not at all! But instead of having dumb IBM terminals directly attached to the mainframe, you can use Java applications or applets to do the things the dumb terminals used to do -- field layout, input validation, consistency checks, etc -- then send them back to a central server. Thus, Java is a natural for client/server programming. I'm more inclined to believe that it's better for client-side programming than server-side, but some people disagree.
The best thing I can say about perl is this: it's *fun*. [Of course, i'm biased; it's probably my favorite language!] Its main strengths are in text manipulation, and in "gluing" other applications together. It has some disadvantages -- the large amount of punctuation scares people off, and it's easy to write nigh-incomprehensible code. Of course, you can do that in any language, but Perl seems to amplify it.
Perl, like VB, has a large number of "components" available. Unlike VB, most of these components are free for the asking. The Perl culture is very strong on helping each other out; this can probably be traced to Larry Wall, the author of Perl, who released it because his ideals demanded that he help others. That ethic has largely remained intact, although some of the members of that community are getting a bit jaded by the MS-trained "take take take" mentality.
Perl can do GUIs, but I don't find them as obvious as the Java abilities. Perl's GUI abilities are multi-platform, though; at least Unix (using the X Window System) and Win32, possibly also on the Mac.
Perl really hit the scene with the advent of the WWW. Many of the features you find on the web are programmed in perl; its abilities (text manipulation, pattern searching, "gluing") are perfectly matched to the task at hand, and the limitations of Perl (slower than C/C++ for most things, larger memory footprint than optimal) are lost in the network lag.
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.
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. :)