On Fri, 17 Jun 2005 09:08:51 -0700 Eric Wilhelm <[EMAIL PROTECTED]> wrote: > Yes. You can solve it. It's not really trivial by the time you add > meats, cheeses, breads, and mustard though. All of these things come > in many "flavors" and you might have a config file with your favorites > listed in it so that running "go_shop" with no arguments gives you a > routine trip, but you want to be able to change these things when you > get bored of the same-old options. > > These 4 extra lines multiply by 5 items so far.
It's 2 lines, not 4.
Of course, you can request registering a new module to save 2 x 5 =
10 lines of code. Or, as you said, saving 4 x 5 = 20 lines. But mostly
when I get an argument of a file name, I have to check it's existence,
it's permission, its type, bla bla bla. With proper comments, that
takes at least 9 lines for an argument (not an option). In your example,
that is 9 lines x 2 arguments x 5 options = 90 lines. This is only the
argument parsing. The real code is far more complicated. Last
application I wrote take 2442 lines. In such a case, I don't care about
saving 10-20 lines or not. To save 10-20 lines, I would rather try
another neat algorithm for the main code. Enhancing algorithm of the
main code may save 200-300 lines at once.
Most applications as complicated as your example exceeds 1000 lines.
Saving 10-20 lines for that is non-sense. An application that has only
50 lines may matter, but I doubt its option complexity to have 10-20
lines to save.
A new module, with its accompany documentation, its test suite and
its future maintainance, takes at least 1500 lines. The usefulness of
controlling the option order can be done in 2-20 lines with Getopt::Long,
and you are going to writing more than 1500 lines just to save them? Na~
I agree with others. If you do think saving 2-20 lines is vital to
your application, I would suggest naming it something else than
"Getopt::Modern". The word "Modern" poses an attitude of superiority
towards its competitors. But everyone here does not agree with that
superiority. I think it's rather personal taste, not modernity. I
would *not* suggest, say, "Getopt::Save20Lines", by the way. :p
--
Best regards,
imacat ^_*' <[EMAIL PROTECTED]>
PGP Key: http://www.imacat.idv.tw/me/pgpkey.txt
<<Woman's Voice>> News: http://www.wov.idv.tw/
Tavern IMACAT's: http://www.imacat.idv.tw/
TLUG List Manager: http://www.linux.org.tw/mailman/listinfo/tlug
pgp6X2jG2ksI6.pgp
Description: PGP signature
