On Thu, 18 Nov 2004 10:19:20 -0500, Stevan Little
<[EMAIL PROTECTED]> wrote:
> However, I would like to call peoples attention to a very interesting
> module I saw pop up on CPAN today.
> 
> http://search.cpan.org/~trey/Commands-Guarded/
> 
> It has an interesting declarative twist to it which I very much like,
> and being the paranoid and (sometimes overly) defensive programmer that
> I am I really like the whole idea of guarded commands.

Well, any module whose documentation discusses idempotence gets my vote. :-)

What I understand from this module is that 'ensure' defines
postconditions and 'sanity' defines invariants.  How about a
precondition block?  It seems to me that most "scripting" tasks depend
on certain features in the environment -- a particular kernel module
being available, for instance.  In the example, those preconditions
are met by running each command in the right order.  Maybe I'm just
quibbling, but that doesn't strike me as particularly robust -- what
if I come back to the script six months later, having forgotten about
the order dependencies, and start moving things around to add a new
feature?

Incidentally, 'ensure'- and 'sanity'-block size looks like it might be
a useful metric for figuring out whether a particular subroutine is
too complex.  If you don't want to fill out that 'ensure' block
because you know it's going to be a beast, maybe you're trying to do
too much in one place.

Thanks for setting this up, Steve.

--Matt (aka [EMAIL PROTECTED])

_______________________________________________
sw-design mailing list
[EMAIL PROTECTED]
http://metaperl.com/cgi-bin/mailman/listinfo/sw-design

Reply via email to