/* jquery */ /* jquery accordion style*/ /* jquery init */

1 January 2014

The Lua Language

Origins and People

Lua, named after the Portuguese for moon, is a fast, lightweight, embeddable scripting language based around a relatively simple 'C' application programming interface (API).

Roberto Ierusalimschy first created the language in 1993 as part of his work with the Computer Graphics Technology Group (Tecgraf) at Brazil's Pontifacal Catholic University of Rio de Janeiro. Brazil's restrictive trade agreements of the time helped to boost the significance of home grown technology solutions from this and similar technology groups.

Lua's design takes syntactic influences from SQL, DEL (a data entry language), Modula and Scheme. The friendly syntax and multi-platform availability makes it an ideal choice for products that encourage end users to modify or extend the software's behaviour, without exposing them to the inner complexity.

After initially using BSD-like licensing, from version 5.0 onwards Lua was released under the open source MIT license.

Developer Highlights

The intention of Lua's smallish data structure collection and relatively limited feature set is to strike a balance between approachability, flexibility, performance and implementation size. However, another benefit of these design principles is that they help reduce the learning curve to a minimum.

Built on top of the ISO C language Lua offers maximum portability and a tiny binary footprint. The interpreter is typically just 180kB in size. Yet Lua still manages to support automatic memory management and desirable functional language traits such as first-class functions and closures.

Lua is considered an ideal scripting language solution by numerous technology companies and open source projects. It has also found a niche in the video gaming world, with game-enhancing Lua scripts available for World of Warcraft, FarCry and Sim City 4. Lua scores highly with game developers because of its easy to embed nature, fast execution speed and easy-to-grasp syntax.

The LuaForge website hosts a comprehensive collection of Lua modules.

Developer Lowlights

Lua was always intended to be a small, efficient scripting language, rather than a fully-featured, general purpose one. This invariably means it's more suited to a complementary tool role for existing commercial products and open source initiatives.

An intrinsic part of Lua's design philosophy is its limited number of data types and slimmed down feature set. Yet, such restrictions may lead more experienced developers to focus on other, more flexible scripting languages such as JavaScript, Python and Go.

Lua's bare bones Unicode support may trouble some programmers, especially in web development scenarios. And its pattern matching functionality is rather limited when compared to the power of regular expressions.

The Future

Lua scripts are already incorporated into a surprisingly diverse range of products. Lego Mindstorms, Adobe's Lightroom, MySQL's Workbench, Propellerhead's Reason Digital Audio Workstation, Canon's Hack Development Kit for cameras, the Celestia astronomy app and numerous Linux apps are just a few of the many examples.

In January 2012 Lua won a Front Line Award from the Game Developer magazine in the Programming Tools category. And the fast growing open source Machine To Machine (M2M) Communication development world has recognised its potential. With such a pedigree Lua's future appears to be assured.

The C++ Language

Origins and People

In the early 1980s at Bell Laboratories the Danish computer scientist Bjarne Stroustrup decided take the C language and add classes. The result was the birth of C++, and this higher-level, object-oriented language became an instant hit.

Microsoft and Intel and other software organisations soon created their own C++ compilers. Such high profile support ensured a rapid rise in popularity. Mass adoption of C++ by programmers in the 1990s provided huge momentum, and it soon became a major force in the operating system and application development arena.

Bjarne Stroustrup also wrote the classic The C++ Programming Language textbook. New revisions of the book reflect the language's evolution, with the third edition describing features such as virtual functions, the standard template library, exceptions and namespaces.

Developer Highlights

As C++ is a superset of C, the compiler will also compile C programs. In fact, a C++ compiler tends to be superior when it comes to reporting syntax errors and possible coding issues. With its C foundation the cross-platform portability of C++ is equally impressive. And the resulting binary programs are just as efficient on devices with low-powered CPUs and restricted memory.

The ability to encapsulate complex functionality in a collection of flexible object-oriented classes resulted in a plethora of GUI and domain-specific libraries. Developing large, GUI-centric applications in C++ is far easier than with C.

In the years before alternatives like Java and the birth of the web, C++ gained a reputation as the language of choice for coding power, flexibility and control - features still highly valued by today's C++ developer.

Developer Lowlights

With its comprehensive specification and expressive syntax C++ demands a significant learning curve. Competent C++ developers must be just as comfortable with its low-level capabilities as they are with classes. A design-centric mentality is particularly important when working with object-oriented languages. It's a shift that programmers sometimes find difficult.

The scale of some C++ developments can be daunting, even for experienced programmers. Navigating around hundreds or thousands of libraries and source code files isn't easy. Ensuring all this code is subjected to the rigorous testing necessary to achieve reliable, glitch-free operations is an even bigger challenge.

Despite its class extensions the C++ syntax still has a low-level feel, especially when compared with Java, Python, PHP and the like. This can make life difficult for less-experienced developers trying to maintain existing libraries and applications.

The Future

Linux, Microsoft Windows, Apple OS X and Google Android operating systems contain millions of lines of C++ code. And, as many of their respective applications - such as Microsoft Office and Libre Office - are also heavily reliant on C++ code, it's unlikely to be superseded any time soon.

C++ first became an ANSI/ISO standard in 1998. The ISO committee's latest 2011 work, C++11, is a major enhancement, with improvements for multithreading and generic programming. Plans to create new C++14 and C++17 standards will ensure C++ remain a highly relevant language in the coming decade.

Learn Python on the Raspberry Pi

A Gentle Introduction to Python Coding on the Raspberry Pi

The Raspberry Pi is a low cost educational computing platform specifically aimed at hardware and software experimentation.

Starting at around £4 for the Pi Zero to around £30 for the powerful Raspberry Pi 3 it's an ideal product for anyone with a desire to learn the craft of software programming and explore the powerful Linux operating system.

This interactive tutorial is based around my multi-part Micro Mart magazine series Learn Python on the Raspberry Pi.

Learn Python by experimentation, typing in the fully documented code to discover how to program useful, educational and entertaining apps.

After each topic you'll know a little more about the Python coding and the art of programming.

The Python code runs on all Raspberry Pi boards; Pi Zero, Model A, Model B, Model A+, Model B+, Pi 2 and the Pi 3 (and should also run on Windows, Mac OS X and Linux).

Here's the list of all the 45+ topics (now with more advanced subjects in section 7):

Part 1: Diving In
Why Python?
Which Python?
 Interactive Python
Assigning Variables
Using Functions
Introducing Modules
Your First Program

Part 2: Going Loopy
 Introducing Loops
 While Loops
 Timer App
 Running Timer
 For Loops
 File Walk App

Part 3: Building Blocks
 Program Structure
 Using Functions
 Creating Functions
 Guessing Game

Part 4: A GUI World
GUI Windows
GUI Code Structure
GUI Event Handling
Installing Tkinter
Simple GUI App
GUI File Search App

Part 5: Turtle Graphics Fun
What is Logo?
The Turtle Module
Move That Turtle
Draw In Colour
Turtle Patterns
Turtle Shapes
Tom The Turtle
Tom and Tim Stomp
Python Turtle Graphics for 3D Printing

Part 6: PyGame Basics
Why PyGame?
PyGame Overview
PyGame Installation
PyGame Events
PyGame Event Handling
PyGame Colours
PyGame Init Code
PyGame Screen Drawing
PyGame Complete App

Part 7: More Advanced Python Topics
Python 2 to 3 Conversion Tips
Python Turtle Graphics for 3D Printing
Handling Python Exceptions
Python Multi-core Processor Threads
Understanding Web Server Python Scripts
Python Scripting for Applications
Python Mobile Apps with Kivy
BottlePy Web Server - Tiny, Fast and Lightweight

Visit my Raspberry Pi page for news, reviews, advice and tutorials.