What Is Declaration?

Declaration is the means by which data, functionality, and information in a program are identified. Although most programmers think of variables when the word "declaration" is bantered around, declaration covers a wider range of programming tasks, one of which is variable definition.

Declaration has a larger impact on the end user's experience than does style or commenting (which are discussed in Chapter 3, Commenting and Style), so an added amount of care needs to be placed on its usage. Although the use or avoidance of a consistent naming system may have no effect on the final compiled product, many other aspects of declaration can dramatically affect the speed, robustness, and correctness of your Visual Basic application.

Not every programming language requires the use of variables for data storage. Consider LISP, one of the more common non-procedural languages. Although variables are available in LISP, you have to neither use them nor declare them to have a working program, even a somewhat complex program. Yet even LISP has some forms of declaration. How much more, then, does Visual Basic have, with its abundance of data and procedure types.

Among the forms of declaration discussed in this chapter are the following.

  • Local, module, and global variable names and data types

  • Public and private subroutine, function, and property names

  • Parameter names and data types, and function return values

  • Line labels

  • Control names

  • Database object references

  • Declare statements

  • Intrinsic constants and values accessed through type libraries

  • User-defined data type tags and elements

  • Enumerated data types

  • Programmer-defined constants

  • Class names and members

  • Custom control properties and elements

  • Form, module, custom control, property page (etc.) definitions

  • Order of major routine components

And you thought we were just going to talk about variables.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.165.247