In Defense of Simple Stuff

xsawyerx on 2009-04-29T23:00:26

I've just released Test::Ping version 0.09 which has a fully ported version of the Net::Ping testing suite. Basically I took all the tests from it, rewrote them to use Test::More and Test::More's functions (SKIP, TODO, etc.) and Test::Ping instead of Net::Ping. I thought it might be a time to write some of the things I have on my mind right about now.

I started Test::Ping on Apr 22nd, exactly one week ago, and I think I've already reached the high point in the functionality of it, or at least what I imagine(d) it would be. I don't anticipate many (if at all) changes to Test::Ping at this point, since most changes to Net::Ping will continue to be transparently supported in Test::Ping.

The current most interesting discussion (to me) on the Perl front right now is specific Role usage situations. Ovid, Steven Little, Chris Prather, Shawn Moore and a lot of other prolific CPAN/Perl authors I admire quietly are openly discussing it and provide a lot of interesting insight into smart programming paradigms... and I'm sitting and writing a testing module that does pings that probably won't be used by many.

Here are a few reasons why I don't think this module was completely pointless:

  • It's easier to have functional programming for testing than object oriented, as long as it's not too complex. Andy Lester's Test::WWW::Mechanize is a prime example of when object oriented testing is preferred.
  • It's easier to write ping_ok( '127.0.0.1', 'testing localhost' ); than my $p = Net::Ping->new(); my $alive = $p->ping('127.0.0.1'); ok( $alive, 'testing localhost' ); $p->close;
  • It has a clean and updated version of the entire Net::Ping testing suite.
  • It provides another standardized test module using Test::Builder to Perl's repertoire.
  • Gave me my first taste of GitHub. I love it.
  • Gave me my first taste of Test::Builder. It's pretty cool.
  • It's well written, well tested and well documented. If anything, it might help even out the amount of bad code that exists on CPAN.

At least I didn't spend too much time over it.


Simple is Good

chromatic on 2009-04-29T23:36:26

Don't forget that you've wrapped up useful behavior in a package that's easy to understand and easier to use! That's good for everyone.

Right tool for the job

grink on 2009-04-30T03:20:36

Right tool for the job

Sometimes procedural is the way to go, there's nothing wrong with that

my $p = Net::Ping->new(); my $alive = $p->ping('127.0.0.1'); ok( $alive, 'testing localhost' ); $p->close;

... screams Java to me... scary

Re:Right tool for the job

educated_foo on 2009-04-30T16:42:31

It clearly needs a DSL.

Re:Right tool for the job

xsawyerx on 2009-04-30T18:51:27

I found the post in the link and the comments that follow enlightening.

Thanks!

learning through small steps

oliver on 2009-04-30T12:34:26

The thing I liked that you mentioned is the way it's possible to learn about a bunch of stuff through actually tackling a relatively simple and small task. Here, you learned about Test::Builder, GitHub, and more.

I'm doing the same at the moment. I have a large, popular piece of software to rewrite in Moose. First, I'll rewrite one of my small systems that no-one uses in Moose - I'm picking up lots on structuring Roles, etc, and what feels right. It's a great way to learn with relatively low risk.