Monday 27 May 2013

21st Century Pascal

I worked with Pascal for a number of years, so I'll always have an affection for the language of Begins and Ends. It was created in the late 1960s as a very readable and structured general purpose language, and was obviously so suitable for the task that it caught on widely for teaching purposes. As the years passed, MS VB managed to capture the mindset of the masses, then we saw the competing platforms of Java and .NET. Pascal languished on the sidelines, with most of its fans using Delphi, but along the way the procedural language gained full OOP abilities that brought it up to date and able to hold its own.

Pascal finds itself still incorrectly maligned as an 'obsolete training language' (very far from the case!) while the world assumes that C-like languages of curly braces { } are the One True Way - as if a little change in syntax flavouring really makes any difference! I do prefer more verbose languages given the choice, begins and ends just stand out more than tiny { and }s. You'll find that 'muscle memory' makes typing begin as quick as entering a password, and a modern Pascal code editor will autocomplete the matching end for you.

Here's some reading material comparing Pascal and C : http://en.wikipedia.org/wiki/Comparison_of_Pascal_and_C
and assorted opinions are offered here : http://programmers.stackexchange.com/questions/114846/why-has-c-prevailed-over-pascal

In the end, we can easily conclude that by the time you 'outgrow' Pascal (if ever?) then you'll be experienced enough to switch to the more terse C (or descendants) without any great trouble - so it's still a great way to start programming.

Free Pascal and Lazarus

And here's a great reason to get going with Pascal. It's Free! The Free Pascal project has brought us an Open Source compiler, and the Lazarus IDE is also an impressive piece of work for development. In one easily installed all-in-one IDE application, it's a snap to produce GUI programs with standard controls and much much more. It talks to all the major databases and makes Pascal a credible alternative to other languages.

Your Lazarus/FPC program will compile to a standard .exe that requires no runtime framework, is as fast as other compiled languages (leaving interpreted scripting languages in its dust), and all this for no cost and no vendor lock-in. Free! What are the alternatives? Java is still at the mercy of Oracle, and .NET has Mono, but .... isn't Totally Free quite appealing? Scripting languages like Python and Ruby have their fans, but after studying them to my satisfaction I found I simply didn't need them (yet?) and creating GUIs seems to be a nightmare compared to the Lazarus drag-and-drop simplicity.

Installation

Hundreds of users are downloading every day, from Source Forge. I downloaded the 110MB file lazarus-1.0.8-fpc-2.6.2-win32.exe, and it was an easy install with no tricky questions to confuse anyone :



 When you fire it up, you'll find that the various parts of the IDE user interface are separate windows :


but this is nothing to worry about, even if you have previous experience with Visual Studio it's no biggie - you get used to it (so easily that they've never been motivated to change this).

If you don't like the rather nasty default font, it can be changed easily via Tools.. Options.. Editor..Display so you can make it look as smart and contemporary as you like :

... and I was also able to change the Default Text Background colour to some something slightly darker than bright white glaring into my eyeballs.

Almost too easy!

In moments you can add a button to a form, and display a mesage with showmessage :

So why not give it a try? There's a helpful Wiki and the forums are friendly. It must be straightforward because most of the forum questions are of a quite advanced technical nature - nobody seems to need to ask about the basics and run of the mill queries.

I believe Lazarus is unmatched in its niche, so have a go!

No comments:

Post a Comment