Beyond the strictness you’re used to

Perl is famous as a programming language for letting its users code as they like. The mantra every Perl developer knows is There Is More Than One Way To Do It (even though, it looks like these days, some popular Perl developers are upset when you bring a new solution to a problem, but I digress).

My point is, Perl is like water. It will fit in your bowl, whatever its shape. It’s a language that will reflect your way of thinking most than any other language. I know some Python developers that are pretty in love with their language just because of the opposite spirit: in Python, there should be only one good solution for any given problem. That’s what they like, and what comes together with this philosophy is a very strict language that forces you to be a good citizen.

I can understand that. Strictness is a very good ally for a developer. But I want my strictness. Not the one that comes with the box. The strictness of my programming should be as I want it to be, it’s personal, and if I’m in a team, it should be a set of rules everyone are aware of.

This is were, again, I’m very happy to use Perl.

A couple of weeks ago, at work, I wanted to set a strict Perl environment for my everyday needs. I ended up writing a pre-commit hook that has the following features:

  • filter the code with PerlTidy
  • prevent any commit that violates a Perl::Critic policy
  • run the test suite with Devel::Cover and make sure the total coverage rate is not lower than it was before the commit

Of course, as I said above, I want my strictness, so PerlCritic and PerlTidy use respectively .perlcriticrc and .perltidyrc in the local directory, so I can tweaks the rules on a per-project basis.

After two weeks working with this hook, I realize that my code is now much more robust and very well tested (100% coverage is easy to reach when you start working on a project like that).

If anyone is interested in this commit hook, it’s on GitHub.

Dancer Q&A Hackaton

For your information, a Dancer hackaton is scheduled on the 14th of august (saturday) in order to help the team on different topics:

  • Test the devel branch (which provides a new core and new features)
  • Improve the documentation
  • Improve the test coverage and reach 1k tests (we have 977 so it shouldn’t be difficult ;)

If you like Dancer and want to help, feel free to join us, this will hapen on irc.perl.org, chan ♯dancer, see you there!

Happy dancing.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes