Don't give Boolean variables and parameters "super-universal" names like flag or switchIt. Instead, write what exactly they flag/switch.
For example, if a method's argument enables or disables fields with personal information then call it enablePersonalInfo - you should describe what the argument is doing or which information it brings, you don't need to explain other programmers what Boolean type is! The only exception to this rule - if the meaning of the Boolean argument is conveyed by the method's name: for example, the method SetReadOnlyMode() can have an argument named simply switchIt (so it's understood that passing false cancels the mode).
- Site Admin
- Posts: 111
- Joined: 19 Feb 2013, 20:33
Return to Intriguing World of Logic
Who is online
Users browsing this forum: No registered users and 1 guest