Re: OT: Programming Languages (Was: Spell Checking for Non European Languages, and for Conlangs)
From: | Mark J. Reed <markjreed@...> |
Date: | Wednesday, March 31, 2004, 13:57 |
On Tue, Mar 30, 2004 at 11:12:06PM -0800, Philippe Caquant wrote:
> So I'm trying to find advices on the very many new
> languages appearing everywhere, most of them as
> freeware. I bought a book about Perl, looks powerful
> but nearly unreadable. I really wondered about Perl
> philosophy: what can be the use of saving a few
> keyboard hits if you lose 100x more time trying to
> decipher program sources? It's very irrational to me.
It's perfectly possible to write quite legible Perl. I
find the "line noise" arguments against it overstated, but
it is true that the onus is on the programmer a little moreso
than in other languages.
A big part of that is due to the niche Perl was created to fill - as a
reporting language for other software, it had to be able to do the
high-level glue work of shell scripts; but to be efficient, it also
needed to interface directly to the OS at the system call level. And
all without having to invoke any external programs (shellscripts are
mostly invocations of other programs that do the heavy lifting, while
the built-in shell instructions are merely control flow).
It was in a sense a language designed to make one-off one-liners easy,
and for that reason it's full of shortcuts.
But you don't *have* to use the shortcuts, and for a program of any size
there's no point in doing so. When I write a program in Perl, I have no
trouble going back and reading it later - even years later, as I
recently had to do. Perl has a lot going for it. Don't believe all
the predictions of its imminent demise, either. It's not like there's
only room for one scripting language and now that Python is catching on
Perl will disappear.
The biggest flaw in Perl, in my opinion, is that it's support for
object-oriented design is clunky. Yes, OO is overhyped. Yes, you
can write code based on an object-oriented design in any language;
you don't need an object-oriented one. But OOD is still the best tool
available for designing reusable code, and Perl5's OO stuff is a hack
built on a kludge. I'm really looking forward to Perl6, which will be
O-O from the ground up, but since Larry et al are taking their time to
Get It Right, I'm not holding my breath waiting for it to come out.
Python is better, but not as much better as its proponents claim.
Saving a few keystrokes isn't worth it if the legibility suffers, but
that doesn't mean that adding keystrokes makes things more legible.
Things that are simple should look simple, but some operations in Python
require so much scaffolding that you can't see the forest for the trees.
And despite much touting of its status as an OOPL, it's full of
fundamental features that are functional. There's no excuse for len()
being a global function instead of a method, for instance, and only
recently did it get the ability to call methods on primitive types.
As I said, I like Ruby a lot. The only real drawback there is that its
current implementation is a little less stable and a little slower than
Perl's and Python's. Which makes sense since it is a younger lanugage.
But it's also relatively unknown over here. And there's still a lot of
documentation that's not available in English. All of that is changing,
but it'll be some time before you find many job postings asking for Ruby
skills.
Technically, PHP doesn't have anything to recommend it that I can see.
It was originally tailored very well to its intended use: as a language
embedded in HTML to add dynamic elements on the server side. What ASP
did with a choice of several languages, and JSP did with Java, PHP did
with a brand-new language created especially for the purpose. But it
turns out that a lot of web pages need the features of the
general-purpose languages, and over time PHP has grown a lot - and not
prettily. It suffers from a lack of namespace management - everything
is a global function, usually with some long_category_prefix to make
sure there's no conflict - and general bloat; PHP 5 is a considerably
larger Apache module and runs considerably slower than PHP 4 on my
machine. But PHP is marketable.
The important thing is to understand the fundamental way computers and
programming languages work. Once you have that, you can learn any new
language pretty quickly. But as with spoken languages, there's more to
programming language than grammar and basic vocabulary; there are
idioms, standard practices, libraries of other people's code that you
have to know how to use, etc. To get to the point where you have a
marketable skill in a given language does take time.
For maximum marketability, I recommend learning C, C++, and Java.
C is sort of the Latin of programming; so many other languages have borrowed
heavily from its syntax that knowing it gives you a serious leg up.
C++ is like Vulgar Latin to C's Classical, while Java is a Romance
language. C# is similar as well, but not yet as in demand; I'm sure
that will change, but for now if you want to proram in the Windows
.NET environment there's more demand for the .NET version of Visual
Basic than for C#.
For higher-level programming, you have what is generally referred to as
"very high level" or "fourth generation" or "scripting" or "prototyping"
or "rapid development" languages such as JavaScript, Perl, Python, and
Ruby. If you're going to do anything at all with web pages, JavaScript
is a must here; despite the name, it's not related to Java beyond their
shared kinship with C, and in many ways is more like Python. Perl is
still the way to go for marketability, but there's work to be had in
Python as well. Ruby is not in demand but I think is worth learning
just to get your feet wet in a different way of doing things.
-Mark