Hi Folks,
Question #1: Which of the following is easiest to read and quickly grasp what it’s saying?
(a) 2 + 3
(b) two plus three
(c) <expression>
<left_operand>2</left_operand>
<operator>+</operator>
<right_operand>3</right_operand>
</expression>
Answer #1: Clearly (a) is easiest to read and quickly grasp what it’s saying.
Question #2: Of the above forms, which is quickest, easiest, and cheapest to implement an evaluator?
Answer #2: Clearly (c) is quickest, easiest, and cheapest to implement an evaluator.
Question #3: Suppose an evaluator is implemented for each of the above forms. Which evaluator runs fastest?
Answer #3: Likely they all run at roughly the same speed.
Question #4: Which of the following is more expensive and whose expense rises yearly?
(d) Human
(e) Machine
Answer #4: Clearly (d) is more expensive and whose expense rises yearly.
Question #5: How often would we need to incur the expense of implementing an evaluator?
Answer #5: Implementing an evaluator is a one-time investment.
Question #6: How often would we need to incur the expense of reading and understanding an expression?
Answer #6: The expense of reading and understanding is large and grows larger over time.
Conclusion: Write terse, easy-to-read, easy-to-grasp expressions.
Do you agree?
/Roger