On 5/12/2007, at 4:24 PM, L wrote:
Question about buttons and knobs..
What exactly is a knob?
[cut]
it simpler. For example the CP command is just a knob for copy..
My understanding of knob is an option or a switch. I guess the
meaning is like a music console - all those knobs you can turn to
fiddle with sound.
So you start off with command X that moves bytes from A to B.
So the user does ...
X A B
... and his bytes are moved.
Then dev. "a" adds an option - a knob.
X [a] A B
Then dev. "b" add his option
X [a|b] A B
Then devs "c", "d", "e" etc. And someone adds the -quiet knob, the -
verbose knob. And obviously if you run -quiet you would ignore -
verbose? Or the other way round?
X [a|b|c|d|e|f] A B
By now the code starts to have a lot of conditionals:
if a and b but not c
do this
otherwise if f
do that
Code gets messy - harder to follow - bugs creep in (potentially
security related.) When you want to add feature Z - which ones of
all those knobs/options should it handle? In what way? Was it
REALLY worth adding all those options for a couple of people here or
there (who could have piped output / used a Perl script / whatever?)
Usually not.
I guess it would be the same for an API - you start with a simple
entry point and end up with a lot of entry points, or having a whole
heap of options in every entry point.
My 2c ...