Minimizing Scope

Other programmers prefer to keep their variables as local as possible because local scope helps

intellectual manageability. The more information you can hide, the less you have to keep in mind at any

one time. The less you have to keep in mind, the smaller the chance that you'll make an error because

you forgot one of the many details you needed to remember.

From Code Complete 2 edition page 250

Last updated