Software Design/Reduce variable's scope

Sources

edit
  • Effective Java (3 ed.). 2018. ISBN 978-0134685991.  Item 57: "Minimize the scope of local variables"
  • Boswell, Dustin; Foucher, Trevor (2011). The Art of Readable Code. ISBN 978-0596802295.  Chapter 9, "Shrink the Scope of Your Variables" section
  • "Keep scopes small" in C++ Core Guidelines