London Perl Workshop

Yesterday was the London Perl Workshop. Thanks to the joys of the british railway system I had to catch the 07:19 train from Brighton in order to make it in reasonable time. This included an extra half hour on the train due to “maintenance” being carried out. I was only diverted about 10 miles, you do the math. When I eventually arrived, I was there for about 3 seconds before bumping into Muttley who was worrying about the lack of signs. Apparently all the signs had been destroyed by a beer infestation the previous night. So I volunteered to go outside with Acme and guide people in to the main lecture theatre. I also bumped into mirod whilst standing there—I’ve been using XML::Twig for years, so there was plenty to talk about. Eventually, Mark turned up with the signs, so we went inside to the talks.

After a lot of faffing around trying to find U214, I got to Abigail’s first talk on Regexp::Common. It’s a repository of useful regexes (NB: I have no idea of the correct pluralisation). It can match things like numbers, URLs, email addresses, postcodes and a tonne of other stuff. But what’s really cool/scary is the interface. It acts as a string, or a hash, or a regex, or an object, or a function, all depending on how you use it. Naturally, it’s originally a DCONWAY production. If that wasn’t scary enough, you need to look at how it uses uses tied hashes to pass flags in when creating a regex, so you can adjust the details of how it recognises a number. I really need to go back and use this module in lots of places. What’s nice is the ability to extend it seamlessly without having to understand all the magic.

I popped back to the beginners track briefly to hear <a href="”>Aaron Crane talk about Content Management at El Reg. Most of the talk appeared to be why they found Bricolage inappropriate and instead refactored their old system to come up with Troi, their custom CMS. What’s good to see is that they publish to static files and use rsync to distribute amongst several web servers. A great way of serving a lot of content. They also use SSI to do the page template, which is about as quick as it gets. I really liked the way that they use libtidy to get very clean HTML which then gets chucked through some XSLT to generate the final content. All in all, it sounded quite a neat solution. He did admit that there was no version control at all, but justified it on the grounds that there wasn’t a real business case for having it. Oh, and they’re still using for advertising, but it’s apparently quicker now (yeah right).

After a quick nose through the O’Reilly stand outside (30% off! Woo!), I wandered back to the other room to hear Abigail on “Lexical Attributes.” I caught the end of the Parrot talk, but I don’t think that I missed much that I need right now. I also managed to discover from talking to <a href="”>Nicholas that <a href="”>Jos Boumans, due to speak next was not present due to unit testing the new licensing laws (unfortunately, it’s still very easy to say “ok” after several units of alcohol 🙂 )

Anyway, Abigails second talk was very interesting. He covered lots of problems with the standard way of implementing objects in Perl, and then set about trying to find the best way to solve them. He started out exploring the Flyweight pattern, and moved through several other ideas, before arriving at (more-or-less), Class::Std (aka Inside-Out objects). This appears to fix most of the problems, like good encapsulation. But he also went on to describe the <a href="”>Lexical::Attributes module, which goes even further at solving the problem. The only catch: it’s a source filter. So, it turned out to be a nice possibility, but not good for production code. Wait for Perl 6 instead.

I have to praise Abigail as a speaker. Even though his slides have some odd colour schemes, he managed to get the point across swiftly and also managed to be brutally funny at the same time. He had the typical dutch poker face whilst producing very funny, brutal insults. Good stuff.

Due to the lack of Jos, Mark Fowler bravely stepped up and did a live introduction to Froody, a web-xml framework thingy. Yes, another one. But this is cool. It tries as hard as possible to get out of the way. It’s modelled on the Flickr API, and is a really good candidate for REST-style interfaces. I like it a lot. All it needs now is some JavaScript goodness to make it Ajax ready. And apparently, that’s on the way. In short, if you need to shove up some kind of API on your web site, it’s probably worth taking a peek at Froody. I’m going to have to try it to be sure, but it looks like it hits a sweet spot between functionality and configuration. Check out the QuickStart.

After this, I pottered off to lunch with Mirod and Maddingue. We found a nice looking cafe and found Robin Houston (with less hair than I recall) there as well, a nice surprise. It’s great to actually be able to talk shop with some new people a bit. You can’t really talk about computers in polite company without a lot of peoples’ brains dribbling out of their ears.

After lunch, I popped into the talk on Perl at the Sanger institute, but to be honest found it a bit uninformative. I already know something of both DNA and Perl and this didn’t tell me much new. As always with biological computing though, the numbers are terrifying: 350Tb disk, 450 node clusters for doing sequencing. Fun stuff. Naturally, the compute intensive bits are all in C, and Perl is just the glue. Sadly, there wasn’t much on Bio Perl, which would have been interesting. Although there was stuff on their derivative, ensembl.

Coming out, I picked up two new O’Reilly books. I was too tempted by the shiny “30% off” offer. I also overheard muttley frantically trying to locate MJD for the final talk…

Meanwhile, I went to see Casey West on “Using Attributes.” This is one of the few areas of Perl where I know absolutely zilch, so I was really looking forward to it. And in the first few slides, you could really see why this was part of the “Advanced Perl” track. The summary is that attributes let you attach arbitrary bits of code to a subroutine or variable. And you need to use Attribute::Handlers in order to avoid going insane. But it made it really easy to see how you could implement a :Private attribute for an object. Pretty cool stuff.

Afterwards, back to the main hall to hear MJD. But I managed to catch the final 5 minutes of acme and Leo talking about MighTyV, their project that wone them a prize from the BBC. I wished I had heard the rest of that. They make a great double act.

Shortly thereafter, MJD arrived, completely spaced out from the flight over still. He was giving a talk on “Red Flags”—things you see in a Perl program that make you think “Hmmm, that doesn’t look right.” They seem similiar to bad code smells. Apparently, this was a 3 hour class usually, and he was trying to get through it in an hour and a half…

MJD started out by saying he wasn’t here to tell us how to do clever stuff. Merely how to make existing code better by thinking about simple things. “You don’t have to be clever to write good code” was his mantra. Most of what he talked about was a very simple example. He’d taken a script from usenet or Perlmonks or somewhere which copied files from two input directories into an output directory. A really simple task, mostly trivial, which sysadmins everywhere love to use Perl for. But the script had many, many flaws. Basically, everything was repeated twice, once for each input directory. So, in his words, he was going to “fix the hell out of it.” He went through lots of bits of it, pointing out the slightly daft bits, and how to pick up on them in general. Stuff like “For repeated variable names, use an array” and “for related variable names use a hash.” Common sense stuff, but things that are often missing in code that you happen to inherit.

His biggest lesson was “Repeated Code is a Mistake.” This is the same as the pragmatic programmers saying “Don’t Repeat Yourself.” While none of what he said was a cast iron rule, more a guideline, this came closest to being 100% enforceable.

Like Abigail before, MJD was an fantastic public speaker (which is probably why he gets paid to do it). Despite significant heckling from the audience (participation), he kept up the snappy comebacks. Very entertaining. In fact, nobody wanted to interrupt him at 17:30, so we ran on until 18:00. Sadly, I had to get away quickly in order to travel back to Brighton. I didn’t get in my front door until 21:00. 😦

Overall, I had a great day. I’m enourmously grateful to the sponsors for enabling such a fantastic event to be put on for free. It was a triumph for all concerned.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s