Preface: I don't claim neither that I like this kind of programming, nor that I hate it. I would just like to read some opinions

I am in charge of writing a small simple application that we will use to update our DNS zones. No pressure, no timelines, no hurry, so I have some time to think about how to make it :-)

The application scheme is quite simple:

Does it make sense to build this kind of application in a block-based way, like:

# cvs update, croak if it fails ... C: { # call the editor, croak if it fails ... redo C if $named_checkzone_failed ; # show cvs diff redo C unless $user_is_happy ; } # ...and so on

instead of, e.g., creating subroutines and making decisions on which to run? Does the block-based approach make sense at all? Which pro's and con's do you see for each approach?

Thanks in advance for your opinions

Update after Abigail's post: The pro I see in the block-based style is that it mimics the states graph (???wrong???) of the program; for example, it could be made clear from the source using labeled blocks and redos that once one enters the "EDIT_ZONE" block he could restart it any times he likes, but once he gets out, he'll never come back. On the con side, it seems to me that the source get more structured than it needs this way, and the approach seems unfeasible when the complexity of the states graph grows.

Ciao!
--bronto


The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
--John M. Dlugosz

In reply to block-based programming... by bronto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.