LUG Villafranca Programming Course

January, 2008
../Pictures/chairs_stuehle.jpg
This document gives a brief outline of the programming course organised together with the Linux User Group of Villafranca, Verona, Italy. The course introduces programming in JavaScript, Ruby, and fundamentals of Ajax over a ten week period. In twenty intensive hours, students are introduced to the tools and methods used in modern programming practices, and the author's twenty years of experience.
This document is being published on the Internet in parallel with the course. Once the course has finished, it will remain as a tutorial for other fledgling programmers.
This, and the other articles outlined here, are also available as a PDF document (about 2.3 MB).

Course Outline

The course has the following objectives:
  • Introduce general programming concepts; literals, types, values, constants, variables, expressions, statements, functions and objects.
  • Introduce programming in the JavaScript language; development environment, overview of (X)HTML and CSS, simple JavaScript exercises.
  • Advanced programming in the JavaScript language; using the Prototype library, using the script.aculo.us library.
  • Introduce programming in the Ruby language; development environment, simple Ruby exercises.
  • Advanced programming in the Ruby language; Unit testing in Ruby.
  • Using JavaScript for Ajax; using the XMLHttpRequest object, Unit testing in JavaScript, Ajax mocking.

Lessons Held

The first lesson entitled 'Welcome' took place on Monday, 14th January 2008.
The second lesson entitled 'Simple JavaScript Concepts' took place on Monday, 21st January 2008.
The third lesson entitled 'Advanced JavaScript Concepts' took place on Monday, 28th January 2008.
The fourth lesson entitled 'Prototype and script.aculo.us' took place on Monday, 4th February 2008.
The fifth lesson entitled 'Review of JavaScript, CSS and XHTML' took place on Monday, 11th February 2008.
The sixth lesson entitled 'Ruby Full Immersion' took place on Monday, 18th February 2008.
The seventh lesson entitled 'Ruby and Ajax' took place on Monday, 25th February 2008.
The eighth lesson entitled 'Review of Ruby, Overview of Ruby on Rails' took place on Monday, 3rd March 2008.
The ninth lesson entitled 'Ruby on Rails, Part 1' took place on Monday, 10th March 2008.
The tenth lesson entitled 'Ruby on Rails, Part 2' took place on Monday, 17th March 2008.
Many thanks to all the participants.

Good Tools = Good Start

Programming is a difficult task, but fortunately there are many tools available to ease the burden. Whilst it is perfectly possible to write programs using just a text editor and a compiler / interpreter, we're now well into the 21st century, an overwhelming number of tools are available, and there is no reason to make our lives any harder than they already are.
Here then, is the minimal tool list for programming in a specific language:
  • An Integrated Development Environment for the language. Try to find the best that you can, and get to know the fundamentals of the program. An IDE, apart from editing text and running your programs, should also provide project management, information about the libraries being used, debugging, compilation, and program packaging.
  • Good language books and tutorials. Learn the fundamentals correctly. Learn the relative strengths and weaknesses of the language.
  • Well written source code examples. Learn from the masters.
  • Unit testing frameworks. Always test your code, it will give you a warm fuzzy feeling, and act as a partial guarantee for the code you produce.
  • Learn to be able to at least read in English. Sometimes mechanical translators such as Babelfish can help.

General Language Agnostic Tools

There is one tool that I use as a professional programmer which I cannot live without – Subversion, a modern version control system. Think of it as being a database which can store (historically) each unit of work that you do on your computer. That may sound a little Orwellian, but in fact you are the one who decides what does and does not get stored in the database. Of course you should backup the database regularly.
For the course, the use of Subversion is optional, however I will probably make loving references to it on a regular basis.
If you want to learn to use it yourself, download Subversion for your operating system, get the book (also available in Italian), and choose a client GUI such as TortoiseSVN for windows, or RapidSVN for Linux and Mac.

JavaScript Tools

This course looks at the fundamentals of JavaScript as used within a browser. In order to do this, you will need to install the programs described below on your computer.
We'll be using the Firefox web browser, together with the Firebug add-on, which can be directly installed within the browser. However, the IDE we are going to use, Aptana Studio, does this for you so that it can directly connect to Firebug. If you don't want to use Aptana, you can install Firebug from this page.
The IDE we'll be using is Aptana Studio Community Edition. Follow the download instructions for your operating system – in all cases, you'll only need the Zip files. On-line documentation is also available, which is also included inside the IDE.
The program requires the Java Runtime Environment to be installed for your operating system. The Java Runtime Environment page provides verify buttons to check if you already have Java installed.
Extract the contents of the Zip file in the folder where you want the IDE to be stored – I have a windows platform, so I chose C:\DevTools\Aptana. Then launch the application to complete the installation.
Aptana has an installation forum, if you have problems installing the software.
Once you've got Aptana up and running, open the Plugins Manager view. From the menu bar select Window then Show view then Other..., click on the Aptana Views folder, select Plugins Manager, and click on OK. If you want to version control your projects, you'll want to install the Subclipse plugin.

Ruby Tools

This course looks at the fundamentals of Ruby. In order to do this, you will need to install the programs described below on your computer.
We'll continue using Aptana Studio for Ruby development on this course.
Later on in the course, you'll also need Ruby on Rails, SQLite, and Rmagick. So you'll need to install Ruby on Rails – we're using version 2.0.2. Installing RMagick is explained in this FAQ, we're using version 2.0.0. Installing SQLite is explained in this How-to, we're using version SQLite3 1.2.1. Windows users will need both the .exe and .dll versions of SQLite. The Ruby on Rails Wiki page also gives helpful information for SQLite.

Ajax Tools

As such, the tools outlined above will give you enough to get started developing Ajax applications, however, you will also need to download the Prototype library, and the script.aculo.us library, which we'll be using during this course.

Recommended Reading

Learn to Program, by Chris Pine.
The Pragmatic Programmer, by Andrew Hunt and David Thomas.