You are on page 1of 673

The black art of

programming
Mark McIlroy
A book about computer programming
(c) Blue Sky Technology 2013. All right
reer!e"
###.bluekytechnology.com.au
Contents
1. Prelude 4
2. Program Structure 6
2.1. Procedural Languages 6
2.2. Declarative Languages 28
2.3. Other Languages 32
3. Topics from Computer Science 33
3.1. Execution Platforms 33
3.2. Code Execution odels !2
3.3. Data structures !"
3.!. #lgorithms $6
3.%. &echni'ues 11"
3.6. Code odels 1%!
3.$. Data (torage 182
3.8. )umeric Calculations 213
3.". (*stem (ecurit* 2!!
3.1+. (,eed - Efficienc* 2%1
4. The Craft of Programming 292
!.1. Programming Languages 2"2
!.2. Develo,ment Environments 312
!.3. (*stem Design 318
!.!. (oft.are Com,onent odels 33$
!.%. (*stem /nterfaces 3!!
!.6. (*stem Develo,ment 3%$
!.$. (*stem evolution 3"3
!.8. Code Design !+6
!.". Coding !36
!.1+. &esting !"2
!.11. De0ugging %1$
!.12. Documentation %3!
5. Glossar 53!
6. "ppendi# " $ Summar of operators 6%&
1. Prelude
A computer program i a et o$ tatement
that i ue" to create an output% uch a a
creen "iplay% a printe" report% a et o$ "ata
recor"% or a calculate" et o$ number.
Mot program in!ol!e tatement that are
e&ecute" in e'uence.
A program i #ritten uing the tatement o$
a programming language.
In"i!i"ual tatement per$orm imple
operation uch a printing an item o$ te&t%
calculating a ingle !alue% an" comparing
!alue to "etermine #hich et o$ tatement
to e&ecute.
Simple intruction are per$orme" in
har"#are by the computer( central
proceing unit.
)omple& intruction are #ritten in
programming language an" tranlate" into
the internal intruction et by another
program.
)omputer memory i generally compoe" o$
byte% #hich are "ata item that contain a
binary number. Thee !alue can range $rom
0 to 2**.
Memory location are re$erre" to by number%
kno#n a an a""re.
A memory location can be ue" to recor"
in$ormation uch a a mall number% "ata
$rom a graphic image% part o$ a memory
a""re% a program intruction% an" a numeric
!alue repreenting a ingle letter.
+rogram intruction an" "ata are tore" in
memory #hile a program i e&ecuting.
2. Program Structure
2.1. Procedural Languages
+rogram #ritten in proce"ural language
in!ol!e a et o$ tatement that are per$orme"
in e'uence. Mot program are #ritten uing
proce"ural language.
Thir" generation language are language
that operate at the le!el o$ in"i!i"ual "ata
item% ,i$- tatement% loop an" ubroutine.
A large proportion o$ program are #ritten
uing thir".generation language.
2.1.1. Data
2.1.1.1. Data Types
Baic "ata type inclu"e numeric !alue an"
tring.
A tring i a hort te&t item% an" may contain
in$ormation uch a a name or a report
hea"ing.
/umeric "ata may be tore" internally a a
binary number% #hich i a "itinct $ormat
$rom a et o$ in"i!i"ual "igit tore" in a te&t
$ormat.
Se!eral numeric "ata type may be a!ailable.
Thee may inclu"e integer "ata type%
$loating point "ata type an" other $ormat.
Integer are #hole number an" integer "ata
type cannot recor" $ractional number.
0o#e!er% operation #ith integer "ata type
are generally $ater than operation #ith
other numeric "ata type.
1loating point "ata type tore the "igit
#ithin a number eparately $rom the
magnitu"e% an" can tore #i"ely !arying
!alue uch a 2230000000 an"
0.0000002322.
Some language alo upport a range o$ other
numeric "ata type #ith !arying range an"
preciion.
3ate are upporte" a a eparate "ate type in
ome language.
A Boolean "ata type i a type that recor"
only t#o !alue% ,true- an" ,$ale-. Boolean
"ata type an" e&preion are ue" in
checking con"ition an" per$orming "i$$erent
action in "i$$erent circumtance.
The language )obol i ue" in "ata
proceing. 3ata item #ithin cobol are
e$$ecti!ely $iel" #ithin "atabae recor"%
an" may contain a combination o$ te&t an"
numeric "igit.
In"i!i"ual poition #ithin a "ata $iel" in
cobol can be "e$ine" a hol"ing an
alphabetic% alphanumeric or numeric
character. )alculation can be per$orme"
#ith numeric $iel".
2.1.1.2. Type Conversion
4anguage generally pro!i"e $acilitie $or
con!erting bet#een "ata type% uch a
bet#een t#o "i$$erent numeric "ata type% or
bet#een numeric "ata in binary $ormat an" a
te&t tring o$ "igit.
Thi may be "one automatically #ithin
e&preion% through the ue o$ an operator
ymbol% or through a ubroutine call.
5hen "i$$erent numeric "ata type are mi&e"
#ithin an e&preion% the !alue #ith the
lo#er le!el o$ preciion i generally
promote" to the higher le!el o$ preciion
be$ore the calculation i per$orme".
The "etail o$ type promotion !ary #ith each
language.
2.1.1.3. Variables
A !ariable i a "ata item ue" #ithin a
program% an" i"enti$ie" by a !ariable name.
6ariable may conit o$ $un"amental "ata
type uch a tring an" numeric "ata type%
or a !ariable name may re$er to multiple
in"i!i"ual "ata item.
6ariable can be ue" in e&preion $or
calculation% an" alo $or comparion to
per$orm "i$$erent ection o$ co"e un"er
"i$$erent con"ition.
The !alue o$ a !ariable can be change" uing
an aignment tatement% #hich change the
!alue o$ a !ariable to e'ual the !alue o$ an
e&preion.
2.1.1.4. Constants
)ontant uch a $i&e" number an" tring
can be inclu"e" "irectly #ithin program
co"e.
)ontant can alo be gi!en a name% imilar
to a !ariable name% an" ue" in e!eral place
#ith the program.
The !alue o$ a contant i $i&e" an" cannot
be change" #ithout recompiling the program.
2.1.1.5. Data Structures
6ariable can be "e$ine" a a collection o$
in"i!i"ual "ata item.
An array i a !ariable that contain multiple
"ata item o$ the ame type. 7ach item i
re$erre" to by number.
A tructure type% alo kno#n a a recor"% i a
collection o$ e!eral "i$$erent "ata item.
An ob8ect i an element o$ ob8ect orientate"
program. An ob8ect i re$erre" to by name
an" contain in"i!i"ual "ata item.
Subroutine kno#n a metho" are alo
"e$ine" #ithin an ob8ect.

Array can contain tructure% an" tructure
can contain array an" other tructure.
Some language upport other "ata tructure
uch a lit.
2.1.1.6. Pointers & Reerences
A pointer i a !ariable that contain a
re$erence to another !ariable. The econ"
!ariable can be accee" in"irectly by
re$erring to the pointer !ariable.
+ointer are ue" to link "ata item together%
#hen "ata tructure are "ynamically create"
a a program e&ecute.
In ome language% pointer can be increae"
an" "ecreae to can through memory an"
acce "i$$erent element #ithin an array% or
in"i!i"ual byte #ithin a block o$ "ata.
A re$erence to a !ariable i alo kno#n a an
a""re% an" re$er to the location o$ the
!ariable in memory.
The !alue o$ a pointer !ariable can be et to
the a""re o$ another "ata item by uing a
re$erence operator #ith the "ata item.
The "ata item that a pointer point to can be
accee" by uing a "e.re$erencing operator.
2.1.1.!. Variable Scope
In"i!i"ual !ariable can only be accee"
#ithin certain ection o$ a program.
9lobal !ariable can be accee" $rom any
point #ithin the co"e.
4ocal !ariable apply #ithin a ingle
ubroutine. An in"epen"ent copy o$ the local
!ariable i create" each time that a
ubroutine i calle".
5here a local !ariable ha the ame name a
a global !ariable% the name #oul" re$er to the
!ariable #ith the tightet cope% #hich in that
cae #oul" be the local !ariable.
+arameter are "ata !alue or !ariable that
are pae" to a ubroutine #hen it i calle".
+arameter can be accee" $rom #ithin the
ubroutine.
Some language ha!e multiple le!el o$
cope. In thee cae% ubroutine may be
"e$ine" #ithin other ubroutine% an"
!ariable may be "e$ine" #ithin inner co"e
block.
6ariable #ithin the current le!el o$ cope
an" outer le!el o$ cope can be accee"%
but not !ariable #ithin an inner le!el o$
cope or in an in"epen"ent part o$ the
ytem.
Mo"ule an" ob8ect may ha!e public an"
pri!ate ubroutine an" !ariable. +ublic
!ariable are acceible outi"e the mo"ule%
#hile pri!ate !ariable are only acceible
#ithin the mo"ule.
The ue o$ global !ariable can lea" to
interaction bet#een "i$$erent part o$ the
co"e% #hich may make "ebugging an"
mo"i$ying the co"e more "i$$icult.
2.1.1.". Variable #ieti$e
9lobal !ariable e&it $or the perio" o$ time
that the program i running.
4ocal !ariable are create" #hen a
ubroutine i calle"% an" e&pire #hen the
ubroutine terminate.
Static !ariable may ha!e a cope that
applie #ithin a ingle ubroutine% ho#e!er
they ha!e a li$etime that e&it $or the $ull
perio" that the program i e&ecuting% an"
they retain their !alue $rom one call to the
ubroutine to the ne&t.
3ynamically create" "ata item e&it until
they are $ree". 3ynamic memory allocation
in!ol!e creating "ata item #hile a program
i running.
Thi may be "one e&plicitly% or it may occur
automatically #hen the lat remaining
!ariable that point to the item i aigne" a
"i$$erent !alue% or e&pire a it le!el o$
cope terminate.
2.1.2. %&ecution
2.1.2.1. %&pressions
An e&preion i a combination o$ contant%
!ariable an" operator that i ue" to
calculate a !alue.
An aignment operation in!ol!e a !ariable
name an" an e&preion. The e&preion i
e!aluate"% an" the !alue o$ the !ariable i
change" to e'ual the reult o$ the e&preion.
7&preion are alo ue" #ithin control $lo#
tatement uch a ,i$- tatement an" loop.
/umeric e&preion inclu"e the tan"ar"
arithmetic operation o$ a""ition% ubtraction%
multiplication an" "i!iion an"
e&ponentiation.
The baic tring operation are concatenating
t#o tring to $orm a ingle tring% e&tracting
a ubtring% an" comparing tring.
String e&preion may inclu"e contant
tring% tring !ariable% an" operator uch
a a concatenation operator.
Boolean !ariable an" e&preion ha!e only
t#o poible !alue% ,true- an" ,$ale-.
An e&preion containing a relational
operator% uch a ,:;-% i a Boolean
e&preion. 1or e&ample% ,* : 3- ha the
!alue ,$ale-.
The Boolean operator ,an"-% ,or- an" ,not-
can alo be ue" in e&preion. An ,an"-
e&preion ha the !alue ,true- #hen both
part are true% an ,or- e&preion ha the
!alue ,true- #hen either !alue i true% an" a
,not- e&preion re!ere the !alue.
Boolean e&preion are ue" #ithin ,i$-
tatement to e&ecute co"e un"er certain
con"ition an" #ithin loop to repeat a erie
o$ tatement #hile a con"ition remain true.
2.1.2.2. State$ents
2.1.2.2.1. 'ssi(n$ent State$ents
An aignment tatement contain a !ariable
name% an aignment ymbol uch a an ,;-
ign% an" an e&preion.
The e&preion i e!aluate"% an" the !alue o$
the !ariable i et to e'ual the reult o$ the
e&preion.
Some language are e&preion.$ocue"
rather than tatement.$ocue". In thee
language% an aignment operation may
itel$ be an e&preion% an" may be ue"
#ithin other e&preion.
2.1.2.2.2. Control )lo*
2.1.2.2.2.1. + State$ents
An ,i$- tatement contain a Boolean
e&preion an" an aociate" block o$ co"e.
The e&preion i e!aluate"% an" i$ the reult
i true then the tatement #ithin the block
are e&ecute"% other#ie they are kippe".
An ,i$- tatement may alo ha!e a block o$
co"e attache" to an ,ele- ection. I$ the
e&preion i $ale% then the co"e #ithin the
,ele- ection i e&ecute"% other#ie it i
kippe".
2.1.2.2.2.2. #oops
A loop tatement may contain a Boolean
e&preion. The e&preion i e!aluate"% an"
i$ it i true then the co"e #ithin the block i
e&ecute". The control $lo# then return to the
beginning o$ the loop% an" the cycle repeat
the loop each time that the con"ition
e!aluate to true.
<ther loop tatement may alo be a!ailable%
uch a tatement that peci$y a $i&e"
number o$ iteration% or tatement that loop
through all item in a language "ata tructure.
2.1.2.2.2.3. ,oto
Some language upport a ,goto- tatement.
A goto tatement caue a 8ump to a "i$$erent
point in the program to continue e&ecution.
)o"e that ue goto tatement can "e!elop
!ery comple& control $lo# an" may be
"i$$icult to "ebug an" mo"i$y.
Some language alo upport tructure" goto
operation% uch a a tatement that
terminate the current loop mi".#ay through
the loop co"e.
Thee operation "o not complicate the
control $lo# to the ame e&tent a general
goto tatement% ho#e!er thee operation
can be eaily mie" #hen co"e i being
rea".
1or e&ample% a tatement in an early part o$ a
comple& loop may reult in the loop being
e&ite" #hen it i e&ecute". Thi tatement
complicate the control $lo# an" may make
interpreting the loop co"e more "i$$icult.
2.1.2.2.2.4. %&ceptions
In ome language% e&ception han"ling
ubroutine an" ection o$ co"e can be
"e$ine".
Thee co"e ection are automatically
e&ecute" #hen an error occur.
2.1.2.2.2.5. Subroutine Calls
Inclu"ing the name o$ a ubroutine #ithin a
tatement caue the ubroutine to be calle".
The ubroutine name may be part o$ an
e&preion% or it may be an in"i!i"ual
tatement.
5hen the ubroutine i calle"% program
e&ecution 8ump to the beginning o$ the
ubroutine an" e&ecution continue at that
point. 5hen the co"e in the ubroutine ha
been e&ecute"% or a termination tatement i
per$orme"% the ubroutine terminate an"
e&ecution return to the ne&t tatement
$ollo#ing the original ubroutine call.
2.1.2.3. Subroutines
Subroutine are in"epen"ent block o$ co"e
that are re$erre" to by name.

+rogram are compoe" o$ a collection o$
ubroutine.
5hen e&ecution reache a ubroutine call the
program e&ecution 8ump to the beginning o$
the ubroutine.
)ontrol $lo# return to the point $ollo#ing
the ubroutine call #hen the ubroutine
terminate.
Subroutine may inclu"e parameter. Thee
are !ariable that can be accee" #ithin the
ubroutine. The !alue o$ the parameter i et
by the calling co"e #hen the ubroutine call
i per$orme".
)alling co"e can pa contant "ata !alue or
!ariable a the parameter to a ubroutine
call.
+arameter are pae" in !ariou #ay.
,)all.by.!alue- pae the !alue o$ the "ata
to the ubroutine. ,)all.by.re$erence- pae
a re$erence to the !ariable in the calling
routine% an" the ubroutine can alter the !alue
o$ a parameter !ariable #ithin the calling
routine.
)all by !alue lea" to $e#er une&pecte"
e$$ect in the calling routine% ho#e!er
returning more than one !alue $rom a
ubroutine may be "i$$icult.
Subroutine may alo contain local !ariable.
Thee !ariable are acceible only #ithin
the ubroutine% an" are create" each time that
the ubroutine i calle".
In ome language% ubroutine can alo call
themel!e. Thi i kno#n a recurion an"
"oe not erae the pre!iou call to the
ubroutine. A ne# et o$ local !ariable i
create"% an" $urther call can be ma"e.
Thi proce i ue" $or $unction that
in!ol!e branching to e!eral point at each
tage in a proce. A each ubroutine call
terminate% e&ecution return to the pre!iou
le!el.
2.1.2.4. Co$$ents
)omment are inclu"e" #ithin program co"e
$or the bene$it o$ a human rea"er. )omment
are i"enti$ie" a eparate te&t item% an" are
ignore" #hen the program i compile".
)omment are ue" to inclu"e a""itional
in$ormation #ithin the co"e that i rele!ant
to a particular calculation or proce% an" to
"ecribe "etail o$ the $unction #ithin a
comple& ection o$ co"e.
2.2. Declarative Languages
A "eclarati!e program "e$ine tructure an"
pattern% an" may contain a et o$
in$ormation an" $act.
In contrat% proce"ural co"e peci$ie a et o$
operation that are e&ecute" in e'uence.
3eclarati!e co"e i not e&ecute" "irectly% but
i ue" a input to other procee.
1or e&ample% a "eclarati!e program may
"e$ine a et o$ pattern% #hich i ue" by a
parer to i"enti$y pattern an" ub.pattern
#ithin a et o$ input "ata.
<ther "eclarati!e ytem ue a et o$ $act to
ol!e a problem that i preente".
3eclarati!e language are alo ue" to "e$ine
et o$ item% uch a recor" #ithin "ata
'uerie.

3eclarati!e program are !ery po#er$ul in
the operation that can be per$orme"% in
comparion to the i=e an" comple&ity o$ the
co"e.
1or e&ample% all poible program can be
compile" uing a "e$inition o$ the language
grammar.
Alo% a problem ol!ing engine can ol!e all
problem that $all #ithin the cope o$ the
in$ormation that ha been pro!i"e".
1act may inclu"e baic "ata% an" may alo
peci$y that t#o thing are e'ui!alent.
1or e&ample>
& ? y ; = @ 2
Month303ay ; April <A Bune <A
September <A /o!ember
1iel"/ame ; 322.CCC.2*3
e&preion> number ,?- e&preion
The $irt e&ample i a mathematical
tatement that t#o e&preion are
e'ui!alent% the econ" e&ample peci$ie that
,Month303ay- i e'ual to a et o$ $our
month% the thir" e&ample matche the et o$
$iel" name beginning #ith 322 an" en"ing
#ith 2*3% an" the $ourth e&ample peci$ie a
pattern in a language grammar.
+attern may be recuri!ely "e$ine"% uch a
peci$ying that bracket #ithin an e&preion
may contain an entire e&preion% #ith
potentially in$inite le!el o$ ub.e&preion.
3eclarati!e co"e may in!ol!e pattern%
#hich ha!e a $i&e" tructure% an" et% #hich
are unor"ere" collection o$ item.
2.2.1. Co-e Structure
3eclarati!e co"e may contain key#or"%
name% contant% operator an" tatement.
Dey#or" are language key#or" that may
be ue" to eparate ection o$ the program
an" i"enti$y the type o$ in$ormation that i
recor"e".
The name may i"enti$y pattern% #hile the
operator may be ue" to create a ne# pattern
$rom other pattern.
Statement may be entere" in the $orm o$
peci$ying that t#o e&preion are
e'ui!alent.
The chain o$ connection i "e$ine" by the
appearance o$ name #ithin "i$$erent
tatement. There i no or"er #ithin a
tatement or $rom one tatement to the ne&t.
2.3. Other Languages
+rogramming language appear in a #i"e
!ariety o$ $orm an" tructure.
In the language 4IS+% $or e&ample% all
proceing i per$orme" #ith lit% an" a
4IS+ program conit o$ multiple bracket
#ithin bracket "e$ining lit o$ "ata an"
intruction
3. Topics from Computer Science
3.1. Eecution Platforms
3.1.1. .ar-*are
)omputer har"#are e&ecute a imple et o$
intruction kno#n a machine co"e.
Machine co"e inclu"e intruction to mo!e
"ata bet#een memory location% per$orm
baic calculation uch a multiplication% an"
8ump to "i$$erent point in the co"e
"epen"ing on a con"ition.
<nly machine co"e can be "irectly e&ecute".
+rogram #ritten in programming language
are con!erte" to a machine co"e $ormat
be$ore they are e&ecute".
Machine co"e intruction an" "ata are
tore" in memory #hile a program i
running.
3.1.2. /peratin( syste$s
An operating ytem i a program that
manage the operation o$ a computer. The
operating ytem per$orm a #i"e range o$
$unction% inclu"ing managing the creen
"iplay an" other uer inter$ace component%
implementing the "ik $ile ytem% managing
e&ecution o$ procee% an" managing
memory allocation an" har"#are "e!ice.
9enerally program a "e!elope" to run on a
particular operating ytem an" igni$icant
change may be re'uire" to run on other
operating ytem. Thi may inclu"e
changing the #ay that creen proceing i
han"le"% changing the memory management
procee% an" changing $ile an" "atabae
operation.
3.1.3. Co$pilers
A compiler i a program that generate an
e&ecutable $ile $rom a program ource co"e
$ile.
The e&ecutable $ile contain a machine co"e
!erion o$ the program that can be "irectly
e&ecute".
<n ome ytem% the compiler pro"uce
ob8ect co"e $ile. <b8ect co"e i a machine
co"e $ormat ho#e!er the re$erence to "ata
location an" ubroutine ha!e not been
linke".
In thee cae% a eparate program kno#n a
a linker i ue" to link the ob8ect mo"ule
together to $orm the e&ecutable $ile.
1ully compile" co"e i generally the $atet
#ay to e&ecute a program.
0o#e!er% compilation i a comple& proce
an" can be lo# in ome cae.
3.1.4. +nterpreters
An interpreter e&ecute a program "irectly
$rom the ource co"e% rather than pro"ucing
an e&ecutable $ile.
Interpreter may per$orm a partial
compilation to an interme"iate co"e $ormat%
an" e&ecute the interme"iate co"e internally.
Thi approach i lo#er than uing a $ully
compile" program% an" alo the interpreter
mut be a!ailable to run the program. The
program cannot be run "irectly in a tan".
alone en!ironment.
0o#e!er% interpreter ha!e a number o$
a"!antage.
An interpreter tart imme"iately% an" may
inclu"e $le&ible "ebugging $acilitie. Thi
may inclu"e !ie#ing the co"e% tepping
through procee% an" e&amining the !alue
o$ "ata !ariable. In ome cae the co"e can
be mo"i$ie" #hen e&ecution i halte" part.
#ay through a program.
3.1.5. Virtual 0ac1ines
A !irtual machine pro!i"e a run.time
en!ironment $or program e&ecution. The
!irtual machine e&ecute a $orm o$
interme"iate co"e% an" alo pro!i"e a
tan"ar" et o$ $unction an" ubroutine call
to upply the in$ratructure nee"e" $or a
program to acce a uer inter$ace an"
general operating ytem $unction.
6irtual machine are ue" to pro!i"e
portability acro "i$$erent operating
plat$orm% an" alo $or ecurity purpoe to
pre!ent program $rom acceing "e!ice
uch a "ik torage.
An e&tenion to a !irtual machine i a 8ut.in.
time compiler% #hich compile each ection
o$ co"e a it begin e&ecuting.
3.1.6. +nter$e-iate Co-e %&ecution
A run.time e&ecution routine can be ue" to
e&ecute interme"iate co"e that ha been
generate" by compiling ource co"e.

+rogram may be #ritten uing a language
"e!elope" peci$ically $or an application%
uch a $ormula e!aluation ytem or a
macro language.
The ytem may contain a parer% co"e
generator an" run.time e&ecution routine.

Alternati!ely% the co"e generation coul" be
"one eparately% an" the interme"iate co"e
coul" be inclu"e" a "ata #ith the
application.
3.1.!. #in2in(
In ome en!ironment% ubroutine librarie
can be linke" into a program tatically or
"ynamically.
A tatically linke" library i linke" into the
e&ecutable $ile #hen it i create". The co"e
$or the ubroutine that are calle" $rom the
program are inclu"e" #ithin the e&ecutable
$ile.
Thi enure that all the co"e i preent% an"
that the correct !erion o$ the co"e i being
ue".
0o#e!er% e&ecutable $ile may become large
#ith thi approach. Alo% thi pre!ent the
ytem $rom uing up"ate" librarie to
correct bug or impro!e per$ormance%
#ithout uing a ne# e&ecutable $ile.
Static linking may only be a!ailable $or ome
librarie an" may not be a!ailable $or ome
$unction uch a operating ytem call.
3ynamic linking in!ol!e linking to the
library #hen the program i e&ecuting. Thi
allo# the program to ue $acilitie that are
a!ailable #ithin the en!ironment% uch a
operating ytem $unction.
3ynamically linke" librarie can be up"ate"
to correct bug an" impro!e per$ormance%
#ithout altering the main e&ecutable $ile.
0o#e!er% problem can arie #ith "i$$erent
!erion o$ librarie.
3.2. Code Eecution !odels
3.2.1. Sin(le %&ecution T1rea-
+rogram e&ecution i generally bae" on the
mo"el o$ a ingle threa" o$ e&ecution.
7&ecution begin #ith the $irt tatement in
the program an" continue through
ubroutine call% loop an" ,i$- tatement
until the program $inally terminate.
At any point in time% the current intruction
poition #ill only apply to a ingle point
#ithin the co"e.
A ytem may inclu"e e!eral ma8or
procee an" threa"% but #ithin each ma8or
block the ingle e&ecution threa" mo"el i
maintaine".
3.2.2. Ti$e Slicin(
In or"er to run multiple program an"
procee uing a ingle central proceing
unit% many operating ytem implement a
time licing ytem.
Thi approach in!ol!e running each proce
$or a !ery hort perio" o$ time% in rapi"
ucceion. Thi create the e$$ect o$ e!eral
program running imultaneouly% e!en
though only a ingle machine co"e
intruction i e&ecuting at any point in time.
3.2.3. Processes an- T1rea-s
<n many ytem% multiple program may be
run imultaneouly% inclu"ing more than one
copy o$ a ingle program.
An e&ecuting program i kno#n a a proce.
7ach running program i an in"epen"ent
proce an" e&ecute concurrently #ith the
other procee.
A program may alo tart in"epen"ent
procee $or ma8or o$t#are component
uch a $unctional engine.
Some ytem alo upport threa". A threa"
i an in"epen"ently e&ecuting ection o$
co"e. Threa" may not be entire program
ho#e!er they are generally larger $unctional
component than a ingle ubroutine.
Threa" are ue" $or tak uch a
backgroun" printing% compacting "ata
tructure #hile a program i running an" o
$orth.
<n ytem that upport multiple uer
terminal #ith a central har"#are ytem%
uer can tart procee $rom a terminal.
Multiple procee may operate concurrently%
inclu"ing multiple e&ecuting copie o$ a
ingle program.
3.2.4. Parallel Pro(ra$$in(
4anguage ha!e been "e!elope" to upport
parallel programming.
+arallel programming i bae" on an
e&ecution mo"el that allo# in"i!i"ual
ubroutine to e&ecute in parallel.
Thee ytem may be e&tremely "i$$icult to
"ebug. Synchroniation co"e i re'uire" to
pre!ent con$lict #hen t#o ubroutine
attempt to up"ate the ame ection o$ "ata%
an" to enure that one tak "oe not
commence until relate" tak ha!e
complete".
+arallel programming i rarely ue". Total
e&ecution time i not re"uce" by the parallel
e&ecution proce% a the total )+E time
re'uire" to per$orm particular tak i
unchange".
3.2.5. %vent Driven Co-e
7!ent "ri!en co"e i an e&ecution mo"el that
in!ol!e ection o$ co"e being automatically
triggere" #hen a particular e!ent occur.
1or e&ample% electing a $unction in a
graphical uer inter$ace en!ironment may
lea" to a relate" ubroutine being
automatically calle".
In ome ytem e!eral e!ent coul" occur
in rapi" ucceion an" e!eral ection o$
co"e coul" run concurrently.
Thi i not poible #ith a tan"ar" menu.
"ri!en ytem% #here a proce mut
complete be$ore a "i$$erent proce can be
run.
7!ent "ri!en co"e upport a $le&ible
e&ecution en!ironment #here co"e can be
"e!elope" an" e&ecute" in in"epen"ent
ection.
3.2.6. +nterrupt Driven Co-e
Interrupt "ri!en co"e i ue" in har"#are
inter$acing an" in"utrial control
application. In thee cae% a har"#are
ignal caue a ection o$ co"e to be
triggere".
Inter$acing #ith har"#are "e!ice i
generally con"ucte" uing interrupt or
polling. +olling in!ol!e checking a "ata
regiter continually to check #hether "ata i
a!ailable. An interrupt "ri!en approach "oe
not re'uire" polling% a the interrupt han"ling
routine i triggere" #hen an interrupt occur.
3.3. Data structures
3.3.1. '((re(ate -ata types
3.3.1.1. 'rrays
3.3.1.1.1. Stan-ar- 'rrays
Array are the $un"amental "ata tructure
that i ue" #ithin thir".generation language
$or toring collection o$ "ata.
An array contain multiple "ata item o$ the
ame type. 7ach item i re$erre" to by a
number% kno#n a the array in"e&.
In"e&e are integer !alue an" may tart at 0%
1% or ome other !alue "epen"ing on the
"e$inition an" the language.
Array can ha!e multiple "imenion. 1or
e&ample% "ata in a t#o."imenional array
#oul" be in"e&e" uing t#o in"epen"ent
number. A t#o "imenional array i imilar
to a gri" layout o$ "ata% #ith the ro# an"
column number being ue" to re$er to an
in"i!i"ual "ata item.
Array can generally contain any "ata type%
uch a tring% integer an" tructure.
Acce to an array element may be e&tremely
$at% an" may be only lightly lo#er than
acceing an in"i!i"ual "ata !ariable.
Array are alo kno#n a table.
Thi particularly applie to an array o$
tructure% #hich may be imilar to a table
#ith ro# o$ the ame $ormat but "i$$erent
"ata in each column. A table alo re$er to an
array o$ "ata that i ue" $or re$erence #hile
a program e&ecute.

In ome cae the in"e& entry o$ the array
may repreent an in"epen"ent "ata !alue% an"
the array may be accee" "irectly uing a
"ata item.
In other cae an array i imply ue" to tore
a lit o$ item% an" the in"e& !alue "oe not
ha!e any particular igni$icance.
In cae #here the array i ue" to tore a lit
o$ "ata% the or"er o$ the item may or may
not be igni$icant% "epen"ing on the type an"
ue o$ the "ata.
The $ollo#ing "iagram illutrate a t#oF
"imenional array.
3.3.1.1.2. Ra((e- 'rrays
Stan"ar" array are 'uare. In a t#o.
"imenional cae% e!ery ro# ha the ame
number o$ column% an" e!ery column ha
the ame number o$ ro#.
A ragge" array i an array tructure #here the
in"i!i"ual column% or another "imenion%
may ha!e !arying i=e.
Thi coul" be implemente" uing a one.
"imenional array $or one "imenion an"
linke" lit $or each column.
Alternati!ely% a ingle large array coul" be
ue"% an" the ro# an" column poition
coul" be calculate" bae" on a table o$
column length.
The $ollo#ing "iagram illutrate a ragge"
array.
3.3.1.1.3. Sparse 'rrays
A pare array i a large array that contain
many unue" element.
Thi can occur #hen a "ata item i ue" a an
in"e& into the array% o that item can be
accee" "irectly% ho#e!er the "ata item
contain gap bet#een in"i!i"ual !alue.
5here entire ro# or column are miing%
thi tructure coul" be implemente" a a
compacte" array.
Alternati!ely% the in"e& !alue coul" be
combine" into a ingle te&t key% an" the "ata
item coul" be tore" by key uing a
tructure uch a a hah table or tree.
Another approach may in!ol!e uing a
tan"ar" array $or one "imenion% an" linke"
lit to tore" the actual "ata an" o a!oi" the
unue" element in the econ" "imenion.
A pare array i ho#n belo#
3.3.1.1.4. 'ssociative 'rrays
An aociati!e array i an array that ue a
tring !alue% rather than an integer a the
in"e& !alue.
#
#
#
#
#
#
# #
#
#
#
Aociati!e array can be implemente" uing
tructure uch a tree or hah table.
Aociati!e array may be ue$ul $or a".hoc
program% a co"e can 'uickly an" eaily be
#ritten uing an aociati!e array that #oul"
re'uire canning array an" other proceing
uing tan"ar" co"e.
0o#e!er% "ue to the ue o$ tring an" the
earching in!ol!e" in locating element%
thee tructure #oul" ha!e lo#er acce
time than other "ata tructure.
3.3.1.2. Structures
A tructure i a collection o$ in"i!i"ual "ata
item. Structure are alo kno#n a recor"
in ome language.
A programming tructure i imilar in $ormat
to a "atabae recor".
Array o$ tructure are !iually imilar to a
gri" layout o$ "ata #ith each ro# ha!ing the
ame type% but "i$$erent column containing
"i$$erent "ata type.
3.3.1.3. /b3ects
In ob8ect orientate" programming% a "ata
tructure kno#n a an ob8ect i ue".
An ob8ect i a tructure type% an" contain a
collection o$ in"i!i"ual "ata item.
0o#e!er% ubroutine kno#n a metho" are
alo "e$ine" #ith the ob8ect "e$inition% an"
metho" can be e&ecute" by uing the
metho" name #ith a "ata !ariable o$ that
ob8ect type.
3.3.2. #in2e- Data Structures
4inke" "ata tructure conit o$ no"e
containing "ata an" link.
A no"e can be implemente" a a tructure
type. Thi may contain in"i!i"ual "ata item%
together #ith link that are ue" to connect to
other no"e.
4ink can be implemente" uing pointer%
#ith "ynamically create" no"e% or no"e
coul" be tore" in an array an" array in"e&
!alue coul" be ue" a the link.
Eing "ynamic memory allocation an"
pointer reult in imple co"e% an" "oe not
in!ol!e "e$ining the i=e o$ the tructure in
a"!ance.
An array implementation may reult in more
comple& co"e% although it may be $ater a
allocating an" "eallocating memory #oul"
not be re'uire".
Enlike "ynamic "ata allocation% the array
entrie are acti!e at all time. 7ntrie that are
not currently ue" #ithin the "ata tructure
may be linke" together to $orm a $ree lit%
#hich i ue" $or allocation #hen a ne# no"e
i re'uire".
3.3.2.1. #in2e- #ists
A linke" lit i a tructure #here each no"e
contain a link to the ne&t no"e in the lit.
Item can be a""e" to lit an" "elete" $rom
lit in a ingle operation% regar"le o$ the
i=e o$ the lit. Alo% #hen "ynamic memory
allocation i ue" the i=e o$ the lit i not
$i&e" an" can !ary #ith the a""ition an"
"eletion o$ no"e.
0o#e!er% element in a linke" lit cannot be
accee" at ran"om% an" in general the lit
mut be earche" to locate an in"i!i"ual
item.
3.3.2.2. Doubly #in2e- #ists
A "oubly linke" lit contain link to both the
ne&t no"e an" the pre!iou no"e in the lit.
Thi allo# the lit to be canne" in either
"irection.
Alo% a no"e can be a""e" to or "elete" $rom
a lit be re$erring to a ingle no"e. In a ingly
linke" lit% a pointer to the pre!iou no"e
mut be eparately a!ailable in or"er to
per$orm a "eletion.
3.3.2.3. 4inary Trees
A binary tree i a tructure in #hich a no"e
contain a link to a le$t no"e an" a link to a
right no"e.
Thi may $orm a tree tructure that branche
out at each le!el.
Binary tree are ue" in a number o$
algorithm uch a paring an" orting.
The number o$ le!el in a $ull an" balance"
binary tree i e'ual to log
2
(n?1) $or ,n-
item.
3.3.2.4. 4trees
A B.tree i a tree tructure that contain
multiple branche at each no"e.
A B.tree i more comple& to implement than
a binary tree or other tructure% ho#e!er a
B.tree i el$ balancing #hen item are a""e"
to the tree or "elete" $rom the tree.
B.tree are ue" $or implementing "atabae
in"e&e.
3.3.2.5. Sel54alancin( Trees
A el$.balancing tree i a tree that retain a
balance" tructure #hen item are a""e" an"
"elete"% an" remain balance" regar"le o$
the or"er o$ the input "ata.
3.3.3. #inear Data Structures
3.3.3.1. Stac2s
A tack i a "ata tructure that tore a erie
o$ item.
5hen item are remo!e" $rom the tack% they
are retrie!e" in the oppoite or"er to the
or"er in #hich they #ere place" on the tack.
Thi i alo kno#n a a 4I1<% 4at.In.1irt.
<ut tructure.
The $un"amental operation #ith a tack are
+ES0% #hich place a ne# "ata item on the
top o$ the tack% an" +<+% #hich remo!e the
item that i on the top o$ the tack.
A tack can be implemente" uing an array%
#ith a !ariable recor"ing the poition o$ the
top o$ the tack #ithin the array.
Stack are ue" $or e!aluating e&preion%
toring temporary "ata% toring local
!ariable "uring ubroutine call an" in a
number o$ "i$$erent algorithm.
3.3.3.2. 6ueues
A 'ueue i ue" to tore a number o$ item.
Item that are remo!e" $rom the 'ueue
appear in the ame or"er that they #ere
place" into the 'ueue.
A 'ueue i alo kno#n a a 1I1<% 1irt.In.
1irt.<ut tructure.
Gueue are ue" in tran$erring "ata bet#een
in"epen"ent procee% uch a inter$ace
#ith har"#are "e!ice an" inter.proce
communication.
3.3.4. Co$pacte- Data Structures
Memory uage can be re"uce" #ith "ata that
i not mo"i$ie" by placing the "ata in a
eparate table% an" replacing "uplicate"
entrie #ith a ingle entry.
3.3.4.1. Co$pacte- 'rrays
A compacte" array can ometime be ue" to
re"uce torage re'uirement $or a large array%
particularly #hen the "ata i tore" a a rea".
only re$erence% uch a tate tranition table
$or a $inite tate automaton.
In the cae o$ a t#o "imenional array% a
a""itional one."imenional array #oul" be
create".
7ntrie uch a blank an" "uplicate" ro#
coul" be remo!e" $rom the main array% an"
the remaining "ata compacte" to remo!e the
unue" ro#. Thi may in!ol!e orting the
array ro# o that a"8acent i"entical ro#
coul" be replace" #ith a ingle ro#.
The econ" array #oul" then be ue" a an
in"irect in"e& into the main array. The
original array in"e&e #oul" be ue" to in"e&
the ne# array% #hich #oul" contain the in"e&
into the compacte" main array.
An in"irectly a""ree" compacte" array i
ho#n belo#
3.3.4.2. Strin( Tables
1or e&ample% #here a et o$ tring i
recor"e" in a "ata tructure% a eparate tring
table can be create".
The tring table #oul" be an array containing
the tring% #ith one entry $or each uni'ue
tring. The main "ata table #oul" then
contain an in"e& into the tring table.
3.3.5. /t1er Data Structures
3.3.5.1. .as1 tables
ab
c
integer
#hile
i$
A hah table i a "ata tructure that i
"eigne" $or toring "ata that i accee"
uing a tring !alue rather than an integer
in"e&.
A hah table can be implemente" uing an
array% or a combination o$ an array an" a
linke" tructure.
Acceing an entry in a hah table i "one
uing a hah $unction. The hah $unction i a
calculation that generate a number in"e&
$rom the tring key.
The hah $unction i choen o that the
in"e&e that are generate" #ill be e!enly
prea" throughout the array% e!en i$ the tring
key are clutere" into group.
5hen the hah !alue i calculate" $rom the
input key% the "ata item may be tore" in the
array element in"e&e" by the hah !alue. I$
the entry i alrea"y in ue% another hah !alue
may be calculate" or a earch may be
per$orme".
Aetrie!ing item $rom the hah table i "one
by per$orming the ame calculation on the
input key to "etermine the location o$ the
"ata.
Acceing a hah table i lo#er than
acceing an array% a a calculation i
in!ol!e". 0o#e!er% the hah $unction ha a
$i&e" o!erhea" an" the acce pee" "oe not
re"uce a the i=e o$ the table increae.
Acce to a hah table can lo# a the table
become $ull.
0ah table pro!i"e a relati!ely $at #ay to
acce "ata by a tring key. 0o#e!er% item
in a hah table can only be accee"
in"i!i"ually% they cannot be retrie!e" in
e'uence% an" a hah table i more comple&
to implement than alternati!e "ata tructure
uch a tree.
3.3.5.2. .eap
A heap i an area o$ memory that contain
memory block o$ "i$$erent i=e. Thee
block may be linke" together uing a linke"
lit arrangement.
0eap are ue" $or "ynamic memory
allocation. Thi may inclu"e memory
allocation $or tring% an" memory allocate"
#hen ne# "ata item are create" a a
program run.
Implementing a heap can be "one uing
pointer an" a large block o$ memory. Thi
re'uire acceing the memory a a binary
block% an" creating link an" pace #ithin
the block% rather than treating the memory
pace a a program !ariable.
Enue" block are linke" together to $orm a
$ree lit% #hich i ue" #hen ne# allocation
are re'uire".
3.3.5.3. 4uer
A bu$$er i an area o$ memory that i
"eigne" to be treate" a a block o$ binary
"ata% rather than an in"i!i"ual "ata !ariable.
Bu$$er are ue" to hol" "atabae recor"%
tore "ata "uring a con!erion proce that
in!ol!e acceing in"i!i"ual byte #ithin
ab
c
the block% an" a a tran$er location #hen
tran$erring "ata to other procee or
har"#are "e!ice.
Bu$$er can be accee" uing pointer. In
ome language% a bu$$er may be han"le" a
an array "e$inition #ith the array containing
mall integer "ata type% #ith the aumption
that the memory block occupie a contiguou
ection o$ memory.
3.3.5.4. Te$porary Database
Although "atabae are generally ue" $or the
permanent torage o$ "ata% in ome cae it
may be ue$ul to ue a "atabae a a "ata
tructure #ithin a program.
+er$ormance #oul" be igni$icantly lo#er
than "irect memory accee ho#e!er the ue
o$ a "atabae a program element #oul" ha!e
e!eral a"!antage
A "atabae ha !irtually unlimite" i=e% either
tring or numeric !ariable can be ue" a
an in"e& !alue% ran"om accee are rapi"%
large gap bet#een numeric in"e& !alue are
automatically han"le" an" no co"e nee" to
be #ritten to implement the ytem.
3.3.6. #an(ua(e5Speciic Structures
Some language inclu"e "ata tructure
#ithin the ynta& o$ the language% in a""ition
to the commonly implemente" array an"
tructure type.

In the language 4IS+% $or e&ample% all "ata i
tore" #ithin lit% an" program co"e i
#ritten a intruction containe" #ithin lit.
Thee lit are implemente" "irectly #ithin
the ynta& o$ the language.
3.3.!. Data Structure Co$parison
Structur
e
Acce
Metho"
Aan"om
Acce
Time
A""ition
H
3eletion
Time
1ull
Scan
Memor
y
Eage
Array 3irect
In"e&
1 1 Ie 1 item
Search
(orte")
4og
2
(n) F
1
n J 2
Search
(unorte")
n J 2 1
4inke"
4it
Search n J 2 1 Ie 1 item
? 1
link
Binary
Tree
Search
(1ully
Balance")
log
2
(n) F 1 log
2
(n) F 1
(a""ition)
Ie 1 item
? 2
link
Search
(1ully
Enbalance
")
n J 2 n J 2
(a""ition)
0ah
Table
String 1 hah
$unction
1 hah
$unction
/o 1 item
?
imple
mentat
ion
o!erhe
a"
3.". #lgorithms
An algorithm i a tep by tep metho" $or
calculating a particular reult or per$orming a
proce.
1or e&ample% the $ollo#ing tep "e$ine the
orting algorithm kno#n a a bubble ort.
1. Scan the lit an" elect the mallet
item.
2. Mo!e the mallet item to the en" o$
the ne# lit.
3. Aepeat tep 1 an" 2 until all item
ha!e been place" into the ne# lit.
In many cae e!eral "i$$erent algorithm
can be ue" to per$orm a particular proce.
The algorithm may !ary in the comple&ity
o$ implementation% the !olume o$ "ata ue"
or generate"% an" the e&ecution time nee"e"
to complete the proce.
3.4.1. Sortin(
Sorting i a lo# proce that conume a
igni$icant proportion o$ all proceing time.
Sorting i ue" #hen a report or "iplay i
pro"uce" in a orte" or"er% an" #hen a
proceing metho" or algorithm in!ol!e the
proceing o$ "ata in a particular or"er.
Sorting i alo ue" in "ata tructure an"
"atabae to tore "ata in a $ormat that allo#
in"i!i"ual item to be locate" 'uickly.
A range o$ "i$$erent orting algorithm can be
ue" to ort "ata.
3.4.1.1. 4ubble Sort
The bubble ort metho" in!ol!e rea"ing the
lit an" electing the mallet item. The lit i
then rea" a econ" time to elect the econ"
mallet item% an" o on until the entire lit i
orte".
Thi proce i imple to implement an" may
be ue$ul #hen a lit contain only a $e#
item.
0o#e!er% the bubble ort techni'ue i
ine$$icient an" in!ol!e an or"er o$ n
2

comparion to ort a lit o$ ,n- item.
Sorting an array o$ one million "ata item
#oul" re'uire a trillion in"i!i"ual
comparion uing the bubble ort metho".
5hen more than a $e# "o=en item are
in!ol!e"% alternati!e algorithm uch a the
'uickort metho" can be ue".
3.4.1.2. 6uic2sort
Thee algorithm in!ol!e uing an or"er o$
n@log
2
(n) comparion to complete the
orting proce. In the pre!iou e&ample% thi
#oul" be e'ual to appro&imately 20 million
comparion $or the lit o$ one million item.
The 'uickort algorithm in!ol!e electing
an element at ran"om #ithin the lit. All the
item that ha!e a lo#er !alue than the pi!ot
element are mo!e" to the beginning o$ the
lit% #hile the item #ith a !alue that i
greater than the pi!ot element are mo!e" to
the en" o$ the lit.
Thi proce i then applie" eparately to
each o$ the t#o part o$ the lit% an" the
proce continue recuri!ely until the entire
lit i orte".
subroutine qsort(start_item as integer,
end_item as integer)
pivot_item as integer
bottom_item as integer
top_item as integer

pivot_item = start_item + (Rnd *
(end_item start_item))
bottom_item = start_item
top_item = end_item

!hile bottom_item " top_item

!hile data(bottom_item) "
data(pivot_item)
bottom_item = bottom_item + #
end

if bottom_item " pivot_item
tmp = data(bottom_item)
data(bottom_item) =
data(pivot_item)
data(pivot_item) = tmp
pivot_item = bottom_item
end

!hile data(top_item) $
data(pivot_item)
top_item = top_item #
end

if top_item $ pivot_item
tmp = data(top_item)
data(top_item) = data(pivot_item)
data(pivot_item) = tmp
pivot_item = top_item
end

end

if pivot_item $ start_item + #
qsort start_item, pivot_item #
end

if pivot_item " end_item #
qsort pivot_item + #, end_item
end
end
3.4.2. 4inary Tree Sort
A binary tree ort in!ol!e inerting the lit
!alue into a binary tree% an" canning the
tree to pro"uce the orte" lit.
Item are inerte" by comparing the ne#
item #ith the current no"e. I$ the item i le
than the current no"e% then the le$t path i
taken% other#ie the right path i taken.
The comparion continue at each no"e until
an en" point i reache" #here a ub.tree "oe
not e&it% an" the item i a""e" to the tree at
that point.
Scanning the tree can be "one uing a
recuri!e ubroutine. Thi ubroutine #oul"
call itel$ to proce the le$t ub tree% output
the !alue in the current no"e% an" then call
itel$ to proce the right ub.tree.
A binary tree ort i imple to implement.
5hen the input !alue appear in a ran"om
or"er% thi algorithm pro"uce a balance" tree
an" the orting time i o$ the or"er o$
n@log
2
(n).
0o#e!er% #hen the input "ata i alrea"y
orte" or i cloe to orte"% the binary tree
"egenerate into a imple linke" lit. In thi
cae% the orting time increae to an or"er o$
n
2
.
subroutine insert_item
if insert_value " current_value
if left_node_e%ists
ne%t_node = left_node
else
insert item as ne! left node
end
else
if right_node_e%ists
ne%t_node = right_node
else
insert item as ne! right node
end
end
end
subroutine tree_scan
if left node e%ists
call tree_scan on left node
end
output current node value
if right node e%ists
call tree_scan on right node
end
end
3.4.3. 4inary Searc1
A earch on a orte" lit can be con"ucte"
uing a binary earch.
Thi i a $at an" imple techni'ue that
re'uire appro&imately log
2
(n).1
comparion to locate an item. In a lit o$ one
million item% thi correpon" to
appro&imately 1K comparion.
In contrat a "irect can o$ the lit #oul"
re'uire an a!erage o$ hal$ a million
comparion.
A binary earch i per$orme" by comparing
the earch tring #ith the item in the centre
o$ the lit. I$ the earch tring ha a lo#er
!alue than the central item% then the $irt hal$
o$ the lit i electe"% other#ie the econ"
hal$ i electe".
The proce then repeat% "i!i"ing the
electe" hal$ in hal$ again. Thi proce i
repeate" until the item i locate".
&ubroutine binar'_search
found as integer
top_item as integer
bottom_item as integer
middle_item as integer

found = (alse
bottom_item = start_item
top_item = end_item

!hile not found )nd bottom_item "
top_item
middle_item = (bottom_item +
top_item) * +

if search_val = data(middle_item)
found = True
else
if search_val " data(middle_item)
top_item = middle_item #
else
bottom_item = middle_item + #
end
end
end

if not found Then
if search_val = data(bottom_item)
found = True
middle_item = bottom_item
end
end

binar'_serach = middle_item

end
3.4.4. Date Data Types
Some language "o not "irectly upport "ate
"ata type% #hile other language upport
"ate "ata type but implement a retricte"
"ata range.
3ate may be recor"e" internally a te&t
tring% ho#e!er thi may make comparion
bet#een "ata !alue "i$$icult.
Alternati!ely% "ata !ariable may be
implemente" a a numeric !ariable that
recor" the number o$ "ay bet#een a bae
"ate an" the "ata !alue itel$.
5hen a "ate !ariable i implemente" a a
t#o byte igne" integer !alue% thi "ate !alue
co!er a ma&imum "ata range o$ LK year.
3epen"ing on the election o$ the bae "ate%
the earliet an" latet "ate that can be
recor"e" may be le than 30 year $rom the
current "ate.
3ate implemente" in thi #ay cannot be
ue" to repreent a "ate in a long erie o$
hitorical "ata% an" thee "ate range may be
inu$$icient to recor" long.term calculation
in ome application.
The Bulian calen"ar i bae" on the number
o$ "ay that ha!e elape" ince the 1
t
o$
Banuary% 2M13 B).

Bulian "ata !alue can be tore" in a $our.
byte integer !ariable.
Integer !ariable are con!enient to ue an"
operation #ith integer "ata type e&ecute
'uickly. T#o "ate tore" a Bulian !ariable
can be "irectly compare" to "etermine
#hether one "ate i earlier than the other
"ate.
)on!erion bet#een a 8ulian !alue an" a
ytem "ate uing a t#o byte !alue can be
"one by ubtracting a number e'ual to the
number o$ "ay bet#een the ytem bae "ate
an" the 8ulian bae "ate.
The $ollo#ing algorithm can be ue" to
calculate a 8ulian "ate.
,date = -./ * 'ear 0 int( / * ('ear
+ int((month + 1) * #+)) *
2)
. int( - * (int(( 'ear +
(month 0 1) * /)
* #33) + #) * 2)
+ int( +/4 * month * 1) +
da' + #/+#3+564
3.4.5. Solvin( %7uations
In ome cae% the !alue o$ a !ariable in an
e'uation cannot be "etermine" by "irect
calculation.
1or e&ample% in the e'uation ,y ; & ? &
2
-% the
!alue o$ ,&- cannot be calculate" "irectly
$rom the e'uation.
In thee cae% an iterati!e approach can be
ue".
Thi in!ol!e uing an initial gue o$ the
olution% an" then repeate"ly calculating the
reult an" "etermining a more accurate
etimate o$ the olution #ith each iteration.
The $ollo#ing metho" ue t#o etimate o$
the reult% an" calculate a traight line
bet#een the !alue to "etermine an impro!e"
etimate o$ the olution.
Thi proce continue% #ith the t#o mot.
recent !alue being carrie" $or#ar" a ne#
etimate are pro"uce".
9i!en reaonable initial guee% thi metho"
may generate a olution #ith an accuracy o$
i& igni$icant $igure #ithin $i!e to ten
iteration.
Thi metho" "oe not ue the "eri!ati!e o$
the $unction or etimate the lope o$ the line
$rom in"i!i"ual !alue.
5hen a cur!e "iplay a 8agge" hape%
problem can arie #ith metho" that ue the
lope o$ the cur!e.
Bagge" cur!e ha!e a mooth hape at large
cale% but the "etail o$ mall ection o$ the
cur!e may "iplay harp mo!ement.
Thi can occur in practical ituation #here
the cur!e i "eri!e" $rom a large number o$
in"i!i"ual !alue that are relate" in a broa"
#ay% but #here mall change in the pattern
o$ !alue may reult in mall ran"om
mo!ement in the cur!e.
The $ollo#ing co"e outline a ubroutine
uing thi metho".
7 ' = f(%) is the function being evaluated6
7
7 8nsure that %=3 or some other value for 7%9
does not
7 generate a divideb':ero
7
7 '_result is the kno!n ;'< value
7 %_result is the value of ;%< that is
calculated for ;'_result<
subroutine solve_f%( '_result as
floating_point, %_result as floating_point)
define attempts as integer
define %#, %+, %-, '#, '+, '-, m, c as
floating_point
constant =)>_)TT8=?T& = #333
attempts = 3
7 use estimates that are reasonable
and are likel'
7 to be on either side of the correct
result
%# = #
%+ = #3
'# = f(%#)
'+ = f(%+)
repeat !hile ;'+< is further than 3633333# from ;'_target<
!hile (absolute_value( '_target 0 '+ ) $
3633333#
)@A attempts "
=)>_)TT8=?T&)
7 line bet!een %#,'# and %+,'+
Bf %+ %# "$ 3 then
m = ('+ 0 '#)*(%+ 0 %#)
c = '# 0 m * %#
else
7 unstable f(%), %#=%+ but
'#"$'+
attempts = =)>_)TT8=?T&
end
7 calculate a ne! estimate of 7%9
%- = ('_target 0 c) * m
'- = f(%-)
7 roll over to the t!o latest
points
%# = %+
'# = '+
%+ = %-
'+ = '-
attempts = attempts + #
end
if attempts $= =)>_)TT8=?T& then 7 failed
to find solution
solve_f% = false
%_result = 3
else
solve_f% = true
%_result = %+
end
end
3.4.6. Ran-o$isin( Data +te$s
In ome application% !alue are electe"
$rom a collection o$ item in a ran"om or"er.
Thi can be implemente" eaily uing an
array an" a ran"om number generator #hen
the item can be repeate"ly electe".
0o#e!er% #hen each item mut be electe"
once% but in a ran"om or"er% thi proce may
be "i$$icult to implement e$$iciently.
Selecting item $rom an array an" then
compacting the array to remo!e the blank
pace #oul" in!ol!e an or"er o$ n
2

operation to mo!e element #ithin the array.
Item can be "elete" "irectly $rom a linke"
lit% ho#e!er link lit item cannot be "irectly
accee" an" o cannot be electe" at
ran"om.
The $ollo#ing metho" ran"omie an input
lit o$ "ata item uing a metho" that
in!ol!e an or"er o$ n@log
2
(n) operation.
7ach item i $irt inerte" into a binary tree.
The path at each no"e i choen at ran"om%
#ith a *0N probability o$ taking the le$t or
the right path.
The ran"om choice o$ path enure that the
tree #ill remain appro&imately balance"%
regar"le o$ the or"er o$ the input "ata. 7ach
inertion into the tree #oul" in!ol!e
appro&imately log
2
(n) comparion.
5hen the tree ha been contructe"% a can o$
the tree i per$orme" to generate the output
lit.
Thi can be "one #ith a recuri!e ubroutine
that call itel$ $or the le$t ubtree% output
the !alue in the current no"e% then call itel$
$or the right ub.tree.
3.4.!. Subco$ponent an- C1ain
%&pansion
In ome application% tructure may contain
ub.tructure or connection that ha!e the
ame $orm a the main tructure.
1or e&ample% an engineering "eign may be
bae" on a tructure that contain ub.
tructure #ith the ame $orm a the main
tructure.
An in!etment port$olio may contain e!eral
in!etment% inclu"ing in!etment that are
part o$ other in!etment port$olio.
In thee cae% the !alue relating to the main
tructure can be "etermine" recuri!ely.
The in!ol!e calling a ubroutine to proce
each o$ the ub.tructure% #hich in turn may
in!ol!e the ubroutine calling itel$ to
proce ub.tructure #ithin the
ubtructure.
Thi proce continue until the en" o$ the
chain i reache" an" no $urther ub.tructure
are preent. 5hen thi occur% the calculation
can be per$orme" "irectly. Thi return a
reult to the pre!iou le!el% #hich calculate
the reult $or that le!el an" return to the
pre!iou le!el an" o $orth% until the proce
un#in" to the main le!el an" the reult $or
the main tructure can be calculate".
In ome cae a loop may occur. Thi coul"
not happen in a tan"ar" phyical tructure%
but in other application an inner
ubtructure may alo contain the entire outer
tructure.
In the in!etment port$olio e&ample%
port$olio A may contain an in!etment in
port$olio B% #hich in!et in port$olio )%
#hich in!et back into port$olio A.
In a tructural e&ample% the "ata #oul"
ugget that a bo& A #a ini"e another bo&
B% an" that bo& B #a alo ini"e bo& A.
Thi may be "ue to a "ata or proce error
recor"ing a ituation that i phyically
impoible or "oe not repreent a "e$inable
tructure.
A chain uch a thi cannot be "irectly
reol!e"% an" the "ata #oul" nee" to be
interprete" in the conte&t o$ the tructure a it
applie" to the particular application being
mo"elle".
3.4.". C1ec2su$ & CRC
)heckum an" )A) calculation can be
ue" to "etermine #hether a block o$ "ata
ha change".
Thi may be ue" in application uch a "ata
tran$er through "ata link% checking
#hether a block o$ memory ha been altere"
"uring a "ebugging proce% an" !eri$ication
o$ "ata #ithin har"#are "e!ice.

A checkum may in!ol!e umming the
in"i!i"ual binary !alue #ithin the block an"
recor"ing the total.
The ame calculation coul" then be
per$orme" at a $uture time% an" a "i$$erent
reult #oul" in"icate that the "ata ha" been
change".
A checkum i a imple calculation that may
"etect ome change% but it "oe not "etect
change uch a t#o !alue being e&change".
A )A) ()yclic Ae"un"ancy )heck)
calculation can "etect a #i"er range o$
change% inclu"ing !alue that ha!e been
tranpoe".
A checkum or )A) calculation cannot
guarantee that the "ata i unchange"% a thi
#oul" only be poible #ith a ran"om "ata
block by comparing the entire block #ith the
original !alue.
0o#e!er% a 2 byte )A) !alue can repreent
o!er $our billion !alue% #hich implie that a
ran"om change to the "ata #oul" only ha!e a
one in $our billion chance o$ generating the
ame )A) !alue a the original calculation.
Thee $igure #oul" only apply in the cae o$
a ran"om error. In cae #here "i$$erence
uch a tranpoing !alue may occur% thi
#oul" caue problem #ith ome
calculation uch a checkum that #oul"
generate the ame reult i$ the "ata #a
tranpoe".
3.4.8. C1ec2 Di(its
In the cae o$ tructure" number $ormat
uch a account number an" cre"it car"
number% a""itional "igit can be a""e" to
the number to "etect keying error an"
partially !ali"ate the number.
Thi can be "one by calculating a reult $rom
the number% an" toring the reult a
a""itional "igit #ithin the number.
1or e&ample% the "igit may be umme" an"
the reult inclu"e" a the $inal t#o "igit
#ithin the number.
A more comple& calculation #oul" normally
be ue" that coul" "etect "igit that #ere
tranpoe"% a tranpoition i a common
error an" i not "etecte" by a imple um o$
the !alue.
6eri$ying a number #oul" be "one by
per$orming the calculation #ith the main
"igit% an" comparing the calculate" reult
#ith the remaining "igit in the number.
3.4.19. +ni& to Posti& %&pression
Conversion
3.4.19.1.+ni& %&pressions
Mathematical e'uation an" $ormula are
generally preente" in an in$i& $ormat.
Binary operator #ithin in$i& e&preion
appear bet#een the t#o !alue that they
operate on.
In thi conte&t% the term binary "oe not re$er
to binary number% but re$er to operator
that take t#o argument% uch a a""ition.
Arithmetic e&preion ue arithmetic
prece"ence% o that ome operation% uch a
multiplication% are per$orme" be$ore other
operator uch a a""ition.
The tan"ar" le!el o$ arithmetic prece"ence
are>
1. Bracket
2. 7&ponentiation &
y
.
3. Enary minu /egati!e !alue
uch a .3 or .(2@2)
2. Multiplication% 3i!iion
*. A""ition% Subtraction
Bracket may be ue" to group operation
an" change the or"er o$ operation.
3ue to the iue o$ operator prece"ence% an"
the ue o$ bracket% an in$i& e&preion
cannot be "irectly e!aluate" by per$orming
the operation in a "irect or"er% uch a $rom
le$t to right in the e&preion.
In$i& e&preion mut be pare" be$ore they
can be e!aluate". Thi can be "one by uing
a parer uch a a recuri!e "ecent metho"%
an" e!aluating the e&preion a it i pare"
or generating interme"iate co"e.
3.4.19.2.Posti& %&pressions
A pot$i& e&preion i an alternati!e $ormat
$or e&preing an e&preion% that place the
operator a$ter the !alue that they operate
on.
Eing thi $ormat% bracket are not re'uire"%
an" operator prece"ence "oe not nee" to be
applie" to the e&preion a the prece"ence i
implie" in the or"er o$ the ymbol.
1or e&ample% the in$i& e&preion ,2 ? 3 @ *-
#oul" be con!erte" to a pot$i& e&preion o$
,3 * @ 2 ?-
+ot$i& e&preion can be e!aluate" "irectly
$rom le$t to right.
Thi can be "one uing a tack% #here a !alue
in the e&preion i puhe" on to the tack%
an" an operator pop the argument $rom the
tack% calculate the reult% an" puhe the
reult on to the tack.
5hen a !ali" e&preion i e!aluate"% a
ingle reult houl" remain on the tack a$ter
the e&preion e!aluation i complete% an"
thi houl" e'ual the reult o$ the e&preion.
7&preion may be tore" internally in a
pot$i& $ormat% o that they can be "irectly
e!aluate".
)o"e generation e$$ecti!ely generate co"e to
e!aluate e&preion in a pot$i& or"er.
3.4.19.3.+ni& to Posti& conversion
)on!erion $rom an in$i& $ormat to a pot$i&
$ormat can be "one uing a binary tree.
3uring the pare% a tree i built o$ the
e&preion containing a no"e $or each
operator an" !alue. A binary operator no"e
#oul" ha!e t#o ubtree% #ith one argument
appearing in the le$t ub tree an" one
argument appearing in the right ub tree.
Thee ub tree may themel!e be complete
e&preion.
The pare tree can be built "uring the pare%
#ith a no"e create" at each le!el an"
returne" to the ne&t highet le!el to be
connecte" a a ubtree. Thi reult in the
tree being built uing a bottom.up approach.
9enerating the pot$i& e&preion can be
"one by uing a recuri!e ubroutine to can
the tree. Thi ubroutine #oul" call itel$ to
proce the le$t ub tree% then call itel$ to
proce the right ub tree% then output the
!alue in the current no"e.
The output coul" be implemente" a a erie
o$ intruction tore" in a table.
3.4.19.4.%valuation
The e&preion can be e!aluate" by rea"ing
each intruction in e'uence. I$ the
intruction i a puh intruction% then the "ata
!alue i puhe" on to the tack. I$ the
intruction i an operator% then the operator
pop the argument $rom the tack% calculate"
the reult% an" puhe the reult on to the
tack.
1or e&ample% the $ollo#ing in$i& e&preion
may be the input tring
% = + * / + ((2 * 4) 0 -)
+aring thi e&preion an" buil"ing a
bottom.up pare tree #oul" pro"uce a
tructure imilar to the $ollo#ing "iagram.
9enerating the pot$i& e&preion by
canning the pare tree lea" to the $ollo#ing
e&preion.
% = 2 4 * - 0 + / * +
Thi e&preion coul" be "irectly tranlate"
into intruction% a in the $ollo#ing lit
puh 2
puh *
multiply
2
@
.
*
3 M
@
2
?
puh 3
ubtract
puh 2
puh M
multiply
a""
7&ecuting the e&preion #oul" lea" to the
$ollo#ing e'uence o$ tep. In thi e&ample
the tack content are ho#n #ith the item on
the top o$ the tack ho#n at the le$t i"e o$
the column.
Cperation &tack contents
push 2
2
push 4
4 2
multipl'
+3
push -
- +3
subtract
#/
push +
+ #/
push /
/ + #/
multipl'
#2 #/
add
-
Thi proce en" #ith the tack containing
the reult .3% #hich i the correct reult o$ the
original e&preion.
3.4.11. Re(ular %&pressions
A regular e&preion i a te&t pattern.
matching metho".
Aegular e&preion $orm a imple language
an" can be tranlate" into a $inite tate
automaton. Thi allo# the pattern #ithin
the input te&t to be i"enti$ie" in a ingle pa%
regar"le o$ the comple&ity o$ the te&t
pattern.
The operator #ithin a regular e&preion are
lite" belo#.
a The letter A (or #hiche!er letter or
phrae i electe")
OabcP Any one o$ the letter a% b or c (or other
letter #ithin bracket)
OQabcP Any letter not being a% b or c (or other
letter #ithin bracket)
a@ The letter ,a- repeate" =ero or more
time (or other phrae)
a? The letter ,a- repeate" one or more
time (or other phrae)
aC The letter ,a- occurring optionally (or
phrae)
. Any character
(a) The phrae or ub.pattern ,a-
a.= Any letter in the range ,a- to =- (or
other range)
aRb The phae ,a- or ,b- (or other phrae)
1or e&ample% the pattern peci$ying a
!ariable name #ithin a programming
language may be "e$ine" uing the $ollo#ing
regular e&preion
Oa.=A.STPOa.=A.S0.KTP@
Thi #oul" be interprete" a an initial
character being a letter in the range a.= or A.
S% or an un"ercore character% $ollo#e" by a
character in the range a.=% A.S% 0.K or an
un"ercore% repeate" =ero or more time.
Thi pattern #oul" match te&t item uch a
,&-% ,Taa-% ,"3-% but #oul" not match
pattern uch a ,3"c- or ,aN-.
Aegular e&preion can alo be ue" in te&t
earching. 1or e&ample% the $ollo#ing
e&preion #oul" match the #or" ,te&t
canning- or ,canning te&t-% eparate" by an
character repeate" =ero or more time.
(te&t.@canning)R(canning.@te&t)
A another e&ample% a earch $or the #or"
,ub- in program co"e may e&clu"e #or"
uch a ,ubtract- an" ,ub8ect- by uing a
pattern uch a ,ubOQa.=P-. Thi #oul"
match any te&t that containe" the letter
,ub- an" #a $ollo#e" by a character that
#a not another letter.
3.4.12. Data Co$pression
3ata compreion i ue" to re"uce torage
pace% an" to increae the rate o$ "ata tran$er
through communication channel.
A #i"e range o$ "ata compreion techni'ue
an" algorithm are ue"% ranging $rom the
tri!ial to the highly comple&.
3ata compreion approache inclu"e
i"enti$ying common pattern #ithin "ata% an"
replacing common pattern #ith a maller
"ata item.
In compreing te&t% run length enco"ing
in!ol!e replacing a tring o$ i"entical
character% uch a pace% #ith a ingle
character an" a number peci$ying the
number o$ occurrence.
5ithin a te&t "ocument% entire #or" coul"
be replace" #ith number co"e.
0u$$man enco"ing in!ol!e replacing $i&e"
character i=e #ith !ariable bit co"e. In
tan"ar" te&t% character may be repreente"
a eight.bit !alue. In a ection o$ te&t%
ho#e!er% ome character may occur more
o$ten than other.
In thi cae% $re'uent character coul" be
replace" #ith * or U bit co"e% #ith le
$re'uent character replace" #ith 10 an" 11
bit co"e.
)ompreion techni'ue ue" #ith ample"
"ata uch a graphic image an" oun" $all
into t#o categorie.
4ole techni'ue preer!e the original
"ata #hen they are "ecompree". Thi coul"
in!ol!e replacing a repeating ection o$ the
"ata% uch a an area containing a ingle
colour% #ith a ingle !alue an" co"e
repreenting the location o$ the area.
5ithin "ata uch a !i"eo e'uence%
multiple i"entical $rame coul" be replace"
#ith a ingle $rame an" a count o$ the
number o$ occurrence% an" $rame that "i$$er
lightly coul" be replace" #ith a ingle $rame
an" in$ormation i"enti$ying the "i$$erence to
the ne&t $rame.
)ompaction techni'ue coul" in!ol!e toring
"ata uch a i& bit !alue acro byte
boun"arie% rather than toring each i& bit
!alue #ithin a tan"ar" eight bit byte an"
lea!ing t#o bit unue".
4oy techni'ue o$$er a higher compreion
ratio% but #ith a lo in "etail o$ the "ata.
3ata compree" uing a loy metho"
permanently loe "etail an" cannot be
retore" to the original "ata.
4oy metho" inclu"e re"ucing the number
o$ bit ue" to recor" each "ata item%
replacing a"8acent imilar area #ith a ingle
!alue% an" $iltering "ata to remo!e
component uch a barely !iible or barely
au"ible in$ormation.
1ractal techni'ue may in!ol!e !ery high
compreion ratio. A $ractal i an e'uation
that can be ue" to generate repeating
tructure% uch a clou" an" $ern lea!e.
1ractal compreion in!ol!e $iltering "ata
an" "e$ining an alternati!e et o$ "ata that
can be ue" to generate a imilar image or
in$ormation to the original "ata.
3.$. Techni%ues
3.5.1. )inite State 'uto$aton
A $inite tate automaton i a mo"el o$ a
imple machine. The machine #ork by
recei!ing input character% an" changing to a
ne# tate bae" on the current tate an" the
input character recei!e".
Thi i a imple but !ery po#er$ul techni'ue
that can be ue" in a #i"e range o$
application.
1inite tate machine are able to "etect
comple& pattern #ithin input "ata. 3ue to
their imple operation% a $inite tate machine
e&ecute e&tremely 'uickly.
The 1SA conit o$ a loop o$ co"e% an" a
tate tranition table that peci$ie the ne&t
tate to change to% bae" on the current tate
an" the ne&t input character.
A comple& mo"el increae the i=e o$ the
"ata table% ho#e!er the co"e remain
unchange" an" the e&ecution re'uire only a
ingle array re$erence to proce each input
character.
+aring program co"e can be per$orme" by
"e$ining a grammar o$ the language
tructure% an" uing an algorithm to con!ert
the grammar "e$inition into a $inite tate
automaton.
Te&t pattern can be peci$ie" uing regular
e&preion% #hich can alo be tranlate" into
an 1SA.
An e&ample o$ a $inite tate automaton i the
$ollo#ing "ecription o$ a tate tranition
table that i"enti$ie a certain pattern #ithin
te&t.
Thi i a pattern that "e$ine program
comment that begin #ith the e'uence ,J@-
an" en" #ith the e'uence ,@J-.
State /e&t )haracter /e&t State 5ithin a
comment
1 not ,J-- 1 /o
,J- 2
2 not ,@- or ,J- 1 /o
,J- 2
,@- 3
3 not ,@- 3 Ie
,@- 2
2 not ,@- or ,J- 3 Ie
,@- 2
,J- 1
The ytem begin in tate 1% an" each
character i rea" in turn. The ne&t tate i
"etermine" $rom the current tate an" the
input character.
1or e&ample% i$ the ytem #a in tate 2 at a
certain point in the proceing% an" the ne&t
character #a a ,J-% then the ytem #oul"
remain in tate 2. I$ the character #a a ,@-%
the ytem #oul" change to tate 3% an" $or
any other character the ytem change to
tate 1.
1
2
3
2
J
/ot J
/ot @ or J
J
J
@
/ot @
/ot @
or J
The current tate coul" be tore" a the !alue
o$ an integer !ariable.
The proce #oul" continue% changing tate
each time a ne# character #a rea" until the
en" o$ the input #a reache".
3uring proceing% any time that the current
tate #a tate 3 or tate 2% thi #oul"
in"icate that the proceing #a #ithin a
comment% other#ie the proceing #oul" be
outi"e a comment.
Thi proce coul" be ue" to e&tract
comment $rom the co"e.
/o backtracking i re'uire" to han"le
e'uence uch a ,J@J@@J- that may appear
#ithin the te&t
3.5.2. S$all #an(ua(es
In ome application a language may be
"e!elope" peci$ically $or a ingle
application.
Thi may in!ol!e "e!eloping a macro
language $or peci$ying $ormula an"
con"ition% #here the language co"e coul" be
tore" in a "atabae te&t $iel" or ue" #ithin
an application.
Another e&ample may in!ol!e a language $or
"e$ining the chemical tructure o$ molecule
an" compoun". Thi #oul" be a "eclarati!e
language an" #oul" not in!ol!e generating
co"e an" e&ecution% ho#e!er it #oul"
in!ol!e le&ical analyi an" paring to e&tract
the in"i!i"ual item an" tructure #ithin the
"e$inition.
A language can be "e$ine" #ith tatement%
"ata ob8ect an" operator that are peci$ic to
the tak being per$orme". 1or e&ample%
#ithin a "atabae management ytem a tak
language coul" be "e$ine" #ith "ata type
repreenting a recor"% in"e& no"e% cache
table entry etc% an" operator to mo!e recor"
bet#een bu$$er% "ata page an" "ik torage.
Aoutine coul" then be #ritten in the tak
language to implement proce"ure uch a
up"ating a recor"% creating a ne# in"e& an"
o $orth.
The broa" tep in!ol!e" in implementing a
mall language are>
4e&ical analyi
+aring
)o"e 9eneration
7&ecution
3.5.2.1. #e&ical 'nalysis
4e&ical analyi i the proce o$ i"enti$ying
the in"i!i"ual element #ithin the input te&t%
uch a number% !ariable name% comment%
an" operator uch a ,?- an" ,:;-.
Thi proce can be "one uing proce"ural
co"e. Alternati!ely% the pattern can be
"e$ine" a regular e&preion te&t pattern%
an" an algorithm ue" to con!ert the regular
e&preion into a $inite tate automaton that
can be ue" to can the input te&t.
The le&ical analyi phae may pro"uce a
erie o$ token% #hich are numeric co"e
i"enti$ying the element in the input tream.
The e'uence o$ token can be tore" in a
table #ith the numeric co"e $or the token%
an" any aociate" "ata !alue uch a the
actual !ariable name or number contant.
3.5.2.2. Parsin(
+aring or ynta& analyi i the proce o$
i"enti$ying the tructure #ithin the input
te&t.
The language can be "e$ine" uing a
grammar "e$inition #hich #oul" peci$y the
tructure o$ the language.
<ne approach i to ue an algorithm to
con!ert the grammar to a $inite tate
automaton $or paring% ho#e!er thi may be
a comple& proce.
Another alternati!e i to ue a recuri!e
"ecent parer% #hich i a $at an" imple
paring techni'ue that i relati!ely eay to
implement.
3.5.2.3. Direct %&ecution
5hen the language conit o$ e&preion
only% an" "oe not in!ol!e eparate
tatement% the !alue o$ the e&preion can be
calculate" a it i being pare".
Thi #oul" in!ol!e calculating a reult at
each point in the recuri!e "ecent parer an"
paing the reult back up to the pre!iou
le!el o$ the e&preion.
An a"!antage o$ thi metho" i that it i
imple to implement% an" no $urther tage
#oul" be re'uire" in the proceing.
0o#e!er% thi metho" #oul" in!ol!e paring
the e&preion e!ery time it #a e!aluate". I$
a ingle $ormula #a applie" to many "ata
item then thi approach #oul" be lo#er
than continuing the proce to a co"e
generation tage.
Alo% thi metho" may not be practical #hen
the language inclu"e tatement uch a
con"ition an" loop.
3.5.2.4. Co-e ,eneration
)o"e generation may in!ol!e generating
interme"iate co"e that i e&ecute" by a run.
time proceing loop.
The interme"iate co"e coul" conit o$ a
table o$ intruction% #ith each entry
containing an intruction co"e an" poibly
other "ata% uch a a !ariable name or
!ariable re$erence.
Intruction #oul" be e&ecute" in e'uence%
an" branch intruction coul" be a""e" to
8ump to "i$$erent point #ithin the co"e
bae" on the reult o$ e&ecuting e&preion
#ithin ,i$- tatement an" loop con"ition.
A each tructure #ithin the co"e i pare"%
interme"iate co"e intruction coul" be
generate". Thi coul" in!ol!e a""ing
a""itional entrie to the table o$ interme"iate
co"e.
Eing a tack to e&ecute e&preion% the
baic operation o$ a imple thir".generation
language coul" be implemente" uing the
$ollo#ing intruction.
6ariable name re$erence
+ES0 !ariable name (puhe a ne# !alue
on to the tack)
Aignment operator
+<+ !ariable name (remo!e a !alue
$rom the tack an" tore
it in the
!ariable)
<perator (e.g. multiplication)
ME4T (e.g. multiply the
top t#o tack !alue
an"
replace
#ith the
reult)
,i$- tatement
Allocate label poition V
9enerate co"e $or the ,i$- con"ition
9enerate a T7ST 8ump intruction to 8ump to label
V i$ tack reult i $ale
9enerate the co"e $or the tatement block #ithin
the ,i$- tatement
3e$ine the poition o$ label V a thi point in the
co"e
4oop
Allocate label poition V
Allocate label poition I
3e$ine thi poition in the co"e a the poition o$
label I
9enerate co"e $or the loop e&preion con"ition
9enerate a T7ST 8ump intruction to 8ump to label
V i$ tack reult i $ale
9enerate the co"e $or the loop tatement
9enerate a 8ump intruction to label I
3e$ine label V a thi poition in the co"e
5hen the co"e ha been generate"% a econ"
pa can be "one through the co"e to replace
the label name #ith the poition in the co"e
that they re$er to.
In thi co"e the ME4T operator i ue" a an
e&ample an" imilar co"e coul" be generate"
$or each arithmetic operation% $or comparion
operator uch a ,:-% an" $or Boolean
operator uch a ,A/3-.
/o proceing i re'uire" $or bracket% a thi
i automatically han"le" by the paring tage.
The paring operation enure that the co"e
i generate" in the correct e'uence to be
e&ecute" "irectly uing a tack.
3.5.2.5. Run5Ti$e %&ecution
5hen the interme"iate co"e ha been
generate"% it can be e&ecute" uing a run
time e&ecution routine.
Thi routine #oul" rea" each intruction in
turn an" per$orm the operation. The
operation coul" inclu"e retrie!ing a
!ariable( !alue an" puhing it on to the
tack% popping a reult $rom the tack an"
toring it in a !ariable% per$orming an
operation% uch a ME4T or 47SST0A/%
an" placing the reult on the tack% an"
changing the poition o$ the ne&t intruction
bae" on a 8ump intruction.
In the cae #here all !alue #ere numeric%
inclu"ing intruction% 8ump location an"
!ariable location re$erence% e&ecution pee"
coul" be 'uite high.
3.5.3. Recursion
Aecurion i a imple but po#er$ul techni'ue
that in!ol!e a ubroutine calling itel$.
Thi ubroutine call "oe not erae the
pre!iou ubroutine call% but $orm a chain o$
call that return to the pre!iou le!el a each
call terminate.
Aecurion i ue" $or proceing recuri!ely
"e$ine" "ata tructure uch a tree. Many
algorithm are alo recuri!e or inclu"e
recuri!e component.
1or e&ample% the 'uickort algorithm ort
lit by electing a central pi!ot element% an"
then mo!ing all item that are le that the
pi!ot element to the tart o$ the lit% an" the
item that are larger than the pi!ot element to
the en" o$ the lit.
Thi operation i then per$orme" on each o$
the t#o ublit. 5ithin each ublit% t#o
other ublit #ill be create" an" o the
proce continue until the entire lit i
orte".
Thi algorithm can be implemente" uing a
recuri!e ubroutine that per$orm a ingle
le!el o$ the proce% an" then call itel$ to
operate on each o$ the ub part.
The recuri!e "ecent paring metho" i a
recuri!e metho" #here a ubroutine i
calle" $or each rule #ithin the language
grammar% an" ubroutine may in"irectly call
themel!e in cae uch a bracket% #here
an e&preion may e&it #ithin another
e&preion.
A can o$ a binary tree #oul" generally be
"one uing a recuri!e routine that procee
a ingle no"e an" then call itel$ to proce
each o$ the ub tree.
Aecuri!e co"e can be igni$icantly impler
than alternati!e implementation that ue
loop.
In ome language a ubroutine call erae
the pre!iou !alue o$ the ubroutine(
!ariable an" recurion i not "irectly
upporte".
In thee cae% a loop can be ue" #ith a
tack "ata tructure implemente" a an array.
In thi cae a ne# !alue i puhe" on to the
tack #hen a ubroutine call #oul" occur%
an" poppe" $rom the tack #hen a ubroutine
call #oul" terminate.
3.5.4. #an(ua(e ,ra$$ars
Some programming language ue a ynta&
that i bae" on a combination o$ peci$ic
te&t layout "etail% an" $ormal tructure $or
e&preion.
In other cae% the language tructure can be
completely peci$ie" by uing a $ormal
tructure uch a a B/1 (Backu /aur 1orm)
grammar.
Thi i a impler an" more $le&ible approach
than uing a layout "e$inition% both $or
paring an" $or uing the language itel$.
The ue o$ a B/1 grammar ha the
a"!antage that a parer can be pro"uce"
"irectly $rom the grammar "e$inition uing
e!eral "i$$erent metho".
1or e&ample% a recuri!e "ecent parer can
be contructe" by #riting a ubroutine $or
each le!el in the grammar "e$inition.
A B/1 grammar conit o$ terminal an"
non.terminal item. Terminal repreent
in"i!i"ual input token uch a a !ariable
name% operator or contant.
/on.terminal peci$y the $ormat o$ a
tructure #ithin the language% uch a a
multiplication e&preion or an ,i$-
tatement.
/on.terminal may be "e$ine" #ith e!eral
alternati!e $ormat. 7ach $ormat can contain
a combination o$ terminal an" non.terminal
item.
The "e$inition $or each rule peci$y the
tructure that are poible #ithin the
grammar% an" may reult in the prece"ence o$
"i$$erent operator uch a multiplication an"
a""ition being reol!e" though the ue o$
"i$$erent non.terminal rule.
The e&ample belo# ho# a B/1 grammar
$or a imple language that inclu"e
e&preion an" ome tatement.
statementlistD "statement$
"statement$
"statementlist$
statementD B( "e%pression$ TE8@
"statementlist$ 8@A
FEBG8 "e%pression$
"statementlist$ 8@A
variable_name =
"e%pression$
e%pressionD "adde%pression$ )@A
"e%pression$
"adde%pression$ CR
"e%pression$
adde%pressionD "multe%pression$ +
"adde%pression$
"multe%pression$
"adde%pression$
multe%pressionD "unar'e%pression$ * "
multe%pression $
"unar'e%pression $ * "
multe%pression $
unar'e%pressionD constant
variable_name
"e%pression$
( "e%pression$ )
3.5.5. Recursive -escent parsin(
Aecuri!e "ecent paring i a paring
metho" that i imple to implement an"
e&ecute 'uickly.
Thi metho" i a top."o#n paring techni'ue
that begin #ith the top.le!el tructure o$ the
language% an" progrei!ely e&amine
maller element #ithin the language
tructure.
Bottom.up paring metho" #ork by
"etecting mall element #ithin the input te&t
an" progrei!ely buil"ing thee up in to
larger tructure o$ the grammar.
Bottom.up techni'ue may be able to proce
more comple& grammar than top."o#n
metho" but may alo be more "i$$icult to
implement.
Some programming language can be pare"
uing a top."o#n metho"% #hile other ue
more comple& grammar an" re'uire a
bottom.up approach
Aecuri!e "ecent paring in!ol!e a
ubroutine $or each le!el in the language
grammar. The ubroutine ue the ne&t input
token to "etermine #hich o$ the alternati!e
rule applie% an" then call other ubroutine
to proce the component o$ the tructure.
1or e&ample% the non.terminal ymbol
,tatement- may be "e$ine" in a grammar
uing the $ollo#ing rule>
statementD B( "e%pression$ TE8@
"statementlist$ 8@A
FEBG8 "e%pression$
"statementlist$ 8@A
variable_name =
"e%pression$
The ubroutine that procee a tatement
#oul" check the ne&t token% #hich may be
an ,I1-% a ,50I47-% a !ariable name% or
another token #hich may reult in a ynta&
error being generate".
A$ter "etecting the appropriate rule% the
ubroutine $or ,e&preion- an"
,tatementlit- #oul" be calle". )o"e coul"
then be generate" to per$orm the 8ump in the
co"e bae" on the con"ition in the ,i$-
tatement or loop% or in the cae o$ the
aignment operator% co"e coul" be generate"
to copy the reult o$ the e&preion into the
!ariable.
9rammar can ometime be a"8ute" to
make them uitable $or top."o#n paring by
altering the or"er #ithin rule #ithout
a$$ecting the language itel$.
1or e&ample% changing the rule $or an
,a""e&preion- in the $ollo#ing #ay coul"
be ue" to make the rule uitable $or top.
"o#n paring #ithout altering the language.
Initial rule>
adde%pressionD "adde%pression$ +
"multe%pression$
A"8ute" rule
adde%pressionD "multe%pression$ +
"adde%pression$
In the a"8ute" rule the ne&t le!el o$ the
grammar% ,multe&preion-% can be calle"
"irectly.
5hen a language i being create"%
a"8utment can be ma"e to the grammar to
make it uitable $or paring uing thi
metho". Thi may inclu"e inerting ymbol
in poition to eparate element o$ the
language.
1or e&ample% the $ollo#ing rule may not be
able to be pare" a the parer may not be
able to "etermine #here an ,e&preion-
en" an" a ,tatementlit- begin.
statementD B( "e%pression$
"statementlist$ 8@A
Thi language coul" be altere" by inerting a
ne# key#or" to eparate the element in the
$ollo#ing #ay>
statementD B( "e%pression$ TE8@
"statementlist$ 8@A
A recuri!e "ecent pare may in!ol!e
generating interme"iate co"e% or e!aluating
the e&preion a it i being pare".
5hen the e&preion i "irectly e!aluate"%
the calculation can be per$orme" #ithin each
ubroutine% an" the reult pae" back to the
pre!iou le!el $or $urther calculation.
The tructure o$ the ubroutine call
automatically han"le iue uch a
arithmetic prece"ence% #here multiplication
are per$orme" be$ore a""ition.
3.5.6. 4it$aps
Bitmap in!ol!e the ue o$ in"i!i"ual bit
#ithin a numeric !ariable.
Thi may be ue" #hen "ata i procee" a
pattern o$ bit% rather than number. Thi
occur #ith application uch a the
proceing o$ graphic "ata% encryption% "ata
compreion an" har"#are inter$acing.
Typically "ata i compoe" o$ byte% #hich
each contain eight in"i!i"ual bit. Integer
!ariable may conit o$ 1% 2% or 2 byte o$
"ata.
In ome language a continuou block o$
memory can accee" uing a metho" uch a
an array o$ integer% #hile in other language
the !ariable in the array are not guarantee"
to be contiguou in memory an" there may
be pace bet#een the in"i!i"ual "ata item.
Bitmap can alo be ue" to tore "ata
compactly. 1or e&ample% a Boolean !ariable
may be implemente" a an integer !alue% but
in $act only a ingle bit i re'uire" to
repreent a Boolean !alue.
Storing e!eral Boolean $lag uing "i$$erent
bit #ithin a !ariable allo# 1U in"epen"ent
Boolean !alue to be recor"e" #ithin a 2.
byte integer !ariable.
Storing $lag #ithin bit allo# e!eral $lag
to be pae" into ubroutine an" "ata
tructure a a ingle !ariable.
Bit manipulation i "one uing the bit#ie
operator A/3% <A an" /<T.
The bit#ie operator ha!e the $ollo#ing
reult
A/3 1 i$ both bit are et to 1% other#ie the
reult i 0
<A 1 i$ either one bit or both bit are et to
1% other#ie the reult i 0
/<T 1 i$ the bit i 0 an" 0 i$ the bit i 1
V<A 1 i$ one bit i 1 an" the other bit i 0%
other#ie the reult i 0
The operation per$orme" on a bit are teting
to check #hether the bit i et% etting the bit
to 1% an" clearing the bit to 0.
A bit can be checke" uing an A/3
operation #ith a tet !alue that contain a
ingle bit et% #hich i the bit being tete".
1or e&ample
6alue 01011011
Tet 6alue 00001000
6alue A/3 Tet 6alue 00001000
I$ the reult i non.=ero then the bit being
checke" i et.
)ontant may be #ritten uing he&a"ecimal
number or "ecimal number.
In the cae o$ "ecimal !alue% the !alue
#oul" be t#o raie" to the po#er o$ the
poition o$ the bit% #ith poition
commencing at =ero in the rightmot place
an" increaing to the le$t o$ the number.
In the cae o$ he&a"ecimal number% each
group o$ $our bit correpon" to a ingle
he&a"ecimal "igit.
The $ollo#ing number #oul" be e'ui!alent
Binary 01011011
0e&a"ecimal *B
A bit can be et uing the <A operator #ith a
tet !alue than contain a ingle bit et.
1or e&ample
6alue 01011011
Tet 6alue 00000100
6alue <A Tet 6alue 01011111
A bit can be cleare" by uing a combination
o$ the /<T an" A/3 operator #ith the tet
!alue
1or e&ample
6alue 01011111
Tet 6alue 00000100
/<T Tet 6alue 11111&11
6alue A/3 /<T Tet 6alue 01011&11
3.5.!. ,enetic 'l(orit1$s
9enetic algorithm are ue" $or optimiation
problem that in!ol!e a large number o$
poible olution% an" #here it i not
practical to e&amine each olution
in"epen"ently to "etermine the optimum
reult.
1or e&ample% a ytem may control the
che"uling o$ tra$$ic ignal. In thi e&ample%
each ignal may ha!e a !ariable "uty cycle%
being either re" or green $or a $i&e"
proportion o$ time% ranging $rom 10N to K0N
o$ the time. Thi repreent nine poible
!alue $or the "uty cycle.
<ne approach #oul" be to et all tra$$ic
ignal to a *0N "uty cycle% ho#e!er thi
may impe"e natural tra$$ic $lo#.
In a city.#i"e tra$$ic net#ork #ith 1000
tra$$ic ignal% there #oul" be K
1000
poible
combination o$ tra$$ic ignal e'uence.
Thi i an e&ample o$ an optimiation
problem in!ol!ing a large number o$
in"epen"ent !ariable.
A genetic algorithm approach in!ol!e
generating e!eral ran"om olution% an"
creating ne# olution by combining e&iting
olution.

In thi e&ample% a ran"om et o$ ignal
e'uence coul" be create"% an" then a
imulation coul" be ue" to "etermine the
appro&imate tra$$ic $lo# rate bae" on the
ignal e'uence an" typical roa" uage.
A$ter the ran"om olution are checke"% a
ne# et o$ olution i generate" $rom the
e&iting olution.
Thi may in!ol!e "icar"ing the olution
#ith the lo#et reult% an" combining the
remaining olution to generate ne#
olution.
1or e&ample% t#o remaining olution coul"
be combine" by electing a ignal e'uence
$or each tra$$ic ignal at ran"om $rom one o$
the t#o e&iting olution.
Thi #oul" reult in a ne# olution #hich
#a a combination o$ the t#o e&iting
olution.
/e# ran"om olution coul" then be
generate" to retore the total number o$
olution to the pre!iou le!el.
Thi cycle #oul" be repeate"% an" the
proce i continue" until a olution that
meet a threhol" reult i $oun"% or olution
may be "etermine" #ithin the proceing
time a!ailable.
In ome cae a genetic algorithm approach
can locate a uperior olution in a horter
perio" o$ time than alternati!e techni'ue
that ue a ingle olution that i continually
re$ine".
3.&. Code !odels
)o"e can be tructure" in !ariou #ay. In
ome cae% "i$$erent co"e mo"el can be
combine" #ithin a ingle ection o$ co"e.
In other cae% changing the co"e mo"el
in!ol!e a $un"amental change #hich turn
the co"e ini"e.out% an" in!ol!e completely
re#riting the co"e to per$orm the ame
$unction a the original program.
)hanging co"e mo"el can ha!e a "ratic
e$$ect on the !olume o$ co"e% e&ecution
pee" an" co"e comple&ity.
3.6.1. Process Driven Co-e
+roce "ri!en co"e in!ol!e uing
proce"ural tep to per$orm peci$ic
proceing.
Thi approach lea" to clear co"e that i eay
to rea" an" maintain. +roce "ri!en co"e
can be "e!elope" 'uickly an" i relati!ely
eay to "ebug.
0o#e!er% large !olume o$ co"e may be
pro"uce".
Alo% ytem #ritten in thi #ay may be
in$le&ible% an" large ection o$ co"e may
nee" to be re#ritten #hen a $un"amental
change i ma"e to a "atabae tructure or a
proce.
3.6.2. )unction Driven Co-e
1unction "ri!en co"e in!ol!e "e!eloping a
et o$ mo"ule that per$orm general $unction
#ith et o$ "ata.
The application itel$ i #ritten uing co"e
that call the general $acilitie to per$orm the
actual procee an" calculation.
1unction "ri!en co"e may in!ol!e maller
co"e !olume than proce "ri!en co"e%
ho#e!er the co"e may be more comple&.
1unction "ri!en co"e may $ollo# a
"e$initional pattern.
1or e&ample% a proce "ri!en approach to
printing a report may in!ol!e calling
ubroutine to rea" the "ata% calculate
$igure% ort the reult% $ormat the output an"
print the report.
7ach ubroutine #oul" per$orm a ingle tep
in the proce.
In a $unction "ri!en approach% ubroutine
may be calle" to "e$ine the "ata et% "e$ine
the calculation% peci$y the ort or"er% elect
a $ormatting metho"% an" $inally generate
an" print the report.
The report generation an" printing #oul" be
"one uing a general routine% bae" on the
"e$inition that ha" been pre!iouly electe".
3.6.3. Table Driven Co-e
Table "ri!en co"e can be ue" in procee
that in!ol!e repeate" call to the ame
ubroutine or proce.
Table "ri!en co"e in!ol!e creating a table o$
contant% an" #riting a loop o$ co"e that
rea" the table an" per$orm a $unction $or
each entry in the table.
1or e&ample% the te&t item on a menu or
creen "iplay coul" be tore" in a table.
A loop o$ co"e #oul" then rea" the table an"
call the menu or creen "iplay $unction $or
each entry in the table.
Thi approach i alo ue" in circumtance
uch a e!aluating e&ternally."e$ine"
$ormula% #here the $ormula may be pare"
an" interme"iate co"e may be tore" in an
array. 7ach intruction in the array #oul"
then be e&ecute" in e'uence uing a loop o$
co"e.
Table "ri!en co"e can lea" to a large "rop in
co"e !olume an" an increae in conitency
in circumtance #here it i applicable.
Table entrie can be tore" in program
!ariable a array o$ tructure type% or in
"atabae table.
Table "ri!en co"e i a large."ata% mall co"e
mo"el% rather tan"ar" proce"ural co"e
#hich i a large co"e% mall "ata mo"el.
Small co"e mo"el% uch a uing table
"ri!en co"e or run.time routine to e&ecute
e&preion% are generally impler to #rite
an" "ebug an" more conitent in output than
mall "ata mo"el.
3.6.4. /b3ect /rientate- Co-e
<b8ect orientate" co"e i a "ata.centre"
mo"el rather than a $unction.centre" mo"el
<b8ect are "e$ine" that contain both "ata
an" ubroutine% kno#n a metho".

Metho" are attache" to a "ata !ariable% an"
a metho" can be e&ecute" by re$erring to the
"ata !ariable an" the metho" name.
Thi i a $un"amentally "i$$erent approach to
$unction.centre" co"e% #hich in!ol!e
"e$ining ubroutine eparately to the "ata
item that they may proce.
<b8ect orientate" co"e can be ue" to
implement $le&ible $unction."ri!en co"e% an"
i particularly ue$ul $or ituation that
in!ol!e ob8ect #ithin other ob8ect.
0o#e!er% ob8ect orientate" co"e can become
e&tremely comple& an" can be "i$$icult to
"ebug an" maintain.
1or e&ample% many ob8ect orientate" ytem
upport a hierarchical ytem kno#n a
inheritance% #here ob8ect can be bae" on
other ob8ect. The ob8ect inherit the "ata an"
metho" o$ the original ob8ect% a #ell a any
"ata an" metho" that are implemente"
"irectly.
In an ob8ect mo"el containing many le!el%
"ata an" metho" may be implemente" at
each le!el an" interpreting the tructure o$
the co"e may be "i$$icult.
Alo% an ob8ect mo"el bae" on the
application ob8ect% rather than an
in"epen"ent et o$ concept% can be comple&
an" re'uire e&teni!e change #hen ma8or
change are ma"e to the tructure o$ the
application ob8ect.
Thi iue alo applie to "atabae tructure
bae" on peci$ic "etail uch a peci$ic
pro"uct or peci$ic account% rather than
general concept.
3.6.5. De$an- Driven Co-e
3eman" "ri!en co"e take the re!ere
approach to control $lo# compare" to
tan"ar" proce."ri!en co"e.
Stan"ar" proce "ri!en co"e operate uing
a $ee".$or#ar" mo"el% #here a proce i
per$orme" by calling each ubroutine in
or"er% $rom the $irt tep in the proce to the
$inal tage.
3eman" "ri!en co"e operate by calling the
$inal ubroutine% #hich in turn call the
econ".lat ubroutine to pro!i"e input% an"
o $orth back through the chain o$ tep.
Thi lea" to a chain o$ ubroutine call that
e&ten" back#ar" to the earliet ubroutine%
an" then a chain o$ e&ecution that e&ten"
$or#ar" to the $inal reult.
Thi approach can imply control $lo# in a
comple& ytem #ith many cro.
connection bet#een procee.
3eman"."ri!en co"e applie to e!ent."ri!en
ytem% $unctional ytem% an" ytem that
are $ocue" on generating a particular output%
rather than per$orming a peci$ic proce.
Thi may apply to o$t#are tool $or
e&ample.
In an e&ample o$ "iplaying a 3."imenional
image o$ a contruction mo"el% a $unction
may be calle" to "iplay the image.
Be$ore "iplaying the "ata% thi ubroutine
may call another ubroutine to generate the
"ata% #hich initially call a ubroutine to
contruct the mo"el% #hich initially call a
ubroutine to loa" the mo"el "e$inition.
5hen the en" o$ the chain #a reache"% the
e&ecution #oul" begin #ith loa"ing the
mo"el "e$inition% then return to contruct the
mo"el% $ollo#e" by generating the "ata% an"
$inally the original co"e o$ "iplaying the
image.
In ome cae% a proce may alrea"y ha!e
been per$orme" an" a $lag coul" be checke"
to "etermine #hether another ubroutine call
#a neceary.
In cae #here there #ere multiple cro.
connection% each ubroutine coul" be
"e$ine" in"epen"ently% an" a call to any
ubroutine #oul" generate a chain o$
e&ecution that #oul" lea" to the correct
reult being pro"uce".
Thi approach allo# a #i"e range o$
$unction to be per$orme" by a et o$ general
$acilitie.
3ia"!antage #ith "eman"."ri!en co"e
inclu"e that $act that the e&ecution path i not
"irectly relate" to a et o$ proce"ural tep%
#hich may make checking an" "ebugging
the co"e more "i$$icult.
3.6.6. 'ttribute Driven Co-e
Attribute "ri!en co"e i an e&tenion o$ a
$unction."ri!en approach% #here each
$unction per$orm action that are "e$ine" by
a et o$ $lag an" option.
I"eally the $lag an" option #oul" be
orthogonal% #hich each $lag an" option being
electe" in"epen"ently% an" each
combination upporte" by the $unction.
Thee $unction can be implemente" by
implementing each $lag an" option a a
eparate tage in the co"e% rather than
implementing eparate co"e $or peci$ic
combination o$ $lag an" option.
5here thi approach i taken% the number o$
co"e ection re'uire" i e'ual to the number
o$ $lag an" option% #hile the number o$
$unction that can be per$orme" i e'ual to
the pro"uct o$ the number o$ !alue that each
$lag an" option can take.
1or e&ample% i a reporting mo"ule
implemente" t#o orting or"er% $i!e layout
type% an" three ubtotalling metho"% then
three ection o$ co"e #oul" be re'uire" to
implement the three in"epen"ent option.
0o#e!er% the number o$ poible output
$ormat #oul" be 2&*&3% #hich #oul" be 30
poible output $ormat.
Attribute "ri!en co"e can be ue" to combine
e!eral relate" procee or $unction into a
ingle general $unction.
5hen the co"e to implement in"i!i"ual
combination o$ option i replace" by co"e
to implement each option in"epen"ently% thi
may lea" to a re"uction in the co"e !olume%
an" alo an increae in the number o$
$unction that are a!ailable.
3.6.!. /ut*ar- loo2in( co-e
<ut#ar" looking co"e applie at a ubroutine
an" mo"ule le!el.
<ut#ar" looking co"e make in"epen"ent
"eciion to generate the reult that ha been
re'uete" by calling the $unction.
1or e&ample% a ubroutine may be calle" to
"iplay a particular ob8ect on the creen. In a
tan"ar" proce."ri!en or $unction."ri!en
approach% thi may imply per$orm a "irect
action uch a "iplaying the ob8ect.
0o#e!er% an out#ar" looking $unction may
check the e&iting creen "iplay% to "ico!er
that the ob8ect i alrea"y "iplaye". In thi
cae no action nee" to be taken. Alternately%
the ob8ect may be "iplaye" but may be
partially hi""en by another ob8ect% in #hich
cae the other ob8ect coul" be mo!e" to
enable the main ob8ect to become $ully
!iible.
)o"e #ritten in thi #a i eaier to ue an"
more $le&ible than co"e that "irectly
per$orm a peci$ic proce.
Thi allo# the calling program to call a
ubroutine to achie!e a particular outcome%
#ith the ubroutine itel$ taking a range o$
"i$$erent action to per$orm the action
"epen"ing on current circumtance.
Thi approach mo!e the logic that check
the current con"ition $rom #ithin the calling
program into the out#ar" looking mo"ule.
5hen the mo"ule i calle" $rom "i$$erent
part o$ the co"e% an" in "i$$erent
circumtance% thi lea" to a net re"uction in
co"e i=e an" comple&ity.
Thi alo localie the co"e that check the
con"ition #ith the operation #ithin the
ubroutine
<ut#ar" looking co"e may impli$y program
"e!elopment% a the calling program co"e
may be impler% an" the out#ar" looking
mo"ule coul" be "e!elope" in"epen"ently o$
other co"e.
Another e&ample may in!ol!e printing
multiple ub.hea"ing le!el on a report%
#here ome ection may be blank an" the
hea"ing may not be re'uire". In thi cae% a
ubroutine coul" be calle" "irectly to print a
line o$ "ata. Thi ubroutine coul" then check
#hether the correct ubhea"ing #ere
alrea"y acti!e% an" i$ not then a call to a
ubroutine coul" be ma"e to print the
hea"ing be$ore printing the "ata itel$.
<ut#ar" looking co"e re$er to e&ternal "ata
an" thi may intro"uce a e'uence
"epen"ence e$$ect. 0o#e!er% e'uence
in"epen"ence i maintaine" i$ the parameter
to the ubroutine $ully peci$y the outcome o$
the proce% e!en through the ubroutine may
take "i$$erent action to achie!e the reult%
"epen"ing on the e&ternal circumtance.
1or e&ample% the ubroutine ,ne&tTentry()- i
e&plicitly e'uence "epen"ant% a it return
the ne&t entry in a lit a$ter the pre!iou call
to the ubroutine. 0o#e!er% a ubroutine that
a"8ute" the creen layout to match a
peci$ie" pattern% an" per$orme" !arying
action "epen"ing on the current creen
layout% #oul" arri!e at the ame reult
regar"le o$ pre!iou operation.
A "ia"!antage o$ thi approach i that the
out#ar" looking mo"ule may take !arying
an" une&pecte" action. Thi may caue
"i$$icultie #hen the action reult in i"e
e$$ect that may not ha!e occurre" i$ the
ubroutine ue" a tan"ar" proce."ri!en
approach.
3.6.". Sel Coni(urin( Co-e
Sel$.con$iguring co"e i co"e that
automatically elect calculation metho"%
proceing metho"% output $ormat etc.
1or e&ample% a report mo"ule may
automatically a"" ubtotal to any report that
ha a large number o$ entrie% a creen
"iplay routine may automatically elect a
"iplay $ormat bae" on the !alue o$ the
number being "iplaye"% an" a calculation
engine may elect $rom a number o$
e'uation.ol!ing techni'ue bae" on the
tructure o$ an e'uation.

Thi approach re"uce the amount o$ e&ternal
co"e that i re'uire" to ue a general $acility.
1or e&ample% a calculation engine that ol!e"
an e'uation #ithout the nee" to peci$y other
parameter may be a more ue$ul $acility
than one that re'uire" e!eral tep an"
option% uch a initialiing the calculation%
electing a ol!ing metho"% electing initial
con"ition% electing a termination threhol"
an" per$orming the calculation.
In cae #here the automatically electe"
approach i not the "eire" outcome% an
o!erri"e option coul" be ue" to peci$y that
a peci$ic metho" houl" be ue" in that cae.
3.6.8. Tas25Speciic #an(ua(es
In ome cae a imple language can be
create" purely $or a particular application or
program.
1or e&ample% in an in"utrial proce control
en!ironment a language coul" be create"
#ith tatement to open an" cloe !al!e%
check enor% tart procee an" o $orth.
The proce itel$ coul" be #ritten uing the
ne#ly."e$ine" language.
Thi ne# program coul" then be compile"
an" tore" in an interme"iate co"e $ormat%
#ith a imple run.time interpreter loop ue"
to e&ecute the intruction.
Thi operation coul" be "one by #riting the
entire application in the tak language.
0o#e!er% a impler approach may in!ol!e
uing tan"ar" co"e $or the tructure o$ the
program an" uing a et o$ e&preion an"
tatement in the tak language $or peci$ic
$unction.
Thi approach may be ue" in ituation
#here memory torage i e&tremely limite"%
a the numeric intruction $or the tak
language may conume le memory pace
than uing tan"ar" program co"e $or the
entire program.
Thi metho" #oul" pro"uce a $le&ible ytem
#here the proce itel$ coul" be eaily
mo"i$ie".
0o#e!er% implementing thi ytem #oul"
in!ol!e #riting a parer% co"e generator an"
run.time interpreter in a""ition to "e!eloping
the proce itel$.
Thi approach may alo make "ebugging
more "i$$icult a there #oul" be e!eral
tage bet#een the proce itel$ an" the
reult% #ith the poibility that a bug may
appear in any one o$ the tage.
3.6.19. 6ueue Driven Co-e
A 'ueue i a "ata channel that pro!i"e
temporary torage o$ "ata. 3ata that i
retrie!e" $rom a 'ueue i retrie!e" in the
ame or"er in #hich it #a inerte" into the
'ueue.
3ata that i inerte" into a 'ueue
accumulate until it i retrie!e"% up to the
ma&imum capacity o$ the 'ueue.
A ingle proce may inert "ata into a 'ueue
an" retrie!e the "ata at a later time% although
in many cae eparate procee inert "ata
into the 'ueue an" retrie!e "ata $rom the
'ueue.
Gueue can be ue" in communication
bet#een in"epen"ent procee an" bet#een
program an" har"#are "e!ice.
The generating proce may generate "ata
in"epen"ently% or it may generate "ata in
repone to a re'uet $rom the recei!ing
proce.
Thi can be han"le" in a number o$ #ay.
Thee inclu"e the $ollo#ing metho">
)hecking a tatu $lag in the 'ueue to
in"icate that "ata it re'uete".
Being triggere" automatically #hen
the 'ueue i empty an" a "ata re'uet
i ma"e.
Aecei!ing a meage $rom the
recei!ing proce.
9enerating "ata continuouly #hile
the 'ueue i not $ull.
At the recei!ing en" o$ the 'ueue% the
recei!ing proce may be triggere" #hen
"ata arri!e in the 'ueue% or it may poll the
'ueue to continually check #hether "ata i
preent.
In or"er to re'uet "ata% the recei!ing proce
may en" a meage to the generating
proce an" #ait $or "ata to appear in the
'ueue% or it may attempt to e&tract "ata $rom
the 'ueue% #hich may automatically trigger
the generating proce #hen the 'ueue i
empty.
5hen a recei!ing proce attempt to retrie!e
"ata $rom the 'ueue an" the 'ueue i empty%
thi may return an error con"ition or halt the
recei!ing proce until "ata arri!e.
Thi proce may alo et a tatu $lag in the
'ueue that the generating proce can check%
automatically trigger the generating proce%
or take no action until "ata arri!e in the
'ueue.
3.6.11. :ser +nterace Structure-
In ome application the uer inter$ace $orm
the backbone o$ the application.
The menu ytem or ob8ect #ithin the uer
inter$ace may $orm the tructure o$ the
ytem% #ith ection o$ co"e attache" to
each point in the proce.
Thi tructure ha a"!antage in eparating
the co"e into eparate ection. En"er thi
mo"el% the co"e may be broken in to a large
number o$ mall ection that can be
"e!elope" in"epen"ently.
1unction can be eaily a""e" an" remo!e"
#ith thi tructure. Thi tructure may be
uitable $or application that in!ol!e" a large
number o$ uer inter$ace item% #ith each
item relating to a relati!ely mall !olume o$
proceing.
3ia"!antage #ith thi approach inclu"e the
$act that the uer inter$ace an" co"e #oul" be
cloely intert#ine"% an" thi coul" caue
problem i$ the ytem #a porte" to a
"i$$erent operating en!ironment or uer
inter$ace mo"el.
Alo% the internal proceing coul" not eaily
be accee" in"epen"ently% $or tak uch a
automate" proceing an" teting.
There may be coni"erable "uplication
bet#een "i$$erent procee an" in ituation
#here the internal proceing i comple& an
alternati!e mo"el uch a eparating the uer
inter$ace an" proceing co"e into eparate
ection may be more e$$ecti!e.
3.6.12. Co-e 0o-el Su$$ary
Code 'odel Structure
+roce "ri!en co"e Se'uential tatement ue" to per$orm
procee.
1unction "ri!en co"e 1unction that per$orm general operation
#ith "ata an" per$orm con$igurable procee.
Table "ri!en co"e Table o$ "ata ue" a input to $unction an"
ubroutine.
<b8ect orientate" co"e <b8ect containing "ata an" ubroutine to
operate on the "ata.
3eman" "ri!en co"e )o"e that call pre.re'uiite $unction. A
back#ar" chain o$ ubroutine call occur%
$ollo#e" by a $or#ar" chain o$ e&ecution.
Attribute "ri!en co"e 9eneral $unction controlle" by $lag an"
option.
<ut#ar" looking co"e )o"e that i calle" #ith a peci$ie" target
reult% an" take !arying action to achie!e the
reult.
Sel$ con$iguring co"e )o"e that automatically elect calculation
metho"% an" proceing metho"% output
$ormat etc.
Tak peci$ic language A mall language "e!elope" $or the
application% #ith application co"e #ritten in
the tak language
Gueue "ri!en co"e In"epen"ent procee en"ing "ata through
'ueue% an" triggere" automatically or by
meage.
Eer Inter$ace Structure" Section o$ co"e attache" to ue" inter$ace
ob8ect uch a menu item.
3.'. Data Storage
3.!.1. +n-ivi-ual )iles
So$t#are tool o$ten ue in"i!i"ual $ile $or
toring "ata. 1or e&ample% an engineering
"eign mo"el may be tore" a an in"i!i"ual
$ile.
Thi approach allo# $ile to be copie"%
mo!e" an" "elete" in"i!i"ually% ho#e!er thi
approach become impractical #hen a large
number o$ "ata ob8ect are in!ol!e".
3.!.2. Docu$ent 0ana(e$ent Syste$s
3ocument torage ytem are ue" in
en!ironment that in!ol!e a large number o$
"ocument. Thee may imply be mail
meage% memo an" #ork$lo# item% or
they coul" alo tore large !olume o$
canne" paper "ocument.
3ocument management ytem inclu"e
$acilitie $or earching an" categoriing
"ocument% "iplaying lit o$ "ocument%
e"iting te&t an" mailing in$ormation to other
location.
Thee ytem may alo inclu"e
programming language that can be ue" to
implement application uch a #ork$lo#
ytem.
3.!.3. Databases
3.!.3.1. Database 0ana(e$ent Syste$s
A "atabae management ytem i a program
that i ue" to tore% retrie!e an" up"ate large
!olume o$ "ata #ithin tructure" "ata $ile.
3atabae management ytem typically
inclu"e a uer inter$ace that upport a".hoc
'uerie% report% up"ate an" the e"iting o$
"ata.
+rogram inter$ace are alo upporte" to
allo# program to retrie!e an" up"ate "ata
by inter$acing #ith the "atabae management
ytem.
Some operating ytem inclu"e "atabae
management ytem a part o$ the operating
ytem $unctionality% #hile in other cae a
eparate ytem i ue".
3.!.3.2. Data Stora(e
3atabae typically tore "ata bae" on three
tructure.
A $iel" i an in"i!i"ual "ata item% an" may be
a numeric "ata item% a te&t $iel"% a "ate% or
ome other in"i!i"ual "ata item.
A recor" i a collection o$ $iel".
A table i a collection o$ "ata recor" o$ the
ame type. A "atabae may contain a
relati!ely mall number o$ table ho#e!er
each table may contain a large number o$
in"i!i"ual recor".
+rimary "ata i the "ata that ha been ource"
e&ternally $rom the ytem. Thi inclu"e
keye" input an" "ata that i uploa"e" $rom
other ytem.
3eri!e" "ata i "ata than ha been generate"
by the ytem an" tore" in the "atabae.
In ome cae "eri!e" "ata can be "elete"
an" re.generate" $rom the primary "ata.
4ink bet#een recor" can be han"le" uing
a pointer ytem or a relational ytem.
In the pointer mo"el% a parent recor" contain
a pointer to the $irt chil" recor". 1ollo#ing
thi pointer locate the $irt chil" recor"% an"
pointer $rom that recor" can be $ollo#e" to
can each o$ the chil" recor".
In the relational mo"el% the chil" recor"
inclu"e a $iel" that contain the key o$ the
parent recor". /o "irect link are neceary%
an" each recor" can be up"ate" in"i!i"ually
#ithout a$$ecting other recor".
The relational mo"el i a general mo"el that
i bae" imply on et o$ "ata% #ithout
e&plicit connection bet#een recor".
In the relational mo"el% the chil" recor"
re$er to the parent recor"% #hich i the
oppoite approach to the pointer ytem% in
#hich the parent recor" re$er to the chil"
recor".
3.!.3.2.1. ;eys
The primary key o$ a recor" i a "ata item
that i ue" to locate the recor". Thi can be
an in"i!i"ual $iel"% or a compoite key that i
"eri!e" $rom e!eral in"i!i"ual $iel"
combine" into a ingle !alue.
A $oreign key i a $iel" on a recor" that
contain the primary key o$ another recor".
Thi i ue" to link relate" recor".
Dey $iel" are generally hort te&t $iel"
uch a an account number or client co"e.
)ompoite key may be compoe" o$
in"i!i"ual key $iel" an" other $iel" uch a
"ate.
The ue o$ a hort key re"uce torage
re'uirement $or in"e&e% an" may alo a!oi"
ome problem #hen multiple layer o$
o$t#are treat character uch a pace in
"i$$erent #ay.
3.!.3.2.2. Relate- Recor-s
Aecor" in "i$$erent table may be unrelate"%
or they may be relate" on a one.to.one% one.
to.many% or many.to.many bai.
A one.to.one link occur #hen a ingle
recor" in one table i relate" to a ingle
recor" in another table.
Multiple recor" $ormat are an e&ample o$
thi% #here the common "ata i tore" in a
main table% an" peci$ic "ata $or each
alternati!e $ormat i tore" in eparate table.
Thi link can be implemente" by toring the
primary key o$ the main recor" a a $oreign
key $iel" in the other recor".
A one.to.many link occur #hen a ingle
recor" in one table i relate" to e!eral
recor" in another table.
1or e&ample% a ingle account recor" may be
relate" to e!eral tranaction recor"%
ho#e!er a tranaction recor" only relate to
one account.
Thi i alo kno#n a a parent.chil"
connection.
A one.to.many link can be implemente" by
toring the primary key o$ the parent recor"
a a $oreign key $iel" in each o$ the chil"
recor".
A many.to.many link occur bet#een t#o
"ata entitie #hen each recor" in one table
coul" be relate" to e!eral recor" in the
other table.
1or e&ample% the connection bet#een
aircra$t route an" airport may be a many.
to.many connection. 7ach route may be
relate" to e!eral airport% #hile each airport
may be relate" to e!eral route.
A many.to.many connection can be
implemente" by creating a thir" table that
contain t#o $oreign key% one $or each o$
the main table.
7ach recor" in the thir" table #oul" in"icate
a link $rom a recor" in one table to a recor"
in the other table.
The recor" may imply contain t#o key% or
a""itional in$ormation coul" be inclu"e"%
uch a a "ate% an" a "ecription o$ the
connection.
The $ollo#ing "iagram illutrate a one.to.
one "atabae link.
The $ollo#ing "iagram illutrate a one.to.
many "atabae link.
The $ollo#ing "iagram illutrate a many.to.
many "atabae link.
3.!.3.2.3. Reerential +nte(rity
A problem can occur #hen a primary key o$
a recor" i up"ate"% but the $oreign key o$
relate" recor" are not up"ate" to match the
change. In thi cae an" link bet#een the
recor" #oul" be lot.
Thi ituation can be a""ree" by uing a
caca"ing up"ate. 5hen thi tructure i
inclu"e" in the "ata "e$inition% the $oreign
key #ill automatically be up"ate" #hen the
primary key i up"ate".
A imilar ituation arie #ith "eleting
recor". I$ a recor" i "elete"% then recor"
containing $oreign key that relate" to that
recor" #ill re$er to a recor" that no longer
e&it.
3e$ining a caca"ing "elete #oul" caue all
the recor" containing a matching $oreign
key to be "elete" #hen the main recor" #a
"elete".
3.!.3.2.4. +n-e&es
3atabae inclu"e "ata tructure kno# a
in"e&e to increae the pee" o$ locating
recor". An in"e& may be a el$.balancing
tree tructure uch a a B.tree.
The in"e& i maintaine" internally #ithin the
"atabae. In the cae o$ 'uery language the
in"e& i generally tranparent to the caller%
an" increae acce pee" but "oe not
a$$ect the reult.
In other cae% in"e&e can be electe" in
program co"e an" a earch can be per$orme"
"irectly againt a "e$ine" in"e&.
In"e&e are generally "e$ine" againt all
primary key.
Alo% #here recor" #ill be accee" in a
"i$$erent or"er to the primary key% a eparate
in"e& may be "e$ine" that i bae" on the
alternati!e proceing or"er.
In"e&e may alo be "e$ine" on other $iel"
#ithin the recor" #here a "irect acce i
re'uire" bae" on the !alue o$ another $iel".
3.!.3.3. Database -esi(n
In general each eparate logical "ata entity i
"e$ine" a a eparate "atabae table.
Alo% "ata that i recor"e" in"epen"ently%
uch a an in"i!i"ual "ata item that i
recor"e" on "i$$erent "ate% may alo be
"e$ine" a a eparate table
3.!.3.3.1. Data Types
3ata type upporte" by "atabae
management ytem are imilar to the "ata
type ue" in programming language. Thi
may inclu"e !ariou numeric "ata type%
"ate% an" te&t $iel".
Some "atabae ytem upport !ariable.
length te&t $iel" although in many cae the
length o$ the $iel" mut be peci$ie" a part
o$ the recor" "e$inition% particularly i$ the
$iel" #ill be ue" a part o$ a key or in
orting.
Ene&pecte" reult can occur i$ numeric
!alue an" "ate are tore" in te&t $iel"
rather than in their nati!e $ormat.
1or e&ample% the te&t tring ,10- may be
orte" a a lo#er !alue than ,K-% a the $irt
character in the tring i a ,1- an" thi may
be lo#er in the collating e'uence than the
character ,K-.
3.!.3.3.2. Re-un-ant Data
5hen a "ata !alue appear multiple time
#ithin a "atabae% thi may in"icate that the
"ata repreent a eparate logical entity to the
table or table that it i recor"e" in.
In thi cae% the "ata coul" be plit into a
eparate "ata table.
Thi #oul" reult in a one.to.many link $rom
the ne# table to the original table. Thi
#oul" be implemente" by toring the
primary key o$ the ne# recor" a a $oreign
key #ithin the original recor".
Thi proce #oul" generally be "one a part
o$ the original "atabae "eign% rather than
appearing "ue to actual "uplicate"
in$ormation.
1or e&ample% i$ a ingle cutomer name
appeare" on e!eral in!oice% thi #oul" be
re"un"ant "ata an" #oul" in"icate that the
cutomer "etail an" in!oice "etail #ere
in"epen"ent "ata entitie.
In thi cae a eparate cutomer table coul"
be create"% an" the primary key o$ a
cutomer recor" coul" be tore" a a $oreign
key in the in!oice recor".
3.!.3.3.3. 0ultiple Recor- )or$ats
In ome cae a ingle logical entity may
inclu"e more than one recor" $ormat% uch a
a client table #hich inclu"e both in"i!i"ual
client an" corporate client.
Some "etail #oul" be the ame% uch a
name an" a""re% #hile other #oul" "i$$er
uch a "ate o$ birth an" primary contact
name.
In thi cae% the common $iel" can be tore"
in the main recor"% an" a one.to.one link
etablihe" to other table containing the
peci$ic "etail o$ each $ormat.
0o#e!er% thi tructure complicate the
"atabae "eign an" alo the proceing%
replacing one table #ith three #ith no
increae in $unctionality.
In cae #here the number o$ peci$ic $iel"
i not e&cei!e% a impler olution may be to
combine all the $iel" into a ingle recor".
Thi #oul" reult in ome $iel" being
unue"% ho#e!er thi #oul" impli$y the
"atabae "eign an" may increae proceing
pee" lightly.
Thi may alo re"uce the "ata torage i=e
#hen the o!erhea" o$ e&tra in"e&e an"
internal tructure i taken into account.
Some "atabae management ytem allo#
multiple recor" $ormat to be "e$ine" $or a
ingle table. In thee cae% the primary key
an" a et o$ common $iel" are the ame in
each recor"% #hile the peci$ic $iel" $or a
particular recor" $ormat ue the ame torage
pace a the alternati!e $iel" $or other recor"
$ormat.
3.!.3.3.4. Co-e- & )ree )or$at )iel-s
A co"e" $iel" i a $iel" that contain a !alue
that i one o$ a $i&e" et o$ co"e. Thi "ata
item coul" be tore" a a numeric "ata $iel"%
or it may be a te&t $iel" o$ e!eral character
containing a numeric or alphabetic co"e.
1ree $ormat $iel" are te&t $iel" that tore
any te&t input.
)o"e" $iel" can be ue" in proceing% in
contrat to $ree.$ormat $iel" #hich can only
be ue" $or manual re$erence% or inclu"e" in
printe" output.
5here a "ata item may be ue" in $uture
proceing% it houl" generally be tore" in a
numeric or co"e" $iel"% rather that a general
te&t $iel".
3.!.3.3.5. Date5Driven Data
Many "ata item are relate" to e!ent that
occur on a particular "ate% uch a
tranaction. Alo% many "ata erie are bae"
on meaurement or "ata that $orm a time
erie o$ in$ormation.
In thee cae the primary key o$ the "ata
recor" may conit o$ main key an" a "ate.
1or e&ample% the primary key o$ a tranaction
may be the account number an" the "ate.
In cae #here multiple e!ent can occur on
a ingle "ay% a "i$$erent arrangement% uch a
a uni'ue tranaction number% can be ue" to
i"enti$y the recor".
0itorie may alo be kept o$ "ata that i
change" #ithin the "atabae.
1or e&ample% the um inure" !alue o$ an
inurance policy may be tore" in a "ata.
"ri!en table% uing the policy number an" the
e$$ecti!e "ate a the primary key. Thi #oul"
enable each "i$$erent !alue% an" the "ate that
it applie" $rom% to be tore" a a eparate
recor".
A hitory recor" may be manually entere"
#hen a change to a "ata item occur% or in
other cae the main recor" i mo"i$ie" an"
the hitory recor" i automatically generate"
bae" on the change.
0itorie are ue" to re.pro"uce calculation
that applie" at pre!iou point in time% uch
a re.printing a tatement $or a pre!iou
perio".
0itorie may be tore" o$ "ata that i kept
$or output or recor".keeping purpoe only%
uch a name an" a""ree% but hitory
particularly applie to "ata item that are
ue" in proceing.
3ate."ri!en "ata i alo ue" #hen a
calculation co!er a perio" o$ time.
1or e&ample% i$ the um inure" !alue o$ an
inurance policy change" mi".#ay through a
perio"% the premium $or the perio" may be
calculate" in t#o part% uing the initial um.
inure" $or the $irt part o$ the perio" an" the
up"ate" um.inure" $or the econ" part o$
the perio".
In ome cae% change to a main "ata recor"
are recor"e" by toring multiple copie o$ the
entire "ata recor".
In other cae each "ata item that i tore"
#ith a hitory i plit into an in"i!i"ual table.
Thi can be implemente" by creating a
primary key in the hitory recor" that i
compoe" o$ the primary key o$ the main
recor"% an" the e$$ecti!e "ate o$ the "ata.
3.!.3.3.6. 'ttributes an- Separate )iel-s
3ata tructure can be impler an" more
$le&ible #here "i$$erent "ata item are
i"enti$ie" by attribute $iel"% rather than
being tore" in eparate "ata item.
1or e&ample% the $ollo#ing table may recor"
"ata ample #ithin a meteorological ytem.
4ocation 3ate Temperature +reure
0umi"ity
1232*U 1J1JL0 1.23 31.2
232.21
0o#e!er% an alternati!e implementation may
be to tore each "ata item in a eparate
recor"% an" i"enti$y the "ata item uing a
eparate attribute $iel"% rather than by a $iel"
name.
Thi coul" be implemente" in the $ollo#ing
#ay
4ocation 3ate Type 6alue
1232*U 1J1JL0 T7M+A7TEA7
1.23
1232*U 1J1JL0 +A7SSEA7
31.2
1232*U 1J1JL0 0EMI3ITI
232.21
/e# attribute% uch a
,MI/TT7M+A7TEA7-% coul" be a""e"
#ithout changing the "atabae tructure or
program co"e.
3ata entry an" "iplay bae" on thi mo"el
#oul" not nee" to be up"ate". 0o#e!er%
creen entry or reporting that "iplaye"
e!eral !alue a eparate $iel" may nee" to
be mo"i$ie".
In thi e&ample% there #oul" be no retriction
on each location recor"ing the ame
attribute% an" a larger et o$ attribute coul"
be "e$ine" #ith a !arying ub.et o$
attribute recor"e" $or "i$$erent et o$ "ata.
Alo% the program co"e may be impler an"
more general% a the proceing #oul"
in!ol!e a ,location-% ,"ate-% ,attribute- an"
,!alue-% rather than peci$ic in$ormation
relate" to the ample themel!e.
5hen a large number o$ attribute are tore"%
thi approach may igni$icantly impli$y the
co"e. In the cae o$ a mall number o$
attribute% thi metho" allo# general
routine an" proceing to be ue" in place o$
eparate $iel".peci$ic co"e.
Thi co"e coul" alo be applie" to other "ata
area #ithin the ytem that coul" be
recor"e" uing a imilar approach.
Aecor" tore" in the econ" $ormat coul" be
procee" by general ytem $unction that
per$orme" procee uch a ubtotalling an"
a!eraging.
3ia"!antage #ith the econ" $ormat
inclu"e the larger number o$ in"i!i"ual
recor"% the poibility o$ ynchroniation
problem #hen a matching et o$ recor" i
not $oun"% an" the greater "i$$iculty in
tranlating the "ata recor" into a ingle
creen or report layout that containe" all the
in$ormation $or one et o$ !alue.
3.!.3.3.!. Ti$esta$ps
A timetamp i a $iel" containing a "ate% time
an" poibly other in$ormation uch a a uer
logon an" program name.
Timetamp may be tore" a "ata item in a
recor" to i"enti$y the con"ition un"er #hich
a recor" #a create"% an" the "etail o$ #hen
it #a lat change".
Timetamp can be ue" $or "ebugging an"
a"minitrati!e purpoe% uch a reconciling
account% tracing "ata problem% an" re.
etablihing a e'uence o$ e!ent #hen
in$ormation i una!ailable or con$licting.
3.!.3.4. Data 'ccess
3.!.3.4.1. 6uery #an(ua(es
Some "atabae management ytem upport
'uery language.
Thee language allo# group o$ recor" to
be electe" $or retrie!al or up"ating.
Guery language are imple an" $le&ible.
Guery language are generally "eclarati!e%
not proce"ural language. Although the
language may contain tatement that are
e&ecute" in e'uence% the actual election o$
recor" in bae" on a "e$inition tatement%
rather than a et o$ tep.
The ue o$ a 'uery language allo# many o$
the "etail o$ the "atabae implementation to
become tranparent to the calling program%
uch a the in"e&e "e$ine" in the "ata bae%
the actual collection o$ $iel" in a table% an"
o on.
1iel" can be a""e" to table #ithout
a$$ecting a 'uery that electe" other e&iting
$iel"% an" in"e&e can be a""e" to increae
acce pee" #ithout re'uiring a change in
the 'uery "e$inition.
In theory a "atabae ytem coul" be
replace" #ith an alternati!e ytem that
upport the ame 'uery language% uch a
#hen "ata !olume gro# ubtantially an" an
alternati!e "atabae management ytem i
re'uire".
0o#e!er% there are alo "ia"!antage #ith
'uery language
The ma8or "ia"!antage relate to
per$ormance.
A the 'uery language i a $ull te&t.bae"
language% there may be a igni$icant
o!erhea" in!ol!e" in compiling the 'uery
into an internal $ormat% "etermining #hich
in"e&e to ue $or the operation% an"
per$orming the actual proce.
Thi "elay may be re"uce" in ome cae by
uing a pre.compile" 'uery% ho#e!er thi i
till likely to be lo#er that a "irect
ubroutine call to a "atabae $unction.
Thi "elay may be a particular iue $or
algorithm that in!ol!e a large number o$
in"i!i"ual ran"om recor" earche.
3.!.3.4.2. +n-e&54ase- 'ccess
Some "atabae management ytem upport
"irect recor" earche bae" on in"e&e. Thi
may in!ol!e electing a table an" an in"e&%
creating a primary key an" per$orming the
earch.
Thi approach i le $le&ible than uing a
'uery language. The tructure o$ the in"e&e
mut be inclu"e" in the co"e% an" the co"e
may be more comple& an" le portable.
0o#e!er% "ue to the lo#er internal o!erhea"
in!ol!e" in a "irect in"e& earch% the
per$ormance o$ in"e&.bae" operation may
be ubtantially $ater than "ata 'uerie.

3.!.3.4.3. :ser +nteraces
Many "atabae management ytem inclu"e
a "irect uer inter$ace. Thi may allo# "ata to
be "irect e"ite"% an" may upport a".hoc
'uerie% reporting an" "ata up"ate.
Guerie may be per$orme" uing a 'uery
language% or uing a et o$ menu."ri!en
$unction an" report option.
Some ytem alo inclu"e an internal macro
language that can be ue" to per$orm
comple& operation% inclu"ing "e!eloping
complete application.
3.(. )umeric Calculations
3.".1. <u$eric Data Types
Many language upport e!eral "i$$erent
numeric "ata type.
3ata type !ary in the amount o$ memory
pace ue"% the pee" o$ calculation% an" the
preciion an" range o$ number that can be
tore".
Integer "ata type recor" #hole number
only.
1loating point !ariable recor" a number o$
"igit o$ preciion% along #ith a eparate
!alue to in"icate the magnitu"e o$ the
number.
Integer an" $loating point "ata type are
#i"ely ue". )alculation #ith thee "ata
type may be implemente" "irectly a
har"#are intruction.
1i&e" point "ata type recor" a $i&e" number
o$ "igit be$ore an" a $i&e" number o$ "igit
a$ter the "ecimal point.
Scale" "ata type recor" a $i&e" number o$
"igit% an" may ue a $i&e" or !ariable
"ecimal point poition.
Arbitrary preciion !ariable ha!e a range o$
preciion that i !ariable% #ith a large upper
limit. The preciion may be electe" #hen
the !ariable i "e$ine"% or may be
automatically electe" "uring calculation.
)obol ue an unuual $ormat #here a
!ariable i "e$ine" #ith $i&e" et o$ character
poition% an" each poition can be peci$ie"
a alphabetic% alphanumeric% or numeric
3.".2. <u$eric Data Stora(e
Integer are generally tore" a binary
number.
1loating point !ariable tore the mantia
an" e&ponent o$ the !alue eparately. 1or
e&ample% the number 1230000 i repreente"
a 1.23 & 10
U
in cienti$ic notation% an"
0.002*U #oul" be 2.*U & 10
.3
.
In the $irt e&ample% a !alue repreenting the
123 may be tore" in one part o$ the !ariable%
#hile a !alue repreenting the U may be
tore" in a eparate part o$ the !ariable.
Actual "etail !ary #ith the torage $ormat
ue".
The preciion o$ the $ormat i the number o$
"igit o$ accuracy that are recor"e"% #hile the
range peci$ie the "i$$erence bet#een the
mallet an" larget !alue that can be tore".
Thi $ormat i bae" on the cienti$ic
notation mo"el% #here large an" mall
number are recor"e" #ith a eparate
mantia an" e&ponent.
1or e&ample
U2*2000000 ; U.2*2 &
10
K
0.00000LM3 ; L.M3 & 10
.U
7&ample o$ integer "ata type>
Storage i=e /umber range
2 byte .32%MUL to ?32%MUM
2 byte .2%12M%2L3%U2L to
?2%12M%2L3%U2M
7&ample o$ $loating point "ata type>
Storage Si=e +reciion
Aange
2 byte appro& M "igit
appro& 10
.2*
to 10
3L
L byte appro& 1* "igit
appro& 10
.322
to 10
30L
1i&e" point number may alo be tore" a
binary number% #ith the poition o$ the
"ecimal point taken into account #hen
calculation are per$orme".
B)3 (Binary )o"e" 3ecimal) number are
tore" #ith each "ecimal "igit recor"e" a a
eparate 2.bit binary co"e.
<ther numeric type may be tore" a te&t
tring o$ "igit% or a tructure" binary
block containing ection $or the number
itel$ an" a cale i$ neceary.
3.".3. 0e$ory :sa(e an- %&ecution
Spee-
9enerally calculation #ith integer are the
$atet numeric calculation% an" integer ue
the leat amount o$ memory pace.
1loating point number may alo e&ecute
'uickly #hen the calculation are
implemente" a har"#are intruction.
Both integer an" $loating point number
may be a!ailable in e!eral $ormat% #ith the
range an" preciion o$ the "ata type relate" to
the amount o$ memory torage ue".

5hen the calculation $or a numeric "ata
type are implemente" internally a
ubroutine% the per$ormance may be
igni$icantly lo#er than imilar operation
uing har"#are.upporte" "ata type.
3.".4. <u$eric /perators
Although the ymbol an" #or" !ary% mot
programming language "irectly upport the
baic arithmetic operation>
? a""ition
. ubtraction
@ multiplication
J "i!iion
mo" mo"ulu
Q 7&ponentiation% y
&
5hen calculation are per$orme" #ith
integer !alue% the $ractional part i uually
truncate"% o that only the #hole.number part
o$ the reult i retaine".
4anguage that are orientate" to#ar"
numeric proceing may inclu"e other
numeric operator% uch a operator $or
matri& multiplication% operation #ith
comple& number% etc.
3.".5. 0o-ulus
The mo"ulu operator i ue" #ith integer
arithmetic to capture the $ractional part o$ the
reult.
The mo"ulu i the "i$$erence bet#een the
numerator in a "i!iion operation% an" the
!alue that the numerator #oul" be i$ the
"i!iion e'ualle" the e&act integer reult.
1or e&ample% 13 "i!i"e" by * e'ual 2.U.
Truncating thi reult to pro"uce an integer
!alue lea" to a reult o$ 2.
0o#e!er% 10 "i!i"e" by * i e&actly e'ual to
2.
In thi e&ample% the mo"ulu #oul" be e'ual
to the "i$$erence bet#een 13 an" 10% or in
thi cae 3.
Thi coul" be e&pree" a
13 mo" * ; 3
An e'ui!alent calculation o$ ,a M<3 b- i
,a F b @ int( a J b )-% #here the ,int-
operation pro"uce the truncate" integer
reult o$ the "i!iion.
Thi operator may be ue$ul in mapping a
large number range onto an o!erlapping
maller range. 1or e&ample% i$ ,total.line-
#a the total number o$ line in a long
"ocument% then the $ollo#ing reult #oul"
occur>
page.number ; total.line J line.per.page
(integer "i!iion)
line.on.page ; total.line Mo" line.per.page
In thi e&ample% the ,total line- !alue
increae through the "ocument% #hile the
,line.on.page- !alue #oul" reet to =ero a it
croe" o!er into each ne# page.
3.".6. Roun-in( %rror
Some number cannot be repreente" a a
$inite erie o$ "igit. <ne "i!i"e" by three%
$or e&ample% i W #hen e&pree" a a
$raction% but i
0.333333333X.
#hen e&pree" a a "ecimal. +rogramming
language "o not generally upport e&act
$raction% apart $rom ome pecialit
mathematical package.
In thi cae% the 3 a$ter the "ecimal point
repeat $ore!er% but the preciion o$ the
tore" number i limite". <ne.thir" plu t#o
thir" e'ual one. Eing number #ith 1*
"igit o$ preciion% ho#e!er% the reult #oul"
be
0.333333333333333
? 0.UUUUUUUUUUUUUUU
; 0.KKKKKKKKKKKKKKK
I$ a check #a "one in the program co"e to
ee #hether the reult #a e'ual to 1% thi tet
#oul" return $ale% not true% a the number
tore" i 0.KKKKKKKKKKKKKKK% #hich i
"i$$erent $rom 1.000000000000000.
The ma&imum roun"ing error that can occur
in a number i e'ual to one.hal$ o$ the
mallet !alue repreente" in the mantia.
1or e&ample% #ith 1* "igit o$ preciion% the
ma&imum roun"ing error #oul" be a !alue o$
* in the i&teenth place.
3uring a erie o$ a""ition an" ubtraction%
the ma&imum total error #oul" be e'ual to
the number o$ operation% multiplie" by a
!alue o$ one.hal$ o$ the mallet mantia
!alue.
In the cae o$ ,n- a""ition or ubtraction
operation% the number o$ igni$icant $igure
lot i e'ual to log
10
(* @ n)
5hen multiplication an" "i!iion are
per$orme"% the ma&imum error #oul"
increae in the or"er o$ one.hal$ o$ the
mallet mantia !alue raie" to the po#er
o$ the number o$ operation.
Aoun"ing problem can be re"uce" i$ ome
o$ the $ollo#ing tep are taken.
A number torage $ormat #ith an
a"e'uate number o$ "igit o$
preciion i ue".
)haining o$ calculation $rom one
reult to the ne&t i a!oi"e"% an"
reult are calculate" in"epen"ently
$rom input $igure #here poible.
The $ull le!el o$ preciion i carrie"
through all interme"iate reult% an"
roun"ing only occur $or printing%
"iplay% "ata torage% or #hen the
$igure repreent an actual number%
uch a #hole cent.
)alculation are tructure" to a!oi"
ubtracting imilar number. 1or
e&ample%
,3U**.232222 F 3U**.232120 ;
0.000102-% an" ten "igit o$ preciion
"rop to three "igit o$ preciion.
5hen calculation ha!e been per$orme" #ith
number% comparing !alue "irectly may not
generate the e&pecte" reult.
Thi iue can be a""ree" by comparing
the number againt a mall "i$$erence
tolerance.
1or e&ample
Bf (absolute_value( num# 0 num+ ) "
3633333# then
7rror in numeric calculation may alo
appear "ue to proceing iue that are not
"irectly relate" to the torage preciion.
1or e&ample% one ytem may roun" number
to t#o "ecimal place be$ore toring the "ata
in a "atabae% #hile another ytem may
"iplay an" print number to t#o "ecimal
place but tore the number #ith a $ull
preciion.
In thee cae% comparing total o$ the t#o
lit may reult in roun"ing error in the thir"
"ecimal place% rather than the lat igni$icant
"igit.
3.".!. +nvali- /perations
I$ a calculation i attempte" that #oul"
pro"uce a reult that i larger than the
ma&imum !alue that a "ata type can tore%
then an o!er$lo# error may occur.
4ike#ie% i$ the reult #oul" be le than the
minimum i=e $or the "ata type% but greater
than =ero% then an un"er$lo# error may
occur.
3i!i"ing a number by =ero i an un"e$ine"
mathematical operation% an" attempting to
"i!i"e a number by =ero may reult in a
"i!i"e.by.=ero error.
The han"ling o$ in!ali" numeric operation
!arie #ith "i$$erent programming language%
but $re'uently a program termination #ill
reult i$ the error i not trappe" by an error.
han"ling routine #ithin the co"e.
Thee problem can be re"uce" by checking
that the "enominator i non.=ero be$ore
per$orming a "i!iion or mo"ulu% an" by
uing a "ata type that ha an a"e'uate range
$or the calculation being per$orme".
3.".". Si(ne- & :nsi(ne- 'rit1$etic
In ome language numeric "ata type can be
"e$ine" a either igne" or unigne" "ata
type.
Eing unigne" "ata type allo# a #i"er
range o$ number to be tore"% ho#e!er thi
i a minor "i$$erence in comparion to the
!ariation bet#een "i$$erent "ata type.
Mi&ing igne" an" unigne" number in
e&preion can occaionally lea" to
une&pecte" reult% epecially in cae #here
!alue uch a .1 are ue" to repreent
marker uch a the en" o$ a lit.
1or e&ample% i$ a negati!e !alue #a ue" in
an unigne" compariion% it #oul" be treate"
a a large poiti!e !alue% a negati!e !alue
are the e'ui!alent bit.pattern to the larget
hal$ o$ the unigne" number range.
In the cae o$ a 2 byte integer% the range o$
number #oul" be a ho#n belo#.
3ata Type Aange
2 byte igne" .32%MUL to
?32%MUM
2 byte unigne" 0 to
?U**3U
3.".8. Conversion bet*een <u$eric
Types
5hen numeric !ariable o$ "i$$erent type
are mi&e"% ome language automatically
con!ert the type% other language allo#
con!erion #ith an operator or $unction% an"
other language "o not allo# con!erion.
I$ t#o item in an arithmetic e&preion ha!e
"i$$erent numeric type% the !alue #ith the
lo#er le!el o$ preciion may be con!erte" to
the ame le!el o$ preciion a the other !alue
be$ore the calculation i per$orme".
0o#e!er% the "etail o$ "ata type promotion
!arie #ith each language.
3.".19. Strin( & <u$eric conversion
/umeric "ata type cannot be "iplaye"
"irectly an" mut be con!erte" to te&t tring
o$ "igit be$ore they can be printe" or
"iplaye".
Alo% In$ormation "eri!e" $rom creen entry
or te&t uploa" $ile may be in a te&t $ormat%
an" mut be con!erte" to a numeric "ata type
be$ore calculation can be per$orme".
4anguage generally inclu"e operator or
ubroutine $or con!erting bet#een numeric
"ata type an" tring.

Thi con!erion i a relati!ely lo#
operation% an" per$ormance problem may be
re"uce" i$ the number o$ con!erion i kept
to a minimum.
3.".11. Si(niicant )i(ures
The number o$ igni$icant $igure in a
number i the number o$ "igit that contain
in$ormation. 1or e&ample% the number
*023000000 an" 0.000000*023 both contain
$our igni$icant "igit. The $igure ,*023-
peci$y in$ormation concerning the number%
#hile the =ero peci$y the number( i=e.
Meaurement may be recor"e" #ith a $i&e"
number o$ igni$icant $igure% rather than a
$i&e" number o$ "ecimal place. 1or
e&ample% a meaurement that i accurate to 1
part in 1000 #oul" be accurate to three
igni$icant "igit.
Aoun"ing can be per$orme" to a $i&e"
number o$ "ecimal place% or a $i&e" number
o$ igni$icant $igure.
5hen a #i"e range o$ number are "iplaye"
in a narro# pace% a $loating "ecimal point
can be ue" #ith a $i&e" number o$
igni$icant $igure. 1or e&ample% the number
, 3202.L- an" , 3.MU**- both contain $i!e
igni$icant "igit.
3.".12. <u$ber Syste$s
/umber are ue" $or e!eral purpoe #ith
program.
<ne ue i to recor" co"e% uch a a number
that repreent a letter% or a number that
repreent a election $rom a lit o$ option.
/umber are alo ue" to repreent a 'uantity
o$ item. The "ecimal number 12% the roman
numeral VII% an" the binary number 1100 all
repreent the ame number% an" #oul"
repreent the ame 'uantity o$ item.
3.".12.1.Ro$an <u$erals
In the Aoman number ytem% ma8or
number are repreente" by "i$$erent
ymbol. I i 1% 6 i *% V i 10% 4 i *0% ) i
100 an" o on.
/umeral are a""e" together to $orm other
number. I$ a lo#er !alue appear to the le$t
o$ another !alue% it i a""e" to the main
!alue% other#ie it i ubtracte".
The $irt ten roman numeral are
I 1
II 2
III 3
I6 2 $i!e minu one
6 *
6I U $i!e plu one
6II M $i!e plu t#o
6III L $i!e plu three
IV K ten minu one
V 10
Although thi ytem can recor" number up
to large !alue% it i "i$$icult to per$orm
calculation #ith number uing thi ytem.
3.".12.2.'rabic <u$ber Syste$s
An Arabic number ytem ue a $i&e" et o$
ymbol. 7ach poition #ithin a number
contain one o$ the ymbol.
The !alue o$ each poition increae by a
multiple o$ the bae o$ the number ytem%
mo!ing $rom the right.mot poition to the
le$t.
The !alue o$ each poition in a particular
number i gi!en by the !alue o$ the poition
itel$% multiplie" by the !alue o$ the ymbol
in that poition.
1or e&ample
31*02 ; 3 & 10
2
;
3 & 10000
? 1 & 10
3
? 1 & 1000
? * & 10
2
? * & 100
? 0 & 10
1
? 0 & 10
? 2 & 10
0
? 2 & 1
The "ecimal number ytem i an Arabic
number ytem #ith a bae o$ 10. The "igit
ymbol are the tan"ar" "igit 0% 1% 2% 3% 2%
*% U% M% L an" K.
<ther bae can be ue" $or alternati!e
number ytem. 1or e&ample% in a number
ytem #ith a bae o$ three% the number
21302 #oul" be e'ui!alent to the number
21L in "ecimal.
21302
3
; 2 & 3
2
; 2 & L1
10

? 1 & 3
3
? 1 & 2M
10
? 3 & 3
2
? 3 & K
10
? 0 & 3
1
? 0 & 3
10
? 2 & 3
0
? 2 & 1
; 21L
10
In thi notation% the ubcript repreent the
bae o$ the number. The bae.three
repreentation 21302

an" the bae.ten
repreentation 21L both repreent the ame
'uantity.
3.".12.2.1. 4inary <u$ber Syste$
The Arabic number ytem #ith a bae o$ 2
i the kno#n a the binary number ytem.
The "igit ue" in each poition are 0 an" 1.
In computer har"#are% a !alue i repreente"
electrically #ith a !alue that i either on or
o$$. Thi !alue can repreent t#o tate% uch
a 0 an" 1.
7ach in"i!i"ual torage item i kno#n a a
bit% an" group o$ bit are ue" to tore
number in a binary number $ormat.
)omputer memory i commonly arrange"
into byte% #ith a eparate memory a""re
$or each byte. A byte contain eight bit.
An e&ample o$ a binary number i
101101
2
; 1 & 2
*
;
1 & 32
10
? 0 & 2
2
? 0 & 1U
10
? 1 & 2
3
? 1 & L
10
? 1 & 2
2
? 1 & 2
10
? 1 & 2
1
? 0 & 2
10
? 1 & 2
0
? 1 & 1
; 2*
10
In thi e&ample% the binary number 101101 i
e'ui!alent to the "ecimal number 2*.
A the bae o$ the binary number ytem i
t#o% each poition in the number repreent a
number that i a multiple o$ 2 time larger
than the poition to it right.
The !alue o$ a number poition i the bae
raie" to the po#er o$ the poition% $or
e&ample% the "igit one in the $ourth poition
$rom the right in a "ecimal number ha a
!alue o$ 10
3
; 1000. In a binary number% a
"igit in thi poition #oul" ha!e a !alue o$ 2
3
; L.
3.".12.2.2. .e&a-eci$al <u$bers
The he&a"ecimal number ytem i the
Arabic number ytem that ue a bae o$ 1U.
Thi i ue" a a horthan" #ay o$ #riting
binary number. A the bae o$ 1U i a "irect
po#er o$ t#o% each he&a"ecimal "igit
"irectly correpon" to $our binary "igit.
0e&a"ecimal number are ue" $or #riting
contant in co"e that repreent a pattern o$
in"i!i"ual bit rather than a number% uch a
a et o$ option #ithin a bitmap.

3ue to the $act that the bae o$ the number
ytem i 1U% there are 1U poible ymbol
in each poition in the number.
A there are only ten tan"ar" "igit ymbol%
letter are alo ue".
The character ue" in a he&a"ecimal number
are 0% 1% 2% 3% 2% *% U% M% L% K% A% B% )% 3% 7
an" 1. The character A through to 1 ha!e the
!alue 10 through to 1*.
1or e&ample%
L331
1U
; L & 1U
3
; L &
20KU
10
? 3 & 1U
2
? 13
10
& 2*U
10
? 3 & 1U
1
? 3 & 1U
10
? 1 & 1U
0
? 1*
10
& 1
; 3U1*K
10
; 1000110100111111
2
There i a "irect correpon"ence bet#een
each he&a"ecimal "igit an" each group o$
$our binary "igit.
1or e&ample%
L 3 3
1
; 1000 1101 0011
1111
In thi e&ample% the econ" group o$ bit ha
the !alue 1101% #hich correpon" to 13 in
"ecimal an" 3 in he&a"ecimal.
The $ollo#ing table inclu"e the $irt eight
po#er o$ t#o an" ome other number%
repreente" in e!eral "i$$erent bae.
0e&a"ecimal Binary
3ecimal 6alue
01 00000001
1 2
0
02 00000010
2 2
1
02 00000100
2 2
2
0L 00001000
L 2
3
10 00010000
1U 2
2
20 00100000
32 2
*
20 01000000
U2 2
U
L0 10000000
12L 2
M
01 00001111 1*
10 11110000 220
11 11111111 2**
3.*. S+stem Securit+
Sytem ecurity i implemente" in mot large
ytem to pre!ent the the$t o$ program an"
"ata% to pre!ent the unauthorie" ue o$
ytem% an" to re"uce the chance o$
acci"ental or "eliberate "amage to "ata.
3.8.1. 'ccess Control
Acce control i implemente" at the
operating ytem le!el% #hich applie to
running program an" acceing "ata. Similar
approache are ue" #ithin application
program% an" #ithin "atabae.
Acce control generally in!ol!e "e$ining
the type o$ acce a!ailable $or each $unction.
Thi may be bae" on acce le!el% or on
pro$ile #hich "e$ine the acce type $or each
group o$ $unction.
Type o$ acce may inclu"e
/o acce
6ie#.only acce
6ie# an" Ep"ate acce
3elete acce
Aun rea".only program
Aun up"ate program
Acce can alo be limite" to certain group
o$ recor"% uch the pro"uct "e!elope"
#ithin a particular "i!iion. Thi i le
commonly "one% but can be ue" #hen a
common proceing ytem i ue" by
e!eral in"epen"ent organiation.
3.8.2. :ser +-entiication an-
Pass*or-s
4ogging into a ytem generally in!ol!e a
uer I3 an" a pa#or". The uer I3
i"enti$ie the uer to the ytem% an" may be
compoe" o$ the uer( initial or ome other
co"e.
+a#or" may be ran"omly generate"%
either initially or permanently. +a#or"
may be retricte" to pre!ent the ue o$
common pa#or" uch a peronal name
an" account number.
The may inclu"e re'uiring a minimum
number o$ character% an" poibly at leat
one "igit an" one alphabetic character in the
pa#or".
+a#or" may e&pire a$ter a certain time
perio"% a$ter #hich they mut be change"%
poibly to a ne# pa#or" that ha not been
pre!iouly ue".
+a#or" may be encrypte" be$ore being
tore" in a "atabae or "ata $ile% to pre!ent
the te&t $rom being !ie#e" uing an e&ternal
program.

A logon eion may terminate automatically
a$ter a perio" o$ time #ithout acti!ity% to
re"uce the chance o$ acce being gaine"
through an unatten"e" terminal that i till
logge" in.
3.8.3. %ncryption o Data
3ata can be encrypte". Thi in!ol!e
changing the "ata into another $ormat o that
the in$ormation cannot be !ie#e" or
i"enti$ie".
7ncryption i not #i"ely ue" in tan"ar"
ytem. 0o#e!er% encryption i ue" in
high.ecurity "ata tran$er% an" in general.
ue $acilitie uch a net#ork ytem an"
"igital mobile telephone communication.
6ariou algorithm are a!ailable $or
encryption. Thee range $rom imple
techni'ue to comple& calculation.
<ne imple approach i to map each input
character to a "i$$erent output character. Thi
i a imple metho"% ho#e!er it coul" be ue"
$or toring mall item uch a pa#or".
1or e&ample% input "ata coul" be tranlate"
to output "ata uing a $ormula or a lookup
table.
Thi #oul" be a one.to.one mapping. A table
#oul" contain 2*U entrie $or one byte o$
"ata% an" coul" be ue" to encrypt te&t or
binary "ata. The $ollo#ing table ho# the
$irt $e# entrie in a mapping table.
Input <utput
)haracter )haracter
A B
B H
) 3
3 7
0 K
1 )
2 :
@ >
Y ,
C 3
3ata #oul" be unencrypte" by uing the
table in re!ere.
3.8.4. +n-ivi-ual )iles
Small in"i!i"ual $ile% uch a a "ata $ile
create" by a o$t#are tool or a con$iguration
$ile% may ha!e a pa#or" embe""e" #ithin
the $ile.
The o$t#are tool #oul" generally prompt
$or the pa#or" #hen an attempt #a ma"e
to open the $ile% an" #oul" "iallo# acce
unle the correct pa#or" #a entere".
3.8.5. %&ternal 'ccess
3ata can generally be accee" in other% o$ten
impler% #ay that are e&ternal to an
application. Thi inclu"e copying $ile an"
acceing the "ata at another location% or
acceing "atabae "irectly through a
"atabae 'uery inter$ace.
Thee other metho" #oul" alo be
a""ree" in a ecurity arrangement. 1or
e&ample% acce to a "atabae 'uery inter$ace
may be limite" to rea".only acce% #ith the
table toring the uer account an" pa#or"
ha!ing no acce.
3.1,. Speed - Efficienc+
3.19.1. %&ecution Spee-
3.19.1.1.'ccessin( -ata
A igni$icant proportion o$ proceing time i
in!ol!e" in acceing "ata. Thi may inclu"e
earching lit locate a "ata item% or
e&ecuting a earch $unction #ithin a "ata
tructure.
3.19.1.1.1. 'ccess 0et1o-s
The $un"amental acce metho" inclu"e the
$ollo#ing.
3.19.1.1.1.1. Direct 'ccess
3irect acce in!ol!e uing an in"i!i"ual
"ata !ariable or in"e&ing an array element.
Thi i the $atet #ay to acce "ata.
In a $ully compile" program% both thee
operation re'uire only a $e# machine co"e
intruction.
In contrat% a earch o$ a lit o$ 1%000 item
may in!ol!e thouan" o$ machine co"e
operation.
3.19.1.1.1.2. Se$i5Direct 'ccess
3ata can be accee" "irectly uing mall
integer !alue a array in"e&e.
0o#e!er% "ata cannot be accee" "irectly by
uing a tring% $loating point number or #i"e.
ranging integer !alue to re$er to the "ata
item.
3ata tore" uing tring an" other key can
be accee" in e!eral tep by uing a "ata
tructure uch a a hah table.
Acce time to a hah table entry i lo#er
than acce to an array% a the hah $unction
!alue mut be calculate". 0o#e!er% thi i a
$i&e" "elay an" i not a$$ecte" by the number
o$ item tore" in the table.
Acce time can lo# a a hah table
become $ull.
3.19.1.1.1.3. 4inary Searc1
A binary earch can locate an item in a orte"
array in an a!erage o$ appro&imately log
2
(n).
1 comparion.
Thi i generally the implet an" $atet #ay
to locate "ata uing a tring re$erence.
Enle the "ata i=e i e&tremely large% uch
a o!er one million array element% then the
o!erhea" in calculating a hah table key i
likely to be higher than the number o$
comparion in!ol!e" in a binary earch.
A binary earch i uitable $or a tatic lit that
ha been orte".
0o#e!er% i$ item are a""e" to the lit or
"elete" $rom the lit% thi approach may not
be practical. 7ither a complete re.ort #oul"
be re'uire"% or an inertion into a orte" lit
coul" be ue" #hich #oul" in!ol!e an nJ2
a!erage up"ate time.
In thee cae% a hah table or a el$.
balancing tree coul" be ue".
3.19.1.1.1.4. %&1austive Searc1
An e&hauti!e earch in!ol!e imply
canning the lit $rom the $irt item on#ar"
until the "ata item i locate".
Thi take an a!erage o$ nJ2 comparion to
locate an item.
3.19.1.1.1.5. 'ccess 0et1o- Co$parison
The a!erage number o$ comparion
in!ol!e" in locating a ran"om element i
lite" in the table belo#.

7ntrie 3irect In"e& Binary Search
1ull Scan
(orte")
(unorte")
100 1 *.U
*0
1%000 1 K.0
*00
10%000 1 12.3
*%000
100%000 1 1*.U
*0%000
1%000%000 1 1L.K
*00%000
10%000%000 1 22.3
*%000%000
The "irect in"e& metho" can be ue" #hen
the item i re$erence" by an in"e& number.
5hen the item i re$erence" by a tring key%
an alternati!e metho" can be ue".
The hah table acce i not ho#n.
0o#e!er% it ha a $i&e" acce o!erhear" that
coul" be o$ the appro&imate or"er o$ the 20.
comparion binary earch operation.
The binary earch metho" can only be ue"
#ith a orte" lit. Sorting i a lo# operation.
Thi metho" #oul" be uitable $or "ata that
i rea" at the beginning o$ program e&ecution
an" can be orte" once.
The $ull earch i e&tremely lo# an" #oul"
not be practical $or lit o$ more than a $e#
hun"re" item #here repeate" can #ere
in!ol!e".
3.19.1.1.2. Ta(s
Searching by tring !alue can be a!oi"e" in
ome cae by aigning temporary numeric
tag to "ata item $or internal proceing.
1or e&ample% the primary an" $oreign key o$
"atabae recor" may be bae" on tring
$iel"% or #i"ely.ranging numeric co"e.
5hen !alue are rea" into array $or internal
calculation% each entry coul" be aigne" a
mall number% uch a the array in"e&% a a
tag.
<ther "ata tructure #oul" then ue the tag
to re$er to the "ata% rather than the tring key.
Thi #oul" allo# that "ata to be accee"
"irectly uing a "irect array in"e&.
3.19.1.1.3. +n-irect '--ressin(
In cae #here a "ata item cannot be
accee" "irectly uing a numeric in"e& or a
binary earch on a orte" array% an in"irect
acceing metho" may be able to be ue".
Thi approach #oul" apply #hen there #a a
nee" to earch a table by more than one $iel"%
or #hen a numeric in"e& !alue "i" not map
"irectly to an array entry% uch a an in"e&
into a compacte" table.
Thi metho" in!ol!e "e$ining an a""itional
array that i in"e&e" by the earch item% an"
contain an entry that peci$ie the in"e& into
the main array.
In the cae o$ an in"irect in"e&% uch a a
mapping into a compacte" table% the array
#oul" be in"e&e" by the original in"e& an"
#oul" contain the in"e& !alue $or the
compacte" table.
In the cae o$ a tring earch% the array #oul"
be orte" by the tring $iel". Thi #oul" be
earche" uing a binary earch metho" an"
#oul" contain the in"e& into the main table.
Thi approach coul" alo be ue" #hen the
main table containe" large block o$ "ata%
an" mo!ing the "ata "uring a ort operation
#oul" be a lo# proce.
3.19.1.1.4. Sublists
In cae #here earching lit i una!oi"able%
the earch time may be re"uce" i$ the "ata i
broken into ub.ection.
Thi i e$$ecti!ely a partial ort o$ the "ata.
1or e&ample% a et o$ "ata may contain ten
ample $rom ten location% $or a total o$ 100
"ata item. Searching thi "ata #oul" in!ol!e
an a!erage o$ *0 comparion.
0o#e!er% i$ the ample #ere allocate" to
in"i!i"ual location% then earching the
location #oul" take an a!erage o$ *
comparion% an" earching the ample
#oul" alo in!ol!e an a!erage o$ $i!e
comparion% $or a total o$ 10 a!erage
comparion.
A""itionally% although one o$ the other
approache uch a "irect in"e&ing may not
be practical $or the $ull "ata et% it may be
applicable to one o$ the tage in the ub.lit
tructure.
3.19.1.1.5. ;eys
5here "ata i locate" by earching $or
e!eral "i$$erent "ata item% the "ata item
can be combine" into a ingle te&t key.
Thi key can then be ue" to locate the "ata
uing one o$ the tring in"e& metho"% uch
a a hah table or a binary earch on a orte"
array.
3.19.1.1.6. 0ultiple 'rray +n-e&es
5here "ata i i"enti$ie" by e!eral
in"epen"ent numeric item% a multiple
"imenion array can be ue" to tore the "ata%
#ith each numeric item being ue" to in"e&
one o$ the array "imenion.
Thi allo# $or "irect in"e&ing% ho#e!er a
large !olume o$ memory may be ue". The
memory conume" i e'ual to the i=e o$ the
array item multiplie" by the i=e o$ each o$
the "imenion. 1or e&ample% i$ the $irt
"imenion co!ere" a range o$ 3000 !alue%
the econ" "imenion co!ere" L0 !alue an"
the thir" "imenion co!ere" *00 !alue% then
the array #oul" contain 120 million entrie.
Thi problem may be re"uce" by compacting
the table to remo!e blank entrie an" uing a
eparate array to in"irectly in"e& the main
table% or by uing numeric !alue $or ome
"imenion an" locating other !alue by
earching the "ata.
3.19.1.1.!. Cac1in(
)aching i ue" to tore "ata temporarily $or
$ater acce.
Thi i ue" in t#o conte&t. )aching may be
ue" to tore "ata that ha been retrie!e"
$rom a lo#er acce torage% uch a toring
"ata in memory that ha been retrie!e" $rom
a "atabae or "ik $ile.
Alo% caching can be ue" to tore pre!iouly
calculate" !alue that may be ue" in $urther
proceing. Thi particularly applie to
calculation that re'uire" rea"ing "ata $rom
"ik in or"er to calculate the reult.
A tructure" et o$ reult can be tore" in an
array. 5here a large number o$ "i$$erent
type o$ "ata are tore"% a tructure uch a a
hah table can be ue".
)aching o$ calculate" reult can alo be
tore" in temporary "atabae.
5here input $igure ha!e change"% the
cache" reult #ill not longer be !ali" an"
houl" be "icar"e"% other#ie incorrect
!alue may be ue" in other calculation.
3.19.1.2.'voi-in( %&ecution
7&ecution pee" can be increae" by
a!oi"ing e&ecuting tatement unnecearily.
3.19.1.2.1. 0ovin( co-e
Mo!ing co"e ini"e ,i$- tatement an"
outi"e loop may increae e&ecution pee".
I$ the reult o$ a tatement are only ue" in
certain circumtance% then placing an ,i$-
tatement aroun" the co"e may re"uce the
number o$ time that the co"e i e&ecute".
Thi coul" alo in!ol!e mo!ing the tatement
ini"e an e&iting ,i$- tatement.
Mo!ing co"e outi"e a loop ha a imilar
e$$ect. I$ a tatement return the ame reult
$or each iteration o$ the loop% then the co"e
coul" be mo!e" outi"e the loop to a
pre!iou poition.
Thi #oul" reult in the tatement being
e&ecute" only once% rather than e!ery time
that the loop #a repeate".
3.19.1.2.2. Repeate- Calculation
In ome cae a calculation i repeate" but it
cannot be mo!e" outi"e a loop.
Thi can occur #ith nete" loop $or
e&ample.
5here a tatement #ithin the inner loop
re$er to the inner loop !ariable% it cannot be
mo!e" outi"e the inner loop a it !alue
may be "i$$erent #ith each iteration o$ the
loop.
0o#e!er% i$ thi tatement "oe not re$er to
the outer loop !ariable% then the entire cycle
o$ !alue #ill be repeate" $or each iteration
o$ the outer loop.
Thi ituation can be a""ree" by inclu"ing
a eparate loop be$ore the nete" loop% to
cycle through the inner loop once an" tore
the reult o$ the tatement in a temporary
array.
Thee array !alue coul" then be ue" in the
inner nete" loop.
Thi may ha!e igni$icant impact on the
e&ecution time #hen the tatement inclu"e a
ubroutine call to a lo# $unction an" the
outer loop i e&ecute" a large number o$
time.
3.19.1.3.Data types
3.19.1.3.1. Strin(s
+roceing #ith tring i igni$icantly
lo#er than proceing #ith numeric
!ariable.
)opying tring $rom one !ariable to another%
an" per$orming tring operation may
in!ol!e memory allocation an" copying
in"i!i"ual character #ithin the tring
In contrat% etting a numeric !alue can be
"one #ith a ingle intruction.
In general e&ecution pee" may be
igni$icantly increae" i$ numeric !alue are
ue" $or internal proceing rather than tring
co"e.
1or e&ample% "ate% tag to i"enti$y recor"%
$lag an" proceing option coul" all be
repreente" uing numeric !ariable rather
than tring co"e.
/umeric "ata an" "ate rea" into a ytem
may be in a tring $ormat% in #hich cae the
"ata can be con!erte" to a numeric "ata type
$or torage an" proceing.
3.19.1.3.2. <u$eric Data
Integer "ata type generally pro!i"e the
$atet e&ecution pee".
1loating point number calculation may alo
be $at% a har"#are generally upport
$loating point calculation "irectly.

0o#e!er% many language upport other
numeric "ata type that may be 'uite lo#% i$
the arithmetic i implemente" internally a a
et o$ ubroutine.
The numeric "ata type that are compile"
into "irect har"#are intruction !arie #ith
the language% har"#are plat$orm an"
language implementation.
3.19.1.4.'l(orit1$s
The choice o$ algorithm can ha!e a
igni$icant impact on e&ecution pee". In
cae #here thi a!ailable memory i
retricte"% the choice o$ algorithm can alo
impact on the !olume o$ memory ue" $or
"ata torage.
In ome cae% alternati!e algorithm to
pro"uce the ame reult may "i$$er in
e&ecution pee" by many or"er o$
magnitu"e.
Sorting i an e&ample o$ thi. Sorting an
array o$ one million item uing the bubble
ort algorithm #oul" in!ol!e appro&imately
one trillion operation% #hile uing the
'uickort algorithm may in!ol!e
appro&imately 20 million operation.
In many cae e!eral "i$$erent algorithm
can be ue" to calculate a particular reult.
Algorithm that can input "ata #ithout
backtracking may be $ater than algorithm
that in!ol!e backtracking.
1or e&ample% a tet earching metho" that
ue" a $inite tate automaton to can the te&t
in a ingle pa may be $ater than an
alternati!e algorithm that in!ol!e"
backtracking.
Some algorithm make a ingle pa through
the input "ata% #hile other in!ol!e multiple
pae.
I$ the complete procee can be per$orme"
"uring a ingle pa then $ater e&ecution
may be achie!e"% particularly #hen "atabae
accee are in!ol!e". 0o#e!er% in ome
cae a proce #ith e!eral imple pae
may be $ater than a proce that ue a
ingle comple& pa.
3.19.1.5.Run5ti$e processin(
In ome cae% a tructure can be compile" or
tranlate" into another tructure that can be
procee" more 'uickly.
1or e&ample% a te&t $ormula may peci$y a
particular calculation. +roceing thi
$ormula may in!ol!e i"enti$ying the
in"i!i"ual element #ithin the $ormula%
paring the tring to i"enti$y bracket an" the
or"er o$ operator% an" $inally calculating the
reult.
I$ the calculation #ill be applie" to many
"ata item% then the e&preion can be
tranlate" into a pot$i& e&preion an"
tore" in an internal numeric co"e $ormat.
Thi #oul" enable the e&preion to be
"irectly e&ecute" uing a tack. Thi #oul"
be a relati!ely $at operation an" #oul" be
igni$icantly $ater than calculating the
original e&preion $or each "ata item.
Thi proce coul" be e&ten"e" to the cae o$
a macro language uing !ariable an" control
$lo#% by generating internal interme"iate
co"e an" e&ecuting the co"e uing a imple
loop an" a tack.
Another e&ample o$ eparate run.time
proceing #oul" in!ol!e algorithm that
generate $inite tate automaton $rom
pattern uch a language grammar or te&t
earch pattern.
<nce the $inite tate automaton ha been
generate"% it can be ue" to proce the input
at a high rate% a a ingle tranition i
per$orme" $or each input character an" no
backtracking i in!ol!e".
3.19.1.6.Co$ple& Co-e
5hen a ection o$ co"e ha been ub8ect to a
large number o$ change an" a""ition% the
proceing can become !ery comple&. Thi
may in!ol!e" multiple nete" loop% re.
canning o$ "ata tructure an" comple&
control $lo#. Thee change may lea" to a
igni$icant "rop in e&ecution pee".
In thee cae% re.#riting the co"e an"
changing the "ata tructure may lea" to a
"ratic re"uction in comple&ity an" an
increae in e&ecution pee"
3.19.1.!.<u$eric Processin(
/umeric proceing i generally $ater #hen
the "ata i loa"e" into program array be$ore
the calculation commence. 3ata may be
loa"e" $rom "atabae% "ata $ile% or more
comple& program "ata tructure.
7&ecution pee" may be increae" i$
calculation are not repeate" multiple time.
Thi ituation can alo arie #ithin
e&preion.
1or e&ample% an e&preion o$ the $orm ,& ;
a @ b @ c- may appear #ithin an inner
proceing loop. 0o#e!er% i$ part o$ the
e&preion "oe not change #ithin the inner
loop% uch a the ,b @ c- component% then
thi calculation can be mo!e" outi"e the
loop.
Thi may lea" to an e&preion o$ ," ; b @ c-
in an outer loop% an" ,& ; a @ "- in the inner
loop.
5here a calculation #ithin an inner loop i
e$$ecte" by the inner loop but not the outer
loop% then a eparate loop can be a""e"
be$ore the main loop to generate the et o$
reult once% an" tore then in a temporary
array $or ue #ithin the inner loop.
Special cae #ithin the tructure o$ the
calculation an" "ata may enable the number
o$ calculation to be re"uce".
1or e&ample% i$ a matri& i triangular% o that
the "ata !alue are ymmetrical aroun" the
"iagonal% then only the "ata on one i"e o$
the "iagonal nee" to be calculate".
A another e&ample% ome part o$ the
calculation may be able to be per$orme"
uing integer rather than $loating point
operation. 0o#e!er% the con!erion time
bet#een the integer an" $loating point
$ormat #oul" alo a$$ect the "i$$erence in
e&ecution time.
I$ the "ata i likely to contain a large number
o$ !alue e'ual to =ero or one% then thee
input !alue can be checke" be$ore
per$orming unneceary multiplication or
a""ition.
Integer operation that in!ol!e
multiplication or "i!iion by po#er o$ t#o
can be per$orme" uing bit hi$t intea" o$
$ull arithmetic operation.
An integer "ata item can be multiplie" by a
po#er o$ t#o by hi$ting the bit to the le$t%
by a number o$ place that i e'ual to the
e&ponent o$ the multiplier.
In language that upport pointer arithmetic%
tepping through an array by incrementing a
pointer may be $ater than uing a loop #ith
an array in"e&.
In cae #here an e&tremely large number o$
calculation are per$orme" on a et o$
numeric "ata% e!eral tep may lea" to light
per$ormance increae.
Acceing e!eral ingle."imenional array
may be lightly $ater than acceing a
multiple "imenional array% a one le
calculation i in!ol!e" in locating an element
poition.
5hen multiple "imenional array are ue"%
acce may be lightly $ater i$ the array
"imenion i=e are po#er o$ t#o. Thi i
"ue to the $act that the multiplication
re'uire" to locate an element poition can be
per$orme" uing a bit hi$t% #hich may be
$ater than a $ull multiplication.
3.19.1.".#an(ua(e an- %&ecution
%nviron$ent
In e&treme cae an increae in e&ecution
pee" may in!ol!e changing the program to a
"i$$erent programming language or
"e!elopment en!ironment.
1ully compile" co"e that pro"uce an
e&ecutable $ile i generally the $atet #ay to
e&ecute a program.
Some language an" "e!elopment plat$orm
are bae" on interpreter or ue partial
compilation an" a run.time interpreter to
e&ecute the co"e.
Thee approache may be ubtantially
lo#er than uing a $ull compiler.
)ompiler o$ten implement optimiing
$eature to increae e&ecution pee" by
per$orming action uch a con!erting
multiplication by po#er o$ t#o into bit
hi$t% automatically mo!ing co"e outi"e
loop% an" generating peci$ic machine co"e
intruction $or peci$ic ituation.
The le!el an" type o$ optimiation may be
electable #hen a compilation i per$orme".
3.19.1.8.Database 'ccess
+rocee that are tructure" to a!oi" re.
rea"ing "atabae recor" #ill generally
e&ecute more 'uickly than procee that
rea" recor" more than once.
5here a recor" #oul" be rea" many time
"uring a proce% the recor" can be rea" once
an" tore" in a recor" bu$$er or program
!ariable.
5hen a one.to.many link i being procee"%
i$ the chil" recor" are rea" in the or"er o$
the parent recor" key% not the chil" recor"
key% then each parent recor" #oul" only nee"
to be rea" once.
+roceing the chil" recor" in the or"er o$
the chil" recor" key may re'uire re.rea"ing a
parent recor" $or e!ery chil" recor".
Selecting a proceing or"er that re'uire
only a ingle pa through the "ata #oul"
generally reult in $ater e&ecution that an
alternati!e proce that ue" multiple pae
through the "ata% or that re.rea" recor"
#hile proceing one ection o$ the "ata.
3.19.1.19. Re-un-ant Co-e
In co"e that ha been hea!ily mo"i$ie"% there
may be ection o$ co"e that calculate a
reult or per$orm proceing that i ne!er
ue".
A""itionally% ome reult may be pro"uce"
an" then o!er#ritten at a later tage by other
$igure% #ithout the original reult ha!ing
been accee".
Aemo!ing re"un"ant co"e can impli$y the
co"e an" increae e&ecution pee".
3.19.1.11. 4u(s
+er$ormance problem may ometime be
"ue to bug. A bug may not a$$ect the reult
o$ a proce% but it may reult in a "atabae
recor" being re.rea" multiple time% a loop
e&ecuting a larger number o$ time than i
neceary% cache" "ata being ignore"% or
ome other problem.
Eing an e&ecution pro$iler or a "ebugger
may i"enti$y per$ormance problem in
une&pecte" ection o$ co"e "ue to bug.
3.19.1.12. Special Cases
In ome calculation or procee% there i a
particular proce than coul" be "one more
'uickly uing an alternati!e metho".
In thee cae% the alternati!e approach may
alo be inclu"e"% an" ue" $or the particular
cae that it applie to.
1or e&ample% a ubroutine to calculate &
y

coul" implement a tan"ar" numerical
metho" to calculate the reult.
0o#e!er% thi may be a lo# calculation% an"
in a particular application it may be the cae
that the !alue o$ ,y- i o$ten 2% to calculate
the 'uare o$ a number.
In thi cae the !alue o$ ,y- coul" be
checke" in the ubroutine% an" i$ it i e'ual to
2 then a imple multiplication o$ ,y @ y-
coul" be ue" in place o$ the general
calculation.
Another e&ample concern orting. In a
comple& application it may be the cae that a
lit i ometime orte" #hen it i alrea"y in
a orte" or"er.
The ort routine coul" check $or the pecial
cae that the input "ata #a alrea"y orte"% in
#hich cae the $ull orting proce #oul" not
be neceary.
Special cae may alo apply to caching%
rather than a particular $igure or et o$ "ata.
1or e&ample% a ubroutine to return the ne&t
item in a lit a$ter a peci$ie" poition coul"
retain the !alue o$ the lat poition returne"%
a in many cae a imple can o$ the lit
#oul" be "one an" thi #oul" a!oi" the nee"
to re.etablih the tarting poition.
3.19.1.13. Peror$ance 4ottlenec2s
In ome cae the ma8ority o$ the proceing
time may be pent in a mall ection o$ co"e.
Thi may occur #ith nete" loop $or
e&ample. I$ an outer loop iterate 1000 time
an" the inner loop alo iterate 1000 time%
then the co"e #ithin the inner loop #ill be
e&ecute" one million time.
In"irect nete" loop can occur #hen a
ubroutine i calle" $rom #ithin a loop% an"
the ubroutine itel$ contain a loop.
Thi #oul" initially appear to be t#o ingle.
le!el loop% ho#e!er becaue the ubroutine
i calle" $rom #ithin one o$ the loop% the
number o$ time that the co"e #oul" be
e&ecute" #oul" be the pro"uct o$ the number
o$ loop iteration% not the um.
In ome "e!elopment en!ironment an
e&ecution pro$iling program can be ue" to
"etermine the proportion o$ e&ecution time
that i pent #ithin each ection o$ the co"e.
In ome cae a nete" loop may be a!oi"e"
by changing the or"er o$ neting.
1or e&ample% i$ an array i canne" uing a
loop an" another array i canne" #ithin that
loop% i$ the $irt array can be "irectly
accee" uing an array in"e&% then a nete"
loop coul" be a!oi"e" by canning the
econ" array $irt% an" uing the "irect in"e&
to acce the $irt array.
Alo% ub.lit coul" be e&pan"e" to pro!i"e
a ingle complete et o$ "ata combination%
rather than inclu"ing a main et o$ "ata an"
multiple ub.lit o$ relate" in$ormation.
3.19.2. 0e$ory :sa(e
3.19.2.1.Data :sa(e
3.19.2.1.1. +n-ivi-ual variables
/umeric !ariable ue le memory pace
than tring. 5here poible% replacing tring
!alue in table an" array #ith a number
co"e may re"uce memory uage.
Integer numeric !ariable generally occupy
le memory pace than other numeric "ata
type.
Alo% $loating point "ata type may be
a!ailable in e!eral le!el o$ preciion.
)hanging an array o$ "ouble.preciion
$loating point !alue to ingle.preciion
!ariable may hal!e the memory uage%
although thi #oul" only be practical #hen
the ingle.preciion $ormat containe" an
a"e'uate number o$ "igit o$ preciion $or
the "ata being tore".
3ata type uch a "ate may be able to be
tore" a numeric !ariable rather than uing
a "i$$erent internal $ormat that conume
more memory.
3.19.2.1.2. 4it$aps
5here e!eral Boolean $lag are ue"% thee
can be tore" a in"i!i"ual bit uing a
bitmap metho"% rather than uing a $ull
integer !ariable $or each in"i!i"ual $lag.
In ome application% uch a graphic
proceing% in"i!i"ual "ata item may not ue
a number o$ bit that i a multiple o$ a
tan"ar" eight.bit byte.
1or e&ample% eight eparate !alue can be
repreente" uing a et o$ three bit. I$ a large
!olume o$ "ata conite" o$ number #ith
three.bit patten% then e!eral "ata item
coul" be tore" #ithin a particular byte.
Thi #oul" in!ol!e a calculation to
"etermine the location o$ a three.bit !alue
#ithin a block o$ "ata% an" the ue o$ bitmap
to e&tract the three.bit co"e $rom an eight.bit
"ata item.
3.19.2.1.3. Co$pactin( Structures
In cae #here tructure contain "uplicate"
entrie or blank entrie% the tructure may be
able to be compacte".
Thi can be "one by replacing the multiple
"uplicate" entrie #ith a ingle entry%
remo!ing blank entrie% an" uing a eparate
array to map the original array in"e&e to the
in"e& !alue into the compacte" array.
Thi i an in"irect in"e&ing metho".
3.19.2.1.4. Strin( tables
In cae #here a particular tring !alue may
appear multiple time #ithin a et o$ "ata% the
tring can be tore" in a eparate array% an"
the entrie in the original "ata tructure can
be change" to numeric in"e&e into the tring
table array.
Thi may alo increae proceing pee"
#hen entrie are mo!e" an" copie" in the
main "ata tructure.
3.19.2.2.Co-e Space :sa(e
3.19.2.2.1. Tas2 lan(ua(es
In ome cae a imple language may be able
to be "e!elope" that contain intruction
relating to the tak being per$orme".
Statement in thi language coul" then be
compile" into numeric co"e an" tore" a
"ata. At run time% a imple loop coul" then
proce the intruction to e&ecute the
proce.
1or e&ample% in an in"utrial control
application% a et o$ intruction $or opening
!al!e% rea"ing enor etc coul" be
"e!elope". The proce control itel$ coul"
be #ritten uing thee intruction% an" a
mall run.time interpreter coul" e&ecute the
intruction to operate the proce.
Thi i the approach ue" in central
proceing unit that ue microco"e. In thi
cae% the program intruction are e&ecute"
by a imple language #ithin the chip itel$.
3.19.2.2.2. Table -riven co-e
Table "ri!en co"e can be ue" to re"uce co"e
!olume in ome application. An increae in
"ata uage #oul" occur% ho#e!er thi #oul"
generally be le than the "ecreae in the
memory pace ue" $or the program
intruction.
A table "ri!en routine in!ol!e toring a lit
o$ $i&e" !alue in an array% uch a tring $or
a menu "iplay or !alue $or a ubroutine
call% an" uing a loop o$ co"e to can the
array an" call a ubroutine $or each entry in
the array. Thi replace multiple in"i!i"ual
line o$ co"e.
". The Craft of Programming
".1. Programming Languages
4.1.1. 'sse$bler
Machine co"e i the internal co"e that the
computer( proceor e&ecute. In pro!i"e
only baic operation% uch a arithmetic #ith
number% mo!ing "ata bet#een memory
location% comparing number an" 8umping
to "i$$erent point in the program bae" on
=eroJnon.=ero con"ition.
Aembly co"e i the "irect repreentation o$
machine co"e in a rea"able% te&t $ormat.
Aembler ha no ynta& an" i imply a
e'uence o$ intruction.
Aembly co"e i the $atet #ay to
implement a proce"ure ho#e!er it ha ome
e!ere limitation.
7ach proceor ue a "i$$erent et o$
machine co"e intruction% o an aembly
language program mut be completely re.
#ritten to run on a computer that ue a
"i$$erent internal proceor.
Aembler i a !ery baic language an" a
large !olume o$ co"e mut be #ritten to
accomplih a particular $unction.
Aembly language i ometime ue" in
controlling har"#are an" in"utrial machine
control% an" in application #here pee" i
critical% $or e&ample the routing o$ "ata
packet in a high.pee" net#ork.
4.1.2. T1ir- ,eneration #an(ua(es
Thir".generation language (394)% re$er to a
range o$ programming language that are
imilar in tructure an" are in #i"eprea"
ue.
Thee language operate at the le!el o$ "ata
!ariable% ubroutine% ,i$- tatement% loop
etc.
A large proportion o$ all program are #ritten
uing thir" generation language.
4.1.2.1. )ortran
1ortran an" )obol #ere the $irt #i"ely.ue"
programming language% #ith )obol being
ue" $or buine "ata proceing an" 1ortran
$or numeric calculation in engineering an"
cienti$ic application.
1ortran i an acronym $or ,1<Amula
TAA/lator- 1ortran ha trong $acilitie $or
calculation an" #orking #ith number% but i
le ue$ul $or tring an" te&t proceing.
4.1.2.2. 4asic
Baic #a initially "eigne" $or teaching
1ortran. Baic i an acronym $or ,Beginner
All +urpoe Symbolic Intruction )o"e-.
Baic ha $le&ible tring han"ling $acilitie
an" reaonable numeric capabilitie.
4.1.2.3. C
) #a original "e!elope" a a ytem.le!el
language an" #a aociate" #ith the
"e!elopment o$ the E/IV operating ytem.
) i $at an" po#er$ul% an" make e&teni!e
ue o$ pointer. ) i ue$ul $or "e!eloping
comple& "ata tructure an" algorithm.
0o#e!er% proceing tring in ) i
cumberome.
4.1.2.4. Pascal
+acal #a initially "e!elope" $or teaching
computer cience coure. +acal i name"
a$ter the mathematician Blaie +acal% #ho
in!ente" the $irt mechanical calculating
machine o$ mo"ern time.
+acal i a highly tructure" language that
ha trict type checking an" multiple le!el
o$ ubroutine an" "ata !ariable cope.
4.1.3. 4usiness /rientate- #an(ua(es
4.1.3.1. Cobol
)obol operate at a imilar le!el to thir".
generation language% ho#e!er it i generally
groupe" eparately a the tructure o$ cobol
i 'uite "i$$erent $rom other language.
)obol i an acronym $or ,)<mmon Buine
<rientate" 4anguage-.
)obol i "eigne" $or "ata proceing% uch
a per$orming calculation an" generating
report #ith large !olume o$ "ata. 6at
amount o$ cobol co"e ha!e been #ritten an"
are particularly ue" in banking% inurance
an" large "ata proceing en!ironment.
In cobol% "ata $iel" are "e$ine" a a tring o$
in"i!i"ual character% an" each poition in
the !ariable may be "e$ine" a an alphabetic%
alphanumeric or numeric character.
Arithmetic can be per$orme" on numeric
item.

+roceing i accomplihe" #ith proce"ural
tatement. )obol tatement ue 7nglih.
like entence an" cobol co"e i eay to rea"%
ho#e!er a cobol program can $ill a larger
!olume o$ te&t pace that an e'ui!alent
program in an alternati!e language.
)obol i cloely intert#ine" #ith main$rame
operating ytem an" "atabae ytem%
reulting in e$$icient proceing o$ large
!olume o$ "ata.
4.1.3.2. )ourt1 ,eneration #an(ua(es
=4,#>
1ollo#ing the increaing comple&ity o$
computer ytem in the 1KM0( an" L0(%
attempt #ere ma"e to "e$ine ne# higher.
le!el language that coul" be ue" to "e!elop
"ata proceing application uing $ar le
co"e than pre!iou language.
Thee language in!ol!e "e$ining creen an"
report layout% an" inclu"e a minimum
amount o$ co"e $or peci$ying $ormula.
1ourth.generation language% alo kno#n a
application generator% are #i"ely ue" $or
the "e!elopment o$ buine application in
large.cale en!ironment.
0o#e!er% #hile thir".generation language
can be a"apte" to any programming tak%
$ourth.generation language are peci$ic to
buine "ata proceing application.
9enerating the application may in!ol!e
running a proce that pro"uce ource co"e
in a language uch a )obol or ). Thi output
co"e #oul" then be compile" to pro"uce the
application itel$.
Alternati!ely% the $ormat may be compile"
into binary "ata $ile an" a run.time $acility
may be ue" to "iplay the creen an"
operate the application.
4.1.4. /b3ect5/rientate- #an(ua(es
<b8ect.orientate" language ha!e e&ite"
ince the earliet "ay o$ computing in the
1KU0(% ho#e!er they only gre# into
#i"eprea" ue in the 1KK0(.
Many ob8ect.orientate" language are
e&tenion o$ thir".generation language.
4.1.4.1. C??
)?? i a ma8or << language. )?? i an
e&tenion o$ ).
Some o$ the $acilitie o$ )?? inclu"e the
ability to "e$ine ob8ect% kno#n a clae%
containing "ata an" relate" ubroutine%
kno#n a metho". Thee clae may
operate at e!eral le!el an" ub.clae can
be "e$ine" that inclu"e the "ata an"
operation o$ other cla ob8ect.
)?? alo upport operator o!erloa"ing%
#hich allo# operator uch a a""ition to be
applie" to ne#ly.create" "ata type.
4.1.4.2. @ava
Ba!a i an ob8ect orientate" language
"e!elope" $or ue in internet application. It
ha a ynta& that i imilar to )% but i not
bae" on a pre!iou language "eign.
Ba!a inclu"e "ynamic memory allocation $or
creating an" "eallocating ob8ect% an" a
trictly "e$ine" et o$ cla librarie
(ubroutine) that i inten"e" to be portable
acro all operating en!ironment.
Ba!a generally run in a ,!irtual machine-
en!ironment $or portability an" ecurity
reaon.
4.1.5. Declarative #an(ua(es
4.1.5.1. Prolo(
+rolog i a "eclarati!e language. A prolog
program conit o$ a et o$ $act% rather than
a et o$ tatement that are e&ecute" in or"er.
+rolog i ue" in "eciion.making an" goal.
eeking application.
<nce the program ha been "e$ine"% the
prolog interpreter then ue the "e$ine" $act
in an attempt to ol!e the problem that i
preente".
1or e&ample% a prolog program may inclu"e
the mo!e o$ a che game. The prolog
interpreter #oul" then ue the $act that #ere
"e$ine" in the program to "etermine the
mo!e in a computer che game.
4.1.5.2. S6#
SG4% Structure" Guery 4anguage% i a "ata
'uery language that i ue" in relational
"atabae. SG4 i a "eclarati!e language an"
group o$ recor" are "e$ine" a a et% #hich
can be retrie!e" or up"ate".
SG4 tatement may be e&ecute" in e'uence
ho#e!er the actual election o$ recor" i
bae" on the tructure o$ the election
tatement.
4.1.5.3. 4<) ,ra$$ars
A Backu /aur 1orm grammar i a language
that i ue" to peci$y the tructure o$ other
language.
The ynta& o$ ome programming language
can be $ully peci$ie" uing a et o$
tatement #ritten a a B/1 grammar.
B/1 grammar are "eclarati!e an" peci$y
the tructure an" pattern o$ a language.
4.1.6. Special5Purpose #an(ua(es
4.1.6.1. #isp
4ip i a highly unuual language that #a
"e!elope" early in the hitory o$ computing%
an" ue" in arti$icial intelligence reearch.
All "ata item in 4ip are tore" a lit. All
proceing in 4ip in!ol!e canning lit.
The ynta& o$ 4ip i !ery imple% but
in!ol!e mai!e amount o$ bracket a lit
are "e$ine" #ithin lit #hich are #ithin
other lit.
The program co"e itel$ i alo tore" in lit%
a #ell a the "ata item.
4.1.6.2. 'P#
,A +rogramming 4anguage-% A+4 i a
language that #a "e!elope" $or actuarial
calculation in!ol!ing inurance an" $inance
calculation.
A+4 i highly mathematical an" inclu"e
operator $or matri& calculation etc. A+4
co"e i !ery "i$$icult to rea" an" the A+4
character et inclu"e a #i"e range o$ pecial
character% uch a re!ere arro# Z% that
are not ue" in other programming language
or general te&t.
A+4 make e&teni!e ue o$ a large number
o$ operator an" ymbol an" contain $e#
key#or".
4.1.6.3. Sy$bolic Calculation #an(ua(es
Some package $or e!aluating an" "iplaying
mathematical $unction inclu"e ymbolic
calculation language.
Thee package recognie mathematical
e'uation% an" can re.arrange e'uation an"
ol!e the e'uation $or a particular !ariable.
In contrat% tan"ar" programming language
"o not recognie $ull mathematical e'uation%
but recognie e&preion intea".
1or e&ample% the tatement ,y ; & @ 2 ? *-
#oul" be interprete" a ,"etermine the !alue
o$ ,&-% multiply it by t#o% a"" $i!e an" then
copy the reult into the !ariable ,y- in mot
thir".generation language
The e'ual ign i "ecepti!e a it "oe not
repreent a tatement o$ $act% a in an
e'uation% but it repreent an action to be
per$orme".
The ,;- ign i the aignment operator. In
ome language a "i$$erent ymbol uch a
,>;- i ue" $or the aignment operator.
Although the e&preion on the right han"
i"e o$ the ,;- ign i e!aluate" a an
e&preion% the !alue on the le$t.han" i"e o$
the ,;- ign i imply a !ariable name.
True mathematical e'uation uch a ,y . * ;
& @ 2- are not recognie" by tan"ar"
programming language.
0o#e!er% a language that upport ymbolic
calculation #oul" recognie thi e'uation
an" #oul" be able to calculate the !alue o$
any !ariable #hen gi!en the !alue o$ the
other !ariable.
Alo% ome ymbolic calculation language
upport calculation #ith true $raction.
In mot programming language W i treate"
a one "i!i"e" by three% #ith a reult o$
0.333333. Multiplying thi reult by 3 #oul"
pro"uce 0.KKKKKK% not 1.
Eing true $raction% ho#e!er% W @ 3 ; 1.
4.1.!. .oste- #an(ua(es
0ote" language are compile" an" e&ecute"
#ithin an application.
The application may pro!i"e a "e!elopment
en!ironment% #hich may inclu"e e"iting an"
"ebugging $acilitie.
The application alo upplie the
in$ratructure neceary to "iplay creen
in$ormation% print% loa" "ata etc. A range o$
built.in $unction #oul" alo be inclu"e"%
"epen"ing on the particular $unction
upporte" by the application
4.1.!.1. 0acro #an(ua(es
Application may inclu"e a language $or
peci$ying $ormula or "e!eloping $ull
program co"e #ithin macro.
Thee language may be peci$ically
"e!elope" $or the application% or they may be
implementation o$ tan"ar" programming
language.
Acceing "ata an" $unction in other part
o$ the application may be lo#% a multiple
layer o$ o$t#are may be in!ol!e".
0o#e!er% acceing "ata an" !ariable #ithin
the program itel$ may be reaonably $at%
"epen"ing on the interpreter ue" to run the
co"e an" the le!el o$ compilation ue".
4.1.!.2. Database #an(ua(es
Some "atabae ytem inclu"e programming
language that can be ue" to "e!elop
complete application.
In ome cae thee language are interprete"
an" may e&ecute relati!ely lo#ly% #hile in
other cae a $ull compiler i a!ailable.
4.1.". %&ecution Script lan(ua(es
Aunning program% coping $ile an"
per$orming other operating ytem $unction
can be "one #ith language uch a hell
cript an" 8ob control language.
Statement in cript language inclu"e
program an" $ile name% an" may alo
upport !ariable an" baic operation uch
a ,i$- tatement. Script language may
inclu"e pattern.matching $acilitie $or
earching te&t an" matching multiple
$ilename.
Although compiler may be a!ailable in
ome cae% in general a cript language i
interprete" an" run on a tatement.by.
tatement bai by the operating ytem or
comman" line interpreter.
4.1.8. Report ,enerators
Aeport generator allo# a report to be
automatically pro"uce" once the layout an"
$iel" ha!e been "e$ine".
1ormula can be a""e" $or calculation%
ho#e!er co"e i not re'uire" to pro"uce the
report itel$.
Aeport generator are ue$ul $or pro"ucing
report that appear in a ro# an" column
$ormat.
3ocument output% uch a a page #ith graph
an" table o$ $igure% coul" be pro"uce" by
uing a tan"ar" language in a graphical
printing en!ironment.
Alternati!ely% the "ocument coul" be hote"
in an application uch a a #or" proceor%
#ith macro co"e ue" to up"ate "ata $rom
e&ternal ource.
".2. Development Environments
4.2.1. Source Co-e Develop$ent
The three $un"amental element o$ a
"e!elopment en!ironment are an e"itor% a
compiler an" a "ebugger.
An e"itor i ue" to !ie# an" mo"i$y the
ource co"e.
)ompiler compile the ource co"e an"
pro"uce an e&ecutable $ile. Alternati!ely%
interpreter or !irtual machine may pro!i"e
the run.time in$ratructure nee"e" to e&ecute
the program.
A "ebugger i a program that i ue" to ait
in "ebugging. 3ebugger allo# the program
to be toppe" "uring e&ecution% an" the !alue
o$ "ata !ariable can be e&amine".
In ome en!ironment all three program
may be integrate" into a ingle uer inter$ace%
#hile in other en!ironment eparate
program are ue".
4.2.2. Version Control
6erion control or ource.co"e control
ytem per$orm t#o main $unction.
They generally allo# pre!iou !erion o$ a
$ile to be accee"% o that change can be
checke" #hen "ebugging or "e!eloping ne#
co"e.
Alo% thee ytem allo# a ource $ile to be
locke"% o that problem "o not occur #here
t#o people attempt to mo"i$y the ame
ource co"e $ile at the ame time.
4.2.3. +nrastructure
+rogram are generally "e!elope" uing
other co"e $acilitie in a""ition to the
language operation.
Thi coul" inclu"e ubroutine librarie%
$unctional engine% an" acce to operating
ytem $unction.
The co"e element may be ource" $rom
pre!iou pro8ect% a et o$ common routine
acro pro8ect% tan"ar" language librarie
an" $rom e&ternal ource.
4.2.3.1. C1an(es to Co$$on Co-e
)hange to e&iting common co"e can be
han"le" in e!eral #ay.
1or ytem that are currently in
"e!elopment% or #here $uture change are
e&pecte"% the ytem uing the ubroutine or
$unction can be up"ate" to re$lect the change.
1or ol" ytem #here a large number o$
change are not e&pecte"% a eparate copy o$
the common co"e may be tore" #ith the
ytem. Thi a!oi" the nee" to continually
up"ate the ytem to imply re$lect change
in the common co"e.
Alternati!ely% in ome cae the e&iting co"e
can be le$t intact an" a ne# ubroutine can be
a""e" #ith a lightly "i$$erent name. Thi i
impractical #hen a large number o$ change
are ma"e% but may be ue" #hen e&ternal
program ue the inter$ace an" the e&iting
"e$inition mut be le$t unchange" $or
compatibility reaon.
4.2.3.2. Develop$ent o Co$$on
)unctions
)ommon $unction are uually reer!e" $or
$unction that per$orm general calculation
an" operation that are likely to be ue" in
other pro8ect.
1uture change can be re"uce" i$ the
ubroutine upport the $ull calculation or
$unction that i in!ol!e"% rather than the
peci$ic cae that may be ue" in the current
pro8ect.
7rror han"ling in common co"e may in!ol!e
returning error con"ition rather than
"iplaying meage% a the co"e may be
calle" in "i$$erent #ay in $uture pro8ect.
Alo% the co"e may a!oi" input an" output
$unction uch a $ile acce% creen "iplay
an" printing. Thi #oul" allo# the $unction
to be ue" by "i$$erent pro8ect in "i$$erent
circumtance.
".3. S+stem Design
Sytem "eign i largely bae" on breaking
connection% an" uing "i$$erent approache
$or "i$$erent component o$ the "eign.
Thi inclu"e connection bet#een the
$ollo#ing component>
+rocee per$orme" an" the internal
ytem "eign.
The ytem "eign an" the co"ing
mo"el.
The uer inter$ace tructure an" the
co"e control $lo# mo"el.
The application "ata ob8ect an" the
ytem ob8ect.
3atabae entitie an" program
tructure% an" the peci$ic "ata.
The e'uence o$ $unction call an" the
outcome.
The outcome o$ a ubroutine call an"
pre!iou e!ent.
The outcome o$ a ubroutine call an"
e&ternal "ata.
)onnection bet#een ma8or co"e
mo"ule.
4.3.1. Conceptual 4asis
A ytem #ill generally be built on the
concept that un"erlie a particular $iel" or
proce.
1or e&ample% a ,$uture- tranaction i a
$inancial.market tranaction that in!ol!e
$i&ing $uture price $or buying or elling a
commo"ity.
An accounting ytem may treat thi a a
contract% #ith a et o$ payment an" a
$inihing "ate.
An in!etment management ytem may treat
thi a an aet that ha" a tra"ing !alue. Thi
!alue #oul" rie an" $all each "ay a the
$inancial market mo!e".
Thi ame intrument i recor"e" in
completely "i$$erent #ay un"er "i$$erent
conceptual mo"el.
<ne mo"el recor" a !alue that rie an" $all
"aily% #hile the other mo"el recor" a et o$
payment o!er time.
In ome cae the baic concept an"
tructure are clearly "e$ine"% an" a ytem
coul" be "irectly built on the ame
$oun"ation.
0o#e!er% "eigning a eparate et o$
concept $or the ytem may lea" to a more
$le&ible internal tructure that coul" be more
eaily a"apte" to "i$$erent proceing.
In other cae% a ytem may inclu"e
$unction that relate to more than one
conceptual $rame#ork. In thee cae% a
eparate et o$ concept an" mo"el may
nee" to be "e!elope" to implement both
$rame#ork.
1or e&ample% in the pre!iou cae o$ the
$uture tranaction% a ytem that per$orm
both accounting an in!etment management
$unction #oul" nee" to ue an internal
concept o$ a $uture tranaction that allo#e"
the implementation o$ both the accounting
!ie#% o$ regular payment% an" the
in!etment !ie#% o$ a tra"e" aet.
1or e&ample% one internal approach #oul" be
to break the link bet#een ,account- an"
,tranaction-% an" imply recor" cah$lo#.
An account coul" be a collection o$
cah$lo# that matche" a certain criteria.
Alo% the link bet#een aet an" tra"ing
!alue coul" be broken% reulting in a mo"el
bae" on ,actual cah$lo#- (hitorical
tranaction)% ,pre"icte" ca$lo#- ($orecat
payment) an" ,potential cah$lo#- (market
!alue).
4.3.2. #evel o 'bstraction
<ne approach to ytem "eign i to "irectly
tranlate the procee% "ata ob8ect an"
$unction that the application upport into a
ytem "eign an" co"e.
The lea" to traight$or#ar" "e!elopment%
an" co"e that i clear an" eaily maintaine".
0o#e!er% thi approach can alo lea" to a
large !olume o$ co"e% an" pro"uce a ytem
tructure that i "i$$icult to mo"i$y.
A higher le!el o$ abtraction may be
pro"uce" by "e$ining a maller number o$
more general ob8ect% an" uing thee ob8ect
an" $unction to implement the $ull
application.
Thi approach may re"uce co"e !olume an"
create a more $le&ible internal tructure.
0o#e!er% the initial "eign an" "e!elopment
may be more comple& an" the ytem may be
more "i$$icult to "ebug.
1or e&ample% rather than "e!eloping a et o$
eparate report or procee% a general report
$unction or proceing $unction coul" be
"e!elope"% #ith the actual reult being
"epen"ant on the $lag an" option electe".
At a higher le!el o$ abtraction% an
implementation may inclu"e internal macro
language $or calculation% $un"amental
operation on baic ob8ect uch a
calculation on block o$ "ata% an" a
complete "iconnection bet#een the
application ob8ect an" procee an" the
internal co"e tructure.
Thi proce may lea" to e!en maller co"e
!olume an" more $le&ible internal
operation% #ith the "ia"!antage o$ longer
initial "e!elopment time an" comple&
tran$ormation bet#een internal ob8ect an"
application procee.
4o# le!el o$ abtraction are ue$ul #hen
there i little o!erlap bet#een procee%
#hile high le!el o$ abtraction are ue$ul $or
ytem uch a o$t#are tool% an" $or
proceing ytem that inclu"e a large
number o$ imilar operation.
4o# le!el o$ abtraction in!ol!e mainly
application co"ing an" little in$ratructure
"e!elopment% #hile high le!el o$ abtraction
in!ol!e mainly in$ratructure "e!elopment
#ith little application co"ing.
<utput i generally more conitent #ith
highly abtracte" ytem. In lo# abtraction
ytem% minor "i$$erence in $ormatting an"
calculation metho" can arie bet#een
"i$$erent procee.
4.3.3. Data +nor$ation vs. Structure
+nor$ation
In general% ytem tructure are impler an"
more $le&ible% co"e !olume are maller% an"
co"e i impler #hen in$ormation i recor"e"
#ithin a ytem a "ata rather than a
tructure.
1or e&ample% a ytem may in!ol!e e!eral
pro"uct #ith a eparate "atabae table an"
program tructure $or each pro"uct.
The tructure o$ the "atabae table an"
program ob8ect #oul" peci$y part o$ the
in$ormation concerning the application
element.
A impler approach #oul" be to ue a ingle
pro"uct table an" tructure% an" recor" the
"i$$erent pro"uct a "ata recor" an" table
entrie.
A $urther generaliation #oul" be to remo!e
pro"uct.peci$ic $iel" an" proceing% an"
tore a et o$ general $iel" that coul" be ue"
to peci$y option $or a general et o$
proceing.
In ome cae an application may contain a
large number o$ tructure% ob8ect an"
$unction% #hile the "atabae "e$inition an"
co"e tructure may implement a mall
number o$ general tructure.
The application "etail #oul" then relate to
the "ata tore" #ithin the "atabae an" co"e
table.
In general a impler ytem may reult $rom
uing the minimum number o$ "atabae
table an" program tructure.
4.3.4. /rt1o(onality
5hen a et o$ option i a!ailable $or a
proce% $unctionality may be increae" i$ the
option are in"epen"ent an" all combination
o$ the option are a!ailable.
1or e&ample% a report mo"ule may "e$ine a
ort or"er% layout type an" a ubtotalling
metho".
I$ each option #a implemente" a a eparate
tage in the co"e% rather than implementing
each combination in"i!i"ually% thi #oul"
lea" to orthogonal $unctionality.
In the cae o$ t#o ort or"er% $i!e layout
type an" three ubtotalling metho"% there
#oul" be three ma8or ection o$ co"e an"
2?*?3 ; 10 total co"e ection.
0o#e!er% the number o$ poible output
combination #oul" be 2@*@3 ; 30 output
report $ormat.
Thi $unction may ha!e been "eri!e" $rom
$i!e eparate report $ormat.
By combining the report $ormat%
o!erlapping co"e #oul" be eliminate"
lea"ing to a re"uction in co"e !olume% an"
the number o$ output $ormat #oul" rie
$rom * to 30.
A another e&ample% i$ a graphic engine
upporte" three type o$ light an" three
type o$ !ie# $rame% then in an orthogonal
ytem any light coul" be ue" #ith any !ie#
$rame.
In practice ome combination may not be
upporte"% either becaue they #oul" be
particularly "i$$icult to implement% they
#oul" take an e&tremely long time to
e&ecute% or becaue they peci$ie" logical
contra"iction.
1or e&ample% a lit can be orte" in acen"ing
or "ecen"ing or"er% but cannot be orte" in
both or"er imultaneouly.
5hen electe" option con$lict% one outcome
may be electe" by "e$ault.
4.3.5. ,enerality
9enerality in!ol!e $unction that per$orm
$un"amental operation% rather than peci$ic
procee.
1or e&ample% a calculation routine that
e!aluate" any $ormula #oul" be a more
general $acility than a calculation metho"
that implemente" a $i&e" et o$ $ormula.
A "ata tructure that tore" "etail o$
pro"uct #oul" be a more general tructure
than creating a eparate "ata tructure $or
each pro"uct.
+er$orming proceing bae" on attribute%
$lag an" number i a more general
approach than implementing peci$ic
combination o$ option #ithin the co"e.
1or e&ample% toring a $ormula on a recor"
#oul" be a more general approach than
toring a !ariable that in"icate" that
calculation metho" A houl" be ue".
In cae #here the ame $ormula may appear
on multiple recor"% a eparate table coul" be
create" to repreent a "i$$erent "atabae
ob8ect% rather than inclu"ing $i&e" option
#ithin the co"e.
9enerality alo applie to $unction that
accept !ariable input $or proceing option%
rather than a !alue that i electe" $rom a
$i&e" lit o$ option.
1or e&ample% a proceing routine that
accepte" a number o$ "ay bet#een
operation #oul" be a more general routine
than an alternati!e that implemente" a $i&e"
et o$ perio".
In broa" term% a general proce or $unction
i one that i able to per$orm a #i"er range o$
$unction than an alternati!e implementation.
4.3.6. 4atc1 Processes
Batch procee are procee that per$orm a
large amount o$ proceing% an" are generally
"eigne" to be run unatten"e".
Thi may inclu"e rea"ing large number o$
"atabae recor"% or proceing large
amount o$ numeric "ata.
5hen "ata problem occur "uring
proceing% thi may be han"le" by #riting
an error meage to a log $ile an" continuing
proceing.
More eriou error% uch a internal program
error or miing critical "ata may reult in
terminating the proce.
4.3.6.1. +nput C1ec2in(
Input "ata can be checke" uing a range o$
check. 1or e&ample%
3ata that i negati!e% =ero or outi"e
e&pecte" range.
3ata that i inconitent% uch a
percentage that "o not um to 100.
3ata that i greatly "i$$erent $rom
pre!iou !alue.
4.3.6.2. /utput C1ec2in(
Interacting procee may in!ol!e a manual
check o$ the reult% ho#e!er in the cae o$ a
batch proce% large !olume o$ "ata may be
up"ate" to a "atabae.
<utput reult can be checke" uing imilar
check to the input "ata% to "etect poible
error be$ore incorrect "ata i #ritten to a
$ile.
4.3.6.3. Peror$ance
+er$ormance may be a igni$icant iue #ith
batch procee.
3ata that #ill be rea" multiple time can be
tore" in internal program array or "ata
recor" bu$$er.
The or"er in #hich the proceing i
per$orme" can alo ha!e a igni$icant impact
on e&ecution pee".
5hen a one.to.many "atabae link i being
procee"% i$ the chil" recor" are rea" in the
or"er o$ the parent key then each parent
recor" #oul" only nee" to be rea" once.

1or e&ample% i$ account recor" #here
procee" in account number or"er% then the
cutomer recor" #oul" ha!e to be rea" $or
each ne# account. 0o#e!er% i$ the account
recor" #ere procee" in cutomer number
or"er% then the account $or each cutomer
#oul" be procee" in e'uence an" the
cutomer recor" #oul" only ha!e to be rea"
once.
4.3.6.4. Re*ritin(
Batch proceing co"e i o$ten !ery ol"% a it
per$orm baic $unction that change little
o!er time.
Ae#riting co"e may ha!e lea" to a re"uction
in e&ecution time% particularly i$ the co"e ha
been hea!ily mo"i$ie" or a long time ha
elape" ince it #a $irt #ritten.
5hen the co"e ha been hea!ily mo"i$ie"%
the co"e may calculate reult that are ne!er
ue"% rea" "atabae recor" that are not
accee" an" re.rea" recor" unnecearily.
Thi may occur #hen co"e in a late part o$
the proce i change" to a "i$$erent metho"%
ho#e!er the earlier co"e that calculate" the
input $igure remain unchange".
Ae.rea"ing recor" may occur a the control
$lo# #ithin the mo"ule become more
comple&.
Alo% re.#riting the co"e may enable
tructure in the "atabae an" the co"e to be
ue" that #ere not a!ailable #hen the
mo"ule #a originally #ritten.
4.3.6.5. Data Scannin(
A batch procee may alo be #ritten purely
to can the "atabae% an" apply check uch
a range check to i"enti$y error in the "ata.
".". Soft.are Component !odels
A o$t#are component i a ma8or ection o$ a
program that per$orm a relate" et o$
$unction.
1or e&ample% the uer inter$ace co"e
han"ling creen "iplay an" application
control $lo# may be eparate" into a ma8or
ection o$ the program.
)alculation co"e may alo be groupe" into a
eparate ection o$ co"e.
So$t#are component may conit o$ a
ection o$ relate" co"e% or the $unction
per$orme" by the component may be groupe"
into a clearly "e$ine" $unctional inter$ace.

4.4.1. )unctional %n(ines
An engine i an in"epen"ent o$t#are
component that ue a imple inter$ace% an"
ha comple& internal proceing.
3atabae management ytem are an
e&ample o$ a $unctional engine.
<ther engine may inclu"e calculation
engine% printing engine% graphic engine
etc.
In ome cae an engine e&ecute a an
in"epen"ent proce% an" communication
occur through a program inter$ace.
4.4.2. 'bstract /b3ects an- )unctions
So$t#are component uch a proceing
engine are generally more $le&ible an"
ue$ul #hen they "eal #ith a number o$
$un"amental ob8ect an" $unction% rather
than a et o$ $i&e" procee.
1or e&ample% a calculation engine may
calculate the reult o$ any $ormula that i
preente" in the peci$ie" $ormat% an" apply
$ormula to block o$ "ata.
Thi #oul" be a more ue$ul component than
an engine that calculate" the reult o$ a
$i&e" et o$ $ormula.
4.4.3. +$ple$entation
The mo"el o$ "ata an" $unction that appear
on one i"e o$ the inter$ace i in"epen"ent o$
the internal tructure o$ the co"e on the other
i"e o$ the inter$ace% #hich may ue the ame
ob8ect or may be tructure" "i$$erently.
1or e&ample% the co"e on the other i"e o$
the inter$ace coul" implement the ob8ect an"
procee "irectly% or tranlate $unction call
into "e$inition an" attribute% an" per$orm
actual proceing #hen "ata or output #a
re'uete".
Alo% the inter$ace ob8ect themel!e coul"
be implemente" #ithin the o$t#are
component uing a maller et o$ concept.
Thee ob8ect coul" be ue" to implement the
$ull range o$ ob8ect an" $unction that #ere
"e$ine" in the inter$ace.

4.4.4. Sin(le %ntry an- %&it Points
So$t#are component are generally more
$le&ible #hen they operate through a ingle
entry point.
3eigning a ingle entry point inter$ace may
alo lea" to a clearer tructure $or both the
inter$ace an" the internal co"e.
Thi in!ol!e "e$ining a et o$ $unction an"
operation that are upporte" by the
component% an" paing intruction an" "ata
through a ingle inter$ace.
In ome cae a ingle e&it point coul" alo
be ue".
In thi cae% the ubroutine call that are
ma"e #ithin the component #oul" be re.
route" through a ingle $unction that
accee" e&ternal operation. Thi $unction
#oul" then call the rele!ant e&ternal
$unction $or "atabae operation% creen
inter$acing etc.
Thi approach #oul" allo# the internal co"e
o$ the component to be "e!elope" completely
in"epen"ently. )hanging inter$ace to
e&ternal co"e% an" uing the component in
alternati!e ituation% coul" be "one by
mo"i$ying the e&ternal er!ice routine.
4.4.5. Co-e 0o-els
Separating a ytem into ma8or $unctional
ection allo# a "i$$erent co"e mo"el to be
ue" in each ection.
4.4.6. Se7uence Depen-ance
)omponent are more $le&ible #hen
in"epen"ent operation can be calle" in any
or"er. 1or e&ample% a graphic inter$ace may
"e$ine that te&ture% poition an" lighting
mut be "e$ine" in that or"er% or alternately
that the three element coul" be peci$ie" in
any or"er.
4.4.!. /rt1o(onality
<rthogonality #ithin an inter$ace allo#
each option an" $unction to be electe"
in"epen"ently% an" all combination #oul"
be a!ailable.
Thi increae the $unctionality o$ the
inter$ace% an" may alo make program
"e!elopment eaier through le retriction
o$ ue o$ the o$t#are component.
4.4.". ,enerality
A general $unctional inter$ace i one that
implement a #i"e range o$ $unction.
Thi may in!ol!e paing continuou "ata
!alue a input% rather than electing $rom a
pre."e$ine" lit o$ option.
1un"amental $unction an" operation may
be more general than a o$t#are component
inter$ace that inclu"e a range o$ application.
peci$ic $unction an" "ata ob8ect.
".$. S+stem /nterfaces
4.5.1. :ser +nteraces
4.5.1.1. C1aracter 4ase- +nteraces
)haracter bae" uer inter$ace in!ol!e the
ue o$ a keyboar" $or ytem input% an" $i&e"
character poition $or !i"eo "iplay.
Aunning $unction may be "one uing menu
option% or through a comman" line inter$ace.
4.5.1.2. Co$$an- #ine +nteraces
A comman" line inter$ace i bae" on a
"ialog bae" ytem. Thi generally ue a
character bae" inter$ace #ith keyboar" input
an" a $i&e" character "iplay.
)omman" are type" into the ytem. The
particular $unction i per$orme"% an"
proceing return to the comman" line to
accept $urther input.
)omman" line inter$ace are o$ten a!ailable
#ith operating ytem% $or per$orming tak
uch a running program an" copying $ile.
Some application alo inclu"e a comman"
line inter$ace.
4.5.1.3. ,rap1ical :ser +nteraces
9raphical uer inter$ace in!ol!e a graphical
layout o$ #in"o# an" "ata% an" the ue o$ a
moue an" keyboar" to elect item an" input
"ata.
7n!ironment that upport graphical uer
inter$ace are generally multi.taking% an"
allo# multiple #in"o# to be open an"
program to be running at a particular time.
4.5.1.4. /t1er :ser +nteraces
In other circumtance% "i$$erent "e!ice may
be ue" $or both input $rom the uer an" the
"iplay or output o$ in$ormation.
Input "e!ice coul" inclu"e control panel%
peech recognition etc. <utput "e!ice coul"
inclu"e multiple !i"eo "iplay% in"icator
panel% printe" lit output etc.
4.5.1.5. 'pplication Control )lo*
)ontrol $lo# #ith application may $ollo# a
menu ytem. Thi i ue" in both character.
bae" an" graphical en!ironment.
Selecting an option $rom a menu may
per$orm the peci$ie" $unction% or "iplay a
ub.menu.
Menu ytem can be hierarchical% #ith ub
menu connecte" "irectly to main menu.
1unction may appear in one place or they
may appear on multiple ub.menu.
In ome cae ub.menu may be cro.
connecte" an" a ubmenu coul" 8ump
"irectly to another ubmenu.
<ther control $lo# mo"el inclu"e e!ent
"ri!en ytem. In thi mo"el% $unction can
be per$orme" by electing application ob8ect
or comman" button an" per$orming the
action re'uire" to run the $unction.
Application control $lo# may be proce.
"ri!en or $unction."ri!en.
+roce."ri!en control $lo# #oul" in!ol!e
electing menu option to per$orm !ariou
procee% an" may be ue" $or "ata
proceing ytem.
1unction."ri!en ytem $ocu on "ata
ob8ect rather than procee. Thi approach
i commonly ue" $or o$t#are tool.
In a $unction "ri!en ytem% the ob8ect #oul"
$irt be electe"% an" then the $unction to run
#oul" be in!oke".
+rogram co"e can be tructure" in the ame
#ay a the application control $lo#. Thi
approach lea" to a "irect implementation%
#ith the tructure o$ the internal co"e
$ollo#ing the tructure o$ the application
itel$.
0o#e!er% in other cae an in"irect link may
be more uitable. 1or e&ample% a proce.
"ri!en ytem #ith a large amount o$ o!erlap
bet#een procee coul" be implemente"
internally uing a $unction."ri!en co"e
tructure% #hile a $unction."ri!en application
may be implemente" internally a a et o$
procee.
4.5.2. Pro(ra$ +nteraces
+rogram inter$ace are ue" #hen a program
connect to another program or o$t#are
component.
Thi inclu"e inter$ace to ubroutine
librarie% "atabae management ytem%
operating ytem $unction% proceing
engine an" other ma8or mo"ule #ithin the
ytem.
4.5.2.1. <arro* +nteraces
/arro# inter$ace occur #hen the inter$ace
conit o$ a mall number o$ $un"amental
operation an" "ata ob8ect.
The ue o$ a narro# inter$ace enable the
co"e on each i"e o$ the inter$ace to be
change" in"epen"ently.
Alo% the inter$ace itel$ may be eaier to ue.
Thi i a looely.couple" inter$ace% a in
theory the application program coul" be
couple" to a "i$$erent o$t#are component
that per$orme" imilar $unction% poibly
uing a tranlation layer.
Thi may occur% $or e&ample% in porting an
application to another operating ytem that
ue" "i$$erent creen or printing operation.
An alternati!e creen or printing engine
coul" be "e!elope" $or the alternati!e
operating ytem% an" couple" to the main
program.
An e&ample o$ a narro# inter$ace i a "ata
'uery language% #ith tatement pae" to a
"atabae engine. The "ata retrie!al an"
up"ate operation are peci$ie" by the
tatement containe" in the 'uery te&t tring.
A ubroutine library that containe" a large
number o$ ubroutine% each per$orming a
imple $unction% #oul" be a #i"e inter$ace.
The $unction in ubroutine library coul"
repreent a cloely.couple" inter$ace% a the
inter$ace #oul" contain a large number o$
link an" interaction. Thi #oul" pre!ent the
co"e on either i"e o$ the inter$ace $rom
being change" in"epen"ently% a thi #oul"
alo re'uire igni$icant change on the other
i"e o$ the inter$ace. Alo% the co"e coul" not
be replace" #ith an alternati!e library that
ue" a "i$$erent internal tructure% a the
tructure itel$ #oul" be part o$ the inter$ace.
Many program inter$ace are implemente" a
ubroutine call% ho#e!er in the cae o$ a
narro# inter$ace thi may conit o$ a $e#
ubroutine pro!i"ing a link that pae
intruction an" "ata through the inter$ace.
A narro# $unctional inter$ace "oe not
necearily imply a lo# "ata tran$er rate% a
#oul" be the cae in a narro# ban"#i"th
net#ork.
A narro# $unctional inter$ace may upport
the tran$er o$ large block o$ "ata% in
contrat to a narro# "ata channel #hich
in!ol!e tran$erring "ata erially% #ith mall
"ata item tran$erre" in e'uence% rather
than a parallel tran$er o$ all the "ata in a
ingle large block.
4.5.2.2. Passin( Data
3ata can be pae" though inter$ace uing
parameter to ubroutine% or pointer to "ata
ob8ect tore" in memory.
Another approach in!ol!e the ue o$ a
han"le.
A han"le i a mall "ata item that i"enti$ie a
"ata ob8ect. The han"le i returne" to the
calling program% ho#e!er the "ata ob8ect
itel$ remain #ithin the o$t#are component
that #a calle".
1or e&ample% calling a graphic engine to
loa" a graphic ob8ect may reult in the
ob8ect being loa"e" into the graphic
engine( memory pace% an" a han"le being
returne" to the calling program.
The han"le coul" then be ue" to i"enti$y the
ob8ect #hen $urther call #ere ma"e to the
graphic engine.
4.5.2.3. Passin( +nstructions
Aather than containing a large number o$
ubroutine call to per$orm in"i!i"ual
$unction% a narro# program inter$ace #ork
by paing intruction through the inter$ace.
Thi may take the $orm o$ a imple language%
uch a a "ata 'uery language. A calculation
engine may recei!e te&t tring containing
$ormula or imple tatement $or applying
$ormula to "ata ob8ect.
Intruction can alo be pae" a a et o$
numeric operation co"e.
1or e&ample% an engine $or "iplaying
#ire$rame image o$ tructure coul"
implement intruction to "e$ine an element%
"e$ine connection bet#een element% "e$ine
a !ie# poition an" generate an image.
Thee $unction coul" be implemente" in an
inter$ace by uing a numeric !alue to
repreent the operation to be per$orme"% an"
a han"le to in"icate the "ata ob8ect.
Thi approach #oul" lea" to a imple
inter$ace that #a eaily e&ten"e"% an" #oul"
alo upport "ata tran$er through net#ork
connection or inter.proce communication
channel.
4.5.2.4. <on5Data #in2in(
In general% a program inter$ace pae "ata
bet#een procee% an" ubroutine an" "ata
!ariable on the other i"e o$ the inter$ace
cannot be "irectly accee".
Thi allo# the inter$ace to be clearly
"e$ine"% an" pre!ent problem "ue to
interaction bet#een ection o$ co"e on
either i"e o$ the inter$ace.
A""itionally% i$ intruction an" "ata are
pae" through an inter$ace channel% then the
t#o co"e ection can e&ecute in"epen"ently%
an" may operate in eparate memory pace%
through inter.proce communication or
through a net#ork communication channel.
0o#e!er% in ome cae callback $unction
are implemente".
Thi occur #here the engine call a
ubroutine #ithin the main program.
In ome cae callback $unction are
una!oi"able. 1or e&ample% a general orting
routine that applie" to any type o$ ob8ect
#oul" nee" to call a ubroutine in the main
program to compare t#o ob8ect% o that the
or"er o$ the orting coul" be "etermine".
".&. S+stem Development
4.6.1. +nrastructure an- 'pplication
Develop$ent
Sytem "e!elopment can be broken into t#o
eparate phae.
In$ratructure "e!elopment in!ol!e
"e!eloping $acilitie that are ue" internally
#ithin the program.
Thi coul" inclu"e "e!eloping "ata tructure
an" the ubroutine $or operating on them%
"e!eloping ubroutine librarie% "e!eloping
proceing engine% "e!eloping common
mo"ule in proce.orientate" ytem% an"
"e!eloping ob8ect mo"el in ob8ect.
orientate" ytem.
Application "e!elopment in!ol!e #riting
co"e that per$orm the proceing re'uire"
by the ytem% han"le the uer inter$ace% an"
per$orm the $unction an" operation that
the application upport.
In ome pro8ect% the ma8ority o$ "eign an"
co"ing may in!ol!e application co"ing. Thi
may be bae" on traight$or#ar" proceing%
or it may be bae" on an e&iting
in$ratructure.
The in$ratructure ue" coul" inclu"e
$acilitie "e!elope" $or earlier pro8ect% or a
combination o$ operating ytem $unction%
tan"ar" language librarie% an" e&ternally.
ource" librarie.
In other pro8ect the ma8ority o$ the
"e!elopment proce may in!ol!e
in$ratructure "e!elopment% #ith the
application compriing a collection o$ imple
co"e that call general proceing $acilitie.
Thi may occur in proceing application
#ith a large "egree o$ o!erlap bet#een
imilar $unction% an" alo #ith $unction.
"ri!en application uch a o$t#are tool%
#here the application itel$ may be largely a
uer inter$ace aroun" a et o$ general
$acilitie.
The "e!elopment o$ ome in$ratructure can
reult in a ytem that ue le co"e% i more
$le&ible% an" i more conitent acro
"i$$erent part o$ the ytem.
0o#e!er% "e!eloping in$ratructure co"e i
time conuming. Alo% a comple&
in$ratructure may make ytem "e!elopment
more "i$$icult i$ the comple&ity o$ the
in$ratructure i greater than the comple&ity
o$ the un"erlying application re'uirement.
4.6.2. Pro3ect Syste$s Develop$ent
3e!eloping a ytem on a pro8ect bai
in!ol!e a et o$ tage.
Typically a "e!elopment proce coul"
inclu"e the $ollo#ing tep
Ae'uirement Analyi
Sytem Analyi
Sytem 3eign
)o"ing
Teting H 3ebugging
3ocumentation
4.6.2.1. Re7uire$ents 'nalysis
Ae'uirement analyi in!ol!e "e$ining the
broa" cope o$ a ytem% an" the baic
$unction that it #ill per$orm.
Thi may be bae" on a "ocument that i
upplie" a an input to the ytem
"e!elopment proce.
Alternati!ely% the re'uirement analyi can
be "one at an early tage o$ the pro8ect% prior
"e!eloping the ytem.
I"eally the re'uirement peci$ication houl"
outline the baic $unction an" operation
that the ytem houl" pro!i"e% along #ith a
et o$ "eirable but non.eential $unction.
4.6.2.2. Syste$s 'nalysis
Sytem analyi in!ol!e "e$ining the
$unction that the ytem houl" per$orm%
inclu"ing "etail o$ the calculation%
proceing% an" the "ata that houl" be
tore".
Thi proce reult in the pro"uction o$ a
$unctional peci$ication.
The $unction an" "ata re'uire" can be
etablihe" by "etermining the output that
the ytem houl" pro"uce% an" #orking
back#ar" to the input "ata an" the
calculation that are neceary to pro"uce the
output.
Some a""itional "ata may be tore" purely
$or recor".keeping purpoe% ho#e!er thi
proce #oul" i"enti$y the $un"amental "ata
that #a nee"e" $or the proceing to be
complete".
The $unction peci$ie" may inclu"e
interacti!e $acilitie an" batch proceing
$unction.
7&ception an" pecial cae are a minor
iue in manual proceing an" calculation
en!ironment% but they are a igni$icant iue
in ytem "eign.
1or e&ample% i$ one $ormula applie" to
10%000 client an" a "i$$erent $ormula applie"
to 1 client% then "ouble the amount o$ co"e
#oul" ha!e to be #ritten to cater $or the 1
client that ue" a "i$$erent $ormula.
+roceing e&ception arie #hen
"icontinue" pro"uct or operation remain
acti!e% #hen eparate arrangement apply to
con!erion $rom another pro"uct or ituation%
an" #hen non.tan"ar" arrangement are
entere" into.
Special cae can be han"le" by
conoli"ating a range o$ ituation into a
number o$ pro"uct $eature an" option%
inclu"ing o!erri"e !alue on in"i!i"ual
recor" that o!erri"e "e$ault proceing
!alue% an" inclu"ing uer."e$ine" $ormula
in "atabae $iel" that can be a""e" to a lit
o$ a!ailable $ormula.
4.6.2.3. Syste$s Desi(n
Sytem "eign in!ol!e "eigning the
internal tructure o$ the ytem to pro!i"e the
application $acilitie that are peci$ie" in the
$unctional peci$ication.
In ome cae% the ytem "eign an" co"e
tructure may $ollo# the tructure o$ the
$unctional peci$ication an" the application
control $lo#.
Thi may lea" to a proce."ri!en co"e
tructure $or a "ata proceing ytem% or a
$unction."ri!en co"e tructure $or a o$t#are
tool.
In other cae% a "i$$erent co"e tructure
coul" be ue".
1or e&ample% #here there #a a large amount
o$ o!erlap bet#een "i$$erent procee%
implementing a proce."ri!en application
uing a $unction."ri!en co"e tructure may
reult in a large re"uction in co"e !olume.
A another e&ample% application mo"ule
may be groupe" by proce type% #hile the
co"e may be groupe" by internal $unction%
uch a creen "iplay% calculation routine
etc.
4.6.2.3.1. )uture %&pansion
In ome cae% aumption an" retriction
in the $unctional peci$ication coul" be
rela&e" to allo# $or $uture e&panion.
1or e&ample% a many.to.many link coul" be
implemente" #hen the "ata i currently
limite" to one.to.many combination% but
$uture change may be likely.
Alo% a general calculation $acility coul" be
implemente"% rather than programming a
$i&e" et o$ e&iting $ormula.
4.6.2.4. Co-e Develop$ent
In ome cae a "etaile" ytem "eign
"ocument may be pro"uce".
In other cae% co"e "e!elopment may $ollo#
"irectly $rom the $unctional peci$ication% or
$rom a co"e tructure that ha been electe"
$or implementing the ytem.
Teting an" "ebugging $ollo# a cycle o$
teting% correcting problem% releaing ne#
!erion o$ the tet ytem an" continuing
teting.
4.6.2.5. )or$al Develop$ent 0et1o-s
1ormal "e!elopment metho"ologie in!ol!e
a highly tructure" et o$ tep in the
"e!elopment proce. The procee an"
output o$ each tage are clearly "e$ine".
Thi approach i ue" i ome "ata
proceing "e!elopment en!ironment.
1ormal metho" "e$ine the tage in the
"e!elopment proce. Thi inclu"e the
procee that are per$orme" "uring each
tage an" the "ocument an" "iagram that
are pro"uce".
1ormal metho" ha!e a"!antage in
managing an" "e!eloping large "ata
proceing ytem.
The tep are clearly "e$ine"% an" the reult
o$ the "e!elopment procee% both in term
o$ the time perio" in!ol!e" an" that hape o$
the $inal ytem can be clearly i"enti$ie" at
the beginning o$ the pro8ect.
0o#e!er% there are e!eral "ia"!antage
#ith $ormal metho".
1ormal metho" generate large !olume o$
paper "ocumentation% an" may in!ol!e
e!eral layer o$ meticulou "e!elopment to
pro"uce a $inal ection o$ co"e that may be
'uite traight$or#ar".
A more eriou "ia"!antage relate to the
$lo#.through tructure o$ the "e!elopment
proce. There i a trong linking $lo#.
through $rom the initial re'uirement%
through to ytem analyi an" "eign% an"
$inally co"ing.
Thi may reult in the pro"uction o$ a ytem
that cloely matche the e&iting proce
mo"el an" "ata ob8ect. 5hile thi ytem
may per$orm the proceing $unction
#ithout "i$$iculty% it may alo be more
comple& an" in$le&ible than alternati!e
implementation.
A ytem "eign bae" on a range o$ general
ob8ect an" $unction may lea" to a impler
"ata% co"e an" uer inter$ace tructure than a
ytem that "irectly implement e&iting
procee.
4.6.3. #ar(e Syste$ Develop$ent
A large ytem may be traight$or#ar" in
"eign% but in!ol!e a large number o$
procee% "atabae table% report an"
creen.
Alo% a large "e!elopment may in!ol!e a
maller amount o$ co"e% but may implement
a comple& et o$ operation.
4.6.3.1. Separation o 0o-ules
4arge ytem "e!elopment may be more
e$$ecti!e #hen ma8or mo"ule are clearly
eparate"% an" communicate through "e$ine"
programming inter$ace.
Thi enable each ection to be "e!elope"
in"epen"ently. Alo% #here one ection i not
complete% another ection can continue
"e!elopment by re$erring to the "e$ine"
inter$ace #hen inclu"ing procee that
re'uire a link to the other mo"ule.
4.6.3.2. Consistency
)onitency in "eign% ue o$ language
$eature an" co"ing con!ention i important
in large ytem.
5hen co"e i conitently "e!elope"%
"i$$erent ection o$ the co"e can be rea"
#ithout the nee" to a"8ut to "i$$erent
con!ention.
Alo% conitency re"uce the chance o$
problem occurring #ithin inter$ace
bet#een mo"ule.
4.6.3.3. +nrastructure
4arge "e!elopment generally in!ol!e the
"e!elopment o$ ome common $unction an"
general $acilitie.
In too little in$ratructure i "e!elope"% a
large amount o$ "uplicate" co"e may be
#ritten. Thi may reult in a ytem that ha
large co"e !olume% i rigi" in tructure% an"
"oe not inclu"e internal $acilitie to enable
$uture mo"ule to be "e!elope" more eaily.
Alo% i$ too much in$ratructure i "e!elope"%
long "elay may be in!ol!e" an" the $inal
ytem may in!ol!e unnecearily comple&
co"e.
4.6.4. %volutionary Syste$s
Develop$ent
7!olutionary ytem "e!elopment in!ol!e
the continual "e!elopment o$ ytem an"
releaing ne# !erion on a regular bai.
So$t#are tool are $re'uently "e!elope" an"
e&ten"e" on an e!olutionary bai.
The e'uence o$ e!olutionary "e!elopment
$ollo# a pattern o$ a""ing a range o$ ne#
$eature an" $acilitie% an" then conoli"ating
a range o$ $eature into a ne# abtract
$acility.
Thi lea" to minor an" ma8or change% a
$eature are continually a""e"% an" then a
ma8or upgra"e occur a the "eign i re.
tructure" to inclu"e ne# concept an"
tructure that ha!e arien $rom the
in"i!i"ual $eature.
Sytem that are not retructure" on a regular
bai can become e&tremely comple&% #ith
e&ecution pee" an" reliability "ecreaing a
time pae an" more in"i!i"ual $eature are
a""e".
The e'uence o$ minor an" ma8or change
applie to the internal co"e tructure% an"
alo the ue o$ the application itel$% an" the
ob8ect an" $acilitie that it upport.
7!olutionary ytem generally become more
comple& a time pae. 7&iting $eature are
rarely remo!e" $rom ytem% ho#e!er ne#
$eature an" concept may be continually
a""e".
In ome cae% thi reult in the ytem
becoming o large an" comple& that it
e$$ecti!ely become unuable an"
unmaintainable% an" i e!entually aban"one".
The li$e pan o$ an e!olutionary ytem can
be e&ten"e" by making ma8or tructural
change #hen the ytem "eign ha become
more comple& than the $unction that it
per$orm% an" by remo!ing pre!iou
$unction $rom the ytem a the ytem
e!ol!e in "i$$erent "irection.
4.6.5. '-51oc Syste$ Develop$ent
A".hoc ytem "e!elopment in!ol!e
creating ytem $or untructure" an" hort.
term purpoe.
7&ample inclu"e tet program% con!erion
program an" pro"ucti!ity tool.

In ome cae a".hoc "e!elopment may be
"one uing a macro language that i hote"
#ithin an application uch a a prea"heet.
Thi allo# a imple proce to be per$orme"
#ithout the o!erhea" in!ol!e" in "e!eloping
a complete program.
The application pro!i"e the en!ironment $or
loa"ing "ata% "iplaying in$ormation% printing
etc.
An alternati!e to uing an application
program a a hot #oul" be to "e!elop a
mall temporary mo"ule #ithin an e&iting
ytem. Thi #oul" allo# the proce to ue
the internal $acilitie o$ the main program to
per$orm calculation an" proceing.
7&ecution pee" may be le important in an
a".hoc "e!elopment than in a permanent
ytem.
Thi may allo# impler metho" to be ue"
to #rite the co"e% uch a the ue o$ tring%
imple algorithm an" har".co"e" !alue.
In cae #here the ytem i e&pan"e" in i=e
an" continue in ue on a long.term bai% the
original "eign an" co"ing practice may be
unuitable $or long.term operation.
Thi coul" be a""ree" through a ma8or
conoli"ation an" re."eign% an"
commencing on an e!olutionary
"e!elopment path.
In other cae% particularly #hen the
programming language or "e!elopment
en!ironment itel$ i unuitable $or long term
operation% a complete re"e!elopment o$ the
ytem coul" be con"ucte".
4.6.6. @ust5+n5Ti$e Syste$
Develop$ent
But.in.time techni'ue are bae" on
repon"ing to problem a they arie% rather
than relying on $or#ar" planning to pre"ict
$uture con"ition.
But.in.time ytem "e!elopment may
in!ol!e "e!eloping an" releaing ection o$
a ytem in repone to proceing
re'uirement.
Thi approach in!ol!e repon"ing to
change in proceing re'uirement an"
a"apting the ytem to changing con"ition%
rather uing pro8ect "e!elopment o!er long
time$rame that rely on an e&pectation o$
$uture con"ition.
A But.in.time "e!elopment approach may be
uitable $or rapi"ly changing en!ironment.
Thi approach a!oi" e!eral problem that
are inherent in pro8ect "e!elopment.
The re'uirement $or a ytem o$ten arie
be$ore the ytem i "e!elope"% not at the
time that the "e!elopment #ill be complete".
A ome large "e!elopment pro8ect may
take e!eral year% thi mean that other
metho" mut be $oun" to per$orm the
$unction "uring the "e!elopment perio".
Thi may in!ol!e large !olume o$ manual
proceing% "e!elopment o$ temporary
ytem% patch#ork change to e&iting
ytem% an" populating "atabae #ith
in$ormation that later pro!e to be in an
unuitable $ormat.
4arge "e!elopment pro8ect may be
aban"one" or ne!er $ully implemente"% "ue
to unmanageable comple&ity% $la# in
"eign% or circumtance ha!ing change" o
much by the time the pro8ect i complete"
that the ytem i not o$ practical ue.
3ia"!antage #ith 8ut.in.time "e!elopment
inclu"e the $act that the proce i
"eliberately reacti!e% an" o an e$$ecti!e an"
$le&ible ytem "eign may not appear unle
the proce i combine" #ith regular internal
re"eign% an" proacti!e change bae" on a
me"ium.term !ie#.
Thi approach i imilar to the e!olutionary
"e!elopment approach. 0o#e!er% the
e!olutionary approach in!ol!e continuou
"e!elopment o$ a ytem% #hile the 8ut.in.
time approach in!ol!e a table ytem that
change a re'uire" in repone the change
in the proceing en!ironment.
4.6.6.1. '-vanta(es
Eing a 8ut.in.time approach% ytem are
a!ailable at hort notice. Thi may a!oi"
problem #ith uing temporary ytem% an"
toring "ata in #ay that later pro!e
unuitable $or hitorical proceing.
A the "e!elopment a"apt to changing
con"ition% the ytem may be more cloely
matche" to the proceing re'uirement that
a ytem "e!elope" o!er a long perio"% an"
bae" on aumption about the type o$
proceing re'uire"
4.6.6.2. Disa-vanta(es
A 8ut.in.time approach coul" lea" to a
ytem that i tructure" in a imilar #ay to
the proceing itel$.
Thi #oul" not generally be an i"eal
tructure% a thi #oul" lea" to a rigi" co"e
an" "ata "eign that #a "i$$icult to mo"i$y.
An alternati!e #oul" be to retain a eparation
bet#een the ytem tructure an" the
proceing re'uirement% an" a"apt the
ytem tructure in"epen"ently o$ the
proceing change.
Teting coul" become an iue #ith 8ut.in.
time "e!elopment% a $re'uent releae o$
ne# !erion #oul" increae the amount o$
teting in!ol!e" in the "e!elopment proce.
I$ tructural change #ere not ma"e
regularly% a 8ut.in.time proce coul"
"egenerate into a maintenance proce
in!ol!ing patch#ork change to a ytem.
Thi coul" occur #hen change #ere
implemente" "irectly% rather than a"apting
the ytem tructure to a ne# type o$ proce.
I$ the "e!elopment proce i tie" in too
cloely #ith the ue o$ the ytem% then
alternati!e ytem "eign an" tructure
may be lot an" the ytem may be limite" to
the current aumption an" metho" ue" in
proceing.
4.6.6.3. +$ple$entation
In general% 8ut.in.time "e!elopment may be
more e$$ecti!e #hen the ytem tructure i
a"apte" to uit a ne# proce% rather than
implementing the change "irectly.
1or e&ample% a change to a calculation coul"
be implemente" by a""ing a ne# $acility $or
peci$ying calculation option% rather than
inclu"ing the peci$ic change #ithin the
ytem.
Thi proce #oul" allo# the ytem to
retain a $le&ible an" in"epen"ent tructure%
bae" on a range o$ general $acilitie rather
than $i&e" procee.
5hen a large number o$ change ha" been
ma"e% internal tructure coul" be change" to
better re$lect the ne# $unction an" procee
that #ere being per$orme".
4.6.!. Syste$ Re-evelop$ents
Many ytem "e!elopment are bae" on
replacing an e&iting ytem.
A ytem that ha been hea!ily mo"i$ie" an"
e&ten"e" o$ten become comple&% untable
an" "i$$icult to ue an" maintain.
Alo% the $unction an" procee per$orme"
may change an" a ytem may not inclu"e
the $unction re'uire" $or the particular tak
being per$orme".
Ae"e!elopment may $ollo# the tan"ar"
pro8ect "e!elopment tep.
In ome cae% a better reult may be
achie!e" by a!oi"ing a "etaile" re!ie# o$ the
e&iting ytem.
Thi may occur becaue the e&iting ytem
#ill be bae" on a et o$ tructure an"
aumption that may not be the i"eal
tructure to ue $or a ne# "e!elopment.

+er$orming a "etaile" re!ie# o$ the e&iting
ytem may lea" to replacing the ytem #ith
a ne# !erion bae" on the ame tructure%
rather than "eigning a ne# tructure bae"
on the actual un"erlying re'uirement.
0o#e!er% a re!ie# o$ the e&iting ytem
a$ter the "eign ha been complete" may
highlight area that ha!e been mie"% an"
particular problem that nee" to be
a""ree".
Sytem re"e!elopment generally in!ol!e a
"ata con!erion o$ the "ata $rom the pre!iou
ytem.
Thi can be "one by #riting con!erion
program to e&tract the $un"amental "ata%
an" inert the "ata into the ne# "atabae
tructure.
4.6.". 0aintenance an- %n1ance$ents
Sytem maintenance in!ol!e $i&ing bug
an" making minor change to allo#
continue" operation.
Thi may inclu"e a""ing ne# "atabae $iel"
an" a""itional proceing option% or
mo"i$ying an e&iting proce "ue to
change" circumtance.
In ome cae% a ytem may appear to
operate normally% ho#e!er in!ali" "ata may
occaionally appear in a "atabae.
In thee cae% error checking co"e can be
a""e" into the ytem to trigger a meage
#hen the in!ali" reult are pro"uce". Thi
may enable the problem to be locate" by
trapping the error a it occur% enabling the
"ata input an" proceing tep to be
i"enti$ie".
Alternately% in a batch proce the "ata coul"
be #ritten to a log $ile #hen the in!ali"
con"ition #a "etecte".
Maintenance change can ha!e a high error
rate% particularly in $unction."ri!en rather
than proce."ri!en ytem.
Thi i relate" to the $act that the co"e may
be un$amiliar.
Alo% the ytem "eign i $ro=en% an"
change mut be ma"e #ithin the e&iting
tructure. Thi i in contrat to general
"e!elopment% #hen the tructure o$ the co"e
i $lui" an" can e!ol!e a ne# co"e i a""e"
to the ytem.
In general% maintenance change may be
a$er #hen they ue the ame co"ing tyle
an" tructure a the e&iting co"e.
Alo% implementing the minimum number o$
change re'uire" to correct the problem i
le likely to intro"uce ne# bug than i$
e&iting co"e i alo re.#ritten.
Teting that a maintenance change ha not
"iturbe" other procee can be "one by
running a et o$ procee an" pro"ucing "ata
an" output be$ore the change i ma"e.
The ame procee can be re.run a$ter the
change to check that other problem ha!e not
appeare".
7nhancement are larger change that a""
ne# $eature to the ytem.
Thee change may be "one on a pro8ect
bai an" inclu"e the $ull analyi an" "eign
tage.
At a co"ing le!el% problem are le likely to
occur i$ the e&iting ytem tructure are
ue"% an" the co"e i tructure" in a imilar
#ay to the e&iting co"e #ithin the ytem.
An e&ample #oul" be a""ing a mo"ule $or a
ne# report to a ytem.
In thi cae% the co"e tructure ue" $or the
other report mo"ule coul" alo be ue" $or
the ne# mo"ule.
In general% minor bug an" problem houl"
be reol!e" #here poible. A bug that
appear to be a minor problem may be the
caue o$ a more eriou problem in another
part o$ the ytem% or may ha!e a greater
impact in other circumtance.
5hen a large number o$ maintenance
change ha!e been ma"e to a ytem% the
control $lo# an" interaction in the co"e can
become !ery comple&. Thi can reult in a
change that $i&e one problem% but lea" to a
"i$$erent problem appearing.
Thi problem can be a""ree" by re.#riting
ection o$ co"e that ha!e been ub8ect to a
large number o$ maintenance change.
4.6.8. 0ultiple Sot*are Versions
In ome ytem% multiple !erion o$ the
ytem mut be "e!elope" an" maintaine"
concurrently.
Thi may apply #hen cutomie" !erion o$
the program are upplie" to "i$$erent client%
or #hen the ytem i pro!i"e" on e!eral
operating plat$orm.
Multiple !erion can be implemente" by
uing con"itional compilation% #hich allo#
"i$$erent ection o$ co"e to be compile" $or
"i$$erent !erion% keeping multiple !erion
o$ ource co"e $ile% an" uing con$iguration
parameter in $ile or "atabae to elect
proceing option.
7&ten"ing the general $unctionality o$ a
ytem to co!er the range o$ "i$$erent ue
may be a better olution in ome cae.
Maintaining multiple !erion can lea" to
problem #ith tacking ource co"e an"
e&ecutable $ile% an" may in!ol!e
maintaining larger !olume o$ co"e.
4.6.19. Develop$ent Processes
Su$$ary
(e)elopment Process (escription
In$ratructure
3e!elopment
The "e!elopment o$ general
$unction% common routine an"
ob8ect tructure.
Application 3e!elopment 3e!elopment o$ co"e to implement
application peci$ic $unction an"
procee.
+ro8ect 3e!elopment 3e!elopment o$ a ytem $rom
analyi through to completion on a
pro8ect bai.
7!olutionary
3e!elopment
)ontinual "e!elopment o$ a ytem.
A".hoc 3e!elopment 3e!elopment o$ temporary an"
untructure" ytem% uch a
teting program an" pro"ucti!ity
tool.
But.In.Time
3e!elopment
A"apting a ytem to meet changing
re'uirement% an" implementing
mo"ule a they are "e!elope".
Sytem Ae"e!elopment 3e!eloping a ytem on a pro8ect
bai to replace an e&iting ytem.
Maintenance Minor change to an e&iting
ytem to allo# continue"
operation.
7nhancement A""itional $unction a""e" to an
e&iting ytem.
".'. S+stem evolution
4.!.1. )eature & Structural (ro*t1
Sytem e!olution in!ol!e continually
a""ing ne# $eature to a ytem.
Thee $eature may inclu"e an e&panion in
the type o$ "ata that can be tore"% an
increae in the range o$ calculation an"
$unction that can be per$orme"% an" an
increae in the type o$ report an" "iplay
that can be generate".
Thee ne# $eature increae the comple&ity
an" $unctionality o$ the ytem% ho#e!er
they "o not a$$ect the tructure o$ the ytem
or the concept on #hich it i bae".
A the ytem e!ol!e% change to the
tructure an" un"erlying concept o$ the
ytem may alo be ma"e.
Thi inclu"e abtraction% #hich combine
peci$ic ob8ect into general concept.
Alo% the uage an" purpoe o$ the ytem
may alo e!ol!e o!er time. Many ytem are
ue" $or tak that are !ery "i$$erent $rom
their original ue.
Thi can be a""ree" by changing the baic
concept on #hich the ytem ret to other
tructure.
1or e&ample% a ytem that #a originally a
proceing ytem may e!ol!e into a "eign
tool% or !ice !era% #hich #oul" in!ol!e
"i$$erent co"e tructure an" baic $unction.
5hen change are ma"e to ytem $unction
an" the ytem tructure no longer matche
the $unction that the ytem per$orm% the
ytem can become comple& an" untable.
In thi ituation% re.aligning the internal
tructure #ith the $unction that are
per$orme" may lea" to a igni$icant re"ucing
in co"e !olume% an" an increae in
proceing pee" an" reliability.
)hange occur #hen the ytem i applie" to
"i$$erent type o$ proceing or
en!ironment% an" alo #hen techni'ue an"
approache change.
Thi applie at both the co"ing an" "eign
le!el% an" at the le!el o$ the ob8ect an"
procee that the application ue.
4.!.2. 'bstraction
Abtraction i the proce o$ combining
e!eral peci$ic ob8ect or concept into a
ingle% more general concept.
Thi applie #ithin the co"e% #ithin the
ob8ect an" $unction that are ue" in the
application% an" in "atabae "eign.
The ytem e!olution proce typically
in!ol!e continually a""ing $eature% an"
perio"ically combining a range o$ $eature
into a ne# abtract concept.
1or e&ample% in the co"e a number o$
tatitical $unction may be a""e" o!er time.
A the number an" comple&ity gro#% thee
$unction coul" be replace" #ith a generate
"ata et ob8ect that implemente" a range o$
$unction on et o$ "ata.
In an application% $ormatting $eature coul"
be a""e" to a range o$ ob8ect an" procee.
A the $ormatting $eature become
increaingly comple&% the in"i!i"ual
$ormatting $eature coul" be replace #ith a
ingle ,$ormat- ob8ect that coul" be attache"
to any other ob8ect.
Thi change coul" re"uce the comple&ity o$
the co"e% conoli"ate "ata item #ithin the
"atabae an" make the ytem eaier to ue
an" more $le&ible.
0o#e!er% implementing thi change coul"
alo in!ol!e change in a large number o$
"i$$erent co"e ection% an" may alo re'uire
a "atabae or $ile $ormat con!erion.
In a "atabae tructure e&ample% a "atabae
may initially contain a ,cutomer- table. A
the ytem change% a ,upplier- an"
,hipping agent- table coul" be a""e".
Thee table contain relate" in$ormation% an"
coul" be conoli"ate" into a ingle table
uing a general concept o$ ,counterparty-.
4.!.3. C1an(in( t1e Co-e 0o-el
A a ytem e!ol!e there may be ection o$
co"e that are more uite" to a "i$$erent co"e
mo"el than the e&iting mo"el.
1or e&ample% proce."ri!en co"e coul" be
change" to $unction."ri!en co"e #hen a
large amount o$ "uplication ha" appeare"
#ithin the co"e.
An e&ample #oul" be #riting a general
report.proceing routine to replace a large
number o$ imilar report.
1unction."ri!en co"e coul" be change" to
proce."ri!en co"e #hen the $unction ha"
become comple&% an" coul" be implemente"
more eaily uing a proce approach.
An e&ample #oul" be a "ata con!erion an"
uploa" $acility that ha" become e&tremely
comple&% an" coul" be re.#ritten uing a
number o$ eparate proce.orientate"
routine.
Table "ri!en co"e coul" be implemente"
#hen a large number o$ imilar operation
ha" appeare" #ithin the co"e% uch a menu
item "e$inition an" "e$inition o$ "ata
ob8ect.
<b8ect orientate" co"e coul" be inclu"e" in a
$unction."ri!en ection o$ co"e.
In ome cae the ob8ectForientate" tructure
mo"el may not be e$$ecti!e in proce."ri!en
co"e% an" tan"ar" proce"ural operation
may be impler an" clearer.
In ome cae% a change to a "i$$erent co"e
mo"el may commence% an" "uring the re.
#riting it may become apparent that the ne#
co"e mo"el #oul" not be an impro!ement on
the e&iting tructure. In thi cae% the ne#ly.
#ritten co"e can be aban"one" lea!ing the
e&iting tructure in place.
In other cae% a "ratic re"uction in co"e
i=e an" comple&ity can be achie!e" by
changing to a "i$$erent co"e tructure.
4.!.4. Re*ritin( Co-e
5hen co"e i initially implemente"% the
tructure may $ollo# the "eign an" i"ea
behin" the "e!elopment.
A$ter the co"e ha been #ritten% it may be
able to be conoli"ate" by re#riting ection
to impli$y the tructure in the light o$ the
$ully #ritten ection o$ co"e.
Thi proce can alo be applie" to co"e that
ha been mo"i$ie" e!eral time.
In thi cae% the co"e may "e!elop a comple&
control $lo# pattern an" a large number o$
interaction bet#een "i$$erent ection o$ the
co"e. Thi can make maintaining the co"e
"i$$icult an" lea" to an increae" $re'uency
o$ bug an" general intability.
Thi ituation can be a""ree" by re#riting
ection o$ co"e to impli$y the tructure an"
control $lo#.
Ae!ie#ing co"e may be bene$icial i$ a
igni$icant perio" o$ time ha elape" ince
the co"e #a "e!elope". In an e!olutionary
ytem% there may be a range o$ ubroutine
an" $acilitie that coul" be ue" to impli$y
the co"e that #ere not a!ailable #hen the
co"e #a originally "e!elope".
4.!.4.1. Co$binin( )unctions an-
0o-ules
5ithin an application% an" alo #ithin the
co"e% change to $unction may reult in t#o
mo"ule or application $unction per$orming
a imilar proce.
In thee cae% a ingle proce coul" be ue"
to replace the pre!iou procee an"
impli$y the "eign.
4.!.5. ,ro*in( Data Volu$es
3ata !olume generally increae in ytem
o!er time% ometime at "ramatic
compoun"ing rate.
A "ata !olume gro#% procee that #ere
pre!iouly per$orme" manually may be
automate". Thi re'uire "ata to peci$y the
proceing option an" calculation input.
In general% mall "ata !olume may allo# $or
$ree.$ormat entry o$ cutomie" in$ormation%
#hile large "ata !olume generally re'uire
$i&e" $iel" that can be ue" to per$orm
automate" proceing.
4.!.6. Database Develop$ent
A the co"e an" ytem $eature change% the
"atabae tructure may alo change.
Similar problem can arie #ith a number o$
"atabae table toring imilar "ata% an"
inconitencie bet#een $ormat an"
tructure in "i$$erent part o$ the "atabae.
Thi can be a""ree" through changing the
"atabae "e$inition to impli$y the tructure.
Thi may in!ol!e merging relate" table an"
uing $iel" attribute to i"enti$y eparate
type% or creating ne# table to peci$y
in"epen"ent concept that ha!e arien #ithin
e&iting table.
4.!.!. Release Cycles
Sytem that are continually mo"i$ie" are
generally releae" a ne# !erion on a
perio"ic bai.
Minor upgra"e #oul" inclu"e bug $i&e an"
minor enhancement% #hile ma8or upgra"e
may inclu"e igni$icant ne# $unctionality
an" poibly re'uire "atabae or $ile $ormat
con!erion.
Some ytem that are continually "e!elope"
are e$$ecti!ely li!e at all time% #ith change
being intro"uce" a oon a they are ma"e.
Thi approach can be ue" #ith maintenance
change. 0o#e!er% problem can occur #hen
larger an" more $re'uent change are
intro"uce" in thi #ay.
Teting a $ull ytem i not $eaible #hen
each in"i!i"ual change i up"ate" eparately
to the pro"uction !erion o$ the ytem.
Thi may lea" to bug occurring% an"
problem that lea" to the incorrect up"ating
o$ "ata may be "i$$icult to un#in".

".(. Code Design
4.".1. Co-e +nteractions
Ae"ucing interaction bet#een "i$$erent part
o$ a ytem can ha!e e!eral bene$it.
Sytem "e!elopment an" maintenance may
be eaier% a one ection o$ co"e can be
in"epen"ently mo"i$ie" #ithout the nee" to
re$er to other ection o$ co"e.
Bug may be re"uce"% a a caue.an".e$$ect
that i #i"ely eparate" through a ytem can
pro"uce problem #hen one part o$ the co"e
i change" #ithout relate" co"e ection
being up"ate".

+ortability i enhance" an" in"epen"ent
mo"ule can be ue" in other pro8ect or
re#ritten $or other en!ironment.
In general% uing "ata an" operation that
pa through inter$ace bet#een mo"ule%
rather than inclu"ing interaction bet#een
one co"e ection an" a "itant co"e ection%
reult in a ytem that i more $le&ible%
eaier to "ebug an" eaier to mo"i$y.
4.".2. #ocalisation
4ocaliation in!ol!e grouping the
proceing that in!ol!e a particular !ariable
or concept #ithin a mall ection o$ co"e.
Thi may in!ol!e "etermining con"ition
#ithin a region o$ co"e% an" then paing
$lag to other ubroutine% rather than paing
the "ata !alue itel$.
1or e&ample% i$ a !ariable i pae" through
e!eral layer o$ ubroutine an" i then ue"
in a con"ition% there i a #i"e eparation
bet#een the caue an" e$$ect o$ the original
"e$inition o$ the !ariable% an" it ue in the
con"ition.
Thi increae the interaction bet#een
"i$$erent ection o$ the co"e% #hich can
make rea"ing an" mo"i$ying the co"e more
"i$$icult.
I$ the con"ition i tete" in the original
location% ho#e!er% an" a Boolean !ariable i
pae" through% then the proceing o$ the
original !ariable i containe" #ithin the
original ection o$ co"e.
The ubroutine uing the Boolean $lag #oul"
not acce the original "ata !ariable% an" the
calling $unction coul" pa "i$$erent !alue
o$ the $lag un"er "i$$erent con"ition.
Thi approach re"uce the interaction in the
co"e an" lea" to a more $le&ible tructure.
4.".3. Se7uence Depen-ence
Se'uence "epen"ence relate to the iue o$
calling $unction in a particular or"er.
)o"e that i hea!ily "epen"ant on the or"er
o$ e&ecution can be more "i$$icult to "e!elop
an" maintain than co"e that inclu"e
ubroutine an" general $unction that can be
calle" in any or"er.
1or e&ample% a graphic engine may inclu"e
$unction $or initialiing the engine% "e$ining
light% loa"ing ob8ect% "e$ining ur$ace
te&ture% "e$ining backgroun" an"
"iplaying the image.
In a e'uence "epen"ant tructure% each o$
thee $unction #oul" nee" to be per$orme"
in a particular or"er.
Eing a e'uence.in"epen"ent approach% the
ame $unction coul" be calle" in any or"er.
6ali" reult #oul" be pro"uce" regar"le o$
the particular or"er that the ubroutine #ere
calle" in.
A certain or"er may till be re'uire" $or
operation that are logically relate"% rather
than relate" imply "ue to the co"e
implementation.
1or e&ample% the te&ture o$ an ob8ect coul"
not be "e$ine" until the ob8ect itel$ ha" been
"e$ine".
0o#e!er% the lighting coul" be "e$ine"
be$ore the ob8ect #ere loa"e"% or the ob8ect
coul" be loa"e" be$ore the lighting #a
"e$ine"% a thee are in"epen"ent element.

Se'uence.in"epen"ence increae the
$le&ibility o$ $unction% a a #i"er range o$
reult may be pro"uce" uing "i$$erence
combination o$ call to the ubroutine.
Alo% le in$ormation nee" to be taken into
account #hen "e!eloping a ection o$ co"e%
#hich may impli$y ytem "e!elopment.
Se'uence "epen"ence i re"uce" #hen
$unction are "irectly mappe". Thi reult in
the ame reult or proce being per$orme"%
regar"le o$ pre!iou action. Subroutine
that operate in thi #ay can be calle" in any
or"er% an" #oul" pro"uce the ame reult $or
the peci$ie" input.
Speci$ically% the ue o$ tatic an" global
!ariable in ubroutine can intro"uce
e'uence "epen"ence.
Thi arie "ue to the $act that the reult o$
the ubroutine may be relate" to e&ternal
con"ition% or to pre!iou call to the
ubroutine.
Thi may reult in a "i$$erent or"er o$
e&ecution o$ the ame ubroutine call
pro"ucing a "i$$erent reult.
Se'uence in"epen"ence can be implemente"
by eparating the "e$inition o$ ob8ect an"
attribute $rom the proceing tep in!ol!e"%
or by checking that any pre.re'uiite
$unction ha!e alrea"y been run.
4.".3.1. @ust5+n5Ti$e Processin(
Se'uence in"epen"ence can be implemente"
uing a ,8ut.in.time- approach to proceing
an" calculation.
Aather than per$orming each proceing tep
a it i calle"% a et o$ attribute coul" be
"e$ine" a$ter each $unction call.
5hen the $inal $unction call i per$orme"%
uch a the ubroutine to "iplay the image%
the entire proceing i per$orme" in or"er
uing the attribute that #ere peci$ie".
Thi approach eparate the internal
proceing or"er $rom the or"er o$ e&ternal
call to the ubroutine.
The mo"el ue" in thi approach i an
attribute an" "ata ob8ect mo"el% rather than a
proce an" tran$ormation mo"el.
In thi mo"el% each call to the ubroutine
"e$ine a et o$ attribute% rather than
e&ecuting a proce.
1or e&ample% the generation o$ a graphic
image coul" in!ol!e loa"ing #ire$rame
tructure% mapping te&ture to ob8ect%
applying lighting an" generating the image.
<ne approach #oul" be to call a ubroutine
$or each tage in the proce. 0o#e!er% thee
operation may nee" to be per$orme" in
or"er.
Another approach #oul" be to implement
imilar ubroutine call that imply "e$ine"
the ob8ect% te&ture an" lighting% #ith all the
proceing being per$orme" #hen the $inal
,generate image- ubroutine #a calle". Thi
econ" approach #oul" allo# the call to be
per$orme" in any or"er.
4.".3.2. Pre5re7uisite C1ec2in(
Another approach in!ol!e each ubroutine
checking that any pre.re'uiite ubroutine
ha" been run.
5hen each proce i per$orme"% a $lag coul"
be et to in"icate that the "ata ha" been
up"ate".
5hen a ubroutine commence it coul"
check the $lag that #ere relate" to any pre.
re'uiite $unction% an" call the rele!ant
ubroutine be$ore per$orming it o#n
proceing.
Thi approach a!oi" making aumption
about pre!iou e!ent% an" #oul" allo# the
ubroutine to be ue" in a #i"er range o$
e&ternal circumtance.
5hen all ubroutine #ere implemente" thi
may% the e'uence o$ call in the main
routine coul" be replace" #ith a ingle call to
the $inal routine% #hich #oul" lea" to a
back#ar".chaining erie o$ ubroutine call%
$ollo#e" by a $or#ar" chain o$ e&ecution.
4.".4. Direct 0appin(
A ubroutine or inter$ace $unction i "irectly
mappe" i$ the operation that are per$orme"
are completely peci$ie" by the input
parameter.
Thi occur #hen the reult o$ the
ubroutine are not a$$ecte" by pre!iou call
to the ubroutine or by "ata in other part o$
the ytem.
3irect mapping can be implemente" by
paing all the "ata that a ubroutine ue a
parameter to the ubroutine.
3irectly mappe" ubroutine are e'uence
in"epen"ent% a their reult are not a$$ecte"
by pre!iou operation.
Thi enable "irectly mappe" ubroutine to
be calle" in any combination an" in any
or"er.
In"irect mapping i create" by toring
internal tatic "ata that retain it !alue
bet#een call to the ubroutine% or by
acceing "ata outi"e the ubroutine.
1or e&ample% the ubroutine
,litTne&tTentry()- i not "irectly mappe"% a
thi ubroutine return the ne&t item in the
lit a$ter the pre!iou call to the ubroutine.
In contrat% the ubroutine
,litTne&tTentry( currentTentry )- i "irectly
mappe"% an" #oul" return the ame reult $or
any gi!en !alue o$ ,currentTentry-%
regar"le o$ pre!iou operation.
3irect mapping can increae $unctionality by
enabling call to the ubroutine $rom
"i$$erent co"e ection to o!erlap #ithout
con$licting% a #ell a intro"ucing e'uence
in"epen"ence.
1or e&ample% the $irt !erion o$ the
ubroutine allo# only one pa through the
lit at a particular time. 0o#e!er% uing the
"irectly mappe" !erion% multiple
in"epen"ent o!erlapping can o$ the lit
coul" be per$orme" by "i$$erent ection o$
the co"e% #ithout con$licting.
A re"uction in e&ecution pee" coul" occur
#hen a earch i re'uire" to locate the
current poition% uch a the ,currentTentry-
!ariable in the pre!iou e&ample.
Thi problem can be re"uce" by recor"ing an
internal tatic cache !alue o$ the pre!iou
call to the ubroutine% an" uing that !alue i$
the parameter peci$ie the pre!iou call a
the current poition. Thi "oe not intro"uce
e'uence "epen"ence or in"irect mapping% a
the tatic !ariable i only ue" to increae
e&ecution pee" an" "oe not a$$ect the
actual reult.
Another e&ample concern a ubroutine
,getTcurrentTcreenT$iel"()-% #hich return
the te&t !alue that i hel" in the current
creen $iel".
In thi cae the in"irect mapping i not "ue to
tatic "ata relating to pre!iou call to the
ubroutine% but i "ue to acceing a !ariable
outi"e the ubroutine.
Thi co"e coul" be re.#ritten a
,getTcreenT$iel"( $iel" )-% in #hich cae the
$unction i "irect.mappe" an" coul" be ue"
to retrie!e the !alue o$ any $iel" on the
creen.
Subroutine #ritten in a "irectly mappe" #ay
may be more $le&ible an" eaier to ue that
ubroutine that inclu"e in"irect mapping.
Interaction bet#een "i$$erent ection o$ the
co"e are alo re"uce" #hen ubroutine are
"irectly mappe".
4.".5. Deensive Pro(ra$$in(
3e$eni!e programming i a co"ing tyle that
attempt to increae the robutne o$ co"e
by checking input "ata% an" by making the
minimum number o$ aumption about
con"ition outi"e the ubroutine.
Aobut co"e i co"e that repon" to in!ali"
"ata by generating appropriate error
con"ition% rather than continuing proceing
an" generating in!ali" reult% or pre$orming
an operation that lea" to a ytem crah%
uch a attempting to "i!i"e a number by
=ero.
3e$eni!ely co"e" routine may alo check
their o#n output be$ore completing. 1or
e&ample% a proce that pro"uce $igure may
check that the $igure balance to other $igure
or are conitent in ome other #ay.
)hecking output reult "oe not a$$ect the
robutne o$ the in"i!i"ual routine againt
e&ternal problem ho#e!er thi approach
may increae robutne throughout the
ytem.
4.".5.1. +nput Data
)hecking input parameter may in!ol!e t#o
iue. 6alue can be checke" to enure that
incorrect operation are not per$orme"% uch
a attempting to acce a null pointer or
proceing a loop that #oul" ne!er terminate.
Alo% check can be per$orme" to "etect
error% uch a negati!e number in a lit that
houl" not contain negati!e number% or
#eight that "o not um to 1.
5hen lit are canne" an" calculation are
per$orme"% check o$ e&iting $igure can
alo be ma"e #hile other proceing i being
per$orme".
4.".5.2. 'ssu$ptions about Previous
%vents
)hecking pre!iou operation an" con"ition
outi"e the ubroutine can be "one by
checking $lag that are et by other procee.
5hen a pre.re'uiite proce ha not been
per$orme"% the ubroutine can run the
rele!ant $unction be$ore continuing.
4.".6. Se($entation o )unctionality
4.".6.1. )unctional 'pplications
In many ytem the co"e can be groupe"
into e!eral ma8or area.
Thi may inclu"e the uer inter$ace co"e%
calculation co"e% graphic an" image
generation% "atabae up"ating etc.
In $unctional application uch a o$t#are
tool% eparating the co"e into ma8or area
may re"uce the number o$ interaction
bet#een "i$$erent ection o$ the co"e.
Thi may lea" to a ytem that i more
$le&ible an" eaier to maintain% a each
ection per$orm in"epen"ent $unction an"
can be mo"i$ie" #ithout the nee" to re$er to
other part o$ the ytem.
4.".6.2. Process5Driven 'pplications
In proce."ri!en ytem uch a "ata
proceing application% eparating the co"e
by $unction intea" o$ proce may reult in
an internal tructure that i completely
"i$$erent $rom the tructure o$ the application
itel$.
1or e&ample% the application may conit o$
e!eral $unctional mo"ule% uch a an
accounting mo"ule% an a"minitration
mo"ule% a pro"uct reporting mo"ule etc.
Eing a proce."ri!en co"e tructure% each
application mo"ule #oul" contain the co"e
relating to that application mo"ule% inclu"ing
the uer inter$ace co"e% calculation% "atabae
up"ating etc.
0o#e!er% i$ thee $unction #ere groupe"
internally into eparate ection% thi coul"
reult in a igni$icant re"uction in the total
co"e i=e an" re"uce inconitencie.
Thi proce #oul" alo reult in a ytem
that #oul" pro!i"e $acilitie to enable ne#
application mo"ule to be "e!elope" #ith a
minimum amount o$ co"e. In contrat% the
"e!elopment o$ ne# proce.orientate"
mo"ule i not a$$ecte" by the "e!elopment
o$ pre!iou mo"ule.
4.".6.3. +$ple$entation
Separating $unction can be "one by creating
ma8or ection #ithin the co"e that contain
relate" $unction. Thee coul" be accee"
through a "e$ine" et o$ ubroutine call an"
operation.
Thee mo"ule coul" be e&ten"e" to create
proceing engine. 1or e&ample% a
calculation engine may per$orm a range o$
general calculation an" numeric proceing
operation. The engine #oul" be accee"
through a clearly "e$ine" inter$ace o$ "ata
an" $unction% an" may be calle" "irectly or
may e&ecute in"epen"ently o$ the main
program.
7ach ection only remain in"epen"ent #hile
it "oe not contain proceing that relate to
another ection o$ the ytem.
1or e&ample% a calculation ection #oul" not
contain inputJoutput proceing% uch a
creen% $ile or printing operation.
Thi approach allo# the co"e ection to be
ue" a an in"epen"ent unit.
+ortability bet#een "i$$erent ytem i alo
impro!e" #ith the approach.
Maintenance an" "ebugging o$ a co"e
ection may alo be impler #hen the
ection contain only one type o$ relate"
operation.
A""itionally% mo"ule uch a calculation
engine an" graphic $acilitie "e!elope" in
thi #ay coul" alo be ue" #ith other
pro8ect.
4.".!. Subroutines
4.".!.1. Selection
In general% co"e i impler an" clearer #hen
a collection o$ mall ubroutine i ue"%
rather than a number o$ larger ubroutine.
5here a loop contain e!eral tatement%
thee may be plit into a eparate ubroutine.
Thi reult in pro"ucing t#o ubroutine.
<ne ubroutine contain looping but no
proceing% #hile the other contain
proceing an" no looping.
5hen a large ubroutine contain eparate
block o$ co"e that are not relate"% each
ma8or block coul" be plit into a eparate
ubroutine.
5hen co"e that per$orm a imilar logical
operation e&it in e!eral part o$ a ytem%
thi coul" be groupe" into a ingle ubroutine
1or e&ample% "i$$erent ection o$ co"e may
can an" up"ate part o$ the ame "ata
tructure% or per$orm a imilar calculation.
The !ariation in the proce coul" be
han"le" by paing $lag to the ubroutine% or
by toring $lag #ith the "ata tructure itel$%
o that the ubroutine coul" automatically
"etermine the proceing that #a re'uire".
)o"e that #a imilar by coinci"ence but
per$orme" logically in"epen"ent operation%
uch a calculation routine $or t#o
in"epen"ent pro"uct% houl" not generally
be combine" into a ingle ubroutine.
4.".!.2. )la(s
Subroutine are more general i$ they are
pae" $lag an" in"i!i"ual option% rather
than being pae" "ata an" then teting
con"ition "irectly.
1or e&ample% a ubroutine may be pae" a
Boolean $lag to peci$y an option% uch a
orting a lit in acen"ing or "ecen"ing
or"er.
<ther option coul" alo be pae". 1or
e&ample% the key o$ a "ata et coul" be
pae"% rather than an entire tructure type
that containe" the key a one "ata item.
Eing $lag an" option allo# the ubroutine
to be calle" in "i$$erent #ay $rom "i$$erent
part o$ the co"e.
Alo% uing $lag allo# the ubroutine to
per$orm "i$$erent combination o$
proceing% in contrat to checking the "ata
"irectly% #hich may reult in a $i&e" reult
"epen"ant on the "ata.
Interaction #ith "i$$erent part o$ the co"e
may alo be re"uce".

4.".". 'uto$atic Re5,eneration
In ome cae a et o$ input "ata an"
calculate" reult may be tore" in a "ata
tructure.
I$ the input "ata i change"% the calculate"
reult may nee" to be re.generate".
Enneceary re.calculation can be a!oi"e"
by inclu"ing a tatu $lag #ithin the "ata
tructure.
5hen the input $igure are change"% the
tatu $lag i et to in"icate that the
calculate" reult are no# in!ali".
5hen a re'uet i ma"e $or a calculate"
$igure% the tatu $lag i checke". I$ the $lag i
et% then a recalculation i per$orme" an" the
$lag i cleare".
Thi approach enable multiple change to
the input "ata to be ma"e #ithout generating
repeate" re.calculation% an" allo# multiple
re'uet $or calculate" reult to be ma"e
#ithout re'uiring multiple re.calculation.
Thi approach can only be ue" #hen the
calculate" reult are accee" !ia
ubroutine% rather than being accee"
"irectly a "ata !ariable.
4.".8. Co-e Desi(n +ssues Su$$ary
(esign *ssue (escription
Interaction Interaction bet#een "itant part o$
a program% through global !ariable%
tatic !ariable or chain o$
ubroutine call% can make program
more "i$$icult to "ebug an" mo"i$y.
4ocaliation 9rouping proceing relating to a
ingle "ata item or tructure into a
mall ection o$ co"e may make
co"e eaier to rea" an" mo"i$y.
Se'uence 3epen"ence Subroutine that can be calle" in any
or"er% an" #hich pro"uce the ame
reult regar"le o$ pre!iou e!ent%
may be more $le&ible than
alternati!e approache.
+re.re'uiite checking )hecking #ithin a ubroutine that
pre!iou $unction ha!e been
per$orme"% an" e&ecuting them i$
neceary% may increae the
$le&ibility an" generality o$ a
ubroutine.
3irect Mapping Subroutine that pro"uce a reult
that i completely peci$ie" by their
parameter can make program
"e!elopment eaier an" may re"uce
bug caue" by une&pecte"
interaction.
3e$eni!e +rogramming Subroutine may be more robut
#hen they check the parameter "ata
that i pae"% check e&ternal "ata
that i ue"% an" make a minimum
number o$ aumption about
pre!iou e!ent an" current
con"ition.
Segmentation o$
$unctionality
Separating ma8or component o$ a
ytem into eparate ection may
lea" to eaier program "e!elopment
an" more reliable ytem% a each
component can be "e!elope"
in"epen"ently. )lear inter$ace may
be ue$ul in "eigning general
$unctional component.
Subroutine Selection Sytem compoe" o$ a large
number o$ mall ubroutine may be
eaier to interpret% "ebug an" mo"i$y
that ytem compoe" o$ e!eral
large an" comple& ubroutine.
Se!eral mall ubroutine may be
clearer than a ingle comple&
ubroutine.
Subroutine +arameter Subroutine may be more general%
an" interaction may be re"uce"%
#hen ubroutine are pae" $lag
an" option% rather than "ata ue"
$or internal con"ition. 3ata ue" in
internal con"ition caue
interaction #ith "itant co"e an"
reult in a $i&e" outcome $or an
in"i!i"ual "ata con"ition.
".*. Coding
)o"ing i the proce o$ #riting the program
co"e.
4.8.1. Develop$ent o Co-e
Although a general "eign may be planne"%
the "irection that !ariou ection o$ the co"e
take may not become apparent until the
co"ing i actually in progre.
Some $unction turn out to be more comple&
an" "i$$icult to implement than #a
originally e&pecte"% #hile other may turn
out to be coni"erably impler.
An initial "e!elopment o$ the co"e coul"
reult in creating a et o$ me"ium.i=e"
ubroutine to per$orm the !ariou $unction.
A$ter thee are #ritten% the co"e coul" be
conoli"ate" by e&tracting common ection
into maller ubroutine.
Thi proce lea" to a larger number o$
maller ubroutine% an" generally clearer
an" impler co"e.
Attempting to pre"ict the ue$ul ubroutine
in a"!ance can lea" to #riting co"e that i
not ue". Alo% the tructure o$ the co"e
become arti$icially contraine"% rather than
changing in a $lui" #ay a "i$$erent ection
are re.#ritten to impli$y the proceing.
Thi approach applie particularly to
$unction."ri!en co"e% #hich ue a range o$
general.purpoe $unction an" "ata
tructure. Thi approach i le applicable to
proce."ri!en co"e
4.8.2. Robust Co-e
The reliability o$ co"e i "etermine" #hen it
i #ritten% not "uring the teting phae.
A co"e i #ritten% the i"ea an" tructure
that are being implemente" are ue" to $orm
complete ection o$ co"e.
Thi i the time at #hich the interrelation
bet#een !ariable% concept an" operation
are mentally combine" into a ingle #orking
mo"el.
6ariou iue are reol!e" "uring thi
proce% uch a the han"ling o$ all input "ata
combination an" con"ition% implementing
the $unction that the co"e ection upport%
an" reol!ing problem #ith inter$ace to
other ection o$ co"e.
I$ co"ing commence on a "i$$erent ection
o$ the ytem #hile iue remain
unreol!e"% thi may lea" to problem
occurring at $uture time.
Aobut co"e #oul" generally repon" to
in!ali" "ata by generating appropriate error
con"ition% rather than continuing program
operation an" pro"ucing in!ali" output or
attempting an operation that reult in a
ytem crah% uch a attempting to "i!i"e a
number by =ero.

4.8.3. Data 'ttributes Vs. Data
Structures
3ata in relate" but "i$$erent tructure can be
tore" in eparate "atabae table an"
tructure% or combine" into a ingle
tructure an" i"enti$ie" eparately uing a
"ata !ariable.
3ata tructure% co"e an" $unction are
generally impler an" more $le&ible #hen a
"ata !ariable i ue" to i"enti$y eparate
type o$ "ata% rather than creating eparate
tructure.
1or e&ample% corporate client an" in"i!i"ual
client coul" be tore" a eparate "atabae
table an" program tructure.
0o#e!er% a thee t#o ob8ect recor" imilar
$un"amental "ata% they coul" be combine"
into a ingle table.
I$ a large number o$ $iel" apply to only one
type% thi can be plit into a eparate table
#ith a one.to.one "atabae link. 0o#e!er%
#hen the number o$ $iel" i not e&cei!e% a
ingle table may be the impler olution.
A another e&ample% creating a e!eral
eparate table $or "i$$erent pro"uct #oul"
lea" to a more comple& ytem than uing a
ingle table% #ith "ata $iel" to i"enti$y
pro"uct option an" calculation.

4.8.4. #ayout
The !iual layout o$ co"e i important.
5riting% "ebugging an" maintain co"e i
igni$icantly eaier #hen the co"e i lai" out
in a clear #ay.
)lear layout can be achie!e" #ith the ample
ue o$ #hitepace% uch a tab% blank line
an" pace.
)o"e #ritten in language that ue control.
$lo# tructure% uch a ,i$- tatement% can
be in"ente" $rom the tart o$ the line by an
a""itional le!el $or each nete" co"e block.
1or e&ample% tatement #ithin an ,i$-
tatement may be #ritten #ith an a""itional
2% 2 or L pace at the tart o$ the line% to
i"enti$y the neting o$ the co"e #ithin the
,i$- tatement.
)onitency in a layout tyle throughout a
large ection o$ co"e lea" to co"e that i
eaier to rea".
1or e&ample% the $ollo#ing co"e ue $e#
pace an" "oe not in"ent the co"e to re$lect
the change in control $lo#.
for(i=3Hi"ma%_treesHi++)
I if(Jtree_tableKiL6
active)I
tree_tableKiL6usage_count=#H
tree_tableKiL6head_node=ne!
nodeH
tree_tableKiL6active=TRM8HN
queue=queue_headH
!hile(queueJ=@MGG)Iif(queue
$tree==i)
queue$active=TRM8H
queue=queue$ne%tH
N
N
The $ollo#ing co"e i i"entical to the
pre!iou e&ample% ho#e!er it inclu"e
a""itional pace% ue a conitent layout
tyle throughout the co"e% an" i in"ente" to
re$lect the neting tructure o$ the co"e
block.
for (i=3H i " ma%_treesH i++)
I
if (J tree_tableKiL6active)
I
tree_tableKiL6usage_count= #H
tree_tableKiL6head_node
= ne! nodeH
tree_tableKiL6active =
TRM8H
N
queue = queue_headH
!hile (queue J= @MGG)
I
if (queue$tree == i)
queue$active =
TRM8H
queue = queue$ne%tH
N
N
4.8.5. Co$$ents
A comment i te&t that i inclu"e" in the
program co"e $or the bene$it o$ a human
rea"er% an" i ignore" by the compiler.
)omment are ue$ul $or a""ing a""itional
in$ormation into the co"e. Thi may inclu"e
$act that are rele!ant to the ection o$ co"e%
an" general "ecription o$ the procee
being per$orme".
5hen a ubroutine contain a large number
o$ in"i!i"ual tatement% comment can be
ue" to eparate the tatement into relate"
ection.
The $ollo#ing e&ample contain t#o
comment that a"" in$ormation that may not
be rea"ily "etermine" $rom rea"ing the co"e
7 ) 'ear is a leap 'ear if it is divisible
b' four, is not
7 divisible b' #33, or is divisible b' 233
if ('ear mod 2 = 3 and 'ear mod #33 "$ 3) or
'ear mod 233 = 3) then
is_leap_'ear = true
else
is_leap_'ear = false
end
7 reduce value b' # da'9s interest for
(ebruar' +1th
if is_leap_'ear then
value = value * (# + rate*-.4)
end
The $ollo#ing co"e illutrate the ue o$
comment to eparate group o$ relate"
tatement
subroutine process_model()
7 intialse graphics engine and
load model
graphics6initialise
graphics6allocate_data
read_model graphics, model
7 update graphics image
graphics6define_lights
light_table
grphics6define_vie!point
config_date
grphics6displa'
7 generate report
process_report_data
print_report
end
4.8.6. Variable <a$es
The choice o$ !ariable name can ha!e a
igni$icant impact on the rea"ability o$
program co"e.
6ariable name that "ecribe the "ata item%
uch a ,currT"ay- an" ,totalT#eight- a""
more in$ormation into the co"e than !ariable
name that are general term uch a ,count-
or ,amount-.
Single letter !ariable name are ometime
ue" a loop !ariable% a thi impli$ie the
appearance o$ the co"e an" allo# the
rea"ing to $ocu on the operation that are
being per$orme".
1or e&ample% the letter ,i- an" ,8- are
ometime ue" a loop !ariable. Thi uage
$ollo# the con!ention ue" in mathematic
an" early !erion o$ 1ortran% #here the
letter ,i-% ,8- an" ,k- are ue" $or array
in"e&e.
Thi particularly applie to canning array
that are ue" to tore lit o$ "ata.
In other cae% the ue o$ a $ull name $or a
loop !ariable% uch a ,currT"ay- or ,meh-
may lea" to clearer co"e. Thi may apply
#hen the item in an array are accee"
"irectly an" the in"e& !alue itel$ repreent
a particular "ata item.
Some co"ing con!ention a"" e&tra letter
into the !ariable name% or change the cae% to
"ecribe the "ata type o$ a !ariable or it
cope.
1or e&ample% ,i3ay- may be an integer
!ariable% an" the uppercae letter in
,+rintT"e!ice- may in"icate that the !ariable
i a global !ariable.
)ontant may be i"enti$ie" #ith a co"e or
#ith a cae change% uch a the ue o$
uppercae letter $or a contant name.
Eing "i$$erent !ariable name that "i$$er
only by cae or punctation% uch a
,4it0ea"-% ,lithea"- an" ,litThea"- can
make rea"ing an" interpreting co"e more
"i$$icult.
Ambiguou name can alo reult in co"e
that can be "i$$icult to interpret.
1or e&ample% the #or" ,output- can be both
a noun an" a !erb. The name ,reportToutput-
coul" mean ,output (print) the report-% or
,thi i the report output-.
In ome cae% !ariable at "i$$erent le!el o$
cope may ha!e the ame name. 1or
e&ample% a local !ariable may be "e$ine"
#ith the ame name a a global !ariable.
In thee cae% the name i taken to re$er to
the "ata item #ith the tightet le!el o$ cope.
Aea"ing the co"e may be more "i$$icult in
thee cae a an in"i!i"ual name may ha!e
"i$$erent meaning in "i$$erent ection o$ the
co"e.
4.8.!. 4oolean Variable <a$es
The name o$ Boolean !ariable may be
eaier to rea" i$ the #or" ,not- i not
inclu"e" #ithin the !ariable name% an" i$ the
!alue i tate" in the poiti!e $orm rather
than the negati!e $orm.
Thi a!oi" the ue o$ "ouble.negati!e in
e&preion% #hich in!ol!e re!ering the
"ecription o$ the !ariable to "etermine the
actual con"ition being tete".
1or e&ample% the $lag ,!ali"- coul" alo be
name" ,notT!ali"-% ,in!ali"- or
,notTin!ali"-. 3epen"ing on the con"ition%
the other $orm may be le clear that the
imple poiti!e $orm.
4.8.". Variable :sa(e
)o"e may be eaier to rea" #hen there i a
one.to.one correpon"ence bet#een a "ata
concept an" a "ata !ariable.
In general% a ingle "ata !ariable houl" not
be ue" $or t#o "i$$erent purpoe at
"i$$erent point #ithin the co"e.
Alo% t#o "i$$erent "ata !ariable houl" not
be ue" to repreent the ame $un"amental
"ata item at "i$$erent point in the co"e.
Thi iue relate to uage #ithin a common
le!el o$ cope% uch a local !ariable #ithin
a ubroutine% or mo"ule.le!el !ariable
#ithin a mo"ule.
1or e&ample% the item in a lit may be
counte" uing one !ariable% an" thi !alue
may then be aigne" to a "i$$erent !ariable
$or $urther calculation.
In another cae% a !ariable may be ue" to
tore a !alue $or a calculation in an early part
o$ the ubroutine. The ame !ariable may
then be ue" to tore an unrelate" !alue in a
later part o$ the co"e.
In thee cae% the co"e may be
miinterprete" #hen $uture change are
ma"e% lea"ing to an increae" chance o$
$uture bug.
4.8.8. Constants
In mot language% a $i&e" number or tring
#ithin the co"e can be "e$ine" a a
,contant-.
A contant i a name that i imilar to a
!ariable name% but ha a $i&e" !alue.
The ue o$ contant allo# all the $i&e"
!alue to be groupe" together in a ingle
place #ithin the co"e. Alo% #hen a contant
i ue" in e!eral place% thi enure that the
ame !alue i ue" in each place% an" a!oi"
poible bug #here one !alue i up"ate" but
another i not.
Storing contant #ithin the program co"e i
kno#n a har".co"ing.
Thi re"uce the $le&ibility o$ the co"e% a a
program change i re'uire" #hene!er a
contant !alue i change".
The $le&ibility o$ a ytem may be increae"
i$ contant are tore" in "atabae recor" or
con$iguration $ile.
Alternati!ely% in ome cae the ue o$ a
contant !alue can be replace" by !ariable
!alue or $lag.
1or e&ample% a contant !alue that peci$ie" a
particular recor" key coul" be replace" by a
$lag on the recor" that in"icate" that a
particular proce houl" occur.
A another e&ample% a contant number% uch
a a proceing !alue% coul" be replace" by a
tan"ar" "atabae $iel" containing a !ariable
!alue.
)ontant are ue$ul $or !alue that are $i&e"
or change rarely% uch a the "ay o$ the
#eek% cienti$ic contant% or a pro"uct name.
)ontant are alo by ue" $or $i&e" !alue
that are ue" in programming contruction%
uch a en".o$.lit marker% co"e ue" in
"ata tranmiion% interme"iate co"e etc.
The name o$ the contant re$er to the
meaning o$ the "ata% not it !alue. T#o
!alue that #ere the ame by coinci"ence%
uch a the i=e o$ t#o "i$$erent array type%
houl" be "e$ine" a t#o eparate contant
!alue.
9enerally a har".co"e" !alue houl" not be
inclu"e" in a program to repreent "ata that
coul" be in"epen"ently change"% uch a the
key o$ a "atabae recor". Inclu"ing contant
uch a thi #oul" "ecreae the $le&ibility o$
the program% an" #oul" lea" to incorrect
proceing i$ the "ata !alue #a change".
5hen proceing applie" to a certain recor"%
thi coul" be peci$ie" by inclu"ing an option
$lag on the recor" itel$.
4.8.19. Subroutine <a$es
Subroutine name may conit o$ e!eral
#or". 5hen the ubroutine name contain a
noun an" a !erb% thi can be lite" in either
or"er.
1or e&ample% the $ollo#ing co"e "e$ine
!ariable in the !erb.noun or"er.
define_report
format_report
print_report
Thi uage $ollo# the uual e'uence o$ a
entence. The oppoite $orm% in the noun.
!erb or"er% can alo be ue"
report_define
report_format
report_print
Thi approach group relate" $unction
together% an" highlight the "ata ob8ect rather
than the $unction.
)o"e #ritten in thi #ay ha a clearer
eparation bet#een the in"i!i"ual ob8ect an"
$unction. Thi approach i ue" in ob8ect
orientate" programming.
4.8.11. %rror .an-lin(
7rror occur #hen an in!ali" con"ition i
"etecte" #ithin a ection o$ program co"e.
Thi may be "ue to a program bug% or it may
be the reult o$ the "ata that ha been ue" in
the calculation or proce.
7rror at the co"ing le!el inclu"e problem
that lea" to ytem crahe or hanging% an"
problem #ith "ata an" "ata tructure.
Sytem problem inclu"e attempt to "i!i"e a
number by =ero% loop that ne!er terminate%
an" attempting to acce an in!ali" pointer or
an ob8ect that ha not been initialie".
3ata problem inclu"e lit that are empty
#hen they houl" contain "ata% "ata #ithin a
tructure that contain too many or too $e#
entrie% or an incorrect et o$ !alue $or the
proce being per$orme".
At the proce le!el% error may inclu"e input
"ata that i in!ali"% miing "ata% an" input
"ata that i !ali" but pro"uce reult that are
outi"e e&pecte" range.
4.8.11.1. %rror Detection
7rror can be "etecte" by uing error
checking co"e.
Thee tatement "o not alter the reult o$
the proce% but are inclu"e" to "etect error
at an early tage.
Thi i ue" to ait in the "ebugging
proce% an" to pre!ent incorrect "ata being
tore" an" incorrect reult $rom being
pro"uce".
7rror "etection can in!ol!e checking "ata
!alue at point in the proce $or !alue that
are negati!e% =ero% an empty tring% or outi"e
e&pecte" range.
At the proce le!el% check coul" inclu"e
per$orming re!ere calculation% canning
output "ata tructure $or in!ali" !alue an"
combination% an" checking the relationhip
bet#een !ariou !ariable to enure that the
output !alue are conitent #ith each other
an" #ith the input !alue.
7rror "etection co"e may a"" comple&ity an"
!olume to the co"e an" lo# e&ecution.
0o#e!er% thi co"e may alo impli$y
"ebugging an" "etect error that #oul"
other#ie lea" to incorrect output.
A""ing permanent error check that are
imple an" e&ecute 'uickly can be ue" to
increae the robutne o$ the co"e.
4.8.11.2. Response to %rrors
5hen an error con"ition i "etecte"% !ariou
action can be taken.
7rror #ithin general ubroutine an"
$unction may be han"le" by returning an
error tatu con"ition to the calling routine.
Alternati!ely% in ome language an"
ituation an e&ception i generate"% an" thi
e&ception reult in program termination
unle it i trappe" by an error.han"ling
routine. The error han"ling routine i
automatically calle" #hen the e&ception
con"ition arie.
5hen the error occur #ithin a main
proceing $unction% an error meage may
be "iplaye" $or an interacti!e proce% or
logge" to an error log $ile $or a batch proce.
1ollo#ing the error% the proce may
continue operation an" pro"uce a partial
reult% or the current proce may terminate.
4.8.11.3. %rror 0essa(es
7rror meage may inclu"e in$ormation that
i ue" in the "ebugging proce.
In$ormation that can be inclu"e" in an error
meage inclu"e the $ollo#ing point>
An error number.
A "ecription o$ the error.
The place in the program #here the
error occurre".
The "ata that caue" the error.
Aelate" ma8or "ata key that can be
ue" to locate the item.
A "ecription o$ the action that #ill
be taken $ollo#ing the error.
+oible caue o$ the error.
Aecommen"e" action.
Action to a!oi" the error i$ the "ata
i actually correct.
A lit or "ecription o$ alternati!e
"ata that #oul" be !ali".
1or e&ample
,7AA<A +232*> A negati!e policy
contribution o$ [.12.32 i recor"e"
$or policy number 00MUM00022 on
12J03JL*. Mo"ule +rintStatement%
Subroutine )alcBalance-
,7AA<A K32> Mo"el ,Shell+ro$ile-
ha no meh type. Thi error may
occur i$ the con!erion $rom !erion
3.M2 ha not been complete". I$ thi
mo"el i a continuou.ur$ace mo"el%
the option ,continuou ur$ace- in the
mo"el parameter creen can be
electe" to enable correct calculation.
Mo"ule Aen"erMeh% Subroutine
Meh)ount-
In ome cae% help in$ormation i inclu"e"
#ith an application that pro!i"e a""ition
in$ormation regar"ing the error con"ition.
1or the programming perpecti!e% the key
element o$ an error meage are a #ay to
i"enti$y the place in the co"e #here the error
occurre"% an" in$ormation that #oul" enable
the "ata that #a being procee" to be
i"enti$ie".
Thi particularly applie to general ytem
error uch a "i!i"e.by.=ero error.
4.8.11.4. %rror Recovery
In ome procee a igni$icant number o$
error may be e&pecte".
Thi occur% $or e&ample% in compiler #hile
compiling program co"e% an" in "ata
proceing #hile proceing large batche o$
"ata.
In thee cae% en"ing the proce #hen the
$irt error i "etecte" coul" reult in repeate"
re.running o$ the proce a each error i
correcte".
7rror reco!ery in!ol!e taking action to
continue operation $ollo#ing an error
con"ition% to generate other reult or
generate partial output% an" to "etect the $ull
lit o$ error.
3uring program compilation% a compiler #ill
generally attempt to proce the entire
program an" pro"uce a lit o$ all compilation
error #ithin the co"e.
5hen an error i "etecte"% an error meage
may be logge" to a $ile. 3epen"ing on the
ituation% error reco!ery may in!ol!e
ignoring the error an" continuing operation%
terminating part o$ a proce an" continuing
other part% uing a "e$ault !alue in place o$
an in!ali" one% or arti$icially creating "ata to
ubtitute $or miing in$ormation.
4.8.11.5. Sel5Co$pensatin( Syste$s
A el$.compenating ytem i a ytem that
automatically a"8ut the ytem to correct
e&iting error.
Thi can be "one by calculating the e&pecte"
current poition% the actual current poition%
an" creating recor" to a"8ut $or the
"i$$erence.
Thi i in contrat to a proce that imply
per$orm a $i&e" proce an" ignore other
"ata.
1or e&ample% a monthly $ee proce may
create monthly $ee tranaction. I$ a pre!iou
tranaction i incorrect% thi #ill be ignore"
by the current month proce.
0o#e!er% i$ the monthly proce calculate"
the year.to."ate amount "ue% an" the year.to.
"ate amount pai"% an" then create" a
tranaction the repreent the "i$$erence% thi
approach #oul" a"8ut $or the e&iting
incorrect tranaction.
Separate !alue coul" alo be create" $or the
e&pecte" amount an" the une&pecte"
a"8utment.
4.8.12. Portability
+ortable co"e i #ritten to a!oi" uing
$eature that are peci$ic to a particular
compiler% language implementation% or
operating en!ironment.
)o"e that i #ritten in a portable #ay i
eaier to con!ert to "i$$erent "e!elopment
en!ironment.
Alo% ome portability iue a$$ect the
clarity an" implicity o$ the co"e% an" a
ection o$ co"e #ritten in a portable #ay may
be eaier to rea" an" maintain than an
alternati!e ection that ue implementation.
peci$ic $eature.
4.8.12.1.#an(ua(e /perations an-
%&tensions
Many compiler upport e&tenion to the
tan"ar" language% through the
implementation o$ a""itional key#or" an"
operation.
Some language operation an" parameter
are not peci$ie" a part o$ the language
"e$inition. Thi may inclu"e the i=e o$
"i$$erent numeric "ata type% the reult o$
certain operation% an" the reult o$ ome
inputJoutput operation.
)o"e that i "epen"ant on unpeci$ie"
$eature o$ the language% or that ue
compiler.peci$ic e&tenion to the language%
may be le portable than co"e that a!oi"
thee $eature.
Some language "o not ha!e a ingle
"e$inition% an" igni$icant "i$$erence in the
language tructure may occur bet#een
implementation. In thee cae a ubet o$
common $eature acro ma8or
implementation coul" be ue" to re"uce
portability problem.
4.8.12.2.%&ternal +nteraces
Eer inter$ace tructure% $ile an" "atabae
tructure an" printing operation may all
!ary $rom operating ytem to operating
ytem.
In general% con!erion to alternati!e
en!ironment may be impler #hen relate"
procee are groupe" together. 1or e&ample%
all the uer inter$ace co"e% inclu"ing call to
operating ytem $unction% coul" be groupe"
into a uer inter$ace mo"ule.
4.8.12.3.Se($entation o )unctionality
In many ytem the co"e can be groupe"
into e!eral ma8or ection.
<ne ection may be the uer inter$ace co"e%
#hich "iplay creen% menu% an" han"le
input $rom the uer.
<ther ma8or ection may inclu"e a et o$
calculation an" proceing $unction% an"
$ormatting an" printing co"e.
Thi #oul" increae portability by enabling
one ection to be mo"i$ie" $or an alternati!e
en!ironment% #hile the other ection remain
unchange".
0o#e!er% thi approach #oul" not apply to
an e!ent."ri!en ytem that ue" a comple&
uer inter$ace "eign% #ith mall proceing
tep attache" to !ariou $unction.
4.8.13. #an(ua(e Subsets
Eing a ubet o$ a language in!ol!e uing a
et o$ imple $un"amental operation. Thi
#oul" in!ol!e a!oi"ing alternati!e
operation% an" comple& or little.ue"
language $eature.
)o"e #ritten uing a ubet o$ the $ull
language may be impler an" eaier to rea"
than co"e that ue $unction $rom pre!iou
!erion o$ the language an" little.ue"
language $eature.
1or e&ample% a language may upport e!eral
looping tatement that pro!i"e imilar
$unctionality. 5riting co"e in a language
ubet may in!ol!e uing one o$ the loop
contruct throughout the co"e.
4.8.14. Deault Values
A "e$ault !alue i a !alue that i ue" #hen a
"ata item i unkno#n or i not peci$ie".
3e$ault !alue can be ue" to a!oi"
peci$ying multiple option $or a particular
proce. 1or e&ample% the "e$ault !alue $or
each option may be peci$ie" in a "atabae
recor" or con$iguration $ile. Thee "e$ault
!alue #oul" be ue" unle a peci$ic option
#a o!erri""en by another !alue.
3e$ault o!erri"e may occur at multiple
le!el. 1or e&ample% a "e$ault !alue coul" be
peci$ie" $or an option acro an entire
ytem% #hich coul" be o!erri""en by a
eparate "e$ault !alue $or a particular group
o$ recor"% #hich in turn coul" be o!erri""en
by a peci$ic !alue in an in"i!i"ual recor".
The "e$ault at each le!el coul" be
in"epen"ently change".
5hen a "e$ault o!erri"e i remo!e"% the
actual !alue ue" return to the "e$ault !alue
o$ the pre!iou le!el.
The term "e$ault !alue i alo ue" in the
conte&t o$ an initial !alue. Thi i an initial
!alue place" in a "ata recor"% "ata tructure
or creen entry $iel".
0o#e!er% #hen initial !alue are change" the
pre!iou !alue i lot% unlike "e$ault !alue
#hich can be retore" by remo!ing the
o!erri"e !alue.
4.8.15. Co$ple& %&pressions
In ome cae the clarity o$ a comple&
e&preion can be impro!e" by breaking the
e&preion into ub.part an" toring each
part in a eparate !ariable.
Thi allo# the !ariable name to a"" more
in$ormation into the co"e% an" i"enti$ie the
tructure o$ the e&preion.
1or e&ample%
total = (# + ')O(e*d)*(c*(#0(#+')On)*'
+ fv*((# + ')On))
Thi co"e coul" be plit into e!eral
component to clari$y the tructure o$ the
e&preion.
part_period_discount = (# + ') O
(e*d)
annuit' = (# 0 (# + ')O(n))*'
face_value_pv = fv * (# + ')On)
total = part_period * (c * annuit' +
face_value_pv)
A""ing a""itional bracket into a comple&
e&preion may alo clari$y the inten"e"
operation.
4.8.16. Duplicate- %&pressions
5hen a particular e&preion occur more
than once #ithin a program% it can be place"
in a eparate ubroutine.
Thi may a!oi" problem #hen one !erion
o$ the e&preion i change" but the other
!erion i not.
Thee type o$ bug can remain un"etecte"
$or long perio" o$ time% becaue the ytem
may continue to operate an" appear to be
#orking correctly.
1or e&ample
if sample_t'pe = ;>< and result_value
" 36-4 then
print_data
end
P
P
P
if sample_t'pe = ;>< and result_value
" 36-- then
include_in_averages
end
In thi e&ample% the econ" e&preion i
$urther through the co"e. The $irt e&preion
print recor" #ith a !alue o$ le than 0.3*%
#hile the econ" e&preion calculate the
a!erage o$ all recor" #ith a !alue o$ le
than 0.33.
The intention may ha!e been $or thi to
repreent the ame e&preion% an" the
printe" a!erage to be the a!erage o$ the
printe" recor".
Thi bug #oul" not a$$ect ytem operation%
an" #oul" not be "etecte" unle the printe"
$igure #ere re.calculate" manually to check
the ,a!erage- $igure.
5riting a ubroutine to replace thee
e&preion an" implement the e&preion in
a ingle place #oul" a!oi" thi problem.
Alo% the $i&e" number coul" be replace"
#ith a contant uch a
A7SE4TTT<47AA/)7% #hich a""
in$ormation into the co"e an" #oul" allo#
thi contant to be ue" in other place #ithin
the co"e.
5here t#o e&preion #ere the ame by
coinci"ence% but they ha" a "i$$erent
meaning% they houl" not be combine" into a
common ubroutine.
4.8.1!. <este- A+)B state$ents
/ete" ,i$- tatement can be "i$$icult to
interpret.
In general% a erie o$ eparate ,i$-
tatement may be eaier to rea" an"
interpret than a et o$ nete" ,i$- tatement.
1or e&ample% the $ollo#ing co"e "etermine
#hether a year i a leap year% uing nete"
,i$- tatement.
if 'ear mod 2 = 3 then
if 'ear mod #33 = 3 then
if 'ear mod 233 = 3 then
is_leap_'ear = true
else
is_leap_'ear = false
end
else
is_leap_'ear = true
end
else
is_leap_'ear = false
end
Thi co"e can be re.#ritten a a erie o$
eparate ,i$- tatement. In thi cae the
control $lo# may be clearer than the co"e
that ue a nete" tructure.
is_leap_'ear = false
if 'ear mod 2 = 3 then
is_leap_'ear = true
end
if 'ear mod #33 = 3 then
is_leap_'ear = false
end
if 'ear mod 233 = 3 then
is_leap_'ear = true
end
Thi particular e&ample coul" alo be re.
#ritten a a ingle con"ition% a ho#n in the
$ollo#ing co"e
if ('ear mod 2 = 3 and 'ear mod #33
"$ 3) or
'ear
mod 233 = 3 then
is_leap_'ear = true
else
is_leap_'ear = false
end
4.8.1". A%lseB con-itions
In mot cae% the ,ele- part o$ an ,i$-
tatement i inten"e" to apply to ,i$ the
con"ition i not true-. 0o#e!er% in other
cae the intention i $or the co"e to apply
,$or the other !alue-.
1or e&ample% a particular numeric !ariable
may generally ha!e a !alue o$ 1 or 2. The
$ollo#ing co"e i an e&ample.
if process_t'pe = # then
run_process#
else
run_process+
end
In thi e&ample% i$ the !alue o$
,proceTtype- i not 1% then it ha been
aume" to be 2. 0o#e!er% "ue to a bug in
the ytem or a miun"ertan"ing o$ meaning
an" !alue o$ !ariable ,proceTtype-% it may
ha!e a "i$$erent !alue. Thi can be checke"%
a in the $ollo#ing e&ample.
if process_t'pe = # then
run_process#
else
if process_t'pe = + then
run_process+
else
displa'_message ;Bnvalid value ;
Q
process_t'pe
Q ;for
variable
process_t'pe
in
run_process<
end
Thi co"e may "etect e&iting problem% or
"etect problem that arie $ollo#ing $uture
change.
4.8.18. 4oolean %&pressions
4.8.18.1.Con-itions
I$ the !ariable ,ortTacen"ing- i a Boolean
!ariable% i.e. it can only ha!e the !alue True
or 1ale% then the $ollo#ing t#o line o$ co"e
are e'ui!alent
if sort_ascending = true then
if sort_ascending then
The econ" $orm i clear #hen a Boolean
!ariable i ue"% an" the ,; True- i not
neceary.
0o#e!er% in ome language the econ" $orm
o$ the e&preion can alo be ue" #ith
numeric !ariable.
In thi cae the co"e may be clearer i$ the
actual con"ition i inclu"e".
1or e&ample%
if record_count then
if record_count "$ 3 then
In thi cae the !ariable ,recor"Tcount-
recor" a number% not a Boolean !alue. In
language #here ,true- #a "e$ine" a non.
=ero% the t#o e&preion may be e'ui!alent.
0o#e!er% thi imply relie on the metho"
that ha been ue" to implement Boolean
e&preion% an" the econ" $orm may be
clearer a it peci$ie the con"ition that i
actually being tete".
In language that ue trict type checking% the
$irt $orm may generate an error% a the
e&preion ha a numeric type but the ,i$-
tatement ue Boolean e&preion.
4.8.18.2.+nte(er +$ple$entations
In ome language% Boolean !ariable are
implemente" a integer #ithin the co"e%
rather than a a eparate type. The True an"
1ale !alue #oul" be numeric contant.
Sero i generally ue" $or 1ale% #hile True
can be 1% .1% or any non.=ero number
"epen"ing on the language.
In language #here Boolean !alue are
implemente" a number% problem can arie
i$ numeric !alue other than True an" 1ale
are ue" #ith !ariable that are inten"e" to
be Boolean.
1or e&ample% i$ 1ale i =ero an" True i 1%
but any non.=ero !alue i accepte" a true%
the $ollo#ing anomalie can occur.
+alue Condition ,utcome -eason
1 i $ale no 1 i not
e'ual to 0
1 ; True ye 1 i e'ual
to 1
1 i true ye 1 i non.
=ero
2 i $ale no 2 i not
e'ual to 0
2 ; True no 2 i not
e'ual to 1
2 i true ye 2 i non.
=ero
In thi cae% ,2- #oul" match the con"ition
,i true-% a i it non.=ero% but #oul" not
match the con"ition ,; True-% a it i not
e'ual to 1.
Thee problem can be re"uce" i$ numeric
an" Boolean !ariable an" e&preion are
clearly eparate".
4.8.29. Consistency
)onitency in the ue o$ language $eature
may re"uce the chance o$ bug #ithin the
co"e.
1or e&ample% array are commonly in"e&e"
#ith the $irt element ha!ing an in"e& o$ =ero
or one. In ome language thi con!ention i
$i&e"% #hile in other it can be "e$ine" on a
ytem.#i"e bai or #hen an in"i!i"ual
array i "e$ine".
I$ ome array are in"e&e" $rom =ero an"
ome are in"e&e" $rom one% thi may
increae the change o$ bug in the e&iting
ytem% or bug being intro"uce" through
$uture change.
1or e&ample% thi co"e ue the con!ention
o$ toring the !alue tarting #ith element
=ero.
for i = 3 to num_active #
total = total + current_valueKiL
end
The $ollo#ing co"e ue the con!ention o$
toring !alue tarting #ith element one.
for i = # to num_active
total = total + current_valueKiL
end
I$ the #rong loop type #a ue" $or the array%
one !ali" element #oul" be mie"% an"
#oul" be replace" #ith another !alue that
coul" be a ran"om% initial or pre!iou !alue.

Thi may lea" to ubtle problem in
proceing% or create general intability an"
occaional ran"om problem.
5hen maintenance change are ma"e to an
e&iting ytem% the chance o$ error
occurring may be re"uce" i$ the language
$eature are ue" in a #ay that i conitent
#ith the e&iting co"e.
4.8.21. :n-eine- #an(ua(e /perations
In many language% there are combination o$
tatement that $orm !ali" ection o$ co"e%
but #here the reult o$ the operation i not
clearly "e$ine".
1or e&ample% in many language the !alue
that a loop !ariable ha a$ter the loop ha
terminate" i not "e$ine".
The $ollo#ing co"e earche an array $or a
#or" an" a"" the #or" into the array at the
$irt empty pace i$ it i not $oun".
subroutine add_!ord( !ord as string,
substring_found as boolean )
define i as integer
define found as boolean
found = false
for i = 3 to num_!ords 0 #
if !ord_tableKiL = !ord then
found = true
end
if
string_search( !ord_tableKiL, !ord )
then
substring_found = true
end
end
if not found then
!ord_tableKiL = !ord
num_!ords = num_!ords + #
end
end
5hile the !alue o$ the !ariable ,i- increae
$rom 0 to ,numT#or" F 1- on each iteration
through the loop% in many language the
!alue o$ ,i- i not clearly "e$ine" a$ter the
loop ha terminate". It may be e'ual to the
lat !alue through the loop% the lat !alue
plu one% or ome other !alue.
Mot compiler #oul" not "etect thi
problem% a technically thi co"e i a !ali"
et o$ tatement #ithin the language.
Thi problem coul" be a!oi"e" by uing the
!ariable ,numT#or"- a$ter the loop intea"
o$ the loop !ariable itel$.
)alling ubroutine $rom #ithin e&preion
can alo reult in un"e$ine" operation. 1or
e&ample% in ome cae the or"er in #hich an
e&preion i e!aluate" i not "e$ine"% an"
#hen an e&preion contain t#o ubroutine
call% thee call coul" occur in either or"er.
In the cae o$ Boolean e&preion% i$ the
$irt part o$ an A/3 e&preion i $ale% then
the econ" part "oe not nee" to be
e!aluate"% a the reult o$ the A/3
e&preion #ill be $ale% regar"le o$ the
reult o$ the econ" e&preion.
In thee cae% language may "e$ine that the
econ" part #ill ne!er be e&ecute"% that the
econ" part #ill al#ay be e&ecute"% or the
reult may be un"e$ine".
".1,. Testing
Teting in!ol!e creating "ata an" tet
cenario% calling ubroutine or uing the
ytem% an" checking the reult.
Teting i "one at the le!el o$ in"i!i"ual
ubroutine% complete mo"ule% an" an entire
ytem.
Teting cannot repair a ytem that i poorly
"eigne" or co"e". The reliability o$ a ytem
i "etermine" "uring the "eign an" co"ing
tage% not "uring the teting tage.
4.19.1. %&ecution Pat1 Co$ple&ity
The number o$ poible path that program
e&ecution can $ollo# i e&tremely large.
1or e&ample% the $ollo#ing co"e can an
array o$ 1000 item% an" print all the item
that ha!e a !alue o$ le than one.
for i = 3 to 111
if tableKiL " # then
print tableKiL
end
end
The number o$ poible combination o$
output i 2
1000
% #hich i appro&imately 10M
$ollo#e" by 2KK =ero.
In large ytem% only a mall $raction o$ the
poible program $lo# path #ill e!er be
e&ecute" in the entire li$e o$ the ytem
operation.
4.19.2. Testin( 0et1o-s
4.19.2.1.)unction Testin(
Teting in"i!i"ual $unction in!ol!e teting
in"i!i"ual ubroutine an" mo"ule a each
$unction i "e!elope".
3ebugging i eaier an" more reliable i$
teting i "one a each mall tage i
"e!elope"% rather than #riting a large !olume
o$ co"e an" then con"ucting teting.
1unction teting i con"ucte" by #riting a
tet program or tet harne.
Thi may be a eparate program% or a ection
o$ co"e #ithin an e&iting ytem. The
teting routine generate "ata% call the
$unction being tete"% an" either log the
reult to a $ile or check the $igure uing an
alternati!e metho".
4.19.2.2.Syste$ Testin(
Sytem teting in!ol!e teting an entire
ytem. Thi i "one by creating tet "ata%
running procee an" $unction #ithin the
ytem% an" checking the reult.
Sytem teting generally reult in the
pro"uction o$ a lit o$ kno#n problem. The
actual error or outcome in each ituation i
"ecribe"% along #ith the "ata an" tep
re'uire" to re.pro"uce the problem.
5hen a range o$ problem ha!e been $i&e"% a
ne# tet !erion o$ the ytem can be
releae" $or $urther teting.
4.19.2.3.'uto$ate- testin(
Automate" teting in!ol!e the ue o$ teting
tool to con"uct teting.
Teting tool are program that imulate
keytroke entere" by the uer% check the
appearance o$ creen "iplay to "etect error
meage% an" log reult.
Thi proce i particularly ue$ul #hen
change are ma"e to an e&iting ytem. A et
o$ reult can be generate" be$ore the change
i ma"e% an" then automatically re.generate"
a$ter the change. Thi metho" can be ue" to
check that other procee ha!e not been
altere" by the ytem change.
Automate" teting can alo be con"ucte" by
altering the ytem to log each keytoke to a
$ile% an" then re.rea"ing the $ile an"
replaying the keytoke automatically.
4.19.2.4.Stress Testin(
Stre teting in!ol!e teting a ytem #ith
large !olume o$ "ata an" high input
tranaction rate. Thi i "one to enure that
the ytem #ill continue to operate normally
#ith large "ata !olume% an" to enure that
the repone time #oul" be #ithin
acceptable limit.
Stre teting can be "one by generating a
large !olume o$ ran"om or e'uential "ata%
populating the "atabae table% an" running
the ytem procee.
Stre teting can alo be "one #ith internal
"ata tructure. 1or e&ample% a teting routine
$or teting a general et o$ binary tree
$unction% or a orting mo"ule% coul" create a
large !olume o$ "ata% inert the "ata into the
tructure% an" call the $unction that operate
on the "ata tructure.
4.19.2.5.4lac2 4o& Testin(
Black bo& teting in!ol!e teting a ytem
or mo"ule againt a "e$inition o$ the
$unction% #hile ignoring the internal tructure
o$ the proce.
Thi can be a ue$ul initial tet% a the teting
i "one #ithout preconcei!e" i"ea about the
proceing.
0o#e!er% "ue to the large number o$ poible
path in e!en mall ection o$ co"e% it i not
poible to check that the output reult
#oul" be correct in all circumtance.
Tet cae that take into account the tructure
an" e"ge cae in the internal co"e are likely
to "etect more problem that purely black
bo& teting.
4.19.2.6.Parallel Testin(
In ome cae% an alternati!e ytem i
a!ailable that can per$orm imilar $unction
to the ytem being tete".
Thi may be an e&iting ytem in the cae o$
a ytem re"e!elopment% a temporary ytem%
or an alternati!e ytem uch a a
commercial ytem that pro!i"e relate"
$unction.
+arallel teting can be "one by loa"ing the
ame et o$ "ata into both ytem an"
comparing the reult.
The reult houl" alo be checke"
in"epen"ently% to a!oi" carrying o!er bug
$rom a pre!iou ytem into a ne# ytem.
4.19.3. Test Cases
4.19.3.1.'ctual Data
Actual "ata i "eri!e" $rom pre!iou
ytem% manual keying% uploa"ing $rom
e&ternal ytem% an" the e&iting ytem
itel$ #hen change are being ma"e.
Tet con"ucte" on actual "ata can be ue" to
generate a et o$ kno#n reult. Thee reult
can then be re.generate" an" compare" to the
pre!iou "ata a$ter change ha!e been ma"e.
Thi proce can be ue" to check #hether
e&iting $unction ha!e been altere" by
change ma"e to the ytem.
4.19.3.2.Typical an- 'typical Data
Typical "ata i a et o$ create" "ata that
$ollo# uual pattern.
Alo% a range o$ unuual "ata combination
can alo be create" to tet the $ull
$unctionality o$ the ytem.
Typical "ata i ue$ul in teting proceing%
a a $ull et o$ tan"ar" reult #ill generally
be generate". Thi may not occur #ith
unuual cae that are !ali" ytem input%
but "o not reult in a $ull et o$ proceing
being per$orme".
Teting generally co!er the $ull range o$
poible "ata an" $unction% an" $ocue on
unuual an" atypical cae.
+roblem #ith common cae may appear
relati!ely 'uickly% #hile re"ucing long.term
problem in!ol!e checking cenario that
may not appear until ome time into the
$uture.
4.19.3.3.%-(e Cases
7"ge cae in!ol!e checking the igni$icant
point #ithin co"e or "ata.
Thi may inclu"e !alue that reult in a
change in calculation output% or cae that are
"i$$erent $rom the ne&t an" pre!iou !alue%
uch a the lat recor" in a $ile.
1or e&ample% in a calculation the altere" a$ter
one year% teting coul" be "one uing perio"
o$ 3U2% 3U*% 3UU an" 3UM "ay.
A another e&ample% in a ytem $or
recor"ing "etail o$ learner "ri!er #ith a
minimum age o$ 1M% teting coul" be "one
#ith tet cae uing age o$ 1U% 1M an" 1L.
4.19.3.4.Ran-o$ Data
Aan"om "ata generation may pro"uce tet
cae that are unuual an" une&pecte"% e!en
though they are !ali" ytem input.
Teting #ith ran"om "ata can be ue$ul in
checking the $ull range o$ $unctionality o$ a
ytem or mo"ule. Aan"omly generate" "ata
an" $unction e'uence may tet cenario
that #ere not contemplate" #hen the ytem
#a "eigne" an" #ritten.
4.19.4. C1ec2in( Results
4.19.4.1.Syste$ /peration
In ome cae "irect problem occur #hen
procee or $unction are run. Thi may
inclu"e problem uch a a program error
meage being "iplaye"% a ytem crah
#ith an internal error meage% printe" output
not appearing or being incorrectly arrange"%
or the program entering an in$inite loop an"
ne!er terminating.
4.19.4.2.'lternative 'l(orit1$s
In ome cae an alternati!e metho" can be
ue" to check the reult that ha!e been
generate". Thi may in!ol!e #riting a teting
routine to calculate the ame reult% uing a
metho" that may be imple% but may e&ecute
lo#ly an" may only apply to that particular
ituation.
5hen thi i the cae% the tet program can
generate a large number o$ tet cae% call the
mo"ule being tete"% an" check the reult
that are pro"uce".
4.19.4.3.;no*n Solutions
5hen teting i con"ucte" on an e&iting
ytem% a et o$ tan"ar" reult can be
pro"uce". Thi may inclu"e a et o$ "ata that
i up"ate" #ithin a "atabae% or a et o$
calculate" $igure that are tore" in a $ile $or
$uture comparion.
Thi proce allo# a tet program to re.
generate the "ata or $igure% an" check the
reult againt the kno#n correct output.
4.19.4.4.0anual Calculations
The input to calculation an" the calculation
reult can be logge" to a $ile $or manual
checking. Thi may inclu"e #riting a imple
program to can the $ile an" check the
$igure% or it may in!ol!e uing a program
uch a a prea"heet to check the "ata an"
re.calculate the $igure.
)heck can be run againt the input "ata that
#a upplie" to the ytem% an" alo againt
calculation #ithin the et o$ output "ata%
uch a !eri$ying total.
4.19.4.5.Consistency o Results
In ome cae% the output $rom a proce
houl" ha!e a certain $orm% an" in"i!i"ual
output houl" be relate" in certain #ay.

In thee ituation% a tet program can be
ue" to check that the in"i!i"ual reult are
conitent #ith each other. Thee tet coul"
alo be built into the routine itel$% an" ue"
to check output a it i pro"uce".
5hen thee tet are $at an" imple they can
remain in the co"e permanently% other#ie
they can be acti!ate" $or teting an"
"ebugging.
1or e&ample% a et o$ output #eight houl"
um to 1% a orte" output lit houl" be in a
orte" or"er% an" the output o$ a proce that
"ecompoe a !alue into part houl" e'ual
the original !alue.
A another e&ample% checking that a ort
routine ha ucce$ully orte" a lit i a
imple proce% an" in!ol!e canning the lit
once an" checking that each item i not
maller than the pre!iou item.
4.19.4.6.Reverse Calculations
Some calculation an" procee can be
per$orme" in t#o "irection% #ith one
"irection being "i$$icult an" the other
traight$or#ar".
1or e&ample% the !alue o$ ,y- in the e'uation
,y ; &
2
? &- i "etermine" by calculating the
reult $rom the !alue o$ ,&-.
0o#e!er% i$ the !alue o$ ,y- i alrea"y
kno#n but the !alue o$ ,&- i re'uire"% then
the e'uation cannot be "irectly ol!e"% an"
an iterati!e metho" $or "etermining an
appro&imate olution mut be ue".
In thi cae% "etermining the !alue o$ ,y-
may be a relati!ely comple& proce.
0o#e!er% once the reult i kno#n% it can be
eay checke" by pre$orming the re!ere
calculation an" enuring that the reult
matche the original $igure.
4.19.5. Declarative Co-e
Teting "eclarati!e pattern in!ol!e
checking that the pattern matche the
e&pecte" et o$ tring uing the e&pecte" et
o$ ub.pattern.

4.19.5.1.Testin( o t1e pro(ra$
In the cae o$ $act.bae" ytem that in!ol!e
problem ol!ing an" goal eeking% teting
can be con"ucte" to enure that $act are not
con$licting% an" that there are no uninten"e"
gap in the in$ormation that #oul" lea" to
un"e$ine" reult.
A tet program can be #ritten to rea" the
pattern or $act "ecription into an internal
"ata tructure $or canning.
A can o$ the tructure can be per$orme" to
check $or loop% multiple path% an"
con"ition that ha!e un"e$ine" reult.

5here a loop occur% in ome cae thi may
be the reult o$ a "eliberate recuri!e
"e$inition% #hile in other cae thi may
igni$y an error.
In ome cae% t#o point #ithin a pattern
may be connecte" by multiple path.

In thee cae% an input tring may be
matche" by a pattern in t#o "i$$erent #ay.
In ome application thi may not be
igni$icant% #hile in other cae thi may
in"icate that the pattern coul" not be ue" in
proceing.
In ome application% algorithm e&it to
check particular attribute o$ a pattern
tructure.
1or e&ample% an algorithm coul" be ue" to
check #hether a language grammar #a or
#a not uitable $or top."o#n paring.
4.19.5.2.Testin( Pro(ra$ /peration
Teting can be per$orme" #ith input "ata to
enure that the correct reult i pro"uce".
Thi may in!ol!e uing the program #ith tet
cae an" checking output.
Trace coul" be pro"uce" o$ the logic path
that #a $ollo#e" to arri!e at the reult% or
the ub.pattern that #ere matche".
4.19.6. Testin( Su$$ary
Testing 'ethods
1unction teting Teting in"i!i"ual
ubroutine% mo"ule an"
$unction uing tet program.
Sytem Teting Teting entire ytem by
running tet cae an"
checking reult.
Automate" Teting Eing automate" teting tool
to imulate keying% run
procee% an" "etect creen
an" "ata output.
Stre Teting Teting application #ith
large "ata !olume an" high
tranaction rate to check
operation an" repone time.
Black bo& teting Teting a $unction againt a
peci$ication% ignoring the
$unction( internal tructure.
+arallel Teting Teting a ytem by running
an alternati!e ytem uing
the ame "ata.
Test (ata
Actual 3ata 3ata ource" $rom pre!iou
ytem% "ata uploa"% the
e&iting ytem itel$ or
manual keying.
Typical an" Atypical
3ata
)reate" "ata uing common
"ata combination an" alo
unuual an" une&pecte"
combination that are !ali"
ytem input.
7"ge )ae Tet "ata that i lightly le%
lightly more% an" e'ual to
!alue that reult in change
in calculation% or internal
program limit.
Aan"om 3ata 3ata create" #ith ran"om
!alue an" combination%
ue" to generate large "ata
!olume an" to tet the $ull
range an" combination o$
ytem input.
(etecting .rrors
Sytem <peration +roblem "ue to program
crahe% error meage% an"
incorrect output.
Alternati!e Algorithm 9enerating the ame reult
#ithin a tet program uing an
alternati!e algorithm% an"
comparing reult.
Dno#n Solution )omparing reult #ith
reult generate" pre!iouly%
an" "e$ining a et o$ input
"ata #ith kno#n reult
generate" by a eparate tet
program.
Manual )alculation )hecking reult uing tet
program an" o$t#are tool
to re.calculate output reult
an" check $igure #ithin
output uch a total.
)onitent Aeult )hecking output $or
conitency% uch a
in"i!i"ual output that houl"
balance to =ero or e'ual
another output% checking that
orte" "ata i actually orte"
etc.
Ae!ere )alculation +er$orming a calculation in
re!ere to "etermine the
original $igure% an"
comparing thi reult #ith the
actual input !alue to !eri$y
that the generate" reult i
correct.
(eclarati)e Code
Teting <utput 3eclarati!e co"e can be run
againt actual tet "ata% an"
the output reult checke".
)hecking program
trace
Trace o$ logic an" pattern
matche" "uring the operation
#ith the input "ata may
highlight problem #ith the
"eclarati!e tructure.
Structure )heck 3eclarati!e tructure can be
rea" by tet program% an" a
can o$ the tructure can be
per$orme" to check $or loop%
multiple path% an"
combination o$ e!ent that
#oul" lea" to un"e$ine"
reult.
".11. De0ugging
3ebugging i the proce o$ locating bug
#ithin a program an" correcting the co"e. A
bug i an error in the co"e% or a "eign $la#%
that lea" to an incorrect reult being
pro"uce".
4.11.1. Proce-ural Co-e
Be$ore "ebugging can be per$orme"% a et o$
tep that lea" to the ame problem
occurring each time the program i run mut
be "etermine". Thi tep i the $oun"ation o$
the "ebugging proce.
3ebugging can be "one uing ome o$ the
$ollo#ing metho"
Aea"ing the co"e an" attempting to
$ollo# the e&ecution path o$ the
particular et o$ tep.
Aunning the program #ith trace co"e
a""e" to log the !alue o$ !ariable to
a "ata $ile% an" to i"enti$y #hich
con"ition #ere triggere".
Stepping through the e&ecution uing
a "ebugger% an" pauing at !ariou
point in the e&ecution to e&amine the
!alue o$ "ata !ariable.
A""ing error checking co"e into the
ytem to "etect error at an earlier
tage% or to trigger a meage #hen
in!ali" "ata or reult are pro"uce".
Some e&ample o$ bug inclu"e>
An error in entering an e&preion%
uch a placing bracket in the #rong
place.
A logic error% #here a certain
combination o$ con"ition i not
han"le" correctly.
A mitake in the un"ertan"ing o$ a
!ariable\ ho# it i calculate"% an"
#hen it i up"ate".
A e'uence problem% #hen calling a
et o$ $unction in a particular or"er
lea" to an incorrect reult.
A corruption o$ memory% "ue to an
up"ate to an incorrect memory
location uch a an incorrect array
re$erence.
A loop that terminate un"er incorrect
con"ition.
An incorrect aumption about the
concept an" procee that the
ytem ue.
4.11.1.1. Vie*in( Data Structures
The content o$ entire "ata tructure% uch a
array an" table% can be #ritten to a te&t $ile
an" then !ie#e" in a program uch a a
prea"heet application. Thi can be "one by
#riting ubroutine to #rite the content o$
the "ata tructure to a te&t $ile.
Thi metho" may highlight ob!iou
problem% uch a a column $ull o$ =ero or a
large lit #hen there houl" be a mall lit.
3ata column $rom "i$$erent "ata tructure
can be compare"% an" manual calculation
can be "one to check that the $igure are
correct.
4.11.1.2. Data Traces
A log $ile can be #ritten o$ the !alue o$
!ariable a the program run.
Thi can be ue" to !ie# the e'uence o$
change to !ariou "ata !ariable.
Trace may alo be ue" to recor" #hich
ection o$ the co"e #ere e&ecute"% an"
#hich con"ition #ere triggere".
A Timetamp% containing an up"ate "ate an"
time% can be inclu"e" on "ata recor". Thi
can be ue" to i"enti$y the recor" that #ere
up"ate" "uring the proce.
4.11.1.3. Cleanin( & Re*ritin( Co-e
In cae #here a "i$$icult bug cannot be
$oun"% the co"e can be re!ie#e" an" change
uch a a""ing comment% minor re.#riting
o$ co"e% changing !ariable name etc. can be
ma"e.
In ituation #here the co"e i in !ery poor
con"ition% $ollo#ing a large number o$
change% an entire ection o$ co"e may be re.
#ritten.
Thi may occur #hen the control $lo# #ithin
a ection o$ co"e i e&tremely comple&% an"
it i likely that other problem are alo
preent in the co"e% a #ell a the particular
problem being checke".
In thi cae% the original bug houl" be
locate" be$ore the re.#riting i$ poible% a it
may repreent a "eign $la# that i alo
preent in other part o$ the ytem.
4.11.1.4. +nternal C1ec2s
Internal check are co"e that i a""e" into the
ytem to "etermine a point in the proce
#hen the reult become incorrect.
Thi can be ue" to "etermine the
appro&imate location o$ the problem. Thi
metho" i particularly ue$ul $or bug that
ran"omly occur% #here a e'uence o$ tep to
repro"uce the problem cannot be "etermine".
In ome cae% in!ali" "ata may occaionally
appear in a "atabae% ho#e!er re.running the
proce generate the correct reult.
Inclu"ing internal check may trap the error
a it occur% enabling the problem to be
trace".
4.11.1.5. Reverse Calculations
Some calculation can be per$orme" in
re!ere% to check that the reult i correct. 1or
e&ample% an iterati!e metho" coul" be ue"
to "etermine the !alue o$ the !ariable ,&- in
the e'uation ,y ; &
2
? &-% #hen the !alue o$
,y- i kno#n.
In thi e&ample% #hen the !alue o$ ,&- ha
been calculate"% the e'uation can be ue" to
calculate the !alue o$ ,y- an" enure that it
matche" the original !alue.
4.11.1.6. 'lternative 'l(orit1$s
In ome cae an alternati!e metho" can be
ue" to calculate a reult an" check that it i
correct. 1or e&ample% thi may be a imple
metho" that i lo#er that the metho" being
checke"% an" only applie in certain
circumtance.
4.11.1.!. C1ec2in( Results
Some procee pro"uce e!eral reult that
can be checke" againt each other. 1or
e&ample% in proce that "ecompoe a !alue
into component part% the um o$ the part
houl" match the original !alue.

A another e&ample% orting i a lo#
proce% ho#e!er checking that a lit i
actually orte" can be "one #ith a ingle pa
o$ the lit.
3uring teting a ort routine coul" check the
output being pro"uce" to enure that the "ata
ha" been correctly orte".
4.11.1.". Data C1ec2in(
3ata !alue can be checke" at !ariou point
in the program to "etect problem. Thi may
inclu"e checking in"i!i"ual !ariable% an"
canning "ata tructure uch a array.
)heck can inclu"e checking $or =ero%
negati!e number% number outi"e e&pecte"
range% empty tring etc. 4it can be
canne" to check that total match in"i!i"ual
entrie% an" that !alue are conitent% uch
a percentage #eight umming to 100N.
4.11.1.8. 0e$ory Corruptions
Memory corruption can occur in ome
en!ironment #here a ection o$ memory
containing "ata item can be o!er#ritten by
other "ata "ue to a program bug. In ome
en!ironment% $or e&ample% memory may be
o!er#ritten by uing an array in"e& that i
larger than the i=e o$ the array.
Some memory corruption can be "etecte"
by uing a $i&e" number co"e #ithin a "ata
!ariable in a tructure or array. 5hen the
tructure i accee"% the number i checke"
againt the e&pecte" !alue% an" i$ the !alue i
"i$$erent then thi in"icate that the memory
ha been o!er#ritten.
A checkum can alo be ue"% #hich i a um
o$ the in"i!i"ual !alue in the tructure. Thi
$igure i up"ate" each time that a "ata item i
mo"i$ie". 5hen the checkum i
recalculate"% a "i$$erence $rom the pre!iou
$igure #oul" in"icate a memory corruption.
4.11.2. Declarative Co-e
3ebugging "eclarati!e co"e may be "i$$icult%
a in many cae the "e$inition are
recuri!e% an" allo# an in$inite number o$
poible pattern.
1or e&ample% the $ollo#ing "e$inition "e$ine
a language o$ imple calculation e&preion.
e%pressionD number
number * e%pression
number + e%pression
number e%pression
number * e%pression
( e%pression )
Thi i a recuri!e "e$inition% a an
e&preion can be a number% a number
multiplie" by another e&preion% or a et o$
bracket containing another e&preion.
Teting an" "ebugging "eclarati!e co"e may
in!ol!e rea"ing the pattern or $act into an
internal "ata tructure% an" canning $or
loop% multiple path an" combination that
#oul" lea" to un"e$ine" output.
In ome cae% a proce coul" be ue" to
e&pan" a pattern into a tree.like tructure
#hich may be eaier to interpret !iually. In
the cae o$ recuri!e "e$inition that coul" be
in$inite% a tree "iagram coul" e&ten" to
e!eral le!el to in"icate the general pattern
o$ e&panion.
The pattern can alo be ue" to generate
ran"om "ata that ha a matching pattern
bae" on the "e$inition.
Thi may highlight ome o$ the cae that are
inclu"e" #ithin the pattern unintentionally%
an" pattern that #ere inten"e" to be
inclu"e" but are not being generate".
3ebugging can alo be per$orme" by
e&ecuting a proce that ue the pattern or
lit o$ $act% an" generating a trace o$ the
logic path that #a ue" "uring proceing.
Thi may inclu"e a lit o$ the in"i!i"ual ub.
pattern that #ere matche" at each tage% or
the $act that #ere checke" an" ue" to
"etermine the reult.
4.11.3. Su$$ary o -ebu((in(
approac1es
"pproach (escription
Aea"ing co"e Aea"ing co"e an" $ollo#ing the
e&ecution path that reult in the
incorrect output.
+rogram trace 4ogging the !alue o$ "ata !ariable%
an" "etail o$ #hich ection o$ co"e
#ere e&ecute" an" #hich con"ition
#ere triggere"% to a "ata $ile a the
program run.
3ebugger Eing a "ebugger to halt the program
"uring e&ecution% !ie# the !alue o$
"ata !ariable% an" tep through
ection o$ co"e.
6ie#ing "ata
tructure
5riting entire "ata tructure to a $ile
an" !ie#ing the content o$ the
tructure% to i"enti$y ob!iou problem
an" to re.calculate $igure an"
compare "ata #ith other tructure.
)leaning co"e Minor re.#riting o$ co"e to a""
comment% correct inconitent
!ariable name an" tatement% an"
clari$y the logic $lo# #ithin the co"e.
(etecting errors
Ae!ere calculation +er$orming a calculation in re!ere
an" recalculating the input !alue $rom
the generate" output% to check that the
input !alue match.
Alternati!e algorithm Eing an alternati!e algorithm to
generate the ame output% an" check
that the output "ata matche.
)onitent output )hecking output reult $or
conitency% uch a checking that
output #eight um to 1% that orte"
"ata i actually orte" etc.
3ata checking )hecking "ata item at !ariou tage
in a proce% inclu"ing canning "ata
tructure% to check $or negati!e item%
=ero !alue% empty lit% #eight that
"o not um to 1 etc.
Memory corruption Eing checkum an" magic number
to "etect pointer to incorrect type
an" memory tructure that ha!e been
o!er#ritten #ith other "ata.
(eclarati)e code
Trace o$ logic $lo# 5riting a trace o$ the logic path ue"
an" the pattern that #ere matche" to a
$ile% o that problem #ith the
"eclarati!e tructure can be i"enti$ie".
Scanning tructure Scanning tructure uing a tet
routine to "etect loop% multiple path%
an" combination o$ input con"ition
that #oul" reult in an un"e$ine"
output.
".12. Documentation
4.12.1. Syste$ Docu$entation
3uring the "e!elopment o$ a ytem% e!eral
"ocument may be pro"uce". Thi typically
inclu"e a ,1unctional Speci$ication-% #hich
"e$ine in "etail the $unction an"
calculation that the ytem houl" per$orm.
<ther "ocument% uch a "eign "ocument
may alo be pro"uce".
Sytem "ocumentation can be ue" "uring
maintenance% an" alo "uring enhancement
to a ytem.
4.12.2. :ser ,ui-e
Eer "ocumentation may inclu"e a uer
gui"e. Thi "ocument i a gui"e to uing the
ytem. It may inclu"e a "ecription o$ the
proce an" $unction that the ytem
per$orm% a #ell a a re$erence gui"e to
calculation an" con"ition. In ome uer
gui"e a et.by.tep tutorial o$ !ariou
$unction i inclu"e".
4.12.3. Proce-ure 0anual
A proce"ure manual i uually pro"uce" by
the en" uer o$ the ytem% rather than the
"e!eloper o$ the ytem.
The proce"ure manual "e$ine ho# a ytem
i ue" in a particular intallation. Thi may
inclu"e a "ecription o$ the ource o$
!ariou "ata item that are maintaine" an" a
lit o$ the timing an" or"er o$ regular
procee.
$. 1lossar+
Abolute
6alue
The i=e o$ a number #ithout it
ign. ?2 an" .2 both ha!e an
abolute !alue& o$ t#o.
Abtraction The proce o$ replacing a et o$
peci$ic ob8ect #ith a more
general concept% uch a replacing
client% upplier an" bank #ith
,counterparty-.
A""re A number i"enti$ying a memory
location. A ,re$erence- i the
a""re o$ a "ata item% an" a
,pointer- i a !ariable that can
contain an a""re.
Ageing Altering proceing bae" on a
time perio" or count (uually a
time count% not actual time). 1or
e&ample% cache "ata may be age"%
an" remain in the cache only
#hile it ha been recently
accee".
Aggregate A "ata type that i compoe" o$
3ata Type in"i!i"ual "ata item. 1or
e&ample% a ,tructure- type may
contain e!eral in"i!i"ual
!ariable% #hile an ,array-
contain multiple entrie o$ the
ame "ata type.
Algorithm A tep.by.tep proce"ure $or
pro"ucing a certain reult. 1or
e&ample% a lit can be orte" by
canning the lit an" electing the
mallet item% then repeating the
can $or the ne&t mallet item an"
o on. Thi i the ,bubble ort-
algorithm.
Alphabetic
)haracter
The *2 character ,a- through to
,=- an" ,A- through to ,S-% a
"itinct $rom "igit% punctuation
an" pecial ymbol.
Alphanumeric
)haracter
A character that i either a letter or
a "igit% that i the character ,a- to
,=-% ,A- to ,S- an" ,0- to ,K-.
Thi i ue" in ome "e$inition%
uch a the !ali" $ormat $or
!ariable name.
Ambiguou 0a!ing more than one poible
meaning. An ambiguou language
grammar may match an input
tring #ith more than one
language pattern% an ambiguou
tatement "oe not ha!e a
guarantee" reult.
Analyi )ollection o$ in$ormation an"
"etermining un"erlying concept
an" procee% prior to "eigning a
ytem. ,Ae'uirement Analyi-
in!ol!e "e$ining the broa"
purpoe an" $unction o$ a ytem%
#hile ,Sytem Analyi-
in!ol!e "etermining the $unction
that a ytem #ill per$orm% an"
pro"ucing a ,1unctional
Speci$ication-
A/3 A Boolean operator. A ,logical-
A/3 e&preion i TAE7 i$ both
part o$ the e&preion are TAE7%
other#ie it i 1A4S7. A
,bit#ie- A/3 e&preion ha the
!alue 1 i$ both bit are 1%
other#ie it ha a !alue o$ 0.
A+I Application +rogram Inter$ace. A
"e$ine" et o$ "ata tructure an"
ubroutine call or operation%
ue" to communicate bet#een t#o
in"epen"ent mo"ule or procee.
Alo calle" a ,er!ice inter$ace-
A+I
Speci$ication
A peci$ication o$ an Application
+rogram Inter$ace. Thi
peci$ication "e$ine the
ubroutine call or operation
intruction% an" the "ata ob8ect
that pa through the A+I. <ther
iue uch a "epen"ence on the
or"er o$ certain operation%
limitation on certain $unction
an" o $orth may alo be
a""ree". Thi i primarily a
logical "e$inition% although "etail
in!ol!e" in connecting to the
inter$ace in practice may alo be
inclu"e".
A+4 Actuarial +rogramming 4anguage.
A mathematically.orientate"
programming language "e!elope"
$or actuarial calculation% #hich
in!ol!e $inance an" tatitic in
the inurance $iel". A+4 co"e i
hea!ily la"en #ith operator
ymbol an" make e&teni!e ue
o$ matrice.
Application
9enerator
A "e!elopment en!ironment that
allo# application to be create"
by "e$ining the creen an" report
layout% #ith a minimum o$
proceing co"e. Thee ytem
are ue" in "ata proceing
en!ironment. Alo calle" $ourth.
generation language.
Arabic
/umber
Sytem
A number ytem bae" on a et o$
character% #here each place in the
number contain one o$ the
character% an" the !alue o$ each
place increae by a multiple o$
the ,bae- a place mo!e $rom
right to le$t. The "ecimal an"
binary number ytem are Arabic
number ytem% #hile roman
numeral are not.
Arbitrary
+reciion
Arithmetic
A type o$ numerical !ariable
#here any number o$ "igit o$
preciion can be peci$ie". The
calculation $unction are generally
implemente" a ubroutine% an"
may be !ery lo#.
Arithmetic
<perator
The common mathematical
operation o$ a""ition% ubtraction
etc. Mot programming language
"irectly upport a""ition%
ubtraction% multiplication%
"i!iion an" e&ponentiation (&
y
).
Array A "ata tructure that contain
multiple item o$ the ame type.
In"i!i"ual item are generally
re$erre" to by number% kno#n a
the ,in"e&-. In ome cae a tring
can be ue" a the in"e&% in #hich
cae the array i kno#n a an
,aociati!e array-.
Aembly
4anguage
A programming language that ha
a "irect one.to.one
correpon"ence #ith the internal
machine co"e o$ the computer.
Aembler ha no ynta& or
tructure% an" i imply a lit o$
intruction. Aembly co"e i
e&tremely $at% ho#e!er large
!olume o$ co"e mut be #ritten
to per$orm baic tak.
Aignment
<perator
The operator $or etting the !alue
o$ a !ariable% o$ten ,;-. 1or
e&ample% ,total ; total ? count-.
Aociati!e
Array
An array that ue a tring a the
in"e& !alue% rather than the uual
cae o$ uing a number. 1or
e&ample% ,runTtypeO ,Mon"ay- P
; 3-
Attribute A "ata !alue that peci$ie a
property o$ another ob8ect. 1or
e&ample% the colour o$ a "iplaye"
ob8ect i a "ata item that i an
attribute o$ the ob8ect.
Au"it Trail A lit o$ "ata entrie that recor" a
erie o$ change% generally to
"ata #ithin a "atabae. Au"it trail
are ue" $or "ebugging% "ata
reconciliation etc.
Automate"
+roce
A proce that operate #ithout
input $rom a uer. 1or e&ample% a
"aily "ata up"ate proce may
connect to an e&ternal ytem an"
tran$er "ata automatically.
Backbone The main link in a large net#ork%
#hich carrie high.!olume tra$$ic
acro a net#ork an" "itribute
"ata to maller ub.net#ork.
Backtracking Aeturning to pre!iou point in a
"ata can% uch a returning to an
earlier point in a tree an" taking a
"i$$erent branch% or re.canning
pre!iou te&t. Algorithm that
in!ol!e backtracking are generally
lo#er than algorithm that
in!ol!e a ingle pa through the
input "ata or tructure.
Bae The ,bae- i the number #hich
$orm the $oun"ation o$ an
operation. The bae o$ the "ecimal
number ytem i 10% #hile the
bae o$ the binary number ytem
i 2. A natural logarithm i a
logarithm #ith a bae o$ the
mathematical contant ,e-% #hile a
common logarithm i a logarithm
to the bae 10.
BASI) A thir".generation programming
language #ith a imilar broa"
tructure to language uch a )%
1ortran an" +acal
Batch +roce A proce "eigne" to be run
unatten"e" an" generally
in!ol!ing rea"ing a large number
o$ "ata recor" an" taking a
igni$icant perio" o$ time to run.
B)3 Binary )o"e" 3ecimal. A number
torage $ormat that i bae" on
toring each "ecimal "igit
eparately a a binary number%
rather than con!erting the entire
number !alue into a true binary
number. B)3 number #here
ue" in earlier computing% an" are
alo ue" in ome har"#are
application uch a control
"e!ice an" calculator.
Binary An Arabic number ytem bae"
on the number t#o. 7ach place in
a binary number ha the "igit 0 or
1% in contrat to the "ecimal
ytem #hich ue the "igit 0 to
K. The "ecimal number 223 i
2&1000 ? 2&100 ? 3&1% #hile the
binary number 1011 i 1&L ? 0&2
? 1&2 ? 1&1. )omputer generally
tore all "ata internally a binary
number.
An e$$ect that inclu"e t#o
element% uch a an operator that
take t#o argument or a
con"ition that ha t#o poible
outcome.
Binary
<perator
An operator that operate on t#o
!alue% uch a the multiplication
operator ,@-% an" the Boolean
operator ,<A-. In thi conte&t%
,binary- "oe not re$er to binary
number% but re$er to the $act that
t#o !alue are ue". See alo
,unary operator-.
Binary Search A $at metho" $or locating an item
in a orte" lot. The number in the
centre o$ the lit i checke" $irt%
then the top hal$ or bottom hal$ o$
the lit i choen. Thi hal$ i then
"i!i"e" in t#o an" o on% until the
!alue i locate". The a!erage
number o$ comparion $or a lit
o$ ,n- item i appro&imately
log
2
(n).1. Alo kno#n a a ,binary
chop-.
Binary Tree A "ata tructure that conit o$
no"e% #here each no"e contain a
"ata !alue% a pointer to a le$t ub.
tree% an" a pointer to a right ub.
tree. A binary tree i imilar to an
upi"e."o#n tree% commencing at
a ingle root no"e an" branching
out $urther "o#n the tree. Binary
tree are ue" in a number o$
algorithm.
Bin"ing
Strength
See ,+rece"ence-
Bit A ingle binary "igit% ha!ing a
!alue o$ 0 or 1. Bit are commonly
groupe" into eight bit to $orm a
,byte-. A""ree commonly re$er
to the location o$ a ingle byte.
Bitmap A collection o$ in"epen"ent bit
ue" $or recor"ing in"i!i"ual
option or eparate !alue. In
contrat% mot collection o$ bit
are relate" an" repreent a binary
number.
Bit#ie
)omparion
A comparion that compare bit
pattern "irectly% rather than
comparing #hether t#o number
ha!e the ame !alue.
Bit#ie
<perator
An operator that operate on an
in"i!i"ual bit. See alo ,A/3-%
,<A-% ,/<T-% ,V<A-.
Block A ection o$ co"e% #hich may be
an arbitrary ection o$ co"e% or
may be relate" uch a the block
o$ co"e #ithin a loop or ,i$-
tatement.
Boolean In!ol!ing the t#o !alue TAE7
an" 1A4S7. A Boolean !ariable
ha one o$ thee !alue% an" a
Boolean e&preion uch a ,3 :
*- i either true or $ale.
Boolean
<perator
The operator A/3% <A% /<T
an" V<A. Ee" $or ,logical-
Boolean e&preion in!ol!ing
TAE7 an" 1A4S7% an" ,bit#ie-
Boolean e&preion in!ol!ing 0
an" 1. See alo ,A/3-% ,<A-%
,/<T-% ,V<A-.
Brace The character ,], an" ,^-
Bracket <$ten ue" to re$er to the
character ,(, an" ,)-% but
technically a bracket i the 'uare
bracket ,O, an" ,P-% #hile the
ymbol ,(, an" ,)- are
parenthei% an" ,], an" ,^- are
brace.
Branching Bumping to another point in the
program to continue e&ecution.
Machine co"e ue brache bae"
on con"ition% an" uncon"itional
8ump. Statement that alter
control $lo# in a programming
language% uch a ,i$- tatement
an" loop% are tranlate" into
branche an" 8ump by the
compiler.
B.tree A tree tructure that ha multiple
branche at each le!el. B.tree are
el$.balancing #hen item are
inerte" an" "elete"% an" are o$ten
ue" #ithin "atabae to
implement in"e&e.
Bubble Sort A orting algorithm. The bubble
ort metho" in!ol!e canning a
lit to locate the mallet item%
then re.canning $or the ne&t
mallet item an" o on% until
e!ery item ha been procee".
Thi metho" i imple to
implement an" i ue$ul $or a".hoc
program% 0o#e!er% the bubble
ort algorithm i highly ine$$icient%
an" i impractical $or lit o$ more
than a $e# hun"re" item. In thee
cae an alternati!e algorithm
uch a ,'uickort- #oul" be
ue".
Bu$$er An area o$ memory ue" $or
general torage rather than
peci$ic !ariable% uch a a
tranlation $rom one binary "ata
tructure to another. Alo ue" a a
memory area to pa "ata bet#een
in"epen"ent procee% or bet#een
program co"e an" har"#are
"e!ice.
Bug An error in program co"e% or a
$ault in "eign that reult in an
incorrect reult being pro"uce"
#hen a particular combination o$
e!ent occur.
Byte A collection o$ eight Bit.
)omputer memory i o$ten
organie" into byte% #ith a ingle
a""re re$erring to the location o$
an in"i!i"ual byte o$ torage. A
byte can repreent a number $rom
0 to 2**% an" may contain
in$ormation uch a part o$ a
larger number% or a co"e
repreenting a ingle letter.
) A thir".generation programming
language% #ith a broa"ly imilar
tructure to language uch a
1ortran an" +acal. ) i o$ten ue"
in ytem.le!el programming.
)ache An area o$ memory or a "ata
tructure "eigne" $or the
temporary torage o$ "ata item to
allo# $ater acce. A cache may
be ue" to tore "ata that #a
retrie!e" $rom a lo#er torage
metho"% uch a a "atabae or "ik
$ile. )ache are alo ue" to tore
the reult o$ pre!iou calculation
that #ill be re.ue" in $urther
proceing.
)ache are ue" in har"#are an"
o$t#are at multiple le!el.
)all A re$erence to a ubroutine name%
#hich caue the program
e&ecution to 8ump to the
ubroutine an" begin e&ecuting
the co"e #ithin the ubroutine.
)ontrol $lo# return to the
tatement $ollo#ing the ubroutine
call #hen the ubroutine
terminate.
)allback
1unction
A pointer or re$erence to a
ubroutine that i pae" to
another routine% an" ue" to call
the ubroutine that i re$erence".
Thi i ue" #hen general.purpoe
$unction nee" to call a ubroutine
that i relate" to the operation
being per$orme". 1or e&ample% a
callback $unction may be calle" by
a general orting routine to
compare t#o ob8ect that #ere
being orte".
)all.By.
Ae$erence
A metho" $or paing parameter
to ubroutine% #here a pointer to
a !ariable i pae"% rather than
the !ariable( !alue. Thi allo#
the calle" ubroutine to change the
!ariable( !alue an" return
multiple reult% ho#e!er thi can
intro"uce problem #hen the
calling program !ariable are
change" in une&pecte"
circumtance. See alo ,call by
!alue-
)all.By.6alue A metho" $or paing parameter
to ubroutine% #here the !alue o$
the !ariable i pae". Thi
metho" increae the
in"epen"ence o$ co"e an"
guarantee to the calling program
that it !ariable #ill not be
change" in une&pecte"
circumtance. 0o#e!er% thi
metho" can be lo#er that call.by.
re$erence% a more "ata may nee"
to be copie"% an" returning
multiple !alue $rom a ubroutine
can be "i$$icult. See alo ,call by
re$erence-
)aller The ection o$ co"e that
per$orme" a call to a ubroutine.
)aca"ing
Ep"ate J
3elete
In a relational "atabae% a
,caca"ing up"ate- up"ate the
"ata $iel" o$ all recor" that re$er
to the key o$ another recor"% #hen
the key i change". 1or e&ample%
i$ a client number #a change"%
then all recor" inclu"ing the
client number a a "ata item
#oul" be automatically up"ate"
#ith the ne# client number.
,)aca"ing "elete- reult in a
"eletion o$ all recor" that re$er to
a primary recor"% #hen the
primary recor" i "elete".
)ae A tatement a!ailable #ithin ome
language that act a a
combination o$ e!eral ,i$-
tatement% uch a a tatement
that e&ecute three "i$$erent
ection o$ co"e "epen"ing on
#hether a !ariable( !alue i 1% 2
or 3.
The cae o$ a character% uch a
,a- $or lo#er cae an" ,A- $or
upper cae. In internal torage%
thee character are tore" #ith
eparate co"e an" are no more
relate" then ,=- an" ,H-.
0o#e!er% ome $unction an"
operation are cae.ineniti!e%
an" #oul" treat ,a- an" ,A- a the
ame character.
)ae.
ineniti!e
A cae.ineniti!e proce i one
that treat uppercae an"
lo#ercae letter a the ame
!alue. In a programming language
that ue" cae.ineniti!e !ariable
name% the name ,/e&tItem- an"
,ne&titem- #oul" re$er to the
ame !ariable.
)ae.eniti!e A cae.eniti!e operation i one
that treat upper.cae an" lo#er.
cae letter a "i$$erent character.
1or e&ample% in a programming
language that ue cae.eniti!e
!ariable name% the name
,1irtItem- an" ,$irtitem- #oul"
repreent "i$$erent !ariable.
)at An operation a!ailable in ome
programming language to con!ert
one "ata type to another% uch a
an integer !alue to a $loating.point
!alue.
)entral
+roceing
Enit ()+E)
In mot computer the e&ecution
o$ machine co"e intruction i
per$orme" by a ingle chip% or a
har"#are tructure kno#n a a
)+E F )entral +roceing Enit.
Many computer ha!e only one
)+E% #hile in ome cae a large
computer may ha!e e!eral%
although thi i general a mall
number. Alo kno#n a a
,proceor-.
)haracter An in"i!i"ual letter% "igit or
ymbol% uch a ,e-% ,7-% -P- an"
,*-.
)haracter Set A et o$ numeric co"e $or
character% uch a ,a-% ,2-% ,A-
an" ,],. <riginally mot
proceing #a "one uing the
AS)II character et% #ith ome
main $rame computer uing an
alternati!e character et kno#n a
7B)I3I). Thi change"
igni$icantly #ith the gro#th in
computer uage in non.englih
language. Te&t proceing may
ue a range o$ alternati!e character
et% although programming
ource co"e o$ten ue a
tra"itional character et. In ome
ituation alternati!e character et
are ue"% uch a the A+4
programming language #hich
inclu"e a""itional ymbol.
)heckum A number that i calculate" $rom a
block o$ "ata. Thi can be ue" to
check that the block o$ "ata ha
not change"% uch a #hen "ata i
ent through a communication
link. )heckum cannot "etect all
error% an" a more ophiticate"
calculation kno#n a a )A) can
be per$orme" that #ill "etect a
#i"er range o$ error.
)hil" Ee" in the conte&t o$ "atabae
recor" an" "ata tructure% a
,chil"- recor" or ob8ect i attache"
to a ,parent- recor" or ob8ect. Thi
i ue" to "ecribe a one.to.many
connection% #here each parent
recor" may ha!e e!eral chil"
recor"% but a chil" recor"
connect to only one parent
recor".
)hip Shortene" term $or ,Silicon
)hip-. Mot computer har"#are i
implemente" #ith ilicon chip
that inclu"e million o$ tranitor
etche" onto a mall block o$
ilicon% uing a photographic or
other proce. 7ach tranitor can
#itch on an" o$$ electricity%
#hich i ue" to tore the 0 an" 1
!alue in a binary number% an" to
per$orm the e'uence o$ tep
nee"e" to e&ecute an intruction.
)la A term ue" in ob8ect.orientate"
programming to "ecribe a type o$
"ata ob8ect. A cla contain a
"e$inition o$ "ata !ariable an"
ubroutine% kno#n a ,metho"-.
5ithin the program co"e% cla
ob8ect are create"% an" the
metho" are applie" to e&ecute
$unction.
)lear To et the !alue o$ a Boolean
!ariable to 1A4S7% or to et the
!alue o$ a bit to 0.
)oalece To combine t#o ob8ect into a
ingle large ob8ect. 1or e&ample% i$
t#o $ree memory block are
a"8acent in memory% then they can
be re."e$ine" a a ingle larger
block o$ $ree memory
)obol A programming language that
operate at a imilar le!el o$
abtraction to thir".generation
language uch a 1ortran% +acal
an" ). 0o#e!er% cobol i
tructure" 'uite "i$$erently to
other language an" ue 7nglih.
like entence a program co"e.
)obol i ue" e&teni!ely in large
"ata proceing en!ironment.
)o"e See ,Source )o"e-
)o"e" $iel" A "atabae $iel" that contain one
item $rom a et o$ $i&e" co"e%
uch a a tranaction type $iel".
Thee may be numeric co"e or
tring !alue.
)ollating
Se'uence
The or"er in #hich the character
are orte". Although ,b- #oul"
generally be orte" a$ter ,a-%
"i$$erence arie #ith the
treatment o$ upper.cae an" lo#er.
cae letter% punctuation% an"
"igit.
)olumn )olumn may be a "ata column in
a report% a ingle $iel" #ithin a
"atabae recor" or tructure type
that appear a a column o$ !alue
#hen a lit o$ recor" i "iplaye"%
or one "imenion o$ a t#o.
"imenional matri&. T#o.
"imenional matrice are
ometime procee" a ro# an"
column o$ "ata item.
)omment Te&t entere" #ithin program co"e
$or the bene$it o$ a human rea"er%
uch a note concerning a
calculation. )omment "o not
a$$ect the operation o$ a program
an" are ignore" by the compiler.
)ommon )o"e ubroutine that are calle"
)o"e $rom more than one program.
)ommon mo"ule are ometime
"e!elope" an" maintaine"
eparately $rom application
program% #here e!eral ytem
"e!elopment may ue the ame
$unction.
)ompacte"
Structure
A "ata tructure that ha been
mo"i$ie" to remo!e blank entrie
an" replace "uplicate" entrie #ith
a ingle entry% to re"uce memory
uage.
)ompacting +roceing a "ata tructure or
"atabae to re"uce it i=e% by
eliminating unue" pace #ithin
the tructure. 5hen recor" or
"ata ob8ect are a""e" an" "elete"%
the "eletion can lea!e empty
pace #ithin the tructure. Ae.
creating the tructure #ith the
acti!e "ata create a ne# tructure
#ithout the unue" pace. Thi i
ometime "one on a perio"ic
bai #ith "atabae.
)omparion See ,Aelational <perator-
<perator
)ompilation The proce o$ generating a
machine co"e !erion o$ a
program $rom the program ource
co"e. The machine co"e !erion
o$ the program can be "irectly
e&ecute" by the computer. Thi
proce i "one by a program
kno#n a a compiler.
)ompiler A program that generate an
e&ecutable machine.co"e $ile $rom
a program ource co"e $ile. In
ome ytem% ,ob8ect co"e- i
pro"uce" intea"% #hich i a
machine.co"e $ormat but mut be
linke" #ith other mo"ule uing a
program kno#n a a ,linker- to
pro"uce an e&ecutable $ile.
)omple&
/umber
A mathematical tructure that i
ue" in ome engineering
calculation. A comple& number i
bae" on the "e$inition o$ the
letter ,i- a repreenting the
'uare root o$ negati!e one. A the
'uare root o$ a negati!e number
cannot be repreente" by a real
number% the ,i- i kno#n a an
,imaginary number-. 3ue to the
"e$inition% i
2
; .1. A ,comple&
number- ha t#o component% a
,real- an" an ,imaginary- part.
1or e&ample% the comple& number
,3 ? *i- repreent 3% plu *
multiplie" by ,i-.
)ompoite
Dey
A recor" key in a relational
"atabae that i compoe" o$ t#o
or more "ata $iel". 1or e&ample%
the primary key o$ a change.o$.
a""re recor" may be the
combination o$ the client number
an" the e$$ecti!e "ate o$ the
change. 3ate are commonly
inclu"e" in compoite key. Thi
i ue" $or orting purpoe% o
that ran"om accee can check
#hether a recor" e&it $or a
particular "ate% an" to create a
uni'ue key to i"enti$y the recor".
)ompree" In application uch a "ata
tranmiion o!er lo# link% "ata
may be tranlate" into a
compree" $ormat to re"uce it
i=e an" increae the tran$er rate.
A number o$ imple an" comple&
algorithm are ue" $or thi
proce.
)oncatenation )ombining t#o tring to $orm a
ingle tring. 1or e&ample%
appen"ing ,.c!- to the tring
,temp- create the tring
,temp.c!-.
)oncurrently <perating at the ame time.
)oncurrent procee e&ecute
in"epen"ently an" communicate
through program inter$ace.
)oncurrent e&ecution o$
ubroutine i poible in ome
pecial.purpoe language
although thee are rarely ue"% a
"ebugging i e&tremely "i$$icult
an" little bene$it i a""e"
compare" to a tan"ar" proce.
)on"ition A Boolean e&preion ue" in an
,i$- tatement or a loop. In an ,i$-
tatement% the co"e $ollo#ing the
tatement i e&ecute" i$ the
con"ition i true% other#ie it i
kippe".
)on$iguration
3ata
)on$iguration "ata i ue" to
peci$y option $or ytem
operation. 1or e&ample% a !alue
may peci$y that a certain
calculation metho" houl" be ue"
#hen e!eral calculation metho"
are a!ailable.
)ontant A $i&e" !alue% uch a 12.23 or
,comma-. /ame are ometime
ue" $or contant% $or clarity an"
o that the !alue can be "e$ine" in
one place% uch a
,577DST+7ATI7AA-.
)ontrol 1lo# See ,logic-
)orrupt 3ata A ection o$ memory% a "ata
tructure% or a "atabae item that
contain "ata in an in!ali" $ormat.
Thi can be caue" by the "ata
being o!er#ritten "ue to a
program bug% uch a #riting the
"ata $rom one tructure type into
the memory location o$ a "i$$erent
tructure type. Thi i "itinct
$rom incorrect "ata% #hich i in a
!ali" $ormat but i bae" on an
incorrect calculation or other
problem.
)A) )yclic Ae"un"ancy )heck. Thi i
a comple& calculation that i
per$orme" on a block o$ "ata to
pro"uce a mall number. The
number can then be compare"
againt the ame reult at another
time to check #hether the "ata ha
been change"% uch a "uring a
"ata tranmiion or "ue to an
error on a "ik. A )A) cannot
"etect all poible change%
ho#e!er i can "etect a #i"er
range o$ problem than a imple
,checkum-% uch a t#o number
being interchange".
)utomie"
So$t#are
So$t#are that ha been altere" $or
a particular uer% or $or a particular
purpoe.
3ata /umber% te&t an" other
in$ormation uch a graphic
image. In mot computer% "ata i
tore" internally a binary
number% #ith number co"e
being ue" to repreent letter in
te&t% an" et o$ in"i!i"ual bit
ue" $or point in graphic image.
3ata
proceing
A type o$ program that in!ol!e
proceing large !olume o$ "ata%
per$orming calculation%
generating "ata recor" an"
pro"ucing report. Ee" hea!ily in
banking% inurance% general
a"minitration an" in"utrie uch
a manu$acturing.
3ata type In mot language% "i$$erent type
o$ !ariable may be tore". Thi
may inclu"e tring (mall te&t
item)% numeric !ariable o$
!ariou type% an" other type
uch a "ate. Aggregate "ata
type% uch a array an"
tructure% can alo be "e$ine".
See alo ,array-% ,tring-%
,tructure-% ,integer-% ,$loating
point-.
3atabae A large "ata torage $ile that
contain recor" in a $i&e" et o$
$ormat. In mot "ata bae% a
,recor"- i a $ormat that contain
e!eral in"i!i"ual "ata item uch
a number an" te&t tring.
Multiple recor" o$ the ame type
but #ith "i$$erent "ata may be
tore"% an" multiple recor"
$ormat can be "e$ine". See alo
,relational "atabae-
3atabae
con!erion
Ma8or up"ate to ytem
ometime re'uire a "atabae
con!erion% #hich re.create a
"atabae in a ne# $ormat uing the
original "ata. Thi i "one by
#riting con!erion program% an"
ometime manual a"8utment to
ome "ata
3atabae
Management
Sytem
A program that manage the
retrie!al% a""ing% mo"i$ying an"
"eletion o$ recor" in a "atabae.
+rogram communicate #ith the
3BMS through ubroutine call or
a "ata 'uery language. Thi i
ue" to retrie!e "ata an" up"ate
recor". A 3BMS may alo
inclu"e a "irect uer inter$ace to
pro!i"e $or a".hoc report an"
up"ate to the "ata.
3ea"lock A con"ition that can occur #ith
concurrent procee% #here
e&ecution cannot continue a each
proce i #aiting $or the other to
complete a tak be$ore it can
continue. 1or e&ample% one
proce coul" lock a $ile an" #ait
$or acce to a printer be$ore
continuing% #hile another proce
ha locke" the printer an" i
#aiting $or acce to the $ile. Thi
particular ituation #oul" not
occur a printer are not locke"%
an" $ile rarely are% ho#e!er
"ea"lock i an iue in ome
procee uch a locking multiple
"atabae recor" $or a ingle
up"ate proce.
3e.allocate
Memory
The operation o$ en"ing the
allocation o$ memory that i ue"
a a "ynamic memory tructure.
Alo kno#n a ,$reeing memory-%
,"eleting ob8ect-% ,releaing
memory- an" ,"etroying ob8ect-
3ebugger A program that i ue" to ait in
"ebugging. A "ebugger may be
ue" to tep through a program in
tage% an" e&amine the !alue o$
"ata !ariable at "i$$erent point in
the program e&ecution.
3ebugging The proce o$ locating bug
#ithin the program co"e. Thi can
be "one by rea"ing the co"e to
check a e'uence o$ operation%
tepping through tage uing a
"ebugger% an" a""ing check an"
tet #ithin the program co"e.
3ecimal An Arabic number ytem bae"
on the !alue 10. The "ecimal
number ytem i the number
ytem ue" $or e!ery"ay ue.
A point ue" to eparate the
#hole.number part o$ a number
$rom the $ractional part% or
alternati!ely ue" to eparate
thouan" in ome region.
3eclarati!e A language that conit o$ a et o$
4anguage "e$inition% rather than a et o$
tatement that are e&ecute" in
e'uence. A program in a
"eclarati!e language contain a et
o$ $act or pattern "e$inition%
#hich the language engine ue in
an attempt to ol!e a problem that
i preente"% or to match input
pattern. An e&ample i a che.
playing program% #here the
program conit o$ tatement
"e$ining the mo!e on a che
boar". 3eclarati!e language are
not #i"ely ue".
3eclarati!e
Statement
A tatement that pro!i"e
in$ormation about the program%
but i not e&ecute" a an
operation. The "e$inition o$
!ariable are "eclarati!e
tatement.
3ecryption The proce o$ tranlating
encrypte" "ata into the original
"ata $ormat. See ,7ncrypte" 3ata-
3e$ault A !alue that i ue" in the abence
o$ an o!erri"ing !alue. 1or
e&ample% the "e$ault !alue $or
printer output may be the ytem
"e$ault printer% unle another
printer i electe". 3e$ault !alue
may be initial !alue that can be
change"% or true "e$ault !alue
#here the !alue #ill return to the
"e$ault !alue i$ the o!erri"e i
remo!e"
3e$ault
<!erri"e
A !alue ue" to o!erri"e a "e$ault
!alue. 1or e&ample% tatement
may be able to be printe" in
"etaile" $ormat or ummary
$ormat% #ith the output "epen"ing
on the "e$ault !alue electe"%
unle there i a ,"etaile" only- or
,ummary only- o!erri"e entere"
on a cutomer recor".
3e$eni!e
+rogramming
A programming tyle that attempt
to impro!e the reliability an"
robutne o$ co"e by a!oi"ing
aumption about pre!iou
operation an" con"ition outi"e
the ubroutine% an" by checking
"ata that i pae" into a
ubroutine.
3elete Aemo!e a recor" $rom a "atabae
or an item $rom a "ata tructure.
3e.allocate memory $or a
"ynamic memory tructure. See
3e.Allocate.
3eri!e" 3ata 3ata tore" in a "atabae that ha
been generate" by the ytem. In
ome cae% "eri!e" "ata coul" be
"elete" an" re.generate" $rom the
primary "ata. See alo ,+rimary
3ata-
3eterminitic
1inite State
Automaton
A 1inite State Automaton that ha
a ingle poible tranition $or
each e!ent in each tate. Thi can
be e&ecute" "irectly% in contrat to
a /on."eterminitic 1inite State
Automaton.
3e!elopment
7n!ironment
The "e!elopment re$er to the
e"itor% compiler% "ebugger an"
other tool ue" in the
"e!elopment o$ program. Thi
may alo inclu"e other o$t#are
tool uch a !erion control
ytem% ubroutine librarie an"
er!ice a!ailable $or program
"e!elopment.
3igit <ne o$ the character ,0- through
to ,K-. Alo ue" a ,"ecimal
"igit- or ,binary "igit-% #here the
binary "igit can be either 0 or 1.
3imenion An in"epen"ent election o$ an
element in an array or matri&. 1or
e&ample% in a t#o."imenional
array% each element i electe" by
t#o in"epen"ent number%
ometime re$erre" to a ro# an"
column% & an" y% etc.
+rogramming language that
upport array generally upport
array up to a large number o$
"imenion.
3ocumente"
1eature
A $eature or operation that i
inclu"e" in the "e$ine" operation
o$ a ubroutine% programming
language or programming
inter$ace. In contrat% an
,un"ocumente"- reult i
"etermine" e&perimentally an"
may change #ith ne# !erion o$
o$t#are or change"
circumtance.
3ouble Shortene" term $or ,"ouble
preciion $loating point number-.
Some programming language ue
the term ,"ouble- to "e$ine "ata
!ariable o$ thi type.
3oubly
4inke" 4it
A lit "ata tructure in #hich each
no"e contain a link to the ne&t
no"e in the lit an" alo a link to
the pre!iou no"e. Thi allo#
canning in both "irection% an"
inert an" "elete operation may a
lightly impler than #ith a ingle
linke" lit.
3o#nloa" See ,e&port-
3ynamic
4inking
Ee" to link to ubroutine librarie
#hile a program i running. Thi
may be ue" to acce operating
ytem $unction% an" to link to
o$t#are engine.
3ynamic
Memory
Allocation
)reating an" "etroying "ata
ob8ect a a program run. Thi
"oe not inclu"e !ariable that are
create" a ubroutine tart an"
$inih% but re$er to memory
block that continue to e&it
through the program operation
until they are $ree".
7"itor A program that i ue" $or !ie#ing
an" mo"i$ying program co"e. An
e"itor i imilar to a #or"
proceor but inclu"e $eature
uch a "iplaying language
key#or" in "i$$erent color%
in"enting co"e block an"
recor"able keytoke macro
7le Ee" #ith an ,i$- tatement to
e&ecute co"e #hen the con"ition
i $ale. 5hen an ,i$- tatement
contain an ,ele- ection% i$ the
con"ition i true then the $irt
block o$ co"e i e&ecute" an" the
,ele- co"e i kippe"% other#ie
the $irt block i kippe" an" the
,ele- co"e i e&ecute".
7mbe""e" )ontaine" #ithin another ection
o$ co"e or a "ata tructure. 1or
e&ample% embe""e" SG4 re$er to
SG4 tatement entere" "irectly in
program co"e.
7ncapulation A "ecription o$ a ituation #here
relate" co"e an" "ata item are
groupe" into a ingle unit. Thi
alo implie that the co"e an" "ata
cannot be accee" e&ternally% but
mut be accee" through an
inter$ace. Thi term i $re'uently
ue" in ob8ect orientate" co"e.
7ncapulation can impro!e co"e
reliability by re"ucing the number
o$ link an" interaction bet#een
program ection.
7ncrypte"
3ata
3ata that ha been cramble" into
an unrecogniable $ormat $or
ecurity purpoe. 7ncryption i
ue" in communication ytem%
uch a large net#ork an" "igital
mobile telephone
communication. A #i"e range o$
encryption algorithm are
a!ailable% ranging $rom tri!ial
techni'ue to ophiticate"
algorithm.
7ncryption The proce o$ encrypting "ata.
See ,7ncrypte" 3ata-.
7ngine A ma8or o$t#are component that
pro!i"e a range o$ $unction in a
relate" area% uch a graphic
"iplay or calculation. 7ngine are
accee" through a programming
inter$ace% an" may be linke" into a
program or e&ecute a a eparate
proce.
7nhancement )hange ma"e to a ytem to a""
a""itional $eature an" procee.
Similar to ,maintenance-%
although maintenance generally
re$er to $i&ing bug an" minor
change to enable continue"
operation% #hile enhancement are
larger a""ition o$ ne#
$unctionality.
7ntity Ee" in ytem analyi to re$er
to a $un"amental "ata ob8ect%
#hich may be implemente" a a
"atabae table. Alo a general term
$or an in"epen"ent $un"amental
ob8ect.
7rror
Aeco!ery
Taking action to enable proceing
to continue a$ter an error ha
occurre". 1or e&ample% i$ "ata i
miing% then a "e$ault !alue may
be ue" to generate a partial reult%
rather that terminating the entire
proce.
7!ent An e!ent i omething that occur
that reult in a ection o$ program
co"e being e&ecute" in an e!ent.
"ri!en ytem% or that reult in a
"ata meage being "eli!ere" to a
ection o$ co"e in a meage.
paing ytem.
7&ception A "ata e&ception i a "ata problem
that pre!ent normal proceing.
Thi may reult in an error
meage or ome other action. An
e&ecution e&ception i an internal
ytem error% uch a an attempt to
"i!i"e a number by =ero. Thi may
be trappe" by an error.han"ling
ubroutine.
7&ecutable
1ile
A $ile containing machine co"e
that can be e&ecute" "irectly. The
ource co"e o$ a program i
compile" to pro"uce an e&ecutable
$ile.
7&ecution The running o$ a program% or the
per$orming o$ an action that i
peci$ie" #ithin a line o$ program
co"e. 1or e&ample% #hen an
e&preion #ithin a program i
e&ecute"% the !alue #ill be
calculate" an" the !alue o$ a
!ariable may be et to e'ual the
reult. A ,print- tatement may
caue te&t to be ent to a printer
#hen it i e&ecute".
7&ecution
7n!ironment
The har"#are an" operating
ytem that the program run on.
Alo kno#n a the ,e&ecution
plat$orm-. In the cae o$
implementation that re'uire run.
time upport% uch a interprete"
co"e an" co"e that run on !irtual
machine% thi inclu"e the
o$t#are component re'uire" to
e&ecute the program.
7&ecution
+lat$orm
See ,7&ecution 7n!ironment-
7&ecution
+ro$iler
A program that pro"uce a report
o$ the e&ecution time pent in each
ection o$ the co"e a$ter a program
i run. Thi i ue" to i"enti$y
per$ormance bottleneck an"
i"enti$y ection o$ co"e that can
be mo"i$ie" to increae e&ecution
pee".
7&port 9enerate "ata #ithin a ytem an"
#rite it to a tran$er $ile% #hich i
then ue" to import "ata by
another ytem. Alo kno#n a
,"o#nloa"ing-.
3e$ine ubroutine an" "ata name
that #ill be a!ailable to co"e
outi"e a mo"ule.
7&preion A combination o$ !ariable%
contant !alue an" operator that
pro"uce a calculate" reult. 1or
e&ample% ,2 @ 3 ? *-. Another
e&ample i ,!arO3P : *3 A/3 y _
&-
1ale A Boolean !alue% the other
Boolean !alue being True. See
alo ,Boolean-. Eually
implemente" internally a the
!alue =ero.
1iel" Ae$er to an in"i!i"ual "ata
!ariable #ithin a tructure type% or
an in"i!i"ual "ata item #ithin a
"atabae recor". Thi may be a
number% te&t tring% or a ,co"e"
$iel"-. See alo ,co"e" $iel"-.
1I1< 1irt.In.1irt.<ut. Ee" in e!eral
conte&t. A ,'ueue- i a 1I1< "ata
tructure% #here the $irt "ata item
place" in the 'ueue i the $irt one
retrie!e". In caching% a 1I1<
cache "icar" the "ata that ha
been in the cache $or the longet
perio" o$ time #hen ne# recor"
are rea" into the cache.
1ile Many operating ytem manage
"ata in block kno#n a a ,$ile-. A
$ile i name"% copie" an" "elete"
a a ingle unit. A $ile may contain
"ata uch a a ingle "ocument or
program% or it may contain an
entire large "atabae.
1inite State
Automaton
A ytem that in!ol!e "e$ining a
et o$ tate% an" a et o$
tranition $rom one tate to
another bae" on e!ent. 1inite
State Automaton are ue" in
paring an" te&t proceing. An
1SA i !ery $at a it inclu"e a
imple tranition at each point an"
"oe not in!ol!e backtracking.
0o#e!er% creating an 1SA "irectly
can be "i$$icult% an" ome
algorithm create an 1SA
automatically $rom another
tructure uch a a language
grammar or a te&t matching
pattern. Alo kno#n a a 1inite
State Machine.
1i&e" +oint A type o$ number torage $ormat
that inclu"e a $i&e" number o$
"igit o$ preciion be$ore the
"ecimal point% an" a $i&e" number
o$ "igit a$ter the "ecimal point.
Thi i not upporte" by har"#are
a commonly a integer an"
$loating point $ormat are.
1lag A Boolean !ariable% #ith a !alue
TAE7 o$ 1A4S7. Thi i ue" to
in"icate option an" to tore
reult "uring proceing. 1or
e&ample% ,ort acen"ing
trueJ$ale-
1lat 1ile A $ile that i untructure" an"
imply contain a lit o$ "ata in
te&t $ormat% uch a "ata recor"
tore" a ro# an" column. Thi
i ue" to tran$er "ata bet#een
ytem.
1loat Shortene" term $or ,$loating point
number-. Some programming
language ue the term ,$loat- to
"e$ine !ariable o$ thi type.
1loating +oint A type o$ number torage that
inclu"e a number o$ "igit o$
preciion% an" a eparate number
peci$ying the i=e o$ the number.
1or e&ample% 12300000 coul" be
tore" a 1.23 & 10
M
% #hile
0.000000123 coul" be tore" a
1.23 & 10
.M
. Mot computer
har"#are upport integer an"
$loating point $ormat.
1or A key#or" commonly ue" in
thir".generation programming
language to repeat a loop o$ co"e
a certain number o$ time% uch a
,$or i ; 1 to 100-
1oreign Dey In a relational "atabae% a $oreign
key i the primary key o$ another
recor"% tore" a a "ata item to
pro!i"e a metho" o$ acceing the
relate" recor". 1or e&ample% an
account recor" may contain a
client number $iel" to recor" the
client number o$ the client relate"
to the account. See alo
,caca"ing up"ateJ"elete-%
,primary key-% ,compoite key-.
1ormal
"e!elopment
metho"ology
A tructure" an" planne"
techni'ue $or "e!eloping ytem%
ue" mainly $or "ata proceing
ytem. Thi inclu"e a number
o$ clearly "e$ine" tage% an" a et
o$ tool an" tructure uch a
,entity relationhip "iagram-%
#hich ho# the ma8or
$un"amental "ata item an" their
connection. 1unction may alo
be "e$ine" uing a tructure"
metho".
1ormal
language
"e$inition
A "etaile" peci$ication that
attempt to peci$y all operation
o$ the language% inclu"ing
peci$ying #hich operation are
not inclu"e" #ithin the language
$acilitie% or ha!e un"e$ine"
reult. In ome cae tructure"
in$ormation uch a a ,language
grammar- may be inclu"e". Thi
peci$ication may be ue" a a
re$erence gui"e to check peci$ic
iue% an" alo $or the pro"uction
o$ o$t#are uch a compiler.
1ortran A thir".generation programming
language that i particularly ue"
in engineering an" cienti$ic
application. 1ortran an" )obol
#here the $irt #i"ely.ue"
programming language.
1ourth.
9eneration
4anguage
See ,Application 9enerator-.
1ragmente" A "ata tructure ha contain a
large number o$ mall eparate
block% rather than a $e# large
block. Thi arie $ollo#ing
$re'uent a""ition an" "eletion.
1ragmentation occur #ith "ik
$ile% an" alo #ith "ata tructure
uch a a ,heap-. 1ragmentation
re"uce per$ormance by increaing
earch time% an" i correcte" by
coalecing mall $ree block into
larger $ree block% or by rebuil"ing
the "ata tructure.
1ree memory (noun) 1ree memory i memory
that i not allocate" to a peci$ic
purpoe% an" i a!ailable $or
allocation $or ne# "ynamic "ata
ob8ect.
(!erb) 1reeing memory in!ol!e
"icar"ing "ynamic memory
ob8ect an" releaing the memory
allocation. See alo ,"e.
allocation-.
1unction A term ue" in ome programming
language $or a ubroutine that
return a ingle "ata !alue.
1unctional
Speci$ication
A "ocument pro"uce" "uring
Sytem Analyi that peci$ie
the "etaile" $unction an"
calculation that a ytem houl"
per$orm. A $unctional
peci$ication may alo "e$ine the
"ata item to be tore" an"
procee".
1unctionality The $eature an" $acilitie that a
o$t#are component pro!i"e.
9arbage
collection
A proce o$ canning a "ynamic
memory allocation tructure to
per$orm proceing uch a
coalecing $ragmente" memory
block into larger block. 9arbage
collection i uually per$orme"
automatically in language that
re'uire it $or "ynamic memory
management% although in ome
cae a $unction can be e&plicitly
calle" to per$orm garbage
collection #hen reource le!el or
e&ecution pee" "rop.
9enerality Iue relating to co"e per$orming
a range o$ $unction% rather than a
$i&e" et o$ procee. 1or
e&ample% a report $unction that
print a report $or any gi!en "ata
et% column combination an" ort
or"er ha a higher "egree o$
generality than a group o$
$unction that generate peci$ic
report. Thi ha a"!antage #ith
$le&ibility an" $uture "e!elopment%
but "ia"!antage #ith greater
internal co"e comple&ity.
9enerate )reate a et o$ "ata% $ollo#ing a
"e$inition o$ the proce. 1or
e&ample% a 3 "imenional graphic
"iplay coul" be generate" a$ter
the ob8ect ha" been "e$ine".
9eorgian
)alen"ar
The tan"ar" 5etern calen"ar
inclu"ing the t#el!e month o$ the
year% leap year etc.
9lobal
6ariable
A !ariable that can be accee"
$rom co"e in any part o$ the
ytem
9oto A tatement a!ailable in many
thir".generation language $or
8umping to a peci$ic place in the
co"e an" continuing e&ecution at
that point.
9rammar A $ormal "ecription o$ the ynta&
o$ a programming language% i.e.
the combination o$ ymbol that
#ill generate !ali" program.
9rammar in certain peci$ic
$orm can be procee"
automatically to pro"uce a parer%
#hich i the ection o$ a compiler
that break a program into it
component part.
9ue Some numeric algorithm re'uire
an initial !alue in or"er to
commence the proce. Thi i a
gue or etimate o$ the
appro&imate olution to the
e'uation or proce.
0an"le A !alue that i returne" to a
calling proce to i"enti$y a "ata
ob8ect that ha been create". Thi
han"le i then pae" back in
$uture ubroutine call to i"enti$y
#hich "ata ob8ect a $unction
houl" be applie" to.
0ar" Ee" in e!eral conte&t to mean a
!alue that i $i&e"% in contrat to a
,o$t- !alue that can be change".
0ar".#ire" chip ue" tranitor
to per$orm calculation% #hile
microco"e" chip ue a imple
internal program to e&ecute
intruction. ,0ar".co"ing- i the
practice o$ inclu"ing $i&e" !alue
#ithin a program% uch a name
an" "e$ault !alue% in contrat to
rea"ing !alue $rom a "ata $ile that
can be mo"i$ie".
0ar"#are 7lectrical component #ith a
computer% inclu"ing memory chip
an" the computer( central
proceing unit #hich e&ecute the
program. Some numeric
calculation are e&ecute" in
har"#are by the central proceing
unit% #hile other calculation are
per$orme" in o$t#are by program
ubroutine.
0ah
1unction
A calculation $or generating a
eemingly.ran"om in"e& $rom an
input tring. The in"e& peci$ie
the location in memory o$ the
"ata% an" the ame $unction i
per$orme" #hen the "ata i being
retrie!e".
0ah Table A ,hah table- i a "ata tructure
that tore "ata in ran"om
location. The "ata i i"enti$ie" by
a ,key-% #hich i an in"e&
generate" by applying a
calculation to the input key. 0ah
table allo# almot "irect acce
to "ata item uing tring a key%
but only in"i!i"ual item can be
retrie!e"% item cannot be
retrie!e" in e'uence.
0ea" A pointer to the $irt item in a lit.
0eap A ,heap- i a "ata tructure that i
ue" $or allocating memory block
o$ !ariou i=e. 3ynamic memory
allocation $or creating ne# "ata
ob8ect may be "one uing a heap.
0e&a"ecimal The he&a"ecimal number ytem
i an Arabic number ytem #ith a
bae o$ 1U. Thi i ue" mainly a
a hort.han" #ay o$ recor"ing
binary number. A 1U i an
integer po#er o$ 2% each
he&a"ecimal "igit "irectly relate
to $our binary "igit. The
he&a"ecimal character are ,0- to
,K- an" ,A- to ,1-% $or i&teen
poible "igit in each poition.
1or e&ample% 3A27 ; 3&20KU ?
10&2*U ? 2&1U ? 12&1
0ot A computer% operating ytem%
application or programming
language that pro!i"e an
en!ironment in #hich a program
can operate. 1or e&ample% an
application may be mo"i$ie" to
run on e!eral "i$$erent operating
ytem. 7mbe""e" SG4
tatement appear #ithin a ,hot
language-% #hile macro routine
are #ritten in a hot application.
Icon A mall graphic image% o$ten
ue" to elect an in"i!i"ual
$unction.
I3 ,I"enti$ier-% uch a a recor".I3
#hich #oul" be a numeric $iel" on
the recor" that containe" a !alue
i"enti$ying the recor".
I$ A tatement a!ailable in many
language $or per$orming the
$un"amental con"itional e&ecution
element o$ proce"ural
programming. I$ an e&preion i
true% then a block o$ co"e i
e&ecute"% other#ie it i kippe".
1or e&ample% ,i$ "ayTinTmonth ;
31 then X-
Illegal A !alue or operation that i not
recognie" by a language an"
generally gi!e rie to an error
con"ition. 1or e&ample% i$
memory ha" been altere" an"
containe" incorrect "ata% the
central proceing unit may
attempt to e&ecute a !alue that "i"
not correpon" to a recognie"
intruction. Thi #oul" gi!e rie
to an ,illegal intruction error-.
Implementatio
n
An actual program that per$orm a
"e$ine" tak% a "itinct $rom the
"eign itel$. 1or e&ample% a
compiler implement a
programming language by
generating an e&ecutable $ile $rom
a ource co"e $ile.
Importe" Subroutine an" !ariable name
"e$inition that re$er to ob8ect
that are e&ternal to the main
ytem
Importing Aea"ing a tran$er "ata $ile into a
ytem% an" toring the "ata in a
"atabae or et o$ $ile. Alo
kno#n a ,uploa"ing-.
In"enting Inclu"ing pace at the beginning
o$ a line o$ co"e to !iually
eparate ection o$ co"e. )o"e i
generally in"ente" $or an
a""itional le!el #ithin each
control $lo# block uch a a loop
or ,i$- tatement. )o"e #ithin the
centre o$ an ,i$- tatement an"
t#o loop #oul" be in"ente" by
three le!el. An in"enting le!el
may correpon" to a tab character%
or 2% 2 or L pace "epen"ing on
the layout tyle.
In"e& A number ue" to re$erence an
element in an array. Array
element are generally re$erence"
in integer or"er uch a 1% 2% 3%
an" may begin at 0% 1 or ome
other number.
A "ata tructure ue" #ithin a
"atabae to increae the pee" o$
ran"omly acceing a recor". Thi
i may be a balance" tree tructure
uch a a B.tree.
In"irect In"irect acce occur #hen
e!eral tep are in!ol!e" in
acceing a "ata item. 1or
e&ample% acceing a !ariable
uing a pointer i a ingle le!el o$
,in"irection-. I$ that !ariable #a
a pointer itel$% t#o le!el o$
in"irection #oul" be re'uire" to
acce the "ata item. Thi i alo
kno#n a ,"e.re$erencing- a
pointer. Eing array% in ome "ata
tructure an array may contain a
!alue #hich i ue" a the in"e& to
a eparate array. Thi i an in"irect
array acce.
In$inite loop A loop that continue $ore!er an"
ne!er terminate% "ue to a program
bug. 1or e&ample% i$ tructure A
containe" a link to tructure B%
#hich #a linke" to tructure )%
#hich #a linke" back to tructure
A% then $ollo#ing the link #oul"
lea" to an in$inite chain that ne!er
terminate".
In$i&
7&preion
An in$i& e&preion i an
e&preion #here the binary
operator (the operator uing t#o
!alue) occur bet#een the t#o
!alue. Thi i the uual metho" o$
#riting e&preion% uch a ,2 .
(3 ? *) @ 2-. 7&preion are
generally not tore" internally in
thi $ormat% a they cannot be
e&ecute" "irectly until the or"er o$
the operation ha been
"etermine". Thi proce i
uually "one at an early tage an"
the e&preion i tore" in a
eparate $ormat% uch a a ,pot$i&
e&preion-.
In$ratructure
("e!elopment
en!ironment)
The "e!elopment tool uch a
compiler an" e"itor% an" the
ubroutine librarie that are ue"
in the proce o$ ytem
"e!elopment.
In$ratructure
(internal)
The practice o$ buil"ing general
common mo"ule% an" program
component that per$orm general
$unction on "ata ob8ect% a an ai"
to "e!eloping the main program
itel$.
Inheritance A term ue" in ob8ect orientate"
co"e #hen an ob8ect i "e$ine"
that i an e&tenion o$ another
ob8ect. The ne# ob8ect inclu"e
the "ata an" metho" o$ the main
ob8ect a #ell a a""itional
$eature a""e" in the ne# ob8ect.
Initialiation
(!ariable)
Initialiation i the proce o$
"e$ining the !alue that a !ariable
ha #hen the !ariable $irt
become acti!e. In ome
language% a !ariable "eclaration
can inclu"e an initial !alue. In
ome language% !ariable are
automatically initialie" to !alue
uch a =ero an" empty tring ,-%
#hile in other language
!ariable commence #ith ran"om
!alue% #ith "ata in memory
remaining $rom pre!iou
procee.
Initialiation
co"e
)o"e that i per$orme" at the
beginning o$ a proce to et up
the $acilitie ue" "uring the
proce% uch a creating "ata
tructure% rea"ing con$iguration
$ile etc.
Input 3ata that $lo# into a program
$rom keyboar" input an"
in$ormation rea" $rom "atabae
an" "ik $ile.
Inertion A""ing a ne# recor" into a
"atabae or a ne# "ata item into a
"ata tructure.
Intallation The proce o$ copying $ile%
regitering ob8ect an" creating
con$iguration in$ormation that i
ue" to intall a program on a
computer in a #orking or"er.
Intruction A co"e that repreent a peci$ic
action. The computer( central
proceing unit continually
e&ecute machine co"e
intruction% #hich are numeric
co"e repreenting action uch a
copying "ata $rom one memory
location to another% per$orming
calculation an" 8umping to other
point in the program to continue
e&ecution.
Intruction et The lit o$ intruction that a
central proceing unit e&ecute.
Thee generally inclu"e operation
$or mo!ing "ata bet#een memory
location% comparing number an"
8umping to other point in the
program to continue e&ecution%
an" per$orming baic calculation
uch a a""ition an"
multiplication.
Integer A #hole number% uch a 0% 32 or
.*. Integer !ariable are hea!ily
ue" in program a they ue a
mall amount o$ memory pace
an" calculation on integer
!ariable are generally !ery $at.
Integrate" Integrate" $unction are $unction
that are combine" into a ingle
unit. 1or e&ample% an integrate"
"e!elopment en!ironment
contain an e"itor% complier an"
"ebugger #ithin a ingle uer
inter$ace. ,integrating co"e-
in!ol!e taking a range to imilar
procee an" re.#riting a ingle
general proce to replace the
in"i!i"ual procee per$orme" by
the pre!iou co"e.
Integrity 3ata tructure integrity occur
#hen the link #ithin the "ata
tructure ha!e not been corrupte".
All pointer point to !ali" memory
location% an" !alue uch a
hea"er.count o$ the number o$
ob8ect #ithin the tructure are
correct. The "ata tore" in the
tructure may be incorrect% but the
tructure hol" the "ata item
together correctly. See alo
,corrupt-.
Inter$ace A connection bet#een t#o
eparate thing. The uer inter$ace
inclu"e the creen "iplay an"
keyboar" input ue" to run the
program an" interpret the output.
An application program inter$ace%
or er!ice inter$ace% i an inter$ace
bet#een t#o ma8or co"e mo"ule
(ee Application +rogram
Inter$ace). A ,erial inter$ace- i a
har"#are connection to a "e!ice
that tran$er "ata in a tream o$
character% a ingle character at a
time.
Interme"iate
)o"e
In ome ituation% a compiler
"oe not pro"uce machine co"e
"irectly but initially pro"uce
,interme"iate co"e-. Thi i a
imple language that inclu"e
!ariable re$erence an" tan"ar"
operation% but generally ha no
tructure% an" like aembly
language i imply a lit o$
in"i!i"ual intruction. )ontrol
$lo# #ithin interme"iate co"e i
implemente" by 8ump% either
uncon"itional or con"itional on
the !alue o$ an e&preion.
Interme"iate co"e may be ue" a
an interme"iate tep to a $ull
compilation% or it may be
interprete" "irectly $or tak
uch a macro language an" uer.
"e$ine" $ormula.
Interprete" An interprete" implementation o$
a programming language e&ecute
the program ource co"e "irectly%
rather than pro"ucing a machine
co"e e&ecutable $ile. Internally a
partial compilation to interme"iate
co"e may be per$orme". Thi
proce i lo#er than $ully.
compile" co"e but i ue$ul $or
"ebugging% an" $or pecial.
purpoe language.
Interpreter A program that e&ecute a ource
co"e program "irectly% in contrat
to a compiler that pro"uce an
e&ecutable $ile.
Interrupt A har"#are ignal that caue a
ection o$ co"e to commence
e&ecution. Thi i ue" internally
$or communication bet#een
har"#are "e!ice. Interrupt are
alo hea!ily ue" in har"#are
control application uch a
in"utrial proce control. See alo
,polling-.
Iterate To per$orm an action that i part o$
a repeate" action. 1or e&ample%
one iteration o$ a loop in!ol!e
e&ecuting the co"e block #ithin
the loop a ingle time.
Iteration Aepetition. Iteration in!ol!e
repeating an action many time.
1or e&ample% the !alue o$ & in the
e'uation ,y ; &
2
? &- cannot be
"etermine" "irectly. An initial
gue mut be ma"e% an"
continually re$ine" on each tep to
"etermine the appro&imate
olution. Thi i an iterati!e
proce $or ol!ing the e'uation.
Ba!a A language "eigne" $or creating
program #ithin internet #eb
page. Ba!a i an ob8ect.orientate"
language that ue "ynamic
memory allocation an" run on a
!irtual machine. Ba!a ha a ).like
ynta&% although it i not "irectly
"eri!e" $rom any pre!iou
language.
Bulian The 8ulian calen"ar i an
alternati!e calen"ar to the
tan"ar" 9eorgian calen"ar. A
8ulian "ate i recor"e" a the
number o$ "ay ince the 1
t
o$
Banuary% 2M13 B.). A 8ulian "ate
can be tore" in a 2.byte integer
!ariable. Bulian "ate are ue$ul
becaue they ue a imple an" $at
"ata type% an" becaue they co!er
a #i"e range o$ "ate% in contrat
to many built.in language "ate
$acilitie that co!er a retricte"
"ate range.
Dey A te&t tring that i ue" to
i"enti$y a "atabae recor"% uch a
a client co"e% or i ue" to i"enti$y
a "ata item #ithin a "ata tructure
uch a an aociati!e array or
hah table.
Dey#or" A key#or" i a #or" that $orm
part o$ a programming language%
uch a ,an"-% ,i$-% ,integer- etc.
Alo kno#n a a ,reer!e" #or"-.
4anguage
7&tenion
Some compiler upport $eature
that are not part o$ the tan"ar"
language% an" are kno#n a
language e&tenion.
4ea$ /o"e A no"e #ithin a "ata tructure
uch a a tree% #hich occur at an
en".point in the tructure an" "oe
not ha!e any ub.tree connecte"
to it.
4egal A tatement or e&preion in a
programming language that #ill
compile #ithout error. A legal
tatement or e&preion "oe not
guarantee that the reult o$ the
operation i "e$ine". In ome
cae a legal language tatement
can pro"uce an un"e$ine" reult
#hich may !ary $rom compiler to
compiler or ituation to ituation.
4e&ical
7lement
The le&ical tructure o$ a language
"e$ine the $ormat o$ the
in"i!i"ual component part #ithin
a language% uch a a number
contant% !ariable name an"
operator uch a ,:;-. 1or
e&ample% the $ormat o$ a !ariable
name may be "e$ine" by the
pattern ,Oa.=A.STPOa.=A.S0.
KTP@-% #hich i interprete" a a
letter or un"ercore% $ollo#e" by a
letter% un"ercore or "igit repeate"
=ero or more time. See alo
,ynta&-
4ibrarie A library i generally a collection
o$ ubroutine that per$orm relate"
$unction. Alo calle" a ,$unction
library-.
4I1< 4at.In.1irt.<ut. A 4I1<
tructure or proce ue a lat.in.
$irt.out approach. A ,tack- i a
4I1< tructure% #here the lat "ata
item place" on the tack i the $irt
item remo!e".
4ink The proce o$ combining ob8ect
co"e mo"ule an" linking the "ata
re$erence together to pro"uce an
e&ecutable $ile.
4inker A program that per$orm the
linking operation. See alo ,link-
4ip 4ip i a highly unuual
programming language. All "ata
an" co"e #ithin 4ip i procee"
a lit% an" 4ip co"e baically
conit o$ hun"re" o$ bracket%
#ith occaional !ariable name
an" operator ymbol.
4it A collection o$ item that can be
accee" in or"er. 4it may be
tore" in array% #here each item
i accee" ran"omly or in
e'uence. Alternati!ely a ,linke"
lit- can be ue" #hich comprie
no"e connecte" by pointer%
#here an in"i!i"ual item can be
a""e" or "elete"% but the entire lit
mut be earche" to locate a ingle
item. See alo ,linke" lit-
4ocal A local !ariable i a !ariable that
can only be ue" #ithin a
ubroutine.
4ock A lock i place" on an item to
pre!ent another ob8ect $rom
acceing it. 1or e&ample% thi i
ometime ue" in "atabae
up"ate% #here t#o recor" mut
be up"ate" a a et. In thi
e&ample% either both recor" or
neither recor" houl" be up"ate"%
an" a lock #oul" be place" on
both recor" to pre!ent another
application up"ating one recor"
#hile the $irt application #a
mi".#ay through up"ating the
other recor".
4ocke" A $ile% "atabae recor" or
har"#are "e!ice that i
una!ailable $or ue through being
locke" by another application.
Thi i generally "one to pre!ent
con$lict "uring up"ate
proce"ure% an" #ith har"#are
"e!ice uch a a mo"em #here a
ingle continuou tream o$ "ata i
procee".
4og A $ile containing a lit o$ e!ent or
"ata !alue relating to change
o!er time. 1or e&ample% "uring
"ebugging a log $ile may be
#ritten o$ the !alue o$ a "ata
!ariable% #hich #oul" recor" a
erie o$ !alue changing a the
program e&ecution procee"e".
4ogic The ,logic $lo#- or ,control $lo#-
o$ a program i the path that the
program e&ecution take% an" i
"etermine" by the ,i$- tatement%
loop% an" the !alue o$ "ata
!ariable at !ariou point in time.
Alo calle" ,program logic-.
4ogical
<perator
The logical operator are A/3%
<A an" /<T an" are ue" in
logical Boolean e&preion. See
alo ,Boolean <perator-
4ogon A co"e ue" to i"enti$y a uer to a
ytem% uch a the uer( initial.
4ong A hortene" !erion o$ ,4ong
Integer-. In many programming
language the term ,4ong- i ue"
to "eclare !ariable o$ thi type. A
long integer #oul" uually contain
at leat 2 byte o$ "ata%
repreenting number up to
appro&imately t#o billion i i=e%
although the i=e may !ary
bet#een programming language%
an" in ome cae bet#een
"i$$erent implementation.
4ookup Table A table or array that contain
contant "ata or "ata that i ue"
a a re$erence #hile a program i
running. 1or e&ample% a
tranlation table that i ue" to
con!ert common character to
horter binary co"e "uring a "ata
compreion proce.
4ookup Table See ,table-.
4oop A ection o$ co"e that i repeate"
e!eral time. Thir".generation
language make e&teni!e ue o$
loop.
Machine
)o"e
The binary number intruction
that are e&ecute" "irectly by the
computer( central proceing
unit. Machine co"e can be create"
$rom aembly language% #hich i
one.to.one te&t !erion o$
machine co"e% or $rom a high le!el
programming language by a
compiler.
Macro A metho" a!ailable in ome
language to change the program
co"e prior to compilation by
"e$ining a ,macro e&preion- that
operate in a imilar #ay to a one.
line ubroutine.
A ,macro language- i a
programming language that i
uually hote" #ithin an
application% an" may be a
peci$ically create" language or a
!erion o$ a tan"ar"
programming language.
Magic
/umber
A number that i "eigne" to
i"enti$y a type o$ $ile or "ata
tructure% an" i ue" to check $or
incorrect ob8ect an" "ata
corruption.
Maintenance Bug $i&e an" minor repair to
ytem% uually implemente" to
allo# normal operation to
continue. A "itinct $rom
upgra"e an" enhancement #hich
a"" ne# $unctionality.
Mapping Tranlating one et o$ !alue to
another% uch a con!erting a $ile
tore" uing one character et to a
$ile uing another character et.
Matri& A mathematical ob8ect that i
imilar to a program array. A
matri& i a 'uare tructure% i.e. a
matri& #ith * ro# an" 12
column #a 12 column on e!ery
ro#% an" * ro# in e!ery column.
A matri& can ha!e one "imenion%
#here each element i i"enti$ie"
by a ingle number% t#o
"imenion% #here each number i
i"enti$ie" by t#o in"epen"ent
number uch a a ro# an"
column% or higher "imenion.
Some mathematically.orientate"
language inclu"e operator $or
per$orming matri& calculation%
but mot general programming
language "o not.
Memory 5hile program are running% the
program intruction an" "ata
!alue are tore" in memory.
Memory i implemente" in
computer chip #hich tore binary
number. 7ach memory location i
i"enti$ie" by a number kno#n a
an ,a""re-. In many computer
a ingle location hol" one ,byte-%
#hich can repreent a number
$rom 0 to 2**. Thi number may
be a mall !alue% part o$ a larger
number% a co"e repreenting a
letter or program intruction% or
ome other "ata uch a part o$ a
graphic image.
Menu A lit o$ option that can be
electe" $or operation to be
per$orme"% commonly ue" in
both character.bae" an" graphical
uer inter$ace.
Meh A pattern o$ connection #here a
et o$ point are each connecte" to
e!eral nearby point. 1or
e&ample% the ur$ace o$ ob8ect
ue" in 3."imenional graphic
"iplay i o$ten "e$ine" a a large
number o$ mall triangle% #ith
each triangle 8oine" to a"8acent
triangle along each o$ the three
i"e.
Metho"ology A tructure" an" $ormal approach
to ytem "e!elopment% "e$ining
peci$ic tep in the proce an"
in$ormation pro"uce" at each
tage% uch a ,$unctional
peci$ication- an" ,entity
relationhip "iagram-.
Metho" A metho" i an operation that can
be per$orme" on a "ata ob8ect in
an ob8ect.orientate" ytem.
Metho" are implemente" a
ubroutine.
Microco"e )entral proceing unit are
generally either har".#ire"% #here
operation are per$orme" "irectly
by tranitor #itching on an"
o$$% or they ue ,microco"e-.
Microco"e i imple programming
intruction that operate internally
to the computer chip. Thee
intruction are e&ecute" by an
internal controller an" e&ecute the
intruction et o$ the chip.
Mo" Shortene" term $or ,mo"ulu-.
The mo"ulu i the "i$$erence
bet#een the integer multiple an"
the actual multiple in a "i!iion.
1or e&ample% 13 J * i e'ual to 2.U%
o the integer (#hole number) part
e'ual to 2. Thi i the ame reult
a 10 J *% o the mo"ulu o$ 13 J *
i e'ual to 3% the "i$$erence
bet#een 13 an" 10. The Mo"
operator i upporte" in mot
programming language that
inclu"e integer arithmetic. The
reult o$ ,= ; & Mo" y- coul" be
calculate" a ,= ; & F int(&Jy) @
y-% #here ,int()- return the
integer part o$ the "i!iion. Mo"
can be ue" to generate a
repeating cycle o$ number $rom a
riing number% an" to map a #i"e
range o$ eparate number on to
multiple maller number% uch a
mapping a large hah table key to
a maller number o$ entrie.
Mo"el A tructure "e!elope" through the
ue o$ a o$t#are tool% uch a an
engineering "eign.
An approach to co"e tructure or
ytem "e!elopment.
A et o$ concept ue" a the
$oun"ation o$ a ytem% uch a
account an" tranaction in
accounting% $orce an" motion in
imulating air$lo# in a phyical
ytem% or program% $ile an"
e&ecution in a program e&ecution
cript language.
Mo"em Mo"ulator.3emo"ulator% a mo"em
i a har"#are "e!ice ue" to
inter$ace a computer to an e&ternal
connection that "oe not ue
binary "ata% uch a a telephone
line or broa"ban" cable. /et#ork
connection ue net#ork inter$ace
har"#are that "irectly tranport
binary in$ormation.
Mo"ule A unit o$ co"e that inclu"e
e!eral ubroutine% an" generally
per$orm a ingle tak or $unction.
In ome cae a mo"ule i tore"
a a ingle operating ytem $ile.
/arro#
Inter$ace
A narro# inter$ace i an inter$ace
bet#een t#o procee that
pro!i"e the $unctionality #ith a
mall number o$ operation an"
"ata ob8ect. Thi i not relate" to
narro# ban"#i"th% #hich implie
a lo# "ata tran$er rate. The SG4
"ata 'uery language i an e&ample
o$ a narro# inter$ace% #here all
"atabae operation are pae" a
a ingle te&t tring. Thi approach
ha bene$it in eae o$ ue% an"
allo# co"e on each i"e o$ the
inter$ace to be change"
in"epen"ently. In contrat a #i"e
inter$ace ha many connection%
uch a an inter$ace to a
ubroutine library in!ol!ing a
large number o$ eparate
ubroutine call.
/ete" <ne tructure occurring #ithin
another. A nete" ,i$- tatement i
an ,i$- tatement #ithin another
,i$- tatement% a nete" loop i a
loop #ithin another loop% an" a
nete" "ata tructure i a tructure
#ithin another tructure. In ome
language% ubroutine can be
"e$ine" #ithin other ubroutine%
an" can only be accee" $rom
#ithin the outer ubroutine.
/et#ork 0ar"#are connection bet#een
computer allo#ing "ata tran$er.
A mo"el that in!ol!e no"e that
can be connecte" to multiple other
no"e in a many.to.many pattern%
in contrat to a tree tructure
#here connection occur in one
"irection an" a no"e may ha!e
e!eral ,chil"- no"e% but only
one ,parent- no"e.
/et#ork
Tra$$ic
The !olume o$ "ata $lo#ing
through a net#ork.
/e# A key#or" ue" in ome
programming language to create
a ne# "ata ob8ect "ynamically a a
program run.
/o"e A "ata ob8ect that can be
connecte" to other "ata ob8ect by
link or ,pointer-. Thi i ue" to
create "ata tructure uch a tree
an" linke" lit.
/on.
"eterminitic
1inite State
A 1inite State Automaton that may
ha!e e!eral poible path $or a
ingle input e!ent. It i generally
Automaton not practical to e&ecute thi
"irectly. 0o#e!er% ome
algorithm pro"uce a /1SA $rom
an input uch a a te&t matching
pattern% #hich i then tranlate"
into a larger "eterminitic 1SA
that can be e&ecute" "irectly.
/ot The Boolean operator that
re!ere the !alue. ,/ot TAE7- i
e'ual to ,1A4S7-% an" ,/ot
1A4S7- i e'ual to ,TAE7-. 1or
e&ample% ,i$ not recor"T$oun"
then-. 5ith bit#ie operation%
,/ot 0- i e'ual to ,1- an" ,/ot
1- i e'ual to ,0-.
/E44 A key#or" ue" in ome
language to in"icate that a !alue
i un"e$ine" or unkno#n%
particularly ue" #ith pointer.
1or e&ample% #hen a pointer
!ariable i $irt create" i may
ha!e the !alue /E44% in"icating
that it "oe not currently re$er to a
!ali" "ata ob8ect.
<b8ect A tructure ue" #ithin ob8ect.
orientate" programming that
contain "ata item an"
-metho"-% #hich are
implemente" a ubroutine.
<b8ect can be create" an" their
metho" calle"% to per$orm
$unction on the "ata.
<b8ect co"e A complie"% machine.co"e !erion
o$ a program that "oe not ha!e
the internal re$erence linke"
together. Thi tep i "one by a
,linker- to pro"uce an e&ecutable
$ile.
<b8ect.
<rientate"
A mo"el o$ co"e tructure that
in!ol!e "e$ining a et o$ ob8ect%
#ith each ob8ect containing "ata
item an" relate" ubroutine. Thi
i a ,"ata.centere"- approach%
#here $unction are ,attache"- to
"ata ob8ect% in contrat to other
techni'ue #hich may be ,co"e.
centere"- approache% #here "ata
i pae" to procee. Thi mo"el
i ue$ul $or ytem.le!el an"
$unction."ri!en co"e% but i le
applicable to proce."ri!en
ytem.
<p )o"e <peration co"e. A numeric !alue
repreenting an intruction% uch
a a machine co"e intruction%
interme"iate co"e intruction% or
!alue pae" to a o$t#are
component to i"enti$y the
operation to be per$orme".
<perator A ymbol or key#or" that
peci$ie a relationhip in an
e&preion. 1or e&ample% that
a""ition operator ,?-% an" the
Boolean operator A/3. Thi
peci$ie both a relationhip an"
an action. 1or e&ample% in the
e&preion ,2 @ 3-% the operator
,@- igni$ie that the !alue o$ thi
e&preion i e'ual to t#o
multiplie" by three (a tatement o$
a $act)% an" that thi !alue coul"
be "etermine" by taking the t#o
!alue an" per$orming a
multiplication (an action). In
contrat% $unction call uch a
,print( ,hea"ing- )- are imply an
operation to be per$orme"% not a
tatement o$ a $act. See alo
,Boolean operator-% ,comparion
operator-% ,arithmetic operation-%
,mo"ulu-.
<perator
<!erloa"ing
A term ue" in ob8ect orientate"
programming. <perator
o!erloa"ing re$er to a
programming language $acility
that allo# operation to be
"e$ine" on ne# "ata ob8ect uing
the e&iting language operator.
1or e&ample% the tatement ,lit ;
lit ? ne#Tno"e- coul" be ue" to
a"" a ne# no"e to a lit% i$ the
operator ,?- ha" been o!erloa"e"
$or the no"e "ata type.
<ptimiation Impro!ing an" re$ining co"e%
particularly to operate more
e$$ecti!ely $or a particular tak.
1or e&ample% graphic ubroutine
may be re.#ritten an" optimie"
to #ork e$$iciently #ith large
block o$ "ata that are commonly
procee" in graphic operation.
A proce ue" in a compiler to
generate co"e that i maller an"
e&ecute more 'uickly. A large
number o$ techni'ue are ue" by
compiler to optimie co"e%
inclu"ing re.arranging tatement
to pre!ent unneceary
recalculation% an" generating
peci$ic machine co"e intruction
$or certain circumtance.
A proce ue" to pro"uce the
ma&imum or minimum or a
particular !alue% bae" on
a"8uting $igure #ithin
contraint. 1or e&ample% the
proportion o$ the input to a
chemical proce may be
optimie" to pro"uce the
ma&imum yiel" o$ the "eire"
output% ub8ect to the contraint
that the proportion umme" to
100N% an" that no $igure #a a
negati!e number.
<ptimie" +rogram co"e or a generate"
e&ecutable $ile that ha been
ub8ect to an optimiation proce.
<r The Boolean operator ,or-. A
logical Boolean ,<A- e&preion
i TAE7 i$ either part o$ the
e&preion i TAE7 or both part
are TAE7% other#ie it i 1A4S7.
A bit#ie Boolean e&preion ha
the !alue 1 i$ either o$ the !alue
i 1 or they are both 1% other#ie it
ha the !alue 0. Alo kno#n a the
inclui!e.or. See alo ,e&clui!e.
or-.
<rthogonality Meaning ,in"epen"ent-.
<rthogonality re$er to a ituation
#here e!eral option or $unction
are in"epen"ent% an" one !alue
can be change" #ithout a$$ecte"
another !alue. The implication o$
thi i that all combination o$ the
!alue #oul" be poible% a a
retriction on certain combination
#oul" imply that the !alue #ere
"epen"ant on each other% an"
coul" not be electe"
in"epen"ently. A general principal
applie" to the peci$ication o$
programming language% an" the
"e!elopment o$ general.purpoe
$acilitie.
<!er$lo# A ituation #here a calculation
generate a !alue that i too large
$or the "ata type. 1or e&ample% a
igne" 2.byte integer can
repreent a number up to 32%MUM.
I$ a !alue o$ 30%000 #a a""e" to
a !alue o$ 20%000% then thi #oul"
generate an o!er$lo# con"ition.
Thi #oul" generate an error that
coul" be trappe" by an error
han"ling routine. In cae #here
the error #a not trappe"% in many
cae the program #oul"
terminate at that point #ith a
meage uch a ,Integer
o!er$lo#-. See alo ,un"er$lo#-
<!er#ritten
Memory
In ome programming
en!ironment an" #ith ome
language% an error in the co"e can
reult in an incorrect memory
location being mo"i$ie". 1or
e&ample% uing a pointer to the
#rong type o$ "ata ob8ect may
reult in the "ata item $rom one
tructure type being #ritten into a
memory location inten"e" $or a
"i$$erent tructure type. In ome
en!ironment thi may generate an
error% #hile in other a memory
corruption occur an" the program
may continue operating% but crah
much later in an unrelate" ection
o$ the co"e.
+acket Block o$ "ata that are ent
through a net#ork. )omputer "ata
net#ork commonly ue packet
"ata tran$er.
+age A ection o$ memory. In ome
ytem memory i manage" in
page% #hich are tran$erre"
bet#een "ik torage an" internal
memory. Thi i generally
tranparent to the running
program% but in ome ytem thi
may a$$ect per$ormance #ith
tructure uch a !ery large
array. I$ the or"er o$ looping i
electe" o that accee occur at
"itant place in memory
(re'uiring repeate" page $etche
$rom "ik)% rather that rea"ing
e'uentially through memory
location% per$ormance may be
lo#er.
+arallel
+rogramming
A rarely ue" techni'ue that
allo# ubroutine to be run
imultaneouly. +arallel
programming language may be
pecially mo"i$ie" !erion o$
tan"ar" programming language.
+arallel programming re'uire
ynchroniation co"e to pre!ent
con$lict in up"ate% an" to enure
that procee "o not run until
other re'uire" procee ha!e
$inihe". Thee ytem are
e&tremely "i$$icult to "ebug% an"
o$$er little bene$it o!er other
approache.
+arallel <perating t#o ytem an"
teting comparing the reult "uring
teting. Thi may be an original
ytem an" a re"e!elopment% or
another combination uch a a
pro8ect ytem an" a commercial
ytem.
+arameter A !alue that i pae" to a
ubroutine #hen it i calle". 1or
e&ample% a ubroutine to con!ert
the character in a tring to lo#er
cae letter #oul" take a tring a
a parameter% an" return a tring
reult.
+arent A no"e in a "ata tructure% or a
"atabae recor"% that may ha!e
e!eral ,chil"- ob8ect connecte"
to it. In a one.to.many tructure% a
parent recor" may ha!e e!eral
chil" recor"% but a chil" recor"
ha only one parent.
+arenthei The ymbol ,(, an" ,)-. <$ten
calle" bracket% but technically
bracket are the 'uare bracket
ymbol ,O, an" ,P-.
+are The proce o$ canning a
tructure% an" breaking it "o#n
into it component part. Thi i
"one #ithin a compiler to
"etermine the tatement%
e&preion an" in"i!i"ual part o$
the program co"e.
+arer A program or ubroutine that
per$orm a pare operation. See
alo ,pare-
+acal A thir".generation programming
language% name" a$ter the
mathematician Blaie +acal% #ho
in!ente" the $irt mechanical
calculating machine o$ mo"ern
time.
+aing
+arameter
)alling a ubroutine an" inclu"ing
!ariable or e&preion. The
!alue o$ thee !ariable or
e&preion i then a!ailable to the
ubroutine to per$orm calculation
an" proceing.
+atch#ork
Sytem
A ytem that ha been ub8ect to
many change an" i poorly
tructure".
+attern
Matching
A metho" ue" to earch $or
certain type o$ te&t. 1or e&ample%
$or e&ample% the pattern ,i$@then-
may match the letter ,i$-%
$ollo#e" by a erie o$ letter (the
@)% $ollo#e" by the letter ,then-.
+attern matching i ue" in te&t
proceing tak uch a
compiling an" earching. +attern
matching i alo ue" in other
application% uch a han"#riting
recognition $or e&ample. See alo
,regular e&preion-.
+i&el A ingle point #ithin a graphic
image. A pi&el ha a number
aociate" #ith it that repreent a
color. A graphic image i
compoe" o$ multiple pi&el%
peci$ying the color o$ each point
#ithin the image.
+lat$orm See ,e&ecution en!ironment-
+ointer A !ariable that contain the
a""re o$ a location in memory.
Some programming language
upport pointer. +ointer are ue"
to link "ynamic tructure together
to create "ata tructure uch a
linke" lit. In ome language%
pointer can alo be increae" an"
"ecreae" to can through
memory% an" per$orm operation
on "ata uch a array% tring an"
block o$ binary "ata.
+olling )hecking a 'ueue% bu$$er or
regiter to "etermine #hether "ata
ha been place" there% uch a
#hen communicating #ith a
har"#are "e!ice. +olling i
generally "one repeate"ly. See
alo ,interrupt-.
+<+ The operation per$orme" on a
,tack- tructure #hen the "ata
item on the top o$ the tack i
remo!e". See alo ,tack-%
,+ES0-.
+opulate To a"" "ata to a "atabae or "ata
tructure. Thi i uually ue" in
the conte&t o$ a""ing large
!olume o$ "ata to an empty
tructure% uch a a$ter a "atabae
con!erion% or through manual
keying #hen a ne# $eature i
a""e" that re'uire a large !olume
o$ "ata entry
+ortability 5riting co"e in uch a #ay that a
minimum number o$ change
#oul" be re'uire" to mo"i$y the
co"e to run on another type o$
computer ytem% or in another
operating en!ironment.
+ot$i&
7&preion
An e&preion that inclu"e the
operator a$ter the !alue that they
operate on. 1or e&ample% the in$i&
e&preion ,1 ? 3 @ 2- #oul"
correpon" to the pot$i&
e&preion ,3 2 @ 1 ?-. +ot$i&
e&preion "o not re'uire
bracket. 7&preion are
ometime con!erte" to pot$i&
e&preion $or internal torage% a
pot$i& e&preion can be "irectly
e&ecute" $rom le$t.to.right uing a
tack. See alo ,in$i&-
+rece"ence The or"er that operation are
per$orme" in. 1or e&ample% in
arithmetic a multiplication i
pre$orme" be$ore an a""ition% o
in the cae o$ ,* F 2 @ 2-% the
multiplication #oul" be per$orme"
be$ore the ubtraction. +rece"ence
alo applie to other language
operator uch a ,:;- an"
,A/3-. Alo kno#n a ,bin"ing
trength o$ an operator-
+reciion The number o$ "igit o$ accuracy
o$ the number. 1or e&ample% a
$loating.point number type may
inclu"e appro&imately 1*
igni$icant "igit% along #ith an
e&ponent that allo# the
magnitu"e o$ the number to !ary
$rom% $or e&ample% 10
.322
to 10
30L
+rimary 3ata 3ata tore" in a "atabae that
contain $un"amental in$ormation.
Thi "ata may be ource" $rom
manual keying% or uploa" $rom
other ource. See alo ,3eri!e"
3ata-.
+rimary Dey A uni'ue "ata !alue that i"enti$ie
a "ata recor" #ithin a relational
"atabae. Thi may be a ingle
"ata $iel"% or a !alue that i
compoe" o$ e!eral "ata $iel".
See alo ,compoite key-.
+ri!ate A key#or" ue" in ome
programming language to
in"icate that a !ariable or
ubroutine can only be ue" #ithin
a particular mo"ule. See alo
,public-
+roce"ural A programming language that
inclu"e a et o$ tatement that
are e&ecute" in or"er. Mot
program are #ritten uing
proce"ural language. See alo
,"eclarati!e language-
+roce"ure A name ue" in ome
programming language to re$er to
a ,ubroutine-. See alo
,ubroutine-
+roce A et o$ operation to be
per$orme".
A running program. In ome cae
a running program may in!ol!e
t#o or more procee that
e&ecute in parallel% uch a a main
program an" a eparate $unctional
engine.
+roceor See ,)entral +roceing Enit-
+rogram A et o$ tatement an"
e&preion #ritten in a
programming language. A
program i a complete et o$
tatement that can be compile" to
machine co"e by a compiler% an"
run a an in"epen"ent unit.
+rogram
4ogic
See ,logic-
+rolog A ,"eclarati!e- programming
language. +rolog program conit
o$ a et o$ tatement o$ $act%
rather than tatement that are
e&ecute" in or"er. The prolog
engine then ue thee $act to try
an" ol!e a problem that i
preente". 1or e&ample% a
#eather.pre"iction program in
prolog may inclu"e "etail o$
likely #eather bae" on preure
change% current tempreture etc.
The prolog engine #oul" then ue
the "e$ine" relationhip% together
#ith the current "ata% to generate a
#eather pre"iction.
+eu"o )o"e A type o$ #ritten co"e that i
inclu"e" in "ocumentation o$ a
ytem "eign% but i inten"e" $or
a human rea"er% rather than a
compile" computer program. Thi
may inclu"e general tatement
uch a ,rea" ne&t recor"-.
+ublic A key#or" ue" in ome
programming language to
in"icate that a !ariable or
ubroutine can be accee" $rom
co"e outi"e the mo"ule.
+ES0 An operation on a ,tack- "ata
tructure that in!ol!e a""ing a
ne# "ata item to the top o$ the
tack. See alo ,tack-% ,+<+-
Guery A tatement in a "atabae 'uery
language. Thi may "e$ine the
tructure o$ a et o$ recor" to be
retrie!e" or up"ate".
Gueue A ,'ueue- i a "ata tructure
#here the $irt "ata item place" in
the 'ueue i the $irt "ata item that
i retrie!e". Gueue are ue" in
internal operating ytem
proceing% imulation o$ ome
procee% an" in "ata tran$er
bet#een t#o ob8ect. See alo
,1I1<-% ,tack-
Guickort A $at general purpoe orting
algorithm.
Aagge" Array An array #here each column "oe
not necearily ha!e the ame
length. Thi coul" be implemente"
a a et o$ linke" lit% a large
array #here the in"e& poition #a
calculate" $rom a $ormula% or by
uing a hah table or tree #ith the
ro# an" column !alue combine"
into a ingle key.
Aea" To input "ata $rom a "ata $ile into
a program !ariable.
Aecor" A "ata ob8ect in a "atabae that i
tore" an" retrie!e" a a ingle
ob8ect. A recor" may contain
multiple "ata item kno#n a
,$iel"-
Aecurion A techni'ue #here a ubroutine
call itel$. Thi metho" i ue"
$or proceing ome "ata
tructure uch a tree% an" alo
in ome algorithm uch a
recuri!e."ecent paring.
Aecurion i a imple an"
po#er$ul techni'ue but i "i$$icult
in concept. Aecurion i imilar to
a chain o$ ubroutine #ith the
ame co"e calling each other.
Aecuri!e
3ecent
+arer
A imple top."o#n paring
metho" that ue recuri!e
ubroutine% #ith one ubroutine
$or each rule in the language
grammar. See alo ,pare-%
,recurion-.
Ae"un"ant
)o"e
)o"e that calculate a reult that i
not ue"% or rea" a "atabae
recor" that i not accee".
Ae"un"ant co"e can occur a$ter
change are ma"e to a ytem%
#here one ection o$ co"e i re.
#ritten to ue a "i$$erent metho"%
but an earlier ection o$ co"e that
calculate" an input $igure remain
in place.
Ae.entrant
co"e
Technically a ection o$ co"e that
can be e&ecute" by t#o or more
procee imultaneouly% in a
multiple.proce en!ironment. In
a #i"er ene% thi iue applie to
ubroutine that can be calle"
$rom "i$$erent ection o$ the one
program in an o!erlapping
manner% #ithout con$licting.
Ae$erence The a""re o$ a !ariable. Thi
may be aigne" to a pointer% o
that the "ata can be accee"
in"irectly by uing a pointer. Alo%
in ome language re$erence are
ue" to pa a""ree to
ubroutine o that the original
!ariable can be mo"i$ie".
Ae$erential
Integrity
An iue that arie in relational
"atabae ytem #hen the
primary key o$ a recor" i
change". 1or e&ample% i$ a
primary key o$ a client recor" #a
change"% but other recor"
re$erre" to the client co"e #ere
not up"ate"% then the other recor"
#oul" no longer be linke" to the
client recor". Thi iue can be
a""ree" by uing a ,caca"ing
up"ate- proce. See alo
,caca"ing up"ate-.
Aegiter A "ata item that i tore" #ithin a
central proceing unit an" i ue"
$or calculation. Aegiter are alo
ue" in har"#are inter$acing% an"
in ome cae a peci$ic memory
location may link "irectly to a
har"#are "e!ice.
Aegular
7&preion
A type o$ te&t pattern e&preion.
Aegular e&preion can be ue"
$or te&t earching% but are
particularly ue$ul $or i"enti$ying
the in"i!i"ual component #ithin
program co"e% $or ue in
compiler. A regular e&preion
can be automatically tranlate"
into a 1inite State Automaton%
#hich enable the input te&t to be
canne" in a ingle pa #ithout
backtracking. An e&ample o$ a
regular e&preion i a poible
"e$inition o$ the pattern $or a
!ariable name> Oa.=A.STPOa.=A.
S0.KP@. Thi i interprete" a any
character in the range ,a- to ,=- or
,A- to ,S-% or an un"ercore
character% $ollo#e" by any
character in the range ,a-.,=-%
,A-.,S-% ,0-.,K- or an
un"ercore% repeate" =ero or more
time. The ,@- character igni$ie
that the pre!iou character i
repeate" =ero or more time. See
alo ,1inite State Automaton-.
Aelational
3atabae
A "atabae mo"el #here "ata i
tore" in ,table-. A table i a
collection o$ "ata recor"% #ith
each recor" being in the ame
$ormat. Aecor" are i"enti$ie" by a
"ata item kno#n a a ,primary
key-% uch a a tranaction number
on a tranaction recor".
)onnection bet#een recor" are
implemente" by inclu"ing the
primary key o$ the recor" being
linke" a a "ata item on the other
"ata recor" .Thi i kno#n a a
,$oreign key-. See alo ,recor"-%
,$iel"-% ,table-% ,primary key-%
,$oreign key-% ,in"e&-% ,'uery-
Aelational
<perator
The operator le than% ,:-% le
than or e'ual to ,:;-% greater than
,_- an" greater than or e'ual to
,_;-% e'ual% an" not e'ual. The
operator $or e'uality !arie
bet#een language but i o$ten
,;-. In other language ,;;- or
,.e'.- may be ue". The not.e'ual
operator alo !arie% #ith ymbol
uch a ,:_- an" ,Y;- being ue".
A relational operation i a Boolean
e&preion% o ,3 :; *- ha a
!alue o$ either TAE7 or 1A4S7
Aeleae
Aeource
Ae$er to releaing an allocation or
lock that ha been place" on a
reource uch a program memory.
See alo ,3e.Allocate-
Ae'uirement
Speci$ication
A "ocument peci$ying the broa"
purpoe an" role o$ a ytem% an"
the ma8or operation that the
ytem houl" per$orm. Thi may
be upplie" a an input to the
ytem "e!elopment proce% or
may be compile" "uring an early
analyi tage prior to ytem
analyi.
Aeer!e"
5or"
A #or" that i ue" a a key#or"
#ithin the language% an" cannot be
ue a a !ariable name. 1or
e&ample% ,i$-. Alo kno#n a a
key#or".
Aoot /o"e The $irt no"e in a tree or "ata
tructure. The other no"e in a tree
branch out $rom the root note.
Aotate To hi$t the bit in a binary !alue
to the le$t or the right% an" mo!e
the bit that e&it the !alue into the
poition at the oppoite en" o$ the
!alue. See alo ,hi$t-.
Aoun" To change a number to re"uce the
number o$ igni$icant "igit. 1or
e&ample% the number ,32.23M-
roun"e" to t#o "ecimal place i
,32.22-. Aoun"ing may be to a
number o$ "ecimal place% or a
number o$ igni$icant "igit. See
alo ,igni$icant "igit-
Aoun"ing
7rror
An iue that arie #ith
calculation% particularly "i!iion.
Mot programming language "o
not per$orm calculation #ith true
$raction% an" W #oul" be
calculate" a 1 "i!i"e" by three%
an" tore" a a number uch a
0.33333333. 0o#e!er% thi
number multiplie" by three i
0.KKKKKKKKK% not 1.0% o W
multiplie" by 3 #oul" not e'ual 1.
Sa$e 1. A program tructure or
tatement that "oe not reult in a
memory corruption #hen an error
occur. 1or e&ample% a ,a$e
pointer- i a !ariable that #oul"
reult in an error meage being
generate" i$ an incorrect !alue #a
aigne" to the !ariable% rather
than memory being o!er#ritten
an" a program crah occurring at a
later time.
2. A language operation that
pro"uce a clearly "e$ine" reult.
An ,una$e operation- i a
language tatement that #ill
compile an" e&ecute #ithout error%
but #here the reult o$ the
operation may !ary $rom compiler
to compiler or ituation to
ituation.
See alo ,corrupt "ata-%
,o!er#ritten memory-%
,"ocumente"-.
Scope The area o$ a program #ithin
#hich a "ata !ariable or
ubroutine can be accee". 1or
e&ample% local !ariable #ithin a
ubroutine can only be accee"
#ithin the ubroutine itel$% an"
not $rom co"e outi"e the
ubroutine. 9lobal !ariable can
be accee" $rom any point in a
program. Some programming
language ha!e imple coping
le!el% #hile other language
"e$ine multiple le!el o$ cope $or
both "ata !ariable an"
ubroutine. See alo ,public-%
,pri!ate-% ,global-% ,local-.
Script
4anguage
7ither a ,macro language-% #hich
i hote" #ithin an application% or
a language ue" $or running
program an" managing $ile on a
batch bai. See alo ,macro
language-.
Search 1. The proce o$ locating a "ata
item #ithin a "ata tructure. 3ata
can be re$erence" "irectly in an
array by an in"e& !alue% ho#e!er
locating "ata that i i"enti$ie" by a
te&t tring generally in!ol!e a
earching proce. 1or e&ample% in
a orte" array a ,binary earch-
metho" can be ue".
2. Scanning te&t or "ata to locate
an item or pattern. 6ariou
algorithm are ue" to peci$y an"
earch $or pattern.
See alo ,regular e&preion-%
,pattern matching-% ,binary
earch-.
Semantic The meaning o$ programming
language tructure. 1or e&ample%
the le&ical analyi o$ a program
may i"enti$y an operator ,O,% the
ynta& analyi "uring paring
may recognie the pattern
,"ataO&P-% an" the emantic
proceing #oul" interpret thi a
a re$erence to the array ,"ata-
uing the !ariable ,&-. See alo
,le&ical analyi-% ,ynta&-.
Serial <ccurring a ingle e!ent at a time%
in or"er. 1or e&ample% a erial
har"#are "ata inter$ace i a
connection to a "e!ice% uch a a
printer% that en" a ingle
character at a time.
Ser!ice A o$t#are component that
per$orm a range o$ relate"
$unction% an" "eli!er "ata or
reult. 1or e&ample% a calculation
engine #oul" accept $ormula an"
block o$ "ata% calculate the
reult% an" return them to the
calling program. See alo
,application program inter$ace-
Set A collection o$ item% #ithout an
or"er. Some programming
language pro!i"e $eature $or
"ealing #ith et. 1or e&ample% the
collection o$ plant in a
greenhoue i a et% a there i no
or"er to the item. The
$un"amental operation on et are
the ,union- o$ t#o et% #hich i
the et that contain item that are
in either or both et% an" the
,interection- o$ t#o et% #hich
i the et o$ item that occur
#ithin both et. See alo ,lit-.
To et the !alue o$ a boolean
!ariable to TAE7% or to et a bit to
the !alue 1.
Shi$t A bit operation that in!ol!e
hi$ting all the bit in a binary
!alue% uch a a byte% a certain
number o$ poition to the le$t or
the right. Thi i "one in ome
bitmapping proceing% an" alo a
an optimiation o$ multiplication
by a po#er o$ t#o. Shi$ting bit
one poition to the le$t i
e'ui!alent to multiplying the
number by t#o% an" i uually a
$ater operation. 7mpty pace
may be $ille" by =ero% 1% or the
pre!iou character repeate". See
alo ,bitmap-% ,rotate-.
Signe" A numeric !ariable or calculation
that recognie both poiti!e an"
negati!e number. Some
programming language upport
both igne" an" unigne"
!ariable. Enigne" arithmetic
aume that the bit pattern
repreent a poiti!e number% o a
2.byte integer !alue coul"
repreent .32%MUL to ?32%MUM a a
igne" number% or 0 to U*%*3* a
an unigne" !alue.
Signi$icant
3igit
The number o$ "igit #ithin a
number that contain in$ormation.
1or e&ample% the number
202U00000 an" 0.0000202U both
ha!e $our igni$icant "igit. The
accuracy o$ meaurement may be
bae" on igni$icant "igit% not
"ecimal place% o a meaurement
that #a accurate to 1 part in 1000
#oul" be accurate to three
igni$icant "igit. See alo
,roun"-.
Simulation A program that create a mo"el o$
a particular proce% an" multiple
!alue to "etermine the poible
output. 1or e&ample% the $lo# o$
air o!er an aircra$t #ing may be
mo"elle" by uing calculation%
an" ue" in "eigning the hape o$
the #ing. The $lo# o$ tra$$ic on a
roa" net#ork may be imulate" by
auming tra$$ic !olume at
"i$$erent time% an" calculating
a!erage tra!el time. Simulation
o$ten in!ol!e a large number o$
calculation.
Single A horte" !erion o$ ,ingle
preciion $loating point number-.
Some programming language ue
the #or" ,ingle- to "e$ine a
!ariable o$ thi type. See alo
,"ouble-.
Singly.linke"
lit
A linke" lit tructure% #here each
no"e ha a ingle connection to
the ne&t no"e in the lit. See alo
,linke" lit-
So$t#are )omputer program. See alo
,program-
So$t#are Tool A program that i ue" in "eign%
calculation an" per$orming a
range o$ electable $unction% a
oppoe" to a proceing ytem
that per$orm a range o$ $i&e"
procee.
Sort Arranging the item in a lit into
an or"er% uch a an alphabetical
or"er $or printing% orting a lit o$
item into the or"er o$ a te&t key%
o that they can be 'uickly
locate"% or orting a lit o$
number $or a numerical algorithm
that procee the larget
"i$$erence or mallet "i$$erence
$irt. A number o$ "i$$erent orting
algorithm are a!ailable% #ith
large "i$$erence in proceing
pee". Sorting i a time.
conuming proce% an" a large
proportion o$ all computer
proceing time i pent in orting.
See alo ,bubble ort-%
,Guickort-% ,Search-. ,)ollating
Se'uence-.
Source )o"e Statement an" e&preion in a
programming language. The co"e
i tranlate" into an e&ecutable
machine co"e !erion o$ the
program by a compiler. Alo
kno#n a ,program co"e- or
imply ,co"e-.
Source )o"e
)ontrol
Sytem
See 6erion )ontrol Sytem.
Spare Array A large array that contain many
unue" element. 1or e&ample%
"ata recor"ing earth'uake o!er a
long time perio" #oul" be pare
"ata% a there #oul" be large an"
!arie" gap bet#een the "ate o$
the e!ent.
SG4 A "atabae 'uery language. SG4
can be ue" to elect group o$
recor" to be retrie!e" or up"ate"%
an" alo inclu"e tatement $or
altering the tructure o$ "atabae
table an" other "atabae tak.
S'uare Array An array or matri& that ha the
ame number o$ column in e!ery
ro#% an" the ame number o$ ro#
in e!ery column. Thi alo applie
to higher."imenion array. See
alo ,ragge" array-.
Stack A "ata tructure #here the $irt
element retrie!e" i the lat
element that #a place" on the top
o$ the tack. Stack are ue"
"uring calculation to hol"
temporary reult% to hol" the local
!ariable o$ ubroutine% an" in
algorithm uch a ome bottom.
up paring metho". See alo
,4I1<-% ,'ueue-.
State See ,1inite State Automaton-
Statement A ingle e&ecutable intruction
#ithin a programming language.
Thi may be a ingle line o$ co"e%
or a tatement that contain an
attache" co"e block. 1or e&ample%
,i$ a _ b then-
Static Ee" $or !ariou purpoe in
"i$$erent programming language%
but a common ue i to igni$y
that a !ariable retain it !alue.
1or e&ample% a tatic !ariable
#ithin a ubroutine #oul" retain
it !alue $rom one call to the
ubroutine to the ne&t% in contrat
to the local !ariable that are
ne#ly allocate" each time a
ubroutine i calle".
Statically
4inke"
Subroutine in a ubroutine library
that are linke" into a program an"
become part o$ the e&ecutable $ile.
See alo ,3ynamically 4inke"-
Stre Teting Teting a ytem uing large
!olume o$ "ata% inteni!e
automate" input% an" other
procee inten"e" to "etermine
#hether the ytem #ill continue
operating% or #ill operate #ith
acceptable per$ormance le!el%
un"er high.tre con"ition. 1or
e&ample% race betting ytem
uually recor" an e&tremely high
rate o$ tranaction in the $e#
minute be$ore betting cloe.
Strict type
checking
Strict type checking i a $eature o$
ome programming language that
check the type o$ "i$$erent "ata
item #ithin program e&preion
an" tatement. 1or e&ample% the
e&preion ,a!erageTcount ;
totalTcount- may be an acceptable
tatement in ome language i$ the
!ariable ,totalTcount- #a an
integer numeric !ariable an" the
!ariable ,a!erageTcount- #a a
$loating.point numeric !ariable%
#hile in trictly type.checke"
language thi may generate an
error. Strict type checking i
ue$ul in "etecting or a!oi"ing
ome bug% ho#e!er it can make
program co"e unnecearily
in$le&ible an" lea" to a range o$
minor problem.
String A mall te&t item% uch a an
in"i!i"ual letter or a $e# #or".
String are ue" e&teni!ely in
programming.
Structure
Type
Alo calle" a ,recor"- an" by
other name in "i$$erent
language% a tructure type i a
"ata tructure that i compoe" o$
e!eral in"i!i"ual "ata item% uch
a numeric !ariable an" tring.
3epen"ing on the particular
language% tructure can be tore"
in array% contain other tructure%
be create" "ynamically a a
program run% an" be linke"
together uing pointer. See alo
,pointer-% ,linke" lit-% ,tring-%
Subroutine A ubroutine i a ection o$ co"e
that can be calle" a a eparate
unit. 5hen a ubroutine name i
re$erence" in co"e% e&ecution
tran$er to the tart o$ the
ubroutine co"e an" continue at
that point. 5hen the ubroutine
en"% e&ecution return to the ne&t
tatement $ollo#ing the original
call to the ubroutine. 3ata item
can be pae" to ubroutine a
,parameter-. Subroutine can
contain "ata !ariable kno#n a
,local !ariable-. Alo kno#n a
proce"ure% $unction an"
metho". See alo ,tatic-%
,local-. ,parameter% ,call.by.
re$erence-% ,call.by.!alue-%
,nete"-.
Symbolic
)omputation
Mot programming language
treat an e&preion a an operation
to be per$orme"% rather that a
mathematical tatement. 1or
e&ample% the e&preion ,y ; a ?
2- #oul" be interprete" a
,"etermine ,a-% a"" t#o to the
!alue% an" place the reult in
!ariable ,y-. 7&preion uch a
,y @ & ; " F 3- #oul" generate an
error. Some program $or #orking
#ith mathematic upport
ymbolic computation% in #hich
the pre!iou e&preion #oul" be
a !ali" e'uation. The ytem coul"
then generally re.arrange the
e'uation% an" ol!e $or the !alue
o$ a particular !ariable.
Synchroniati
on
)o"e inclu"e" in parallel
programming routine to co.
or"inate the $lo# o$ e&ecution in
"i$$erent e&ecution tream. 1or
e&ample% co"e coul" be inclu"e"
to pre!ent con$lict #hen t#o
point o$ e&ecution attempt to
up"ate the ame "ata. Alo% co"e
coul" be inclu"e" to enure that a
point in the co"e "i" not
commence e&ecution until other
pre.re'uiite tak ha" complete".
See alo ,parallel programming-.
Synta& Synta& "e$ine the #ay that
in"i!i"ual element can be
combine" to $orm e&preion an"
tatement #ithin the language.
1or e&ample% the ynta& o$ a ,$or-
tatement may be "e$ine" a ,$or
:!ariablename_ ; :e&preion_
to :e&preion_-
Table A et o$ "ata item o$ the ame
tructure type. In a "atabae% thi
#oul" be the et o$ "ata recor"
#ith the ame $ormat. In program
co"e% thi may be an array o$
tructure type.
A et o$ contant "ata that i ue"
a a re$erence #hile the program
i running. See alo ,recor"-%
,tructure-.
Tag A !alue ue" to i"enti$y a "ata
ob8ect. 1or e&ample% ob8ect that
are i"enti$ie" by te&t tring coul"
be allocate" mall number
i"enti$ier% to be ue" in
proceing $or "irect array lookup
an" $ater proceing than tring.
Terminal A !i"eo "iplay unit% particularly
one that "oe not per$orm any
proceing but connect to a
computer by a "ata connection.
Terminal
6alue
A !alue ue" to igni$y the en" o$
a et o$ "ata. 1or e&ample% the
!alue =ero may be ue" a a
terminal !alue to in"icate the en"
o$ a te&t tring.
Tet +rogram A tet program or tet routine i a
program or ection o$ co"e that i
#ritten to tet a mo"ule o$ co"e%
by calling the mo"ule% paing
"ata% an" interpreting the reult.
Thir"
9eneration
4anguage
A proce"ural programming
language that operate at the le!el
o$ "ata !ariable% ,i$- tatement%
loop% etc. 5i"ely ue" 394(
inclu"e 1ortran% )% +acal an"
Baic. Some o$ thee language
ha!e "eri!ati!e language that are
e&tenion o$ the original
language. A large proportion o$ all
program are #ritten uing thir"
generation language.
Threa" An in"epen"ent e&ecution tream
#ithin a program. In ome
en!ironment% a running program
can create a ,threa"- #hich i a
eparate proce that e&ecute
concurrently #ith the main
program. Thi may be ue" $or
backgroun" printing or up"ating%
$or e&ample. A threa" uually
contain le proceing than a
complete program% but i not
inten"e" to operate at the le!el o$
in"i!i"ual ubroutine e&ecuting
in parallel.
Time licing 7&ecuting e!eral procee $or
hort time perio" in a rotating
e'uence% to create the ability to
run e!eral procee
imultaneouly.
Timetamp A "ate an" time !alue place" in
"ata to in"icate #hen an e!ent
occurre". 1or e&ample% a batch
proce up"ating recor" may
inclu"e a timetamp on each
recor" in"icating #hen the recor"
#a up"ate". Thi may alo
inclu"e a""itional in$ormation
uch a a uer logon an" program
name. Timetamp are ue" in
"ebugging% reconciling "ata% an"
etablihing a e'uence o$ e!ent
#hen miing or con$licting
in$ormation occur. Timetamp
alo are ue" in ituation #here
real.time e!ent are important%
uch a ynchroniation bet#een
no"e in a large net#ork.
Token A numeric co"e ue" to repreent
an e!ent or type o$ item% uch a
ingle baic element #ithin a
programming language. The !alue
o$ the token "oe not ha!e
particular igni$icance% in contrat
to a numeric !ariable repreenting
a number. 1or e&ample% a le&ical
canner may tranlate the ource
co"e into a e'uence o$ token%
#hile a proce communicating
through a "ata channel may en" a
token% to igni$y that a particular
e!ent ha" occurre"% or that a
particular repone #a re'uete".
See alo ,le&ical analyi-.
Tolerance The threhol" "i$$erence bet#een
t#o number. 1or e&ample% an
iterati!e proce $or ol!ing an
e'uation may continue until the
reult ha" been "etermine" to
#ithin an accuracy o$ i& "ecimal
place. See alo ,roun"ing error-%
,iteration-
Trace A log $ile #ritten o$ the !alue o$ a
!ariable a a program run% an"
ue" in "ebugging. Alo ue" in
other conte&t. See alo ,log-.
Tran$ormatio
n
A calculation that tran$orm one
et o$ "ata to another% uually a
ingle calculation applie" to a
matri& o$ $igure. 1or e&ample% in
graphic proceing% the
,perpecti!e- i generate" by
applying a tran$ormation% bae"
on the !ie#er( poition% to a
matri& containing the image "ata.
Tranparent A proce that "oe not a$$ect
another proce% or i not a
,!iible- part o$ operation. 1or
e&ample% i$ a "atabae ytem
upgra"e inclu"e" a change in the
internal caching ytem% then thi
#oul" be tranparent to the calling
program% a the ame reult #oul"
occur a the pre!iou $unction.
Tree A linke" "ata tructure that
commence #ith a root no"e%
#hich may ha!e t#o o$ more
no"e connecte" to it% "epen"ing
on the type o$ tree. In turn% each o$
thee no"e ha no"e connecte"
to it. Thi $orm a tructure imilar
to an upi"e."o#n tree% branching
out to more no"e at each le!el.
Tree are ue" in a number o$ "ata
tructure an" algorithm% uch a
orting% paring% an" con!erion
$rom in$i& to pot$i& e&preion.
See alo ,no"e-% ,binary tree-% ,B
tree-.
True <ne o$ the Boolean "ata !alue%
the other being ,$ale-. See alo
,Boolean-.
Truncation Truncation occur in "i!iion
#hen the $ractional part o$ the
reult i "icar"e". Mot integer
"i!iion pro"uce a truncate"
reult. In contrat% roun"e" reult
may be higher or lo#er% o !alue
o$ ,0.*- an" greater may be
roun"e" up% #hile !alue le that
,0.*- are roun"e" "o#n. The term
,truncation- i alo ue" in other
conte&t #hen part o$ a tructure
i "icar"e". 1or e&ample% in an
algorithm that generate" a large
tree in earching $or a olution to a
problem% the tree may be truncate"
at !ariou point% "icar"ing ub.
tree% a part o$ the algorithm. See
alo ,roun"-
Tuple The technical name $or a ,recor"-
in the relational "atabae mo"el.
Aarely ue".
Type In ome programming language
all !ariable ue the ame
tructure% but mot language
upport ,type-. A language may
upport e!eral type o$ numeric
!ariable% tring an" "ata
!ariable. Eer."e$ine" type may
inclu"e tructure type an" array.
See alo ,array-% ,integer-%
,$loating point-% ,tring-%
,tructure type-.
Type
)on!erion
A con!erion o$ a "ata item $rom
one type to another% uch a $rom a
numeric !ariable to a tring.
3epen"ing on the language thi
may be "one uing an operator
uch a a cat% #hich may take the
$orm ,(integer)- $or e&ample% or a
$unction uch a ,ToInt()-.
)on!erion may happen
automatically #ithin e&preion%
uch a #hen an attempt i ma"e
to multiply a number by a tring.
Enary
<perator
A unary operator i an operator
that operate on a ingle !alue. 1or
e&ample% the unary minu% a in ,.
3-% i a eparate operator to the
ame ymbol ue" in ubtraction.
The Boolean ,not- operator i a
unary operator% a in the
e&preion ,printTalpha ; /ot
printTnumeric-. See alo ,binary
operator-
Enatten"e"
+roce
A proce "eigne" to run #ithout
input $rom a uer. 1or e&ample% an
automate" o!ernight up"ate that
etablihe" a connection to
another computer an" per$orme" a
"aily "ata up"ate. See alo ,batch
proce-.
Enbalance" A "ata tructure% uch a a tree%
that i not e!enly proportione".
1or e&ample% in a balance" binary
tree% there are appro&imately
log
2
(n).1 le!el $or a large n.
0o#e!er% i$ the number are
alrea"y orte" an" are inerte"
uing the tan"ar" metho"% then
the tree "egenerate into a imple
linke" lit% #ith ,n- le!el.
En"er$lo# A calculation that pro"uce a
reult that i too mall to be
recor"e" #ith a numeric !ariable
o$ that type. 1or e&ample% a
$loating point number may
repreent number "o#n to 1 &
100
.302
% but i$ a calculation
pro"uce" a number maller than
thi% but greater than =ero% then an
un"er$lo# error #oul" occur. See
alo ,o!er$lo#-
En"ocumente
"
See ,"ocumente"-
Enencrypte" See ,encrypte"-
Enigne" See ,igne"-
Eploa" See ,import-
Eer Inter$ace The interaction bet#een a ytem
an" the ytem uer. Thi can be
"one #ith menu% comman"
button% keyboar" input an" creen
"iplay.
6ariable A "ata item #ithin a program that
i i"enti$ie" by a name. A !ariable
may recor" a ingle "ata !alue
uch a a number or tring% or may
contain multiple entrie uch a an
array. See alo ,tring-% ,array-.
6ector A mathematical ob8ect that
conit o$ a lit o$ number% an"
i imilar to a one."imenional
array or matri&. A large proportion
o$ numeric calculation% uch a
engineering mo"elling an"
graphic tran$ormation% in!ol!e
calculation #ith !ector an"
matrice. See alo ,matri&-%
,array-% ,central proceing unit-.
6erion
)ontrol
Sytem
A ytem $or managing ource
co"e mo"ule. Thi pro!i"e t#o
main $acilitie\ the ability to
,regre- to pre!iou !erion o$ a
$ile an" acce pre!iou co"e% an"
the ability to ,lock- $ile a they
are being change" o a to pre!ent
problem #hen t#o people
attempt to change a ingle ource
$ile at the ame time. Alo kno#n
a a ource co"e control ytem.
5eight A proportion. 1or e&ample% a
!alue may be plit into e!eral
component% #ith the component
repreenting 20N% U*N an" 1*N
o$ the total amount. Thee #oul"
be recor"e" a #eight o$ 0.2% 0.U*
an" 0.1*. +ercentage o$
component um to 100N $or the
total amount% #hile #eight um
to 1.
5hile A key#or" commonly ue" in
thir".generation programming
language to repeat a loop% #hile a
con"ition remain true. 1or
e&ample% ,5hile not en".o$.$ile-.
See alo ,loop-.
5hitepace Blank line% pace an" tab.
5hitepace i ue" to eparate
ection o$ co"e in or"er to make
the co"e more rea"able.
5i"e
Inter$ace
See ,narro# inter$ace-.
5in"o# A rectangular ection o$ the creen
in a graphical uer inter$ace%
containing "ata relate" to one
program or ob8ect% uch a a ingle
"ocument. 5in"o# may
generally be mo!e"% rei=e"% an"
may o!erlap.
5ire$rame A !iual 3."imenional image that
conit o$ line connecting the
baic tructure o$ an ob8ect% uch
a the internal $rame o$ a buil"ing%
or a baic connecte" ur$ace o$ an
ob8ect% #ithout te&ture or colour.
5rite To recor" "ata #ithin a "ata $ile
on a "ik.
Vor The e&clui!e.or Boolean
operator. A logical V<A reult i
true only i$ one !alue i true an"
the other i $ale. A bit#ie V<A
ha the !alue 1 i$ one !alue i 1
an" the other i 0% other#ie i it
0. See alo ,<A-.
&. #ppendi # 2 Summar+ of
operators
Bracket (a) Brackete"
7&preion
a
Arithmetic a ? b A""ition a a""e" to b
a F b Subtraction b ubtracte" $rom a
a @ b Multiplication a multiplie" by b
a J b 3i!iion a "i!i"e" by b
a M<3 b Mo"ulu a F b @ int( a J b )
. a Enary Minu The negati!e o$ a
a Q b 7&ponentiation a
b
a raie" to the po#er o$ b
String a H b )oncatenation b appen"e" to a
Aelational a : b 4e Than True i$ a i le than b%
other#ie $ale
a :; b 4e Than or 7'ual
To
True i$ a i le than or e'ual to
b% other#ie $ale
a _ b 9reater Than True i$ a i greater than b%
other#ie $ale
a _; b 9reater Than or
7'ual To
True i$ a i greater than or
e'ual to b% other#ie $ale
a ; b 7'uality True i$ a an" b ha!e the ame
!alue% other#ie $ale
a :_ b Ine'uality True i$ a an" b ha!e "i$$erent
!alue% other#ie $ale
4ogical
Boolean
a <A b 4ogical Inclui!e <A True i$ either a or b i true%
other#ie $ale
a V<A b 4ogical 7&clui!e
<A
True i$ a i true an" b i $ale%
or a i $ale an" b i true%
other#ie $ale.
a A/3 b 4ogical A/3 True i$ a an" b are both true%
other#ie $ale
/<T a 4ogical /<T True i$ a i $ale% $ale i$ a i
true
Bit#ie
Boolean
a <A b Bit#ie Inclui!e <A 1 i either a or b i 1% other#ie
0
a V<A b Bit#ie 7&clui!e
<A
1 i$ a i 1 an" b i 0% or a i 0
an" b i 1% other#ie 0.
a A/3 b Bit#ie A/3 1 i$ a i 1 an" b i 1% other#ie
0
/<T a Bit#ie /<T 1 i$ a i 0% 0 i$ a i 1
A""ree re$ a Ae$erence The a""re o$ the !ariable a
"ere$ a 3ere$erece The "ata !alue re$erre" to by
pointer a
Array
Ae$erence
aObP The element b #ithin the array
a
Subroutine
)all
a(b) A call o$ ubroutine a% paing
parameter b
7lement
Ae$erence
a.b Item b #ithin tructure a
Aignment a ; b Aignment Set the !alue o$ !ariable a to
e'ual the !alue o$ e&preion b

You might also like