A Beginner's Guide to Free Software Programming Languages
Of King C and Friendly Python
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.
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 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 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.
- What's new in Python 3.0
- Ruby documentation
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative