Teach Time Encyclopedia - Learn About Our World
Home Page
Teach Time
Featured Topics

United States
by state

CITYology

Academic Disciplines

Historical Timelines

Themed Timelines

Calendars

Reference Tables

Biographies

How-tos



Sunday, July 20, 2008

Scope

The scope of a given activity or subject is the area or range of what it covers.

In computer programming, the scope of an identifier refers to where and when in the program the identifier can be referenced. Scope applies to all identifiers in a program, but it is mostly used for variables, functionss and classeses.

For example, the scope of a variable refers to where in the program the variable can be accessed and/or modified. For a function, to where the function can be called, and so on.

Common scope levels:

  • global scope: visible from the entire program
  • file scope: visible from a single source file.
  • local scope: visible only from the local function or block where the name was declared.

Scope is usually hierarchical: a variable declared at local scope (for example, as a local variable inside a function) supersedes the same variable declared at global scope. All references to this variable inside the function will manipulate the locally-defined variable. Outside the function, they will manipulate the globally-defined variable.

Because of this automatic scope handling, careful magamenent of variable, class and function names should be a requirement for any non-trivial program. It is considered good programming practice to make variables as narrow a scope as feasible so that different parts of your program do not accidentally interact with each other by modifying each other's variables. Common techniques for doing so are to have different sections of your program use different namespaces, or else make individual variables private through either dynamic variable scoping or lexical variable scoping.

In project management, scope refers to the sum total of all project products and their features. See also scope creep.


Also the term used in firearms for a telescopic sight.



Internet Hotel Solutions

Site Sponsors
AC Units
Baltimore Harbor
Boot Camp Grads
Bra Size
Burkittsville
College Hotels
Digital Harbor
Free Cell Phones
Golden Hare Travel
Golf Vacations
Golf Courses
Gourmet
Hair Styles
Hippodrome
iWoman
Lesson Plans
Maryland Hotels
MD Genealogy
Minor League Stuff
Motel Site
Ocean City
OC Real Estate
Old Agers
Office Supplies
Orlando
Pet Friendly Hotel
Room Prices
Savannah, GA
Ski Vacations
South Baltimore
Student Teaching
Travel Sources
University Hotels
Visit Military Bases
Washington, DC

Brought to you by NoChildLeftBehind.com and the Beaches and Towns Network, LLC.