Directives
5.1 Define focused variables.
When you create and use variables, you should strive to make each variable serve a clearly defined purpose. It can be tempting to make variables serve double duty, but the small savings in memory is often negated by the resulting complexity of the code. A variable used for multiple purposes is said to be unfocused. If you need to perform unrelated actions or calculations on a variable, you’d be better served by having two focused variables rather than one unfocused variable. It’s unnecessarily difficult to read and debug code that contains unfocused variables, and the code itself is more likely to contain errors.
Example. Incorrect:
Public Function IsEmailAddressValid(ByVal strEMailAddress As String ... |
Get Practical Standards for Microsoft® Visual Basic® .NET, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.