[getopt-sig] Prefer non-imperative -- my 1 cent

Joshua Rodman joshua_rodman@yahoo.com
Tue, 12 Feb 2002 14:17:52 -0800 (PST)


I don't have a nice clear argument here, sorry.

I feel that the classic option walking loop (such as old-style getopt,
or the plan9 macro system) is prone to messyness as compared to a set 
of option elements such as Optik. 

In my (limited) experience of creationg various option parsers for 
different projects, I have found that the logic of the loop tends to 
get sufficiently bloated that it is difficult to take in the structure 
of it at once.  

The Optik way of thinking about things tries to tie all the logic related 
to an option into a single solitary stanza, complete with callbacks if 
(rarely) necessary. It may not be easier to see all the option parsing code,
but I believe it is definitely easier to see what is going on with a 
particular option.  I think this is important. When enhancing a program, 
I want to think about the one option, not the entire machinery.

I feel this makes the possibly wordier setup code simpler in concept, and
thus easier to use and grasp.  Contrarily, I think the main advantage of
the traditional approach is that it is traditional.  That is, people coming
to code done the way they are used to will likely grasp it much more quickly.


Yes, this is a touchy-feely description, without much hard currency.
But please do consider it, I think I'm onto something important.

-josh

__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com