Activity

Magic vs Mundane: Keeping them apart

In which your correspondent does magical battle with the guts of Perl and emerges bloodied, but unbowed with a useful principle to code by.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Writing parsers for fun and convenience

One aspect of coming back to Perl for ‘recreational’ programming is that if, like me, you’ve declared war on @_ and boilerplate code, then testing can be somewhat trying. The Perl testing framework that best fits my head is Test::Class, which is an excellent Perlish implementation of xUnit style testing. If you’re unfamiliar with the, library, Ovid is writing what’s shaping up to be an excellent series of introductory articles about it at http://www.modernperlbooks.com/.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Perl: Test Infected since 1987

Here’s something interesting. This is the test directory from the very first version of Perl, released in 1987 and described by Larry as ‘a “replacement” for awk and sed’. Day one of Perl, and we already have the bare bones of the Test Anything Protocol and a prototype for Test::Harness in the TEST file.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

A tip for all programmers

It doesn’t matter what language you program in, there’s one very important thing that you should do if you want to get better at your craft.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Things that may inspire me to hunt and kill you

Let’s say you’re writing a ruby library. Something you want and expect others to use. Here’s how to reduce those others to incandescent rage:

require 'rexml'

include REXML

module MyShinyModule
...
end


No. Not no how. Not never. You just crapped in my namespace and stomped on who knows how many of my own classes. Now, `include` is a fine and dandy thing, and it certainly has its uses, but using it at the top level of your library files is not one of them.

Ahem.

Can anyone guess which library has been wasting my morning?
    
  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Modern Perl

One of the people who make me think that Perl is still worth knowing is chromatic, the ex-editor of O’Reilly’s perl.com. He’s one of the core team who are working to bring the Perl 6 Christmas, a vector of test infection, an extreme programming practitioner and, right now at least, no longer on Giles Bowkett’s christmas card list.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Moose for Ruby programmers

‘Moose for Ruby Programmers’ was the programmed title for the talk I gave at the London.pm technical meet on Thursday, but that was something of a stalking horse for the real title, but I’ll save that for the end of this writeup.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Marking time...

So, it turns out that there’s a recording of my MooseX::Declare talk at the London.pm techmeet last night. And, on listening to it, I sound rather less incoherent than I thought I did while I was delivering it (still plenty of places where I could improve. Must remember to always repeat the questions in full…), but I’m happy enough with it that I’m looking into synching it up with the slides and making a slidecast, which will probable take longer than is sensible.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Choosing a language for 2009

The Prags will tell you that you should learn a new language every year, and I think they have a point. This year though, I’m going to do things slightly differently. If you read the Healthcheck: Perl article I wrote for Heise Online then you’ve probably worked out that my language for 2009 is Perl 5, version 10 (hopefully it’ll be version 10.1 real soon now). I’m still paid to write ruby for AmazingTunes in my day job, but Perl’s the language I learned to program with and developments around Moose and its extensions mean that Perl in 2009 is a different language from the one I pretty much stopped using a couple of years ago.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

It's not just modern music Giles...

Giles Bowkett’s just written up an example of the way that sampling is an essential part of modern music and he’s right. But he doesn’t go far enough really. Sampling has always been an essential part of all musics. What’s the twelve bar blues form after all? Different artists put their own spin and lyrics on top of it, but it’s always the same chord structure and it’s often the same words forming the backbone. I don’t know about you, but I can’t hear the words “I woke up this morning” without expecting a blues to follow.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Warnings are the new test failures

Have you ever tried to run Rails, Rspec, Rake or, for that matter almost any Ruby library or application that you've ever heard of with the -w flag? How about running Rails with taint checking on?

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Maybe time to look at shoulda

So, because I’m sure that there’s a better way of drying up my rails apps, I’ve been porting Magritte to Ruby (given a good meta-description of your models and judicious application of the visitor and interpreter patterns, it’s amazing what you can do). Now, Magritte comes with a decent test suite in its Smalltalk box. However, that test suite makes serious use of inheritance. Several tests of the leaf classes in the Magritte description hierarchy define maybe three helper methods which parameterise the tests they inherit from their parent test suites.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Javascript heresy

So, remind me, what’s the rationale for always using the optional ; when you’re writing Javascript? The only reasons I can think of, off the top of my head are, “Because you’ll break minifiers without it” and “Because Douglas Crockford doesn’t like it”. Well, broken minifiers that can’t parse the language correctly can kiss my fat hairy arse and argument from authority cuts little ice here.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

I think I'm in love with an Axe

We’ve just spent the weekend on one of Robin Wood’s spoon carving workshops, which was my 41st birthday present from Gill. It was great fun, if a little tiring. There is something primally satisfying about turning a piece of wood into woodchips. Getting a spoon or spatula at the end of the process is a huge bonus. We came away with a bag full of more or less decent treen, a couple of woodcarving knives and a burning desire to own one of Robin’s small drinking vessels.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…

Just a thought

There’s a refactoring principle that states that, when you start doing the same thing for the third time, you should refactor to remove the duplication.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Written by Piers Cawley , updated

Read more…