EAC - Voluntary Voting System Guidelines

Name : | Scott Hunsaker
Organization : | Hart Intercivic
Post Date : | 9/30/2005
Section Comments
Section : | 4.2.3
Page no. : | 4-5
Line no.: |
Comment : | Comment: “Each module shall have a single entry point, and a single exit point…” Recommended change: “Separate return(s) shall be allowed to exit the module upon error conditions if appropriately commented.” Rationale: Allowing for more than one return in a module can enhance readability. However, the number of returns in the module should be kept to a minimum. [McConnell, 16.2]. Also, the refactoring pattern “Replace Nested Conditional with Guard Clauses (250)” recommends, “If the condition is an unusual condition, check the condition and return if the condition is true…One entry point is enforced by modern languages, and one exit point is really not a useful rule. Clarity is the key principle: if the method is clearer with one exit point, use one exit point; otherwise don’t.” [Fowler “Replace Nested Conditional with Guard Clauses (250)”]