Topic: initialization of data

topics > computer science > data > Group: data value

type declaration

default value
data structure literals
data type as constructors, selectors, and predicates
finalization of data
initialized constants
notation for declarations
object-oriented objects
type reflection and introspection
undefined, null, and other signal values


When a variable is declared, it can be initialized. Uninitialized variables have an indeterminate value which can create intermittent bugs. Zero or nil is the most popular initialization value. Multiple variables can be initialized to the same value. Loop variables are initialized before loop execution. Initialization is either a pre-loaded memory location or a function executed when the object is declared. In some languages, users can define their own initialization functions for building internal structures. (cbb 5/80)
Subtopic: resource acquistion up

Quote: resource acquisition is initialization. Resources, like objects, are released in the reverse order of their acquisition; works well with exception handling [»stroB_1991]
Quote: resource acquisition is initialization: resources released in reverse order of acquisition, and exceptions release allocated resources [»stroB_1994]

Subtopic: initialization up

Quote: should disallow uninitialized variables and multiple names per declaration
Quote: it is hard for a program to guarantee uniqueness, data type consistency, and initialization [»stroB_1994]
Quote: creation of a record or data structure often needs additional computation
Quote: use a constructor to initialize an object instead of using a function; less error prone [»stroB_1991]
Quote: Java allows a superclass to call an overriding method before the object is initialized [»alexRT1_2000]
Quote: avoid Java initialization blocks; they can appear anywhere in a class; 'static' makes it a static initializer [»alexRT1_2000]
Quote: want guarantees that objects are properly initialized; but restrict data races to the low-level implementation of synchronization primitives [»pughW6_1999]
Quote: declare and initialize local variables at first use; minimizes their scope [»blocJ_2001]

Subtopic: metadata up

Quote: use metadata to configure an application at runtime; e.g., tuning, preferences, installed directory [»huntA_2000]

Subtopic: complex objects up

Quote: the SunOS slab memory allocator retains the state of complex objects between uses; object-coloring for global cache utilization; space efficient and fast [»bonwJ6_1994]
Quote: object cache is up to 5x faster; preserves the invariant portion of an object's initial state [»bonwJ6_1994]

Subtopic: constructor up

Quote: a constructor is not an ordinary function: not virtual, special access to memory management, no 'this' object, no pointer to function [»stroB_1991]
Quote: a C++ constructor has the same name as the class itself
Quote: can turn a constructor into an ordinary function that calls the constructor and returns a constructed object
Quote: a node class usually has a non-trivial constructor; unlike abstract types that rarely have constructors
Quote: 'new' creates an object from raw memory by allocating the memory and calling a constructor to initialize that memory [»stroB_1994]
Quote: use name-value pairs for object initialization; e.g., new Country(Name="Monaco", ...) [»bierGM10_2007]
Quote: Kevo's 'new' operator solves the problem of reserving a prototypical instance
QuoteRef: palmJ5_1973 ;;9 all data initialized- by allocation (eg New person ("john", 1936, male) by initialization routine, or zero for data and nil for pointers
QuoteRef: wulfWA4_1974 ;;7 every form has a create and destroy function for own and local instantiations
Quote: in SL5, create a record by creating an environment and then resuming once to initialize itself; uses self() [»hansDR3_1978a]
Quote: generate an object by evaluating an object designator; returns a reference [»dahlOJ_1967]

Subtopic: copy constructor up

Quote: a copy constructor initializes an object by copying another object; used for initialization, argument passing, and function return [»stroB_1991]
Quote: C++ has copy constructors because it is inefficient to first initialize an object to a default value and then assigning an object [»stroB_1994]
Quote: a Kevo object defines a clone operation to duplicate the object, and a new operation to create an initialized object. The programmer selects which variables to duplicate or initialize [»taivA11_1993]
Quote: a copy constructor creates a copy; zapping a value does not change other initializations [»dehnJC4_1998]

Subtopic: data type up

Quote: provide implicit typing for initialized type declarations [»dorwSM1_1997]

Subtopic: default value up

Quote: a record is a list of field declarations that define a name, a type, and a default value; either the type or default may be omitted [»cardL_1991]

Subtopic: assignment up

Quote: assignment and initialization are different operations; assignment only applies to properly constructed objects
Quote: constructing a type with an initial value is the same as assigning a value; both values equal afterwards [»dehnJC4_1998]

Subtopic: memory placement up

Quote: 'new' needs memory placement arguments for hardware-specific addresses, custom memory allocation, and general resource management [»stroB_1994]
Quote: with memory placement arguments, 'new' can assist with general resource management

Subtopic: declaration at use up

Quote: allow declarations were needed. Used for initialize-only/single-assignment programming, references, initialized constants, and efficiency. [»stroB_1994]

Subtopic: indicating initialized data up

Quote: typestate captures the degree of initialization of simple and composite objects [»stroRE5_1985]
Quote: can have a value 'unassigned' that makes a variable uninitialized [»winnRI10_1984]
Quote: Smalltalk sets 'isnew' true to initiate initialization
Quote: added 'init' predicate for guards; true only during the first execution of a loop [»parnDL8_1983]
Quote: avoid incompletely constructed objects by setting a "fully constructed" flag on each object [»spooD6_2006]

Subtopic: efficiency up

Quote: for initialization, compiled languages fastest and script languages slowest; Java in between [»precL10_2000]

Subtopic: examples up

QuoteRef: gescCM6_1975 ;;33 data initialization and default value by i: integer<-3 and literal by i: integer = 3
QuoteRef: cbb_1973 ;;PL/N a,b,c = 0
QuoteRef: sammJE_1969 ;;553 "prologue" for initializing storage and variables
QuoteRef: sammJE_1969 ;;578 initialization of an entity by a procedure

Related Topics up

Group: type declaration   (5 topics, 110 quotes)

Topic: constants (21 items)
Topic: default value (8 items)
Topic: data structure literals (9 items)
Topic: data type as constructors, selectors, and predicates (20 items)
Topic: finalization of data (11 items)
Topic: initialized constants (12 items)
Topic: notation for declarations (20 items)
Topic: object-oriented objects (39 items)
Topic: type reflection and introspection (28 items)
Topic: undefined, null, and other signal values
(34 items)

Updated barberCB 12/05
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.