What's Chris been doing?

Successes and failures at inf.ed.ac.uk

Posts Tagged ‘UKUUG

Slides from the UKUUG Perl courses

leave a comment »

Dave Cross has shared the slides from the three UKUUG Perl courses he ran in November, including the Intermediate Perl one which I attended. They’re in OpenOffice and PDF formats on his site and in Flash on slideshare.net.

Written by Chris Cooke

December 7, 2009 at 10:14 am

Posted in Uncategorized

Tagged with ,

UKUUG’s Intermediate Perl day

with one comment

I’m currently travelling home from a one day “Intermediate Perl” training course. It was organised by the UKUUG and O’Reilly and written and presented by Dave Cross of Magnum Solutions.

He did a very good job. He’s very personable, and a good teacher. He got through a lot of material at what felt like a clear and lucid but also gentle and unhurried amble through the slides. He judged the technical level almost perfectly for me, introducing us to plenty of new concepts and areas of Perl to explore without bamboozling us. Altogether I’d give him and the course an enthusiastic thumbs up. He’s planning on running more Perl training days in March next year, and if you want to learn more (or anything) about Perl, go, you won’t regret it.

“Intermediate Perl” was the middle of three separate Perl days running back to back. The others were “Beginners” and “Advanced”. The “Intermediate” day covered these areas:

  • Types of Variable – not scalar vs list, or string vs array vs hash, but lexical variables vs package variables. It also covered packages and use of “local”.
  • Strict and Warnings – what use strict and use warnings do; why to use them; what can happen if you don’t.
  • References – creating them, how to use them, why to use them; using them to pass parameters; using them to make complex data structures; some useful examples of complex data structures. The syntax of complex data structures in perl can be rather difficult, not to mention messy; here it was presented so clearly that it really didn’t seem too bad.
  • Sorting – you thought you could just type sort and forget about the detail? You can in some circumstances, but sometimes you need to go more deeply into it, for instance to change the default sort order, or to invent your own sorting order for your own data structures (use sorting subroutines); how then to make your sorting more efficient, and further, how to chain a sequence of efficient sorting operations together into a Schwartzian Transform. The class more or less universally drew a sharp intake of breath when it saw the Schwartzian Transform, thinking it unnecessarily unclear, but the tutor defended it valiantly: don’t be afraid to use Perl in a way that goes beyond simple, clear baby steps; don’t be afraid to assume that whoever has to understand your code will have a decent knowledge of Perl. Personally I disagree with this one, having frequently been in the position of trying to understand/maintain/change code I didn’t understand in a language I didn’t know. I’m a firm believer in making everything as simple and clear and copiously annotated as possible, and I’ll happily prioritise that over elegance and compactness of code. Each to his own.
  • Reusable Code – writing modules, why you might want to and how to go about it. The boilerplate code you have to put in your module file, what it all means and why you need it; exporting things from your module, different ways to export, when not to export at all.
  • Object Oriented Perl – objects, classes, methods, what, when why, how; Moose makes it all a lot easier.
  • Testing – you can write simple tests for your Perl program to pass; this can hugely help your code development; when, why, how to write tests; how very easy it looks; how very useful it looks. This section of the course was a revelation.
  • Dates and Times – All about the wonderful, the magnificent, the magical DateTime family of modules, which do every sort of time-related manipulation you could ever want to do, and which all fit together utterly seamlessly. I knew about DateTime already, having used it to do calculations on the dates and times of upcoming cron jobs for the LCFG sleep component.
  • Templates – when, how and why to use them; how you can us the same data and different templates to produce radically different output – think for instance of generating web pages and their RSS feeds from the same source data, and maybe email messages too. Template Toolkit.
  • Databases – various and increasingly niftier ways of interacting with databases using Perl. This was the only section that was a bit wasted on me, since (shameful admission) I know very little about such things as SQL and haven’t used a database in anger since Edquse or maybe Astrid more years ago than I’d care to admit. Still, if I need to learn, I now know where to turn.

All in all the Intermediate Perl course was a big success.

Written by Chris Cooke

November 25, 2009 at 9:21 pm

Posted in Uncategorized

Tagged with ,