Nesting (computing)

Nesting (computing)

In computing science and informatics, the word nesting may denote several different constructions and activities where information is organized in layers or objects contain other similar objects. The rather general term is thus used in quite specific ways for various situations and concepts depending on context, which is sometimes only remotely related. However, it almost always refer to self-similar or recursive structures in some sense.

The word has been used to denote:

Contents

In spreadsheets

In a spreadsheet functions can be nested one into another, making complex formulas. The function wizard of the OpenOffice.org Calc application allows to navigate through multiple levels of nesting, letting the user to edit (and possibly correct) each one of them separately. The popular Microsoft Excel doesn't support this particular feature, which is particularly useful when working with big sheets.

Naturally, to allow the mathematical resolution of these chained (or better: nested) formulas, the inner expressions must be previously evaluated, and this outward direction is essential because the results that the internal functions return are temporarily used as entry data for the external ones.

Due to the potential accumulation of parentheses in only one code line, editing and error detecting (or debugging) can became somehow awkward. That is why modern programming environments -as well as spreadsheet programs- highlight in bold type the pair corresponding to the current editing position. The (automatic) balancing control of the opening and closing parenthesis known as brace match checking.

In programming

In structured programming languages, nesting is related to the enclosing of control structures one into another, usually indicated through different indentation levels within the source code, as it is shown in this simple BASIC function:

function LookupCode(code as string) as integer
dim sLine, path as string
dim return_value as integer
 
path="C:\Test.csv"
if FileExists(path) then
  open path for input as #1
  do while not EOF(1)
    line input #1, sLine
    if left(sLine, 3)=code then
     'Action(s) to be carried out
    End if
  loop
  close #1
  LookupCode=return_value
end function

In this small and simple example, the conditional block “if... then... end if” is nested inside the “do while... loop” one.

Some languages such as Pascal and Ada have no restrictions on declarations depending on the nesting level, allowing precisely nested subprograms or even nested packages (Ada). Here is an example of both (simplified from a real case):

-- Getting rid of the global variables issue (cannot be used in parallel)
-- from a set of old sources, without the need to change that code's
-- logic or structure.
--
procedure Nesting_example_1 is
 
  type Buffer_type is array(Integer range <>) of Integer;
 
  procedure Decompress(
    compressed  :  in Buffer_type;
    decompressed: out Buffer_type
  )
  is
    -- Here are the legacy sources, translated:
    package X_Globals is
      index_in, index_out: Integer;
      -- *** ^ These variables are local to Decompress.
      -- ***   Now Decompress is task-safe.
    end X_Globals;
    -- Methods 1,2,3,... (specifications)
    package X_Method_1 is
      procedure Decompress_1;
    end X_Method_1;
    -- Methods 1,2,3,... (code)
    package body X_Method_1 is
      use X_Globals;
      procedure Decompress_1 is
      begin
        index_in:= compressed'First;
        -- Here, the decompression code, method 1
      end Decompress_1;
    end X_Method_1;
    -- End of the legacy sources
  begin
    X_Method_1.Decompress_1;
  end Decompress;
 
  test_in, test_out: Buffer_type(1..10_000);
 
begin
  Decompress(test_in, test_out);
end Nesting_example_1;

References

See also


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Nesting — may refer to: building or having a nest Nesting instinct Nesting, Shetland Nesting (computing) Nesting (voting districts), the process of combining or splitting of voting districts Nesting (process), a process of efficiently manufacturing parts… …   Wikipedia

  • Nesting (disambiguation) — Nesting could refer to* building or having a nest * Nesting, Shetland * Nesting (computing) * Nesting, a manufacturing process * Nested sampling algorithm, a method in Bayesian statistics * Nested variation or nested data , described at… …   Wikipedia

  • Nested function — definitions can be compared to how a Matryoshka doll nests within larger versions of itself, in several levels. In computer programming, a nested function (or nested procedure/subroutine) is a function which is lexically (textually) encapsulated… …   Wikipedia

  • Burroughs large systems — The Burroughs large systems were the largest of three series of Burroughs Corporation mainframe computers. Founded in the 1880s, Burroughs was the oldest continuously operating entity in computing, but by the late 1950s its computing equipment… …   Wikipedia

  • Mathematics of radio engineering — A complex valued function. The mathematics of radio engineering is a pleasant and very useful subject. This article is an attempt to provide a reasonably comprehensive summary of this almost limitless topic. While the ideas have historically… …   Wikipedia

  • Bracket — 〈 redirects here. It is not to be confused with く, a Japanese kana. This article is about bracketing punctuation marks. For other uses, see Bracket (disambiguation). Due to technical restrictions, titles like :) redirect here. For typographical… …   Wikipedia

  • X Window System — X11 redirects here. For other uses, see X11 (disambiguation). A historical example of graphical user interface and applications common to the MIT X Consortium s distribution running under the twm window manager: X Terminal, Xbiff, xload and a… …   Wikipedia

  • Union Bay Natural Area — Infobox protected area | name = Union Bay Natural Area iucn category = Ib caption = locator x = 27 locator y = 15 location = Washington, USA nearest city = Seattle, WA lat degrees = 47 lat minutes = 39 lat seconds = 21 lat direction = N long… …   Wikipedia

  • Switch-technology — is a technology for automata based programming support. It was proposed by Anatoly Shalyto in 1991. It involves software specification, design, implementation, debugging, documentation and maintenance. The term “automata based programming” is… …   Wikipedia

  • Fractal time — There are a number of definitions of the notion of fractal time. The term was first mentioned by Benoît Mandelbrot [Mandelbrot, B. B. (1982): The Fractal Geometry of Nature . W.H. Freeman, San Francisco.] , who used it to refer to statistically… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”