August 21, 2014
 
 
RSSRSS feed

A Beginner's Guide to Free Software Programming Languages

Of King C and Friendly Python

  • June 26, 2009
  • By Akkana Peck

Curious about programming, but having trouble getting started because you're confused about all those languages? This article will give you an overview of the most common desktop languages you'll see in free software today.

C and C++

You might call C the king of Linux programming languages. It's the primary language used in the Linux kernel, in most of the GNU command-line utilities (programs like ls and grep) and in a lot of larger desktop applications like GIMP.

C++ is a later extension of C: It adds a lot of new features which make the language either easier to use, or more bloated and complicated, depending on whom you ask.

They're both "compiled" languages, which means you need a "compiler" program (typically gcc) to translate your C or C++ program to machine language before you can run it. They also tend to lack modern features like string handling and memory management, which means they're not the best choice for most first-time programmers.

Python

If C and C++ aren't good starting points, what is? It's a matter of taste, but my first choice would be Python.

Python isn't as low-level or as lightning-fast as C, but most of the time that's really not very important. What is important is that Python has a very clean syntax that makes debugging easy.

Python has one oddity compared to most other languages: the spaces you add to indent each line are significant, and you have to be consistent in how many spaces you add. That sounds like it would make it fiddly and difficult, but in practice it ensures that even beginners write code that will be fairly easy to read a year from now. No other language does that.

Python also has a good set of standard libraries, so lots of tools you might need are already there, and the online documentation at python.org is very helpful.

What's the bad news? Mainly that Python's syntax is about to change. Right now, most distros offer either Python 2.5 or 2.6, but Python 3.0 has already been introduced and a number of things that used to work are now done differently. Most existing books and Web tutorials are still for Python 2, but it's worth checking out the differences so you learn good habits.

Perl

Perl is another good choice. It's much older than Python and fairly similar in power and speed. It has some significant advantages over Python. First, there's an absolutely amazing collection of libraries, called the Comprehensive Perl Archive Network (CPAN). Virtually anything you can think of to write in Perl is probably already mostly written and available in CPAN. Second, there's a very active Perl community so it's easy to find a Perl guru if you need help, and there's a wealth of books and online talks to aid your Perl adventures. Third, lots of software is already written in Perl (lots of examples to help you out).

The disadvantage? Perl syntax is much less clean -- "There's more than one way to do it" is the Perl programmer's mantra -- so reading other people's Perl can be difficult. Sometimes even reading your own Perl is difficult. Non-Perl programmers refer to it as a "write-only language" and they're only half joking.

Ruby

Ruby is sort of an object-oriented Perl. It has a relatively clean syntax and is supported by an enthusiastic community. It's most popular for Web servers in the "Ruby on Rails" framework, where it's used instead of Java, but it's increasingly showing up in Linux desktop applications as well. There's a lot of good online Ruby documentation as well as books.

JavaScript

JavaScript has one big advantage: It runs in every modern browser. If you write a program in JavaScript, you can stick it on a Web site and share it with your friends around the world right away. Since it runs inside a Web page, you can write cool visual effects like moving images around, something that's harder to do in a desktop language where you need to choose a graphics toolkit before you can even open a window.

However, running in a browser has disadvantages, too: No two browsers implement JavaScript the same way, and writing JavaScript that runs in all browsers is quite tricky. JavaScript is a great beginner language if you start by writing apps that only run in Firefox 3.

Runners-up

You may notice that I didn't list Java or PHP. Why not? Because they're primarily used to write software that runs Web servers. Java (which despite the name has nothing to do with JavaScript) is sometimes used to write desktop applications or cellphone games, but it's relatively complex and I don't recommend it as a first langauge. PHP is a little simpler, but it isn't used much outside Web servers and for most beginning programmers, you're better off with another language.

Links

Sitemap | Contact Us