Beyond the command line

If at first you don’t succeed, you must be a programmer.

If you’ve the slightest interest in programming — and I’m hoping the last couple of columns have sparked something in that department — Linux is the place to be. Not only does every distribution come with a plethora of programming tools, languages and libraries, but you also have ready access to some of the best source code on the planet. What’s more, if you feel like doing an apprenticeship, there are thousands of real-life projects on sites like freshmeat.net and sourceforge.net that would be happy to have you help out.

Of the dozens of languages available under Linux, there are four biggies that you’ll see referred to time and again.

C and C++: The most powerful of computer languages, C and its object-oriented extension C++ are what Linux itself is written in (and Windows, for that matter). But that power, speed and flexibility comes at a cost. It has a steep learning curve (did I hear someone say “cliff”?) and there’s even an annual contest celebrating its syntactical opaqueness: check out the International Obfuscated C Code Contest at www.ioccc.org. If you’re looking to just knock out a few simple applications, give C/C++ a miss. But if your interest and dedication goes deeper — systems programming, embedded systems, large-scale application development — becoming a guru will guarantee you work and a good income for life. Not recommended if you’ve never programmed before.

Perl: Described by The New Hacker’s Dictionary as the “Swiss Army chainsaw” of programming languages. Perl, according to the Comprehensive Perl Archive Network (CPAN), is “particularly well-suited for tasks involving quick prototyping, system utilities, software tools, system management tasks, database access, graphical programming, networking and world wide web programming”.

Most tasks only require a small subset of the language, giving it a low and long learning curve — you can get started in next to no time but can do practically anything with it with a little effort.

CPAN (www.cpan.org) contains a vast collection of source code, documentation, scripts, extensions and modules. “If there’s something you need to do,” it claims, “it’s probably already been done, and a working example is usually available for free.”

Python: There’s a lot of rivalry between Perl and Python proponents as both languages are aimed at the general purpose, one-tool-does-it-all programming market. Perl might be older and more established but, according to one Pythonite, it’s also a “large, arcane, quirky, enigmatic, equivocal language that very few people have sufficient mastery of to avoid getting into trouble on a regular basis”. At the risk of sparking a Holy War, I have to say I agree. Some Perl constructs look like escapees from an Obfuscated C Code Contest — but I’ll continue to use both languages as appropriate.

If you’re new to programming, start with Python. Its clear syntax is easy to learn but that doesn’t detract from its power or flexibility. On the downside, its website (www.python.org) isn’t quite as comprehensive, organised or user-friendly as CPAN, with the result that you’re more likely to find suitable sample source code in Perl.

PHP: The only annoying thing about PHP (“PHP: Hypertext Preprocessor”) is its recursive acronym. A general-purpose scripting language, PHP’s particularly suited to web development as it can be easily embedded into HTML and, when combined with a database, used to produce dynamic web pages. In fact you’ll often see it referred to as part of another acronym — LAMP (Linux, Apache server software, MySQL database and PHP) — which describes all you really need to build a website.

It’s an easy language to learn, has the syntactical rigour of Python, and plenty of advanced features to dig into as you build up experience. There’s an outstanding tutorial and manual on the website (www.php.net), and don’t overlook the user-contributed notes at the bottom of each page (you can even add your own). And of course the site is its own advertisement; it makes extensive use of PHP.

IDEs

If you’re going to do any sort of programming, you really should work in an Integrated Development Environment. IDEs provide all sorts of useful bits and pieces designed to simplify and speed up the development process — editing and highlighting tools, file browsers, debugger interfaces, project management systems and application wizards to name but a few. Think of an IDE as a sort of one-stop programming shop that removes the need to flick between separate windows while allowing programs to be tested with just a button-click or function key press.

Of course, being Linux, there are a number of IDEs available; one of the most robust and versatile being KDevelop. It comes ready-packaged with all major distributions and has sample templates for more than a dozen programming languages. Just click Project•New Project for a selection of simple, basic, ready-made applications to get you started. Even if you just stick to shell programming, KDevelop will make life a lot easier.

Join the PC World New Zealand newsletter!

Error: Please check your email address.

Struggling for Christmas presents this year? Check out our Christmas Gift Guide for some top tech suggestions and more.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Geoff Palmer

Unknown Publication

Latest News Articles

Most Popular Articles

Follow Us

Resources

Shopping.com

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?