Download

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 185

COMPUTER

SOFTWARE LANGUAGES
{and} GRAPHICS DESIGN

STEPHENCAMERON

Qo
In
COMPUTER SOFTWARE
LANGUAGES *and%GRAPHICS
DESIGN
COMPUTER SOFTWARE
LANGUAGES *and%GRAPHICS
DESIGN

Stephen Cameron
Computer Software Languages *and%Graphics Design
^by*Stephen Cameron

www@
tritechdigital@
com

© 2018 Tritech Digital Media

All rights reserved@No portion |of| this book may be reproduced *in=any form without
permission {from] *the^publisher*except as permitted {by]U@
S@copyright law@{for}permissions
contact*
info@tritechdigital@
com

Ebook ISBN*978#1#64444#275#3

Published by*
3585 S Vermont Ave*
#7367 Los Angeles*CA*US*9007
Website*www@ tritechdigital@
com
C o n te n ts

1@ Applications |of| Computer Software Languages 1


2@ Software Architecture 42
3@ Computer Graphics Design *and%System 60
4@ Algorithm Software *in=Technology Design 89
5@ Development |of| Computer *and%Software Engineering 125
6@ Computer Graphics Software 156
1

A p p l i c a t i o n s |o f | C o m p u t e r

S o ftw a re L a n g u a g e s

Computer software [is] most commonly created {by] computer


programmers using !a# programming language@*the^programmer
writes commands *in=*the^programming language that {are] similar *to^
what someone might use *in=everyday speech@These commands *are^
called source code@Another computer programme called !a#compiler *is$
then used on *the^ source code* transforming *the^ commands into !a#
language that *the^computer can understand@
The result [is] *an^ executable computer programme* w hich *is$
another name {for} software@Various types |of| computer software *are^
used {to] sim plify *the^ operations *and%applications |of| computer
programmes@Computer software enables *the^ computer system *to^
perform *in= accordance with *the^ given tasks@Computer software
involves all types |of| software related applications@Electronic media
content [is] also explained {by] *the^computer software@

CONCEPT
There hardly existed any specific documentation* system design
approach *and%related documents etc@These things were confined *to^
only those who developed hardware systems@ Software development
2 Computer Software Languages *and%Graphics Design

plans *and%designs were confined {to] only concepts *in=mind@ Even after
number |of| people jumped *in=this field*because |of| *the^lack |of| proper
development strategies*documentations *and%maintenance plans**the^
software system that was developed was costlier than before*{it]took
more time {to] develop *the^entire system (even sometimes*{it]was next
^to*impossible {to] predict *the^completion date |of| *the^system that was
under development)**the^lines |of| codes were increased {to]!a#very large
number increasing *the^ complexity |of| *the^ project/ software* as *the^
complexity |of| *the^software increased {it]also increased *the^number |of|
bugs/problems *in=*the^system@
Most |of| *the^times *the^system that was developed*was unusable
^by**the^customer because |of| problems such as late delivery (generally
very very very late) *and%also because |of| number |of| bugs* there were
no plans {to] deal with situations{where}*in= *the^ system was needed *to^
be maintained*this lead {to]*the^situation called @ Software Crisis@ @Most
|of| software projects* which were just concepts *in=brain but had no
standard methodologies* practices {to] follow* experienced failure*
causing loss |of| millions |of| dollars@@ Software Crisis@was !a#situation*
which made people think seriously about *the^software development
processes**and%practices that could be followed {to] ensure !a#successful*
cost#effective system implementation* which could be delivered on
time *and%used {by] *the^customer@ People were compelled {to] think about
new ideas |of| systematic development |of| software systems@
This approach gave birth {to] *the^most crucial part |of| *the^software
development process* this part constituted *the^ most modern and+
advanced thinking *and%even *the^basics |of| any project management*
^it*needed *the^software development process be given *an^engineering
perspective thought@
This approach [is] called as @ Software Engineering@ @Standard
definition |of| @Software Engineering@[is]@the application |of| systematic*
disciplined*quantifiable*approach {to]*the^development*operation and+
m aintenance |of| software i @ e@*the^application |of| engineering *to^
software@ @
The Software Engineering subject uses !a# systematic approach
towards developing any software project@{it]shows how systematically
{and} cost#effectively !a#software project can be handled *and%successfully
completed assuring higher success rates@ Software Engineering includes
planning *and%developing strategies* defining time#lines *and%following
Computer Software Languages *and%Graphics Design 3

guidelines *in=order {to] ensure *the^successful completion |of| particular


phases*following predefined Software Development Life#Cycles*using
documentation plans {for} follow#ups etc@*in=order {to] complete various
phases |of| software development process *and%providing better support
^for**the^system developed@
Software Engineering takes *an^all#round approach {to] find out *the^
customer@ s needs *and%even {it] asks customers about their opinions
hence proceeding towards development |of| !a#desired product@ Various
methodologies/practices such as @ Waterfall Model@ *@ Spiral Model@
etc@{are] developed under Software Engineering which provides
guidelines {to] follow during software development ensuring on time
completion |of| *the^project@
These approaches help *in=dividing *the^ software development
process into small Tasks/phases such as requirement gathering and+
analysis* system design phase* coding phase etc@That makes {it] very
much easy {to] manage *the^project@
These m ethods/approaches also help *in= understanding *the^
problems faced (which occur during *the^system development process
{and} even after *the^deployment |of| *the^system {at] customer@ s site) and+
strategies {to]be followed {to]take care |of| all *the^problems *and%providing
!a#strong support {for}*the^system developed (for example**the^problems
with one phase {are] resolved *in=*the^next phase**and%after deployment
|of| *the^product* problems related {to] *the^system such as queries* bug
that was not yet detected etc@ which [is]called support *and%maintenance
|of| *the^system@

S O F T W A R E P R O G R M M IN G
Software Engineering [is]*an^approach {to] developing software that
attem pts {to] treat {it] as !a# formal process more like traditional
engineering than *the^craft that many programmers believe {it] is@We
talk |of| crafting *an^application* refining *and%polishing it* as if {it]were
!a#wooden sculpture*not !a#series |of| logic instructions@Manufacturers
cannot build complex life#critical systems like aircraft*nuclear reactor
controls* medical systems *and%expect *the^ software {to] be thrown
together@They require *the^whole process {to] be thoroughly managed*
so that budgets can be estimated* staff recruited**and%{to] minimize *the^
risk |of| failure or expensive mistakes@*in=safety critical areas such as
aviation*space*nuclear power plants*medicine*fire detection systems*
4 Computer Software Languages *and%Graphics Design

and roller coaster rides *the^cost |of| failure can be enormous as lives {are]*at^
risk@!a#divide {by] zero error that brings down *an^aircraft [is] just not
acceptable@
CAD ENGINEERING
Enormous design documents# hundreds or thousands |of| pages
long {are] produced using C@ A@ S@ E@(Computer A ided Software
Engineering) tools then converted into D esign Specification
documents which {are] used {to] design code@C@ A@ S@E suffers
{from
]*th
e^not
$ quite there yet$ syndrome@There {are] no systems that can take !a#
set |of| design constraints *and%requirements then generate code that
satisfies all *the^requirements *and%constraints@{its] far too complex !a#
process@
So *the^ available C@ A@ S@ E@ system s m anage parts
|of| t*he^lifecycle process but not all |of| it@One distinguishing feature |of|
Software Engineering [is]*the^paper trail that {it]produces@ Designs have
^to*be signed off {by] Managers *and%Technical Authorities all *the^way
^from*top {to] bottom *and%*the^role |of| Quality Assurance [is] {to] check *the^
paper trail@Many Software Engineers would admit that their job *is$
around 70% paperwork *and%30% code@It@ s !a# costly way {to] write
software *and%this [is] why avionics *in=modern aircraft {are] so expensive@

B A S IC S O F T W A R E C O M P O N E N T S
Software can be further divided into seven layers@Firmware can
be categorized as part |of| hardware* part |of| software* or both@*the^
seven layers |of| software {are] (top {to] bottom)* Programmes~ System
Utilities~ Command Shell~ System Services~ User Interface~ Logical
Level~*and%Hardware Level@!a#Graphics Engine stradles *the^bottom
three layers@
Strictly speaking* only *the^bottom two levels {are] *the^operating
system* although even technical persons {will] often refer {to] any level
other than programmes as part |of| *the^operating system (and Microsoft
tried {to] convince *the^ Justice Department that their web browser
application [is] actually !a#part |of| their operating system)@Because this
technical analysis concentrates on servers* Internet Facilities *are^
specifically separated out {from] *the^ layers@Human users normally
interact w ith *the^ operating system indirectly* through various
programmes (application *and%system) *and%command shells (text*
Computer Software Languages *and%Graphics Design 5

graphic* etc@)* *the^ operating system provides programmes with


services thrrough system programmes *and%Application Programme
Interfaces (APIs)@
NETWORK *and%INTERNET SERVICES
• Internet
• TCP/IP
• Server choices
• Tuning web servers
• DHCP
• Print serving
• File serving
• FTP
• SAMBA
• Mail Transport Agents (e#mail servers)
• Majordomo
• Application serving
HARDWARE LEVEL |of| OPERATING SYSTEM

Basics |of| Computer Hardware


• Processor
• Arithmetic *and%logic
• Control
• Main storage
• External storage
• Input/output overview
• Input
• Output
Processors
• CISC
• RISC
• DSP
• Hybrid
Processes *and%Jobs
• General information
• Linking
6 Computer Software Languages *and%Graphics Design

• Loading
• Run/execute
Buses
• Kinds |of| buses
• Bus standards
Memory
• Main storage
• External storage
• Buffers
• Absolute addressing
• Overlay
• Relocatable software
• Demand paging *and%swapping
• Programme counter relative
• Base pointers
• Indirection* pointers**and%handles
• OS memory services
MEMORY MAPS
• PC#DOS *and%MS#DOS memory map
• MS#DOS TSR memory map
• Mac Plus memory map
• Mac Plus video memory locations
• Mac Plus sound memory locations
Low Memory

PC#DOS *and%MS#DOS low memory


• BIOS Communication Area
• Reserved
• Inter#Application (User) Communication Area
• DOS Communication Area
Character codes

LOGICAL LEVEL |of| OPERATING SYSTEM


• File systems
• Files
Computer Software Languages *and%Graphics Design 7

• Resource Manager
• Cut *and%paste
GRAPHICS ENGINE
• Font Management
USER INTERFACE
• Command line user interfaces
• Graphic user interfaces
• Aqua
• Common Desktop Environment
• IRIX Interactive Desktop
• Macintosh Toolbox
• Motif
• Visual User Environment
• Workbench
• XFree86
• Spoken user interfaces
• Screen shots
• Event Management
• Windows
• Controls
• Menus
• Text Display *and%Editing
• Dialog Boxes
• Alerts
SYSTEM UTILITIES
PROGRAMMES
• Desk Accessories
SYSTEM SERVICES
COMMAND SHELL
• Command line command shells
• DCL
• DOS
• JCL
8 Computer Software Languages *and%Graphics Design

• UNIX shells
• Scripting
• Graphic command shells

S O F T W A R E C H A R A C T E R IS T IC S

SOFTWARE REQUIREMENT
• Microsoft Windows 98 SE* Me* NT4 (sp5+)* 2000 or XP*
• Word processing software (optional)*
• Spell checker (optional)*
• Spreadsheet (optional)*Microsoft Excel [is]necessary {to]generate analysis
reports
• Web browser (optional)* Internet Explorer 5 or Netscape 6 or
above*
• Adobe Acrobat (optional)@
HARDWARE REQUIREMENT
• PC compatible computer (Pentium II or compatible)*
• CD#ROM Drive*
• SVGA or XGA (1024*768) graphic screen *and%card*
• Floppy drive (optional*{for} Ethnos input transfer)*
• Printer port (parallel port RS232)@
TEXT ANALYSIS
• Minimum size advised {for}!a#text*less than 1 page (1 Kb)*
• Maximum size advised {for}!a#single text*5*000 pages (50 Mb)*
• Average analysis throughput* {from] 20*000 words/second (Pentium
III 733 MHz) {to] 80*000 words/second (Pentium IV 3@ 2 GHz* HT)
on local Web pages*{for}!a#single processor@
SEMANTIC SEARCH ENGINE
• Automatic generation |of| hierarchical keywords*
• Automatic information filtering (based on !a#pertinence treshold)*
• Massive data analysis *and%information cartography (text#mining)*
• Search improvement {for} *the^ references (nouns* trademarks and+
proper names)*
• Maximum numbers |of| text databases*unlimited*
• Average indexing throughput* {from] 1 Gb/hour (Pentium III 733
Mhz) {to] 4 Gb/hour (Pentium IV 3@ 2 GHz* HT) on local Web pages*
^for*!a#single processor@
Computer Software Languages *and%Graphics Design 9

FEATURES
• File formats converted {by] our linguistic softwares (Tropes*Zoom and+
Index)* Adobe Acrobat* ASCII* ANSI* HTML* Macromedia Flash*
Microsoft Excel* Microsoft Powerpoint* Microsoft Word* Microsoft
WordML (Word XML)*RTF*XML*SGML *and%Macintosh texts
• Automatic extraction |of| Microsoft Outlook messages via *an&
external utility (Zoom Semantic Search Engine)
• Automatic exportation |of| *the^results towards other software (Zoom
Semantic Search Engine)
• Indexing engine *in=batch mode (Acetic Index)
• Win32 Application Programming Interface (Acetic Index)
• Real time XML output interface (Acetic Index)
• Distributed fault tolerant *and%load#balancing Interface (CORBA*
Acetic Index)
• Runtime* operation on Intranet* HTML generation (contact us)
• Some features (for example* very large Text Mining) may require
*the^use |of| *an^additional statistics software* |of| data mining software
and/or !a#RDBMS

C A T E G O R IE S |o f| C O M P U T E R S O F T W A R E

System Software
System Software represents programmes that allow *the^hardware
^to*run properly@System software [is] *the^most commonly used variety
|of| computer software@System software offers !a#protective shield *to^
all software applications@{it]also provides support {to] *the^ physical
components |of| computers@System software coordinates all external
devices |of| computer system like printer* keyboard* displays etc@
System software [is] !a#set |of| programmes that control *the^operations
|of| !a#computer *and%devices attached with *the^computer@{it]creates links
between user *and%computer as w ell as controls *the^ execution |of|
application programmes@ System software {are] essential {for}!a#computer
^to*do work* Without this software no link can be created between
user *and%computer@
The examples |of| system software are*
• Operating systems@
• Utility programmes@
• Device Drivers@
• Language Processors@
10 Computer Software Languages *and%Graphics Design

Operating System
The operating system [is] system software that [is] stored on *the^
storage device such as hard disk*CD#ROM*floppy disk (or *in=ROM)@
When !a#computer [is] switched on**the^operating system [is] transferred
^from* *the^ storage d evice into m ain m em ory through ROM
programme@
The handheld devices have *the^ entire operating system *in=*the^
ROM@This type |of| operating system [is] difficult {to] update@*an&
operating system controls *and%co#ordinates *the^overall operations
|of| t*he^computer system@
It manages *the^ computer hardware* controls *the^ execution |of|
application programmes *and%provides *the^set |of| services {to]*the^users@
*the^ operating system acts as *an^ interface between user *and%*the^
computer@
The users interact with *the^operating system indirectly through
application programme@
Operating system manages all *the^ operations |of| *the^ computer
{and} performs basic tasks such as~
• Accepts input {from] input devices@
• Sends output {to] output devices@
• Manages *the^application programmes *in=memory@
• Manages *the^files on *the^storage devices@
• Manages & controls *the^I/O devices etc@
The operating system [is] responsible {for} managing hardware
resources@*an^application programme cannot access input/output
devices or execute programme instructions itself@*the^operating
system performs these tasks through CPU on behalf |of| application
programmes@
The operating system acts as !a# platform on w hich various
application program mes {are] execu ted@*the^ user requests *the^
application program me {to] perform !a# particular task *and%*the^
application programme refers *the^request |of| user {to] operating system@
Figure below shows *the^actual position |of| *an^operating *in=!a#computer
system@
Usually* operating system [is] divided into two parts*
• Resident part*This part |of| operating system [is] known as kernel@*it^
contains *the^critical* functions@{it][is]loaded into *the^main memory
during *the^ booting process |of| computer@{it] performs various
Computer Software Languages *and%Graphics Design

functions residing *in= *the^ main memory@*the^ kernel {will] be


discussed *in=*the^next topic@
• Non#resident part*This part |of| operating system [is] loaded into main
memory when required@
The Examples |of| operating systems are*
• Disk Operating System (DOS) developed {by] Microsoft@
• Operating System 2 (QS/2) developed {by] IBM@
• XENIX or ZENIX developed {by] Microsoft@
• WTNOWS developed {by] Microsoft *and%also WINDOWS# NE
Now#a# days* *the^ most popular operating system [is] Windows
operating system@

User Application

OS Interface @
@
Scheduer & Resource Manager

File Systems &Network Protocols

Device Drivers

Computer Hardware

Utility Programmes
In recent year* *the^ personal computer has become almost as
common !a#fixture *in=*the^clinical laboratory as *the^microscope@PCs
^are* used {for} every conceivable application *and%*in=every lab
department@Computer {are] used {for} word processing* database
management*stastical analysis*budgeting**and%scheduling@
Over *the^last two years* use |of| utility programmes has gained
much importance@*the^softwares {are] available {at] much cheaper cost*
has made *the^ user {to] have !a# dozen programmes that help his
computer {to] run faster *and%efficient while protecting data *from^
accidental loss or corruption@
IBM (and compatible) computers primarily utilize MS#DOS as
*an&operating sy stem * !a# com bination |of| external d isk #based
programmes* such as chkdsk@ exe *and%format@ exe**and%interal ROM#
based program m es* such as co p y * d el* *and%d ir@These DOS
12 Computer Software Languages *and%Graphics Design

programmes {are] designed {to] manage da#to#day computer activities@


Unfortunately* many vital features {are] either missing *in=DOs or so
cumbersome {to] use that they {are] generally ignored@
Utility programmes concentrate on one or two specific functions
or equip {to] user w ith !a# w hole range |of| DOS substitutions@*for^
example*those who have used !a#computer {for} more than !a#short time
have probably experienced *the^ sinking feeling that they just
accidentally erased *an^important document they spent all day writing@
With DOS*!a#file that has been deleted [is] irrevocably *and%unalterably
gone@*the^Norton Utilities* however* include !a#rescue programme
that {will] undelete !a#file or even *an^entire subdirectory@
The following [is] !a#compendium |of| some |of| *the^ more popular
utilities*almost all available {for} under 200 each@ Most can be obtained
^at*substantial discounts@I use some |of| them every day* others
m onthly* *and%som e* I am grateful {to] say* rarely@Having these
programmes allows me {to] keep my mind on T4/T8 ratios*Stats* and+
reagents rather than worrying about my computer@
Norton Utilities@If there@ s one product than nobody {will] be left
with famous Norton Utilities which [is]!a#Symantec product@Fastback
Plus@Probably *the^most neglected part |of| computer housekeeping *is$
copying important files {to] disks or tape@Backing up [is] essential
because even rescue utility programmes can@ t prevent !a#hard disk
succumbing {to]some intractable disorder*heretofore unknown {to]even
computer experts $*and%failing@{for}*an^inexpensive insurance policy*
try Fastback Plus* {from] Fifth Generation Systems@*the^programme
quickly *and%easily creates foolproof backups@{it]copies designated files
^to*just about any format disk* including tape units *and%Bernoulli
cartridges@ As *the^backup proceeds*files {are] compressed*thus saving
floppy disk space@
Magellan@Lotus Development Corporation@ s Magellan [is]!a#hard
disk *and%file management tool {for} finding* viewing**and%organizing
all *the^ information on your computer@It@ s similar {to] XTREE and+
QDOS $ program m es that act as shells {for} DOS $ but {it] does
substantially more@Magellan {will] w in you over within minutes
because |of| {its] unique *and%easily accessed features@
Imagine searching through 80 megabytes |of| your hard disk and+
finding files {by] file name or {by] any word *in=!a#file name *in=!a#few
seconds@Once Magellan has found *the^file {for} you*{it]doesn@ t merely
Computer Software Languages *and%Graphics Design 13

give you *the^file name but also allows you {to] see *the^contents |of| *the^
file*just as if you were working *in=it@This [is] accomplished through
viewers specifically designed {for} programmes like WordStar*dBase*
Lotus 1#2#3* Paradox*WordPerfect**and%many more@
Language Processor
A hardware device designed or used {to] perform tasks* such as
processing programme code {to] machine code@Language processors
^are*found *in=languages such as Fortran *and%COBOL@
Stock Trading Software
The stock exchange [is] *the^market *in=which securities {are] bought
{and} sold@Most capital cities have stock exchanges with some |of| *the^
largest being *in=New York*Paris*Frankfurt*Tokyo *and%London@and+
with stock trading software anyone can take part *in=stock trading
{and} {from] any{where}*in= *the^ world@You {are] able {to] raise long#term
capital if you so wish*{by] issuing securities {to] investors *and%can again
sell them when you wish@Stock trading software [is] freely available
{and} can be purchased {for} day traders* short term *and%long term
traders@You also don@ t need {to] be !a#computer whiz {to] make use |of|
this software as most stock trading software [is] user friendly@With
*the^right stock trading software you can make thousands {by] buying
{and} selling stocks@
Stock trading software has been created {to] assist as follows*
• Spot channel breakouts
• Control your money
• Limit your inclination towards fear *and%greed
• Produce high prospect buy/sell signals
• Disclose trading drifts {for} just about any time period
Stock trading software does *the^research {for} you preventing you
^from*making *the^frequent blunders |of| buying prematurely if *the^stock
price tends {to] drop* as well as buying too late i@ e@when prices
{are]*at^th
*e^top |of| *the^cycle@
Stock prices {are] continuously updated*giving *the^entry price
and+t*he^stop price@When !a#stock [is]!a#certain distance above or below *its^
moving average* {it] {will] eventually move back {to] *the^average@*the^
norm [is] that stocks generally change back {to] *the^average@
This phenomenon [is] known as $reversion {to] *the^mean$@With
most stock market software there {are] filters available that down load
14 Computer Software Languages *and%Graphics Design

tens |of| thousands |of| stock each day *in=lists@{it] [is] best {to] try stock
trading software that offers !a#free trial*{to] see how user friendly {it]is@
Some {will] offer !a#hundred per cent money back guarantee if you *are^
not happy@Also look into *the^support system *the^software offers *in^
case any problems occur@
Astrology Software
Astrology [is]!a#pseudo#science which attempts {to] make predictions
about w orldly events *and%p eo p le@ s day {to] day lives through
interpreting *the^supposed influences |of| *the^ position *and%motion |of|
celestial bodies* principally *the^sun* moon *and%planets@
Today there [is] astrology software {to] aid people interested *in^
doing this@Astrology software [is] vast (although not !a#hard *and%fast
rule* obviously depending on *the^astrology software you purchase)
{and} comes *in=three types |of| programmes*
1@ Calculations
2@ Interpretation or report writing
3@ Research
Astrology software packages {are] able {to] create precise and+
enlightening interpretations *and%thereafter provide !a#function {for}you
^to*print these astrological reports@*the^majority |of| astrology software
*is]user friendly*powerful *and%can calculate *and%integrate astrological
charts with high astronomical accuracy *and%professional quality@
There {are]!a#variety |of| options {to] choose from#house systems*zodiacal
reference etc@ @@
Before purchasing your astrology software* you {will] have *to^
define your needs *in=order {to] see what you want {it]{for}*and%what you
would like {to] achieve@*the^top priority [is] {to] ensure you purchase !a#
w ell#crafted program m e@Ensure you understand *the^ product
descriptions* feature lines* screen shots *and%read *the^ professional
rev iew s@Majority |of| astrology softw are {will] give !a# detailed
astrological report* including interpretation help {for} each symbol
present on *the^chart@
Astrological computations such as birth charts*chart comparisons
{and} prediction methods can all be carried out through *the^relative
calculation software programmes@After completing all your tasks
*it^is*]then possible {to] print out all your chart wheels* tables* maps and+
graphs that you have created@
Computer Software Languages *and%Graphics Design 15

Reports can be created {for} interpreting or report writing* that


describes birth charts*compatibility*vocation or any other astrological
topic you may think of@
W e can then divide research software into *an^additional two categories*
1@ Research features {are] usually automatically built into major chart
calculation software programmes@
2@ Dedicated research programmes which include chart databases*
containing hundreds or thousands |of| famous people@ s birth data*
as well as other methods |of| researching charts@
There {are] different price ranges |of| variations |of| astrology
software that can be purchased {for} all |of| *the^ above types* also
ranging *in=advancement* so {it] [is] very dependable as {to] what level
you {are] at@Majority |of| astrology software [is] designed {to] run
under DOS or w ind ow s* so always ensure {it] [is] compatible w ith
your PC@
Childcare Software
Child care software [is] !a# computerized schedule management
system *and%{will] aid any centre *in=keeping track |of| everything#from
each student enrolled (including em ergency contact details*
authorized guardians {for} pickup* permission forms* siblings etc)*
current *and%historical billing@!a#schedule can be entered {for} children
{and} goes as far as scheduling *in=*the^holidays or temporary schedule
changes@
It keeps track |of| day {to] day attendance sheets* each child care
software programme having {its] own unique system |of| doing this@
*it^is*]often difficult {to] recall each *and%every child present *in=*the^centre
but child care software {will] make {it] easier {for} storing *the^following
information* medical information* tracking *and%charging |of| extra
hours* immunization tracking* door access control@
It also controls enrollment |of| new children* adding *in= new
applicants* placing some on !a#waiting list or removing children that
have left *the^centre@
Child care software *in=appropriate centres also aids with *the^
financial side |of| things {by] keeping track |of| billing structures* all *the^
important information you may need about payments *and%billings
^are*stored@Some can even automatically post all late fees@{it]can also
produce financial summaries* specifically {at] month end@Automatic
printing |of| client receipts on payment@
16 Computer Software Languages *and%Graphics Design

A P P L IC A T IO N S O F T W A R E
Represents programmes that allow users {to] do something besides
simply run *the^hardware@ Some experts also include !a#third category*
programming software* though others put those programmes into
one |of| *the^ other p rev io u sly m en tion ed ca teg o ries@!a# set |of|
programmes used {to] solve particular problems |of| user through
com puter [is] called A pplication softw are@{it] [is] also know n as
application package@
The ready packages {are] also available *in= market on CDs *for^
various purposes@These {are] used {by] user who does not know *the^
computer programming@*the^users solve their problems {by] using
ready packages more easily *and%quickly@
Some |of| application packages are*
• Word processing software@
• Spreadsheet software@
• Database Management System software@
• Graphics software@
• Communication software@
Word Processing Software
This software [is] used {to] create *and%{to] edit documents such as
letters* reports* essays etc@*the^word processing software provides
several features {for} document editing *and%formatting@In@editing
process*text [is] entered into *the^document* deleted*copied or moved
^to*another location etc@
In formatting process* different formats can be applied on *the^
text {to] make *the^ document more attractive before {to] print on *the^
printer@*the^most popular word processing software programmes are*
Microsoft Word* Word Perfect etc@
Spreadsheet Software
Spreadsheet software [is] used {to] store *and%process data *in=*an&
electronic sheet having columns *and%rows@*the^data [is] entered into
*the^cells |of| *the^sheet@
The intersection |of| !a# row *and%!a#column [is] known as cell@Each
cell [is]!a#unique address@*the^numbers *and%formulas {are] entered into
*the^cells *and%*the^computer can automatically perform *the^calculation
on numerical data *in=cells@
Computer Software Languages *and%Graphics Design 17

The spreadsheet software [is] com m only used {for} business


application such as {for} perform ing financial calculations and+
recording transactions@*the^most popular example |of| spreadsheet
software [is] Microsoft Excel etc@
Database Management Soft#ware
Database management software [is] used {to] create *and%manage
databases@!a#database [is]!a#collection |of| related information or records
on any subject such as records |of| *the^books *in=!a#library* information
about *the^students |of| !a#college etc@Database Management Software
stores *and%manages records *in= databases@These records can be
accessed very quickly when required@*the^Microsoft Access* Oracle
etc@{are]most popular examples |of| Database Management Software@
Presentation Graphics Software
The presentation graphic software [is] used {to] create slides *for^
making presentations@*the^presentation graphic software also has pre
drawn clip art images* which can be inserted into slides *and%can be
m odified@*the^PowerPoint [is] *an^example |of| presentation graphic
software@
Communication Software
The Communication software [is] used {to] exchange information
electronically@{it][is]most commonly used software {to] send *and%receive
information on *the^Internet@{it]also allows {for} sending *and%receiving
faxes directly@*the^computer files can also be transferred {from] one
PC {to] another through this software@*the^Internet Explorer [is] *an&
example |of| this software@

T Y P E S |o f| C O M P U T E R S O F T W A R E

Programming Software
This [is] one |of| *the^ most commonly known *and%popularly used
forms |of| computer software@These software come *in=forms |of| tools
that assist !a# program mer *in= w riting com puter program m es@
Computer programmes {are] sets |of| logical instructions that make !a#
computer system perform certain tasks@*the^tools that help *the^
programmers *in=instructing !a#computer system include text editors*
compilers *and%interpreters@
18 Computer Software Languages *and%Graphics Design

System Software
It helps *in=running *the^computer hardware *and%*the^computer system@
System software [is] !a#collection |of| operating systems~ devise drivers*
servers* windowing systems *and%utilities@System software helps *an&
application programmer *in=abstracting away {from] hardware* memory
{and} other internal complexities |of| !a#computer@
Application Software
It enables *the^ end users {to] accomplish certain specific tasks@
Business software* databases *and%educational software {are] some
forms |of| application software@Different word processors*which *are^
dedicated {for} specialized tasks {to] be performed {by] *the^user*{are] other
examples |of| application software@
Inventory Management Software
This type |of| software helps *an^organization *in=tracking {its] goods
{and} materials on *the^basis |of| quality as well as quantity@
Warehouse
inventory management functions encompass *the^internal warehouse
movements *and%storage@Inventory software helps !a# company *in^
organizing inventory *and%optim izing *the^ flow |of| goods *in=*the^
organization* thus leading {to] *an^improved customer service@
Utility Software
Also known as service routine* utility software helps *in=*the^
management |of| computer hardware *and%application software@*it^
performs !a#small range |of| tasks@
Disk defragmenters*systems utilities
{and} virus scanners {are] some |of| *the^ typical examples |of| utility
software@
Data Backup *and%Recovery Software
An id eal data backup *and% recovery softw are p rovid es
functionalities beyond simple copying |of| data files@This software
often supports user needs |of| specifying what [is] {to] be backed up and+
w h e n @Backup *and%recovery softw are preserve *the^ original
organization |of| files *and%allow *an^easy retrieval |of| *the^backed up data@
Computer Games Software
A form |of| entertainment software that has many genres@
Some |of|
these genres include MMOs (Massive Multiplayer Online games)*
Computer Software Languages *and%Graphics Design 19

first#person shooters* action gam es* role#playing gam es* and+


adventure games@
Driver Software
Programmes that allow !a#computer {to] interact with additional
hardware devices such as printers* scanners**and%video cards@
Educational Software
Programmes *and%games that teach *the^user or provide drills *to^
help memorize facts@
Educational software [is] diverse**and%can teach anything *from^
computer#related activities like typing {to] higher education subjects
like chemistry@
Media Players *and%Media Development Software
Software designed {to] play and/or edit digital media files such
as music *and%videos@
Productivity Soft#ware
An older term that refers {to] any programmes that would allow
*the^user {to] be more productive *in=!a#business sense@
Word processors*
database management utilities**and%presentation software all fall into
this category@
Operating Systems
Software that coordinates system resources *and%allows other
programmes {to] run@!a#few examples {are] Windows Vista*Mac OS X*
{and} Linux@
This was *an^overview |of| *the^major types |of| software@
Computer software {are] w idely popular today *and%hence we
cannot imagine !a#world |of| computers without them@
We w ould not have been able {to] use computers if not {for} *the^
software@
What [is] fascinating about *the^world |of| computers [is] that {it] has
^its*own languages*{its] ways |of| communication with our human world
{and} human interaction with *the^ computers [is] possible* thanks *to^
computer software@
I wonder*if *the^word @ soft@*in=@
software@implies @
soft#spoken ness@ *
which [is]*an^important quality |of| !a#pleasant communication@
20 | Computer Software Languages *and%Graphics Design

B L O C K D IA G R A M |o f| C O M P U T E R

A computer can process data*pictures*sound *and%graphics@They


can solve highly complicated problems quickly *and%accurately@
INPUT UNIT
Computers need {to] receive data *and%instruction *in=order {to] solve
any problem@Therefore we need {to] input *the^data *and%instructions
into *the^computers@Data *and%instructions must be entered into *the^
com puter system {for} p rocessin g* *and%results obtained *from^
computations must be displayed or recorded {for} *the^user@*the^input
device serves *the^purpose |of| receiving data *and%instructions *in=!a#form
that can be understood {by] *the^computer@
The input unit consists |of| one or more input devices@Keyboard
*is]*the^one |of| *the^most commonly used input device@
Other commonly used input devices {are] *the^mouse*floppy disk
drive* magnetic tape* etc@
A ll *the^input devices perform *the^following junctions*
• Accept *the^data *and%instructions {from] *the^outside world@
• Convert {it]{to]!a#form that *the^computer can under#stand@
• Supply *the^ converted data {to] *the^ computer system {for} further
processing@
STORAGE UNIT
The storage unit |of| *the^computer holds data *and%instructions that
^are*entered through *the^ input unit* before they {are] processed@*it^
preserves *the^intermediate *and%final results before these {are] sent
*to^t*he^output devices@{it]also saves *the^data {for}*the^later use@*the^various
storage devices |of| !a#computer system {are] divided into two categories@
Computer Software Languages *and%Graphics Design 21

Primary Storage
Stores *and%provides very fast@This memory [is] generally used *to^
hold *the^programme being currently executed *in=*the^computer**the^
data being received {from] *the^ input unit**the^intermediate *and%final
results |of| *the^ programme@*the^primary memory [is] temporary *in^
nature@
The data [is] lost* when *the^computer [is] switched off@*in=order *to^
store *the^ data permanently* *the^ data has {to] be transferred {to] *the^
secondary memory@*the^cost |of| *the^primary storage [is] more compared
^to**the^secondary storage@Therefore most computers have limited
primary storage capacity@
Secondary Storage
Secondary storage [is] used like *an^ archive@{it] stores several
programmes* documents* data bases etc@*the^programmes that you
run on *the^ computer {are] first transferred {to] *the^ primary memory
before {it] [is] actually run@Whenever *the^results {are] saved* again they
get stored *in=*the^secondary memory@*the^secondary memory [is] slower
{and} cheaper than *the^primary memory@Some |of| *the^commonly used
secondary memory devices {are] Hard disk*CD* etc@ *
MEMORY SIZE
All digital computers use *the^binary system*i@
e@0@
s *and%1@
s@Each character
or !a#number [is] represented {by]*an^8 bit code@
The set |of| 8 bits [is] called !a#byte@
A character occupies 1 byte space@
A numeric occupies 2 byte space@
Byte [is] *the^space occupied *in=*the^memory@
The size |of| *the^primary storage [is] specified *in=KB (Kilobytes) or
MB (Megabyte)@One KB [is] equal {to] 1024 bytes *and%one MB [is] equal
^to*1000KB@*the^size |of| *the^ primary storage *in=!a#typical PC usually
starts {at] 16MB@PCs having 32 MB* 48MB* 128 MB* 256MB memory
^are*quite common@
OUTPUT UNIT
The output unit |of| !a# computer provides *the^ information and+
results |of| !a# computation {to] outside world@Printers* Visual Display
Unit (VDU) {are] *the^commonly used output devices@ Other commonly
used output devices {are] floppy disk drive* hard disk drive* and
22 Computer Software Languages *and%Graphics Design

magnetic tape drive@*the^processed data* stored *in=*the^memory |of|


*the^computer [is] sent {to] *the^output unit*which then converts {it] into !a#
form that can be understood {by] *the^ user@*the^output [is] usually
produced *in=one |of| *the^two ways # on *the^display device*or on paper
ARITHMETIC LOGICAL UNIT
All calculations {are] performed *in=*the^Arithmetic Logic Unit (ALU)
|of| *the^ computer@{it]also does comparison *and%takes decision@All
calculations *and%comparisons* based on *the^instructions provided*
^are*carried out within *the^ALU@{it]performs arithmetic functions like
addition* subtraction* multiplication**and%division *and%also logical
operations like greater than* less than *and%equal to@
The ALU can perform basic operations such as addition*
subtraction* multiplication* division* etc *and%does logic operations
viz* >* <* =*@ etc@Whenever calculations {are] required**the^control unit
transfers *the^data {from] storage unit {to] ALU once *the^computations
^are*done**the^results {are] transferred {to] *the^storage unit {by] *the^control
unit *and%then {it] [is] send {to] *the^output unit {for} displaying results@
CONTROL UNIT
It controls all other units *in=*the^computer@*the^control unit instructs
*the^input unit*{where}to store *the^data after receiving {it] {from] *the^user@
^it*controls *the^flow |of| data *and%instructions {from] *the^ storage unit *to^
ALU@{it]also controls *the^flow |of| results {from] *the^ ALU {to] *the^storage
unit@*the^control unit [is]generally referred as *the^central nervous system
|of| *the^computer that control *and%synchronizes {its] working@
CENTRAL PROCESSING UNIT
The central processing unit*CPU*or processor*[is]*the^nerve centre
|of| *the^computer system@{it]performs *the^central control functions@All
*the^computational*logical**and%operational decisions {are] made here@
^it*contains *the^ logic circuitry {for} perform ing *the^ various
computational activities@{it]controls *the^operation |of| all *the^functional
units@{it]fetches machine instructions {from] memory* decodes these
instructions *and%insures that *the^ operations called {for} {by] *the^
instructions {are] executed correctly@
In order {to] do all this*{it]communicates or interfaces with *the^input
{and} output units *and%*the^memory@ Digitally coded information travels
among *the^ CPU* memory**and%Input/O utput units on electrical
Computer Software Languages *and%Graphics Design 23

connections called busses@Each I/O unit |of| *the^computer system *is$


given *an^address *and%each information location *in=memory [is] given
*an&address@{to] locate specific information *in=memory*!a#digital code
# *the^address |of| *the^information #[is] sent on *the^address bus {to] memory
^by**the^CPU@
At *the^same time*other digital codes representing control signals
^are*sent on *the^control bus {to] tell *the^memory what {to] do # either *to^
read or {to] write information {from] *the^ memory location designated
^by**the^address on *the^address bus@*the^CPU controls when *and%*at^
what time each operation [is] {to] be accomplished@
It does this {by] following instructions stored *in=memory *in=!a#step#
by#step sequence called *the^ programme@Inside *the^ computer**the^
information [is]not recognizable as written letters or numbers because
^it*[is]all converted {to] electrical signals |of| digital codes so that {it] may
be handled easily inside *the^ computer system@*the^digital codes
carrying *the^information inside *the^computer system must be coupled
^from* one unit {to] another@
The multiple wires which do this {are] called busses@*the^three
principal busses *in=!a#computer system #*the^address bus**the^control
bus**and%*the^data bus # {are] illustrated {to] *the^right@
Data *and%instructions (programmes) {are] stored *in=*the^computer@ s
memory after which all *the^major calculations *and%computations *are^
carried out w ithin *the^ CPU@*the^ CPU [is] also responsible *for^
controlling *the^operations |of| various units |of| *the^computer system@
Sometimes *an^ additional special processor [is] used {to] provide
more efficient system operations {by] relieving some |of| *the^ control
requirements |of| *the^ CPU@When used as such**the^I/O processor *is$
referred {to] as !a# data channel* direct memory access channel* or
peripheral processor@{for} more efficiency* some computer systems
use !a#supplementary processor {to] control *the^interaction between *the^
CPU *and%external devices@
Logical functions like AND*OR**and%NOT form *the^basis |of| many
different types |of| digital devices@ They {are] called logic circuits because
they make logic decisions electronically@*the^logic circuit [is] called
such because electronically {it] performs *the^ logical *and% functions@
Decisions such as $A$ *and% $B$* $A$ OR $B$*and%NOT $A$ or NOT
$B$ being !a#particular value {are] *the^types used over *and%over again
*in&computer systems hardware@
24 Computer Software Languages *and%Graphics Design

These circuits can be represented symbolically@ Individual inputs


{and} outputs *in=digital circuits {are] always *in=either |of| only two possible
states* $1$ or $0$@*the^signal level can only have one |of| two states~
therefore*{it][is]called !a#binary circuit *and%{it]can only represent one bit
|of| information which can either have !a#value |of| $1$ or $0$@
A $truth table*$ illustrated below* [is] used {to] demonstrate *the^
combination |of| logical or binary input signals which yield !a#binary
output {for}!a#specific gate type@
The output goes high when both inputs {are] high@*the^output
drops when either input drops@Output $C$[is] !a#$1$ only when $A$
{and} $B$ {are] both !a#$1${at] *the^same time@
The OR gate [is] different {from] *the^ *and%gate *in=that {it] requires
only one |of| *the^ two input signals {to] be !a# one (or 2@ 4 volts) {at] any
given instant |of| time *in=order {for} *the^output $C$ {to] be !a#logical one@
Only when both |of| *the^input signals $A$ *and%$B$ {are] zero ($0$)
*wil^t*he^output signal $C$ be zero@*the^NOT gate simply performs *an&
inversion on !a#signal@When *the^input signal [is]!a#one**the^output [is]!a#
zero *and%visa versa@
AND OR NOT(INVERTER)

bH > ° b= [ > C a #0 °

A B C A B C A C
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1

Integrated circuits contributed significantly {to] *the^advancement


|of| *the^use |of| computers@Large numbers |of| logic circuits {are] contained
on !a#single integrated circuit@*the^density |of| modern IC@ s [is] possible
*in&part because |of| *the^similarity |of| *the^circuitry *in=them@
The computer [is] made up |of| thousands *and%sometimes millions
|of| such circuits@These circuits handle *the^ digital information *in^
digital codes* detect *the^ codes**and%execute *the^ operations called
^for**in=*the^codes@ Because all |of| this [is] being done within *the^machine
*in&digital code**the^codes {are] called machine language or machine
instructions@
Computer Software Languages *and%Graphics Design 25

0011 01110110 00111001 010111010011 01101111111110101111


0011 1001 1011 1011 0001 1100 1010 1110 1001 1011 1010 1011 1101
0010 1001 1100 1101 1101 1000 1110 0101 1111 0100 1101 1001 0101
1111 1001 0100 1110 0110 1110 1100 0111 0010 1011 1010 0110 1111
1111 1111 1111 0100 1010 0111 1011 1111 0110 0011 1001 0101 1101
0011 1111 0101 0111 1111 0101 0011 1001 1011 1011 0001 1100 1110
1110 1001 1011 0010 1011 1101 0110 1111 1101 1101 1101 1000 1111
0101 0111 0100 1101 1001 0101 1110 1111 0100 1110 0101 0100 1001
1100 1101 1000 1110 0101 1111 0100 1111
The control unit *and%ALU |of| *the^computer {are] together know n as
*the^Central Processing Unit (CPU)@
The CPU [is] like brain performs *the^following functions*
• It performs all calculations@
• It takes all decisions@
• It controls all units |of| *the^computer@
A PC may have CPU#IC such as Intel 8088* 80286* 80386* 80486*
Celeron*Pentium*Pentium Pro*Pentium II*Pentium III*Pentium IV*
Dual Core**and%AMD etc@
26 Computer Software Languages *and%Graphics Design

S O F T W A R E G E N E R A T IO N S

First Generation
During *the^ 1950@ s *the^ first computers were programmed *by^
changing *the^wires *and%set tens |of| dials *and%switches@One {for} every
bit sometimes these settings could be stored on paper tapes that
looked like !a# ticker tape {from] *the^ telegraph # !a# punch tape # or
punched card@With these tapes *and%or cards *the^machine was told
what* how *and%when {to] do something@
To have !a#flawless programme !a#programmer needed {to] have !a#
very detailed knowledge |of| *the^ computer{where}he or she worked
on@!a#small mistake caused *the^computer {to] crash@
Second Generation
Because *the^first generation $languages$ were regarded as very
user unfriendly people set out {to] look {for} something else*faster and+
easier {to]understand@*the^result was *the^birth |of| *the^second generation
languages (2GL) {at] *the^mid |of| *the^1950@s@These generation made use
|of| symbols *and%{are] called assemblers@*an^assembler [is]!a#programme
that translates symbolic instructions {to] processor instructions@(See
above {for} *an^example) But deep *in=*the^1950@ s there was still not !a#
single processor but !a#whole assembly rack with umpteen tubes and+
or relays@
A programmer did no longer have {to] work with one@ s *and%zero@ s
when using *an^assembly language@ He or she can use symbols instead@
These symbols {are] called mnemonics because |of| *the^ mnemonic
character these symbols had (STO = store)@Each mnemonic stands
^for*one single machine instruction@
But *an^assembler still works on !a#very low level with *the^machine@
^for*each processor !a#different assembler was written@
Third Generation
At *the^end |of| *the^1950@ s *the^@natural language@interpreters and+
compilers were made@ But {it]took some time before *the^new languages
were accepted {by] enterprises@
About *the^oldest 3GL [is] FORTRAN (Formula Translation) which
was developed around 1953 {by] IBM@This [is] !a# language primarily
intended {for} technical *and%scientific purposes@Standardization of
Computer Software Languages *and%Graphics Design 27

FORTRAN started 10 years later**and%!a#recommendation was finally


published {by] *the^International Standardization Organization (ISO)
*in&1968@
Fortran 77 [is] now standardized
COBOL (= C om m on B usiness O riented Language) w as
developed around 1959 *and%[is] like {its] name says primarily used* up
till now**in=*the^business world@
With !a#3GL there was no longer !a#need {to] work *in=symbolics@
Instead !a# programmer could use !a# programming language what
resembled more {to] natural language@Be {it] !a#stripped version with
some two or three hundred @ reserved@w ords@This [is] *the^ period
(1970@ s) were *the^now well known so called @ high level@languages
like BASIC*PASCAL* ALGOL* FORTRAN* PL/I**and%C have been
born@
Fourth Generation
A 4GL [is] *an^aid witch *the^end user or programmer can use *to^
build *an^application without using !a#third generation programming
language@ Therefore knowledge |of| !a#programming language [is] strictly
spoken not needed@
The primary feature [is] that you do not indicate HOW !a#computer
must perform !a# task but WHAT {it] must do@*in=other words *the^
assignments can be given on !a#higher functional level@
A few instructions *in=!a#4GL {will] do *the^ same as hundreds |of|
instructions *in=!a#lower generation language like COBOLor BASIC@
Applications |of| 4GL@ s {are] concentrating on *the^daily performed tasks
such like screen forms* requests {for} data* change data**and%making
hard cop ies@*in=m ost |of| these cases one deals w ith Data Base
Management Systems (DBMS)@
The main advantage |of| this kind |of| languages [is] that !a#trained
user can create *an^application *in=!a#much shorter time {for} development
{and} debugging than w ould be possible w ith older generation
programming language@Also !a#customer can be involved earlier
*in^t*he^project *and%can actively take part *in=*the^development |of| !a#system*
^by*means |of| simulation runs* long before *the^application [is] actually
finished@
Today *the^disadvantage |of| !a#4GL lays more *in=*the^technological
capacities |of| hardware@Since programs written *in=!a#4GL {are] quite !a#
bit larger they {are] needing more disk space *and%demanding !a#larger
28 Computer Software Languages *and%Graphics Design

part |of| *the^ computer@ s memory capacity than 3GL@ s@But hardware
|of| technologically high standard [is] made more available every day*
not necessarily cheaper*so *in=*the^long run restrictions {will] disappear@
Considering *the^arguments one can say that *the^costs saved *in^
d evelop m en t could now be in v ested *in= hardware |of| higher
performance *and%stimulate *the^development |of| *the^4GL@ s@
In *the^1990@ s *the^ expectations |of| !a# 4GL language {are] too high@
{and} *the^ use |of| {it] only {will] be picked up {by] Oracle *and%SUN that
have enough power {to] pull {it] through@However *in=most cases *the^
4GL environment [is] often misused as !a# documentation tool *and%!a#
version control implement@*in=very few cases *the^use |of| such programs
^are*increasing productivity@*in=most cases they only {are] used {to] lay
*the^basis {for} information systems@*and%programmers use all kinds |of|
libraries *and%toolkits {to] give *the^product {its] final form@
Fifth Generation
This term [is] often misused {by] software companies that build
programming environments@Till today one can only see vague
contours@When one sees !a#nice graphical interface {it] [is] tempting *to^
call that !a#fifth generation@But alas changing *the^makeup does not
make !a#butterfly into *an^eagle@
Yes some impressions {are] communicated {from] professional circles
that {are] making these environments *and%sound promising@
But again *the^Fifth generation only exist *in=*the^brains |of| those
trying {to] design this generation* YET$Many attempts {are] made but
^are*stranding on *the^limitations |of| hardware**and%strangely enough
on *the^views *and%insight |of| *the^use |of| natural language@We need !a#
different speak {for} this$
But {it] [is] !a#direction that {will] be taken {by] these languages* no
longer prohibiting {for} *the^ use |of| natural language *and%intuitive
approach towards *the^programme (language) {to] be developed
The basis |of| this [is] laid *in=*the^1990@ s {by] using sound* moving
images *and%agents #!a#kind |of| advanced macro@ s |of| *the^1980@
s@
*it^is]*only natural that neural networks {will] play *an^important role@
*and%
Software {for}*the^end user {will] be (may be) based on principles |of|
knowbot#agents@*an^autonomous self changing piece |of| software that
creates new agents based on *the^ interaction |of| *the^ end user and+
interface@!a#living piece |of| software*as you may say@*and%were human
alike D N A /R N A (intelligent#) algorithms can play !a#big role@
Computer Software Languages *and%Graphics Design 29

C O M PU TER LAN G U AG ES

INTRODUCTION
The term computer language includes !a#wide variety |of| languages
used {to] communicate with computers@{it][is]broader than *the^more
com m only#u sed term program m ing lan gu age@Program m ing
languages {are] !a#subset |of| computer languages@{for}example* HTML
*is] !a#markup language *and%!a#computer language* but {it] [is] not
traditionally considered !a#programming language@Machine code
*is$a#!computer language@{it]can technically be used {for} programming*
{and} has been (e@ g@*the^original bootstrapped {for}Altair BASIC)*though
most would not consider {it]!a#programming language@
Computer languages can be divided into two groups*high#level
languages *and%low #level languages@H igh#level languages *are^
designed {to] be easier {to] use* more abstract**and%more portable than
lo w #level lan gu ages@Syntactically correct programs *in= som e
languages {are] then compiled {to] low#level language *and%executed
*by^t*he^computer@Most modern software [is] written *in=!a#high#level
language*compiled into object code**and%then translated into machine
instructions@
Computer languages could also be grouped based on other
criteria@ Another distinction could be made between human#readable
{and} non#human#readable languages@ Human#readable languages *are^
designed {to] be used directly {by] humans {to] communicate with *the^
computer@
N on#human#readable languages* though they can often be
partially understandable*{are] designed {to]be more compact *and%easily
processed* sacrificing readability {to] meet these ends@
TYPES |of| COMPUTER LANGUAGES
Language can be categories broadly into three categories@
Machine Language
The most elementary *and%first type |of| computer* which was
invented* was machine language@Machine language was machine
dependent@!a#programme written *in=machine language cannot be run
on another type |of| computer without significant alterations@
Machine
language [is] some times also referred as *the^binary language i#e* the
30 Computer Software Languages *and%Graphics Design

language |of| 0 *and%1{where}0 stands {for} *the^absence |of| electric pulse


{and} i stands {for} *the^presence |of| electric pulse@Very few computer
programs {are] actually written *in=machine language@
Assembly Language
As computer became more popular*{it]became quite apparent that
machine language programming was simply too slow slow tedious
^for*most programmers@Assembly languages {are] also called as low
level language instead |of| using *the^string |of| members programmers
began using English like abbreviation {to] represent *the^ elementary
operation@
The language provided *an^opportunity {to] *the^programmers *to^
use English like words that were called MNEMONICS@
High Level Language
The assembly languages started using English like words*m but
still {it] was difficult {to] learn these languages@High level languages
^are**the^computer language *in=which {it] [is] much easier {to] write !a#
programme than *the^low level language@!a#programme written *in^
high level language [is] just like gibing instruction {to] person *in=daily
life@{it]was *in=1957 that !a#high level language called FORTRAN was
developed {by] IBM which was specially developed {for} scientist and+
engineers other high level languages {are] COBOL which [is]widely used
^for*business data processing task@
BASIC language which [is] developed {for}*the^beginners *in=general
purpose programming language@ you Can use C language {for} almost
any programming task@PASCAL {are] other high level languages
which has gained widespread acceptance@

S O F T W A R E C R IS IS
Indeed**the^problem |of| trying {to] write *an^encyclopedia [is] very
much like writing software@Both running code *and%!a#hypertext/
encyclopedia {are] wonderful turn#ons {for} *the^ brain**and%you want
more |of| {it] *the^more you see* like !a#drug@
As !a#user*you want {it]{to] do everything* as !a#customer you don@ t
really want {to]pay {for} it**and%as !a#producer you realise how unrealistic
*the^customers are@
Requirements {will] conflict *in=functionality vs affordability*
and+in
*&
completeness vs timeliness@
Computer Software Languages *and%Graphics Design 31

DIFFERENT TYPES |of| CRISIS

Chronic Software Crisis


By today@ s definition*!a#$large$ software system [is]!a#system that
contains more than 50*000 lines |of| high#level language code@ It@
s those
large systems that bring *the^software crisis {to] light@If you@ re familiar
with large software development projects* you know that *the^work
*is] done *in= teams consisting |of| project managers* requirements
an alysts* softw are en gin eers* d ocu m en tation exp erts* and+
programmers@
With so many professionals collaborating *in=*an^organized manner
on !a#project* what@ s *the^problem# Why [is] {it] that *the^team produces
fewer than 10 lines |of| code per day over *the^average lifetime |of| *the^
project# *and%why {are] sixty errors found per every thousand lines |of|
code# Why [is] one |of| every three large projects scrapped before ever
being completed# *and%why [is] only 1 *in=8 finished software projects
considered $successful#$
• The cost |of| owning *and%maintaining software *in=*the^1980@ s was
twice as expensive as developing *the^software@
• During *the^ 1990@ s* *the^ cost |of| ownership *and%maintenance
increased {by] 30% over *the^1980@ s@
• In 1995* statistics showed that half |of| surveyed development
projects were operational*but were not considered successful@
• The average software project overshoots {its] schedule {by] half@
• Three quarters |of| all large software products delivered {to] *the^
customer {are] failures that {are] either not used {at] all* or do not
meet *the^customer@ s requirements@
Software projects {are] notoriously behind schedule *and%over
budget@Over *the^last twenty years many different paradigms have
been created *in= attempt {to] make software developm ent more
predictable *and%controllable@
While there [is] no single solution {to] *the^crisis* much has been
learned that can directly benefit today@ s software projects@
It appears that *the^ Software Crisis can be boiled down {to] two basic
sources*
1@ Software development [is] seen as !a#craft* rather than *an^engineering
discipline@
2@ The approach {to] education taken {by] most higher education
institutions encourages that $craft$ mentality@
32 Computer Software Languages *and%Graphics Design

Software Development
Software development today [is] more |of| !a# craft than !a#science@
Developers {are] certainly talented *and%skilled*but work like craftsmen*
relying on their talents *and%skills *and%using techniques that cannot
be measured or reproduced@On *the^other hand* software engineers
place emphasis on reproducible* quantifiable techniques#the marks
|of| science@*the^software industry [is] still many years away *from^
b ecom ing !a# m ature engineering d iscip lin e@Formal software
engineering processes exist*but their use [is] not widespread@!a#crisis
similar {to] *the^software crisis [is] not seen *in=*the^hardware industry*
^where* well documented*formal processes {are] tried *and%true**and%ad
hoc hardware development [is] unheard of@{to] make matters worse*
software technology [is] constrained {by] hardware technology@Since
hardware develops {at] !a#much faster pace than software* software
developers {are] constantly trying {to] catch up *and%take advantage |of|
hardware improvements@
Management often encourages ad hoc software development
*in^a*n&attempt {to] get products out on time {for} *the^ new hardware
architectures@D esign * docum entation* *and%evaluation {are] |of|
secondary importance *and%{are] omitted or completed after *the^fact@
However* as *the^ statistics show* *the^ad hoc approach just doesn@ t
work@ Software developers have classically accepted !a#certain number
|of| errors *in=their work as inevitable *and%part |of| *the^job@That mindset
becomes increasingly unacceptable as software becomes embedded
*in&more *and%more consumer electronics@Sixty errors per thousand
lines |of| code [is] unacceptable when *the^code [is] embedded *in=!a#toaster*
automobile* ATM machine or razor (let your imagination run free
^for*!a#moment)@
Computer Science *and%Product Orientation
Software developers pick up *the^ ad hoc approach {to] software
development early *in=their computer science education*{where}they
^are* taught !a# $product orien tation $ approach {to] softw are
development@*in=*the^many undergraduate computer science courses
I took**the^existence |of| software engineering processes was never even
mentioned@
Computer science education does not provide students with *the^
necessary skills {to] become effective software engineers@They are
Computer Software Languages *and%Graphics Design 33

taught *in=!a#way that encourages them {to] be concerned only with *the^
final outcome |of| their assignments#whether or not *the^programme
runs* or whether or not {it] runs efficiently* or whether or not they
used *the^best possible algorithm@Those concerns *in=themselves *are^
not bad@But on *the^ other hand* they should not be *the^ focus |of| !a#
project@
The focus should be on *the^complete process {from] beginning *to^
end *and%beyond@Product orientation also leads {to] problems when
*the^student enters *the^ work force#not having seen how processes
affect *the^final outcome*individual programmers tend {to] think their
work {from] day {to] day [is] too $small$ {to] warrant *the^application |of|
formal methods@
Fully Supported Software
As w e have seen*most software projects do not follow !a#formal
p rocess@*the^ result [is] !a# product that [is] poorly designed and+
documented@Maintenance becomes problematic because without !a#
design *and%documentation* it@ s difficult or impossible {to] predict
what sort |of| effect !a#simple change might have on other parts |of| *the^
system @
Fortunately there [is] *an^awareness |of| *the^ software crisis**and%*it^
has inspired !a#worldwide movement towards process improvement@
Software industry leaders {are] beginning {to] see that following !a#formal
software process consistently leads {to] better quality products* more
efficient teams *and%individuals* reduced costs**and%better morale@
Ratings range {from] Maturity Level 1* which [is] characterized *by^
ad hoc development *and%lack |of| !a# formal software development
process* up {to] Maturity Level 5*{at] which *an^organization not only
has !a#formal process* but also continually refines *and%improves it@
Each maturity level [is] further broken down into key process areas
that indicate *the^areas *an^organization should focus on {to] improve
^its*software process (e@ g @requirement analysis* defect prevention* or
change control)@
Level 5 [is] very difficult {to] attain@*in=early 1995*only two projects*
one {at] Motorola *and%another {at] Loral (the on#board space shuttle
software project)* had earned Maturity Level 5@Another study
showed that only 2% |of| reviewed projects rated *in=*the^top two
Maturity Levels**in=spite |of| many |of| those projects placing *an^extreme
emphasis on software process improvement@
34 Computer Software Languages *and%Graphics Design

Custom ers contracting large projects {will] naturally seek


organizations w ith high CMM ratings* *and%that has prompted
increasingly more organizations {to] investigate software process
improvement@Mature software [is] also reusable software@Artisans *are^
not concerned with producing standardized products**and%that [is]!a#
reason why there [is]so little interchangeability *in=software components@
Ideally*software would be standardized {to] such *an^extent that *it^
could be marketed as !a#$part$* with {its] own part number *and%revision*
just as though {it]were !a#hardware part@
The software component interface would be compatible with any
other software system@Though {it]would seem that nothing less than
!a#software development revolution could make that happen**the^
National Institute |of| Standards *and%Technology (NIST) founded *the^
Advanced Technology Programme (ATP)*one purpose |of| which was
^to*encourage *the^development |of| standardized software components@

S O F T W A R E E N G IN E E R IN G

PROCESS
Software engineering process *and%practices {are] *the^ structures
imposed on development |of| !a#software product@There {are] different
models |of| software process (software lifecycle [is]!a#synonym) used *in^
different organizations *and%industries@ RAL has identified three levels
|of| software process {for} {its] projects@These levels balance *the^different
needs |of| different types |of| projects@Scaling *the^process {to] *the^project
*is]vital {to] {its] success* too much process can be as problematic as too
little~ too much process can slow down !a#purely R&D exploration*
too little process can slow down !a#large development project with
hard deliverables@*the^levels {are] briefly identified as follows*
Level 1*R&D
• No software products delivered* pure research
• Minimal software process
Level 2*Research system
• Larger development team* informal software releases
• Moderate software process
Level 3*Delivered system
• Large software development team*formal software releases
• More formal software process
Computer Software Languages *and%Graphics Design 35

For example**the^Juneau*Alaska Winds Project has evolved *from^


!a#Level 1 {to]!a#Level 3 project over multiple years@{it]started as !a#purely
R&D effort (Level 1)*expanded {to]!a#field programme *in=Juneau (Level
2)**and%[is] currently running *in=*the^field as !a#Operational Prototype
(Level 3)@
The software process *and%software engineering practices have
becom e more form alized *and%more structured as *the^ project
proceeded through *the^ different levels@RAL has evolved !a# set |of|
software engineering best practices that implement *the^three software
process levels@ These include*source code control*nightly code builds*
writing reusable code* using different team models* commitment *to^
deadlines*design *and%code reviews*risk management*bug tracking*
software metrics*software configuration management*requirements
management@
Software configuration m anagement (SCM) [is] !a# step up *in^
formality *and%reproducibility {from] source code control *and%includes
controlling *and%versioning |of| software releases@
Source code control [is]!a#software engineering best practice used
with RAL Level 2 *and%Level 3 projects@SCM [is] !a#best practice used
on !a#number |of| RAL Level 3 projects@
DESCRIPTION
Software Engineering Process
The elements |of| !a#software engineering process {are] generally enumerated
as *
• Marketing Requirements
• System#Level Design
• Detailed Design
• Implementation
• Integration
• Field Testing
• Support
No element |of| this process ought {to] commence before *the^earlier
ones {are] substantially complete**and%whenever !a#change [is] made *to^
some element*all dependent elements ought {to]be reviewed or redone
*in&light |of| that change@It@
s possible that !a#given module {will] be both
specified *and%implemented before {its] dependent modules {are] fully
specified $ this [is] called advanced development or research@
36 Computer Software Languages *and%Graphics Design

It [is] absolutely essential that every element |of| *the^ software


engineering process include several kinds |of| review *peer review*
mentor/management review**and%cross#disciplinary review@ Software
engineering elements (whether documents or source code) must have
version numbers *and%auditable histories@$Checking in$!a#change
*to^a*n&element should require some form |of| review**and%*the^depth
|of| t*he^review should correspond directly {to] *the^scope |of| *the^change@
Marketing Requirements
The first step |of| !a# software engineering process [is] {to] create !a#
document which describes *the^ target customers *and%their reason
^for*needing this product**and%then goes on {to] list *the^features |of| *the^
product w hich address these customer n eed s@*the^ Marketing
Requirements Document (MRD) [is] *the^ battleground{where}*the^
answer {to] *the^question $What should w e build**and%who {will] use
it#$ [is] decided@*in=many failed projects**the^MRD was handed down
like *an^inscribed stone tablet {from] marketing {to] engineering* who
would then gripe endlessly about *the^laws |of| physics *and%about how
they couldn@ t actually build that product since they had no ready
supply |of| Kryptonite or whatever@*the^MRD [is] !a#joint effort* with
engineering not only reviewing but also writing !a#lot |of| *the^text@
System#Level Design
This [is] !a# high#level description |of| *the^ product* *in=terms
|of|m
$ odules$ (or sometimes $programmes$) *and%|of| *the^ interaction
between these modules@*the^goals |of| this document {are] first*{to] gain
more confidence that *the^product could work *and%could be built* and+
second* {to] form !a#basis {for} estimating *the^ total amount |of| work
*it^^will*take {to] build it@*the^system#level design document should also
outline *the^system#level testing plan**in=terms |of| customer needs and+
whether they would be met {by] *the^system design being proposed@
Detailed Design
The detailed design [is]{where}every module called out *in=*the^
system#level design document [is] described *in=detail@*the^interface
(command line formats*calling API*externally visible data structures)
|of| each module has {to] be completely determined {at]this point*as well
as dependencies between modules@Two things that {will] evolve out
|of| *the^detailed design [is]!a#PERT or GANT chart showing what work
Computer Software Languages *and%Graphics Design 37

has {to] be done *and%*in=what order**and%more accurate estimates |of| *the^


time {it] {will] take {to] complete each module@ Every module needs !a#unit
test plan* which tells *the^implementor what test cases or what kind
|of| test cases they need {to] generate *in=their unit testing *in=order *to^
verify functionality@ Note that there {are] additional*nonfunctional unit
tests which {will] be discussed later@
Implementation
Every module described *in=*the^detailed design document has *to^
be im p lem en ted @This in clu d es *the^ sm all act |of| cod in g or
programming that [is] *the^heart *and%soul |of| *the^software engineering
process@ It@
s unfortunate that this small act [is] sometimes *the^only part
|of| software engineering that [is] taught (or learned)*since {it][is]also *the^
only part |of| software engineering which can be effectively self#taught@
A module can be considered implemented when {it] has been
created* tested**and%successfully used {by] some other module (or
*by^t*he^system#level testing process)@Creating !a#module [is] *the^old edit#
compile#repeat cycle@ Module testing includes *the^unit level functional
{and} regression tests called out {by] *the^ detailed design**and%also
performance/stress testing**and%code coverage analysis@
Integration
W hen all m odules {are] nom inally com p lete* system #lev el
integration can be done@This [is]{where}all |of| *the^modules move into !a#
single source pool *and%{are] compiled *and%linked *and%packaged as !a#
system@Integration can be done incrementally**in=parallel with *the^
implementation |of| *the^various modules*but {it]cannot authoritatively
approach $doneness$ until all modules {are] substantially complete@
Integration includes *the^ development |of| !a# system#level test@If
*the^built package has {to] be able {to] install itself (which could mean
just unpacking !a#tarball or copying files {from] !a#CD#ROM) then there
should be *an^automated way |of| doing this*either on dedicated crash
{and} burn systems or *in= containerized/sim ulated environments@
Sometimes**in=*the^middleware arena**the^package [is]just !a#built source
pool**in=which case no installation tools {will] exist *and%system testing
^will*be done on *the^as#built pool@Once *the^system has been installed
(if {it][is]installable)**the^automated system#level testing process should
be able {to] invoke every public command *and%call every public entry
point* with every possible reasonable combination |of| arguments@
38 Computer Software Languages *and%Graphics Design

If *the^system [is] capable |of| creating some kind |of| database* then
*the^automated system#level testing should create one *and%then use
external (separately written) tools {to] verify *the^database@ s integrity@
It@s possible that *the^unit tests {will] serve some |of| these needs**and%all
unit tests should be run *in=sequence during *the^integration* build*
{and} packaging process@
Field Testing
Field testing usually begins internally@That means employees
|of| t*he^organization that produced *the^software package {will] run {it] on
their own computers@This should ultimately include all $production
level$ systems $ desktops* laptops**and%servers@
The statement you want {to] be able {to] make {at] *the^time you ask
customers {to] run !a#new software system (or !a# new version |of| *an&
existing software system) [is] $w e run {it] ourselves@$ *the^ software
developers should be available {for} direct technical support during
internal field testing@Ultimately {it] {will] be necessary {to] run *the^
softw are externally* m eaning on custom ers@(or prospective
customers@ ) computers@It@ s best {to] pick $friendly$ customers {for} this
exercise since it@ s likely that they {will] find !a#lot |of| defects $ even
some trivial *and%obvious ones $ simply because their usage patterns
{and} habits {are] likely {to] be different {from] those |of| your internal users@
The software developers should be close {to] *the^ front |of| *the^
escalation path during external field testing@Defects encountered
during field testing need {to] be triaged {by] senior developers and+
technical marketers* {to] determine which ones can be fixed *in=*the^
documentation*which ones need {to]be fixed before *the^current version
*is]released**and%which ones can be fixed *in=*the^next release (or never)@
Support
Software defects encountered either during field testing or after
*the^software has been distributed should be recorded *in=!a#tracking
system@These defects should ultimately be assigned {to] !a#software
engineer who {will] propose !a# change {to] either *the^ definition and+
documentation |of| *the^system* or *the^definition |of| !a#module* or {to]*the^
implementation |of| !a#module@ These changes should include additions
^to**the^unit and/or system#level tests**in=*the^form |of| !a#regression test
^to*show *the^defect *and%therefore show that {it] has been fixed (and *to^
keep {it] {from] recurring later)@
Computer Software Languages *and%Graphics Design 39

Just as *the^ MRD was !a#joint venture between engineering and+


marketing*so {it][is]that support [is]!a#joint venture between engineering
{and} customer service@*the^battlegrounds *in=this venture {are] *the^bug
list**the^categorization |of| particular bugs**the^maximum number |of|
critical defects *in=!a#shippable software release**and%so on@

S O F T W A R E Q U A L IT Y A T T R IB U T E

HIGH QUALITY SOFTWARE


Developing high quality software [is] hard* especially when *the^
interpretation |of| term $quality$ [is] patchy based on *the^environment
*in&which {it][is]used@*in=order {to] know if quality has been achieved* or
degraded*{it] has {to] be measured* but determining what {to] measure
{and} how [is] *the^ difficult part@Software Quality Attributes {are] *the^
benchmarks that describe system@ s intended behaviour within *the^
environment {for} which {it]was built@
The quality attributes provide *the^means {for}measuring *the^fitness
{and} suitability |of| !a# product@Software architecture has !a# profound
affect on most qualities *in=one way or another**and%software quality
attributes affect architecture@Identifying desired system qualities
before !a#system [is] built allows system designer {to] mold !a#solution
(starting with {its] architecture) {to] match *the^ desired needs |of| *the^
system within *the^context |of| constraints (available resources*interface
with legacy systems* etc)@When !a#designer understands *the^desired
qualities before !a#system [is] built* then *the^likelihood |of| selecting or
creating *the^right architecture [is] improved@
STATEMENTS
Both statements {are] useless as they provide no tangible way |of|
measuring *the^behaviour |of| *the^system@*the^quality attributes must
be described *in=terms |of| scenarios* such as $when 100 users initiate
@complete paym ent@transition* *the^ payment com ponent* under
normal circumstances* {will] process *the^ requests with *an^average
latency |of| three seconds@$ This statement* or scenario* allows *an&
architect {to] make quantifiable arguments about !a#system@
A scenario defines *the^ source |of| stimulus (users)* *the^ actual
stim ulus (initiate transaction)* *the^ artifact affected (paym ent
component)**the^environment *in=which {it] exists (normal operation)*
*the^effect |of| *the^ action (transaction processed)**and%*the^response
40 Computer Software Languages *and%Graphics Design

measure (within three seconds)@Writing such detailed statements *is$


only possible when relevant requirements have been identified
and+a*n&
idea |of| components has been proposed@
QUALITIES
Scenarios help describe *the^qualities |of| !a# system* but they don@ t
describe how they {will] be achieved@ Architectural tactics describe how
!a#given quality can be achieved@{for}each quality there may be !a#large
set |of| tactics available {to] *an^architect@{it][is]*the^architect@ s job {to] select
*the^right tactic *in=light |of| *the^needs |of| *the^system *and%*the^environment@
^for* example*!a#performance tactics may include options {to] develop
better processing algorithms*develop !a#system {for}parallel processing*
or revise event scheduling policy@Whatever tactic [is] chosen*{it] must
be justified *and%documented@
SOFTWARE QUALITIES
It would be naive {to]claim that *the^list below [is]as !a#complete taxonomy
|of| all software qualities # but it@s !a#solid list |of| general software qualities
compiled {from] respectable sources@ Domain specific systems {are] likely *to^
have *an^additional set |of| qualities *in=addition {to] *the^list below@ System
qualities can be categorized into four parts*runtime qualities*non#runtime
qualities*business qualities**and%architecture qualities@
Each |of| *the^ categories *and%{its] associated qualities {are] briefly
described below@ Other articles on this site provide more information
about each |of| *the^ software quality attributes listed below* their
applicable properties**and%*the^conflicts *the^qualities@
TYPES |of| SOFTARE QUALITIES
It defines six softw are q u a lity a ttrib u te s * also called q u a lity
characteristics *
1@ Functionality* {are] *the^ required functions available* including
interoperabilithy *and%security
2@ Reliability*Maturity*fault tolerance *and%recoverability
3@ Usability*How easy {it][is]{to]understand*learn*operate *the^software
system
4@ Efficiency*Performance *and%resource behaviour
5@ Maintainability*How easy [is] {it] {to] modify *the^software
6@ Portability* Can *the^ software easily be transferred {to] another
environment* including installability
Computer Software Languages *and%Graphics Design 41

Product Revision
The product revision perspective identifies quality factors that influence
*the^ability {to] change *the^software product* these factors are*
• Maintainability**the^ability {to] find *and%fix !a#defect@
• Flexibility* *the^ ability {to] make changes required as dictated
*by^t*he^business@
• Testability**the^ability {to] Validate *the^software requirements@
Product Transition
The product transition perspective identifies qu ality factors that
influence *the^ability {to] adapt *the^software {to] new environments*
• Portability* *the^ ability {to] transfer *the^ software {from] one
environment {to] another@
• Reusability**the^ease |of| using existing software components *in=!a#
different context@
• Interoperability**the^extent* or ease*{to] which software components
work together@
Product Operations
The product operations perspective identifies qu ality factors that
influence *the^extent {to] which *the^software fulfils {its] specification*
• Correctness**the^functionality matches *the^specification@
• Reliability**the^extent {to] which *the^system fails@
• Efficiency* system resource (including cpu* disk* memory*
network) usage@
• Integrity* protection {from] unauthorized access@
• Usability* ease |of| use@
2

S o f tw a r e A r c h ite c tu r e

Software Architecture [is] defined {to] be *the^rules* heuristics *and%patterns


governing*
• Partitioning *the^problem *and%*the^system {to] be built into discrete
pieces
• Techniques used {to] create interfaces between these pieces
• Techniques used {to] manage overall structure *and%flow
• Techniques used {to] interface *the^system {to] {its] environment
• Appropriate use |of| development *and%delivery approaches*
techniques *and%tools@

IMPORTANT |of| ARCHITECTURE


Computer Software Languages *and%Graphics Design 43

The primary goal |of| software architecture [is] {to] define *the^non
functional requirements |of| !a# system *and%define *the^environment@
The detailed design [is] followed {by]!a#definition |of| how {to] deliver
*the^functional behaviour within *the^architectural rules@
Architecture [is] important because it*
• Controls complexity
• Enforces best practices
• Gives consistency *and%uniformity
• Increases predictability
• Enables re#use@
OOP
OOP [is] !a# design philosophy@{it] stands {for} Object Oriented
Programming@Object#Oriented Programming (OOP) uses !a#different
set |of| programming languages than old procedural programming
languages (C* Pascal* etc@ )@Everything *in=OOP [is] grouped as self
sustainable $objects$@Hence*you gain re#usability {by] means |of| four
main object#oriented programming concepts@
In order {to] clearly understand *the^ object orientation* let@ s take
your $hand$ as *an^example@*the^$hand$ [is] !a# class@Your body has
two objects |of| type hand* named left hand *and%right hand@
Their main functions {are] con trolled/ m anaged {by] !a# set |of|
electrical signals sent through your shoulders (through *an^interface)@
So *the^shoulder [is]*an^interface which your body uses {to] interact with
your hands@
The hand [is]!a#well architected class@*the^hand [is] being re#used *to^
create *the^ left hand *and%*the^right hand {by] slightly changing *the^
properties |of| it@
OBJECT
An object can be considered !a#$thing$ that can perform !a#set |of|
related activities@*the^set |of| activities that *the^object performs defines
*the^object@ s behaviour@{for}example**the^hand can grip something or
!a#Student (object) can give *the^name or address@*in=pure OOP terms
*an&object [is] *an^instance |of| !a#class@
CLASS
A class [is] simply !a# representation |of| !a# type |of| object@{it][is]*the^
blueprint/ plan/ template that describe *the^details |of| *an^object@
Computer Software Languages *and%Graphics Design

+ Dolearn (Object)* Boolean

A class [is] *the^ blueprint {from] which *the^ individual objects *are^
created@Class [is] composed |of| three things*!a#name* attributes* and+
operations@
p u b lic c la s s S tu d e n t

}
According {to]*the^sample given below we can say that *the^student
object*named objectStudent*has created out |of| *the^Student class@
S tu d e n t o b je c tS tu d e n t = new S t u d e n t ( ) ~
In real world*you@ ll often find many individual objects all |of| *the^
same kind@As *an^example*there may be thousands |of| other bicycles
*in&existence* all |of| *the^same make *and%model@Each bicycle has built
^from* *the^same blueprint@*in=object#oriented terms* we say that *the^
bicycle [is]*an^instance |of| *the^class |of| objects known as bicycles@*in=*the^
software world* though you may not have realised it* you have
already used classes@{for} example**the^TextBox control*you always
used*[is] made out |of| *the^TextBox class*which defines {its] appearance
{and} capabilities@Each time you drag !a# TextBox control* you *are^
actually creating !a#new instance |of| *the^TextBox class@
IDENTIFICATION *and%DESIGN |of| !a# CLASS
This [is]*an^art~each designer uses different techniques {to] identify
classes@However according {to] Object Oriented Design Principles*
there {are] five principles that you must follow when design !a#class*
• SRP#The Single Responsibility Principle #
A class should have one**and%only one* reason {to] change@
• OCP#The Open Closed Principle #
You should be able {to] extend !a# classes behaviour* without
modifying it@
Computer Software Languages *and%Graphics Design 45

• LSP#The Liskov Substitution Principle#


Derived classes must be substitutable {for} their base classes@
• DIP#The Dependency Inversion Principle#
Depend on abstractions* not on concretions@
• ISP#The Interface Segregation Principle#
Make fine grained interfaces that {are] client specific@
Additionally {to] identify !a#class correctly* you need {to] identify
*the^full list |of| leaf level functions/ operations |of| *the^system (granular
level use cases |of| *the^system)@Then you can proceed {to] group each
function {to] form classes (classes {will] group same types |of| functions/
operations)@However !a# w ell defined class must be !a# meaningful
grou p in g |of| !a# set |o f | fu nction s *and% sh ou ld support *the^
re#usability while increasing expandability/ maintainability |of| *the^
overall system@
In software world *the^ concept |of| dividing *and%conquering *is$
always recommended* if you start analysing !a# full system {at] *the^
start*you {will] find {it] harder {to] manage@So *the^better approach [is]*to^
identify *the^module |of| *the^system first *and%then dig deep *in={to]each
module separately {to] seek out classes@
A software system may consist |of| many classes@But *in=any case*
w hen you have many* {it] needs {to] be m anaged@Think |of| !a# big
organisation* w ith {its] work force exceeding several thousand
employees (let@ s take one employee as !a#one class)@
In order {to] manage such !a#work force* you need {to] have proper
management policies *in=place@Same technique can be applies *to^
manage classes |of| your software system as w ell@*in=order {to] manage
*the^classes |of| !a# software system**and%{to] reduce *the^complexity**the^
system designers use several techniques*which can be grouped under
four main concepts named Encapsulation* Abstraction* Inheritance*
{and} Polymorphism@These concepts {are] *the^four main gods |of| OOP
world *and%*in=software term*they {are] called four main Object Oriented
Programming (OOP) Concepts@
ENCAPSULATION (OR INFORMATION HIDING)
The encapsulation [is] *the^inclusion within !a#programme object |of|
all *the^resources need {for}*the^object {to] function#basically**the^methods
{and} *the^data@*in=OOP *the^encapsulation [is]mainly achieved {by] creating
classes**the^classes expose public methods *and%properties@*the^class
Computer Software Languages *and%Graphics Design

is kind |of| !a#container or capsule or !a#cell* which encapsulate *the^set


|of| m ethods* attribute *and%properties {to] provide {its] indented
functionalities {to] other classes@*in=that sense*encapsulation also allows
!a#class {to] change {its] internal implementation without hurting *the^
overall functioning |of| *the^ system@That idea |of| encapsulation [is]*to^
hide how !a#class does {it] but {to] allow requesting what {to] do@

+ Dolearn (Object)* Boolean

In order {to] modularise/ define *the^functionality |of| !a# one class*


that class can uses functions/ properties exposed {by] another class *in^
many different ways@According {to] Object Oriented Programming
there {are] several techniques* classes can use {to] link with each other
{and} they {are] named association* aggregation**and%composition@
There {are] several other ways that *an^encapsulation can be used*
as *an^example we can take *the^ usage |of| *an^ interface@*the^interface
can be used {to] hide *the^information |of| *an^implemented class@
I S t u d e n t m y S tu d e n t = new L o c a l S t u d e n t ( ) ~
I S t u d e n t m y S tu d e n t = new F o r e i g n S t u d e n t ( ) ~
According {to] *the^sample above (let@
s assume that LocalStudent
{and} ForeignStudent {are] implemented {by] *the^IStudent interface) we
can see how LocalStudent *and%ForeignStudent {are] hiding their*
localise implementing information through *the^IStudent interface@
ASSOCIATION
Association [is]!a#(*a*) relationship between two classes@{it]allows
one object instance {to] cause another {to] perform *an^action on {its] behalf@
Association [is] *the^ more general term that define *the^ relationship
between two classes*{where}as *the^aggregation *and%composition *are^
relatively special@
p u b lic c la s s S tu d e n tR e g is tr a r
Computer Software Languages *and%Graphics Design

{
p u b lic S tu d e n tR e g is t r a r ()~
{
new R e c o r d M a n a g e r ( ) @I n i t i a l i s e () ~
}
}
In this case we can say that there [is] *an^ association between
StudentRegistrar *and%RecordManager or there [is] !a# directional
a ssociation {from ] StudentR egistrar {to ] RecordM anager or
StudentRegistrar use !a#(*Use*) RecordManager@Since*!a#direction *is$
exp licitly sp e c ifie d * *in= this case *the^ controller class [is] *the^
StudentRegistrar@

To some beginners* association [is] !a# confusing concept@*the^


troubles created not only {by] *the^association alone*but with two other
OOP concepts* that [is] association* aggregation *and%composition@
Every one understands association * before aggregation and+
composition {are] described@
The aggregation or composition cannot be separately understood@
If you understand *the^aggregation alone {it] {will] crack *the^definition
given {for} association**and%if you try {to] understand *the^composition
alone {it] {will] always threaten *the^definition given {for} aggregation*all
three concepts {are] closely related* hence* must study together**by^
comparing one definition {to] another@Let@ s explore all three *and%see
whether w e can understand *the^ differences between these useful
concepts@

THE DIFFERENCE BETWEEN *an^INTERFAC


{and} *an^ ABSTRACT CLASS
There {are] quite !a#big difference between *an^ interface *and%*an^abstract
class* even though both look similar*
• Interface definition begins with !a# keyword interface so {it] [is] |of|
type interface
• Abstract classes {are] declared with *the^abstract keyword so {it] [is] |of|
type class
• Interface has no implementation*but they have {to] be implemented@
48 Computer Software Languages *and%Graphics Design

• Abstract class@ s methods can have implementations *and%they have


^to*be extended@
• Interfaces can only have method declaration (implicitly public and+
abstract) *and%fields (implicitly public static)
• Abstract class@ s methods can@t have implementation only when
declared abstract@
• Interface can inherit more than one interfaces
• Abstract class can implement more than one interfaces* but can
inherit only one class
• Abstract class must override all abstract method *and%may override
virtual methods
• Interface can be used when *the^implementation [is] changing
• Abstract class can be used {to] provide some default behaviour
*for^a#!base class@
• Interface makes implementation interchangeable
• Interface increase security {by] hiding *the^implementation
• Abstract class can be used when implementing framework
• Abstract classes {are] *an^excellent way {to] create planned inheritance
hierarchies *and%also {to] use as non#leaf classes *in=class hierarchies@
Abstract classes let you define some behaviours~they force your
subclasses {to] provide others@{for}example*if you have *an^application
framework* *an^abstract class can be used {to] provide *the^ default
implementation |of| *the^services *and%all mandatory modules such as
event logging *and%message handling etc@This approach allows *the^
developers {to] develop *the^ application w ithin *the^ guided help
provided {by] *the^framework@
H ow ever* *in= practice w h en you com e across w ith som e
application#specific functionality that only your application can
perform* such as startup *and%shutdown tasks etc@*the^abstract base
class can declare virtual shutdown *and%startup methods@*the^base
class knows that {it] needs those methods* but *an^abstract class lets
your class admit that {it] doesn@ t know how {to] perform those actions~
^it*only knows that {it]must initiate *the^actions@When {it][is]time {to] start
up**the^abstract class can call *the^startup method@ When *the^base class
calls this method*{it]can execute *the^method defined {by] *the^child class@
IMPLICIT *and%EXPLICIT INTERFACE IMPLEMENTATIONS
As mentioned before*Net support multiple implementations@*the^
concept |of| implicit *and%explicit implementation provide safe way to
Computer Software Languages *and%Graphics Design 49

implement methods |of| multiple interfaces {by] hiding* exposing or


preserving identities |of| each |of| interface methods* even when *the^
method signatures {are] *the^same@
Let@
s consider *the^interfaces defined below@
in t e r f a c e ID is p o s a b le
{
v o id D is p o s e ()~
}
Here you can see that *the^ class Student has im plicitly and+
explicitly implemented *the^method named Dispose() via Dispose and+
IDisposable@ Dispose@
c la s s S t u d e n t * ID is p o s a b le
{
p u b lic v o id D is p o s e ()
{
C o n s o l e @W r i t e L i n e ( $S t u d e n t @D i s p o s e $ ) ~
}
v o id I D i s p o s a b l e @D i s p o s e ( )
{
C o n s o l e @W r i t e L i n e ( $I D i s p o s a b l e @D i s p o s e $ ) ~
}
}
According {to] *the^ above example *the^ new class (IOException)*
which [is] called *the^derived class or subclass*inherits *the^members
|of|a*n&existing class (Exception)*which [is] called *the^base class or super
class@*the^class IOException can extend *the^functionality |of| *the^class
Exception {by] adding new types *and%methods *and%{by] overriding
existing ones@
Just like abstraction [is] closely related with generalisation**the^
inheritance [is] closely related with specialisation@{it][is]important *to^
discuss those two concepts together with generalisation {to] better
understand *and%{to] reduce *the^complexity@
One |of| *the^most important relationships among objects *in=*the^real
w orld [is] specialisation* w hich can be described as *the^ $is#a$
relationship@ When we say that !a#dog [is]!a#mammal*w e mean that *the^
dog [is]!a#specialised kind |of| mammal@{it]has all *the^characteristics |of|
any mammal (it bears live young* nurses with milk* has hair)*but *it^
specialises these characteristics {to] *the^familiar characteristics |of| canis
domesticus@!a#cat [is] also !a#mammal@As such* w e expect {it] {to] share
certain characteristics with *the^dog that {are] generalised *in=Mammal*
but {to] differ *in=those characteristics that {are] specialised *in=cats@
Computer Software Languages *and%Graphics Design

The specialisation *and%generalisation relationships {are] both


reciprocal *and%hierarchical@ Specialisation [is] just *the^other side |of| *the^
generalisation coin* Mammal generalises what [is] common between
dogs *and%cats**and%dogs *and%cats specialise mammals {to] their own
specific subtypes@
Similarly*as *an^example you can say that both IOException and+
SecurityException {are] |of| type Exception@ They have all characteristics
{and} behaviours |of| *an^ Exception* That mean *the^ IOException [is] !a#
specialised kind |of| Exception@
A SecurityException [is] also *an^Exception@As such* we expect
*it^t^
o*share certain characteristic with IOException that {are] generalised
*in&Exception*but {to] differ *in=those characteristics that {are] specialised
*in&SecurityExceptions@*in=other words* Exception generalises *the^
shared characteristics |of| both IOException *and%SecurityException*
w hile IOException *and%SecurityException specialise with their
characteristics *and%behaviours@
In OOP**the^specialisation relationship [is] implemented using *the^
principle called inheritance@This [is] *the^ most common *and%most
natural *and%widely accepted way |of| implement this relationship@
INHERITANCE
Ability |of| !a# new class {to] be created* {from] *an^ existing class *by^
extending it*[is] called inheritance@

p u b lic c la s s E x c e p tio n
{

p u b lic c la s s IO E x c e p t io n * E x c e p tio n
{
Computer Software Languages *and%Graphics Design 51

POLYMORPHISMS
Polymorphisms [is]!a#generic term that means @ many shapes@ @More
precisely Polymorphisms means *the^ability {to] request that *the^same
operations be performed {by]!a#wide range |of| different types |of| things@
At times* I used {to] think that understanding Object Oriented
Programming concepts have made {it] difficult since* they have
grouped under four main concepts* while each concept [is] closely
related with one another@Hence* one has {to] be extremely careful *to^
correctly understand each concept separately* while understanding
*the^way each related with other concepts@
In OOP *the^polymorphisms [is] achieved {by] using many different
techniques named method overloading* operator overloading and+
method overriding*
METHOD OVERLOADING
The method overloading [is] *the^ability {to] define several methods
all with *the^same name@
p u b lic c la s s M yLogger
{
p u b lic v o id L o g E rr o r(E x c e p tio n e)
{
// I m p le m e n t a t i o n goes h e re
}
p u b lic b o o l L o g E r r o r (E x c e p tio n e * s t r in g m essage)
{
// I m p le m e n t a t i o n goes h e re
}

OPERATOR OVERLOADING
The operator overloading (less commonly known as ad#hoc
polymorphisms) [is]!a#specific case |of| polymorphisms *in=which some
or all |of| operators like +*# or == {are] treated as polymorphic functions
{and} as such have different behaviours depending on *the^types |of| *its^
arguments@
p u b lic c la s s C o m p le x
{
p r iv a t e in t r e a l~
p u b lic in t Real
{ get { re tu rn r e a l~ } }
p r iv a t e in t im a g in a r y ~
52 Computer Software Languages *and%Graphics Design

p u b lic in t Im a g i n a r y
{ get { re tu rn im a g in a r y ~ } }
p u b lic C o m p le x (in t r e a l* in t im a g i n a r y )
{
t h i s @r e a l = r e a l~
t h i s @i m a g i n a r y = i m a g i n a r y ~
}
p u b lic s t a t ic C o m p le x o p e r a t o r + (C o m p le x c 1 * C o m p le x c 2 )
{
re tu rn new C o m p l e x ( c 1 @R e a l + c 2 @R e a l * c 1 @I m a g i n a r y +
c 2 @I m a g i n a r y ) ~
}
}
In above example I have overloaded *the^plus operator {for} adding
two complex numbers@There *the^ two properties named Real and+
Imaginary has been declared exposing only *the^ required $get$
method*while *the^object@ s constructor [is] demanding {for} mandatory
real *and%imaginary values with *the^user defined constructor |of| *the^
class@
METHOD OVERRIDING
Method overriding [is] !a#language feature that allows !a#subclass
^to*override !a# specific implementation |of| !a# method that [is] already
provided {by] one |of| {its] super#classes@
A subclass can give {its] own definition |of| methods but need *to^
have *the^same signature as *the^method *in={its]super#class@This means
that when overriding !a#method *the^ subclass@ s method has {to] have
*the^same name *and%parameter list as *the^ super#class@ s overridden
method@
u s in g S y s te m ~
p u b lic c la s s C o m p le x
{
p r iv a t e in t r e a l~
p u b lic in t Real
{ get { re tu rn r e a l~ } }
p r iv a t e in t im a g in a r y ~
p u b lic in t Im a g in a r y
{ get { re tu rn im a g in a r y ~ } }
p u b lic C o m p le x (in t r e a l* in t im a g in a r y )
{
t h i s @r e a l = r e a l~
t h i s @i m a g i n a r y = i m a g i n a r y ~
Computer Software Languages *and%Graphics Design 53

}
p u b lic s t a t ic C o m p le x o p e r a t o r + (C o m p le x c 1 * C o m p le x
c2 )
{
re tu rn new C o m p l e x ( c 1 @R e a l + c 2 @R e a l * c 1 @Im a g i n a r y +
c 2 @I m a g i n a r y ) ~
}
p u b lic o v e r r id e s t r in g T o S t r i n g ()
{
re tu rn ( S t r i n g @F o r m a t ( $ { 0 } + { 1 } i $* r e a l * im a g in a r y ))~
}
}
In above example I have extended *the^ implementation |of| *the^
sample Complex class given under operator overloading section@ This
class has one overridden method named $ToString$* which override
*the^default implementation |of| *the^ standard $ToString$ method *to^
support *the^correct string conversion |of| !a#complex number@
C o m p le x num1 = new C o m p le x ( 5 * 7 ) ~
C o m p le x num2 = new C o m p le x ( 3 * 8 ) ~
/ / A d d tw o C o m p le x n u m b e rs u s i n g *the^
// o v e r lo a d e d p lu s o p e ra to r
C o m p le x sum = num1 + num 2~
/ / P r i n t *th e ^ n u m b e rs *and% *the^ sum
// u s i n g *the^ o v e r r i d e n T o S tr in g m e th o d
C o n s o l e @W r i t e L i n e ( $ ( { 0 } ) + ({1}) = { 2 } $* num 1* num2* s u m )~
C o n s o l e @R e a d L i n e ( ) ~

THE DIFFERENCE BETWEEN ASSOCIATION*


AGGREGATION *and%COMPOSITION
Association [is]!a#(*a*) relationship between two classes*{where}one
class use another@But aggregation describes !a# special type |of| *an&
association@Aggregation [is] *the^ (*the*) relationship between two
classes@
When object |of| one class has *an^(*has*) object |of| another*if second
*is]!a#part |of| first (containment relationship) then we called that there
*is]*an^aggregation between two classes@ Unlike association*aggregation
always insists !a#direction@
p u b lic c la s s U n iv e r s it y
{
p r iv a te C h a n c e llo r u n iv e r s it y C h a n c e llo r = new
C h a n c e l l o r () ~
}
54 Computer Software Languages *and%Graphics Design

In this case I can say that University aggregate Chancellor or


University has *an^(*has#a*) Chancellor@ But even without !a#Chancellor
!a#University can exists@But *the^ Faculties cannot exist without *the^
University**the^life time |of| !a#Faculty (or Faculties) attached with *the^
life time |of| *the^University@ If University [is] disposed *the^Faculties *will^
not exist@*in=that case we called that University [is] composed |of|
Faculties@So that composition can be recognised as !a#special type
|of| a*n&aggregation@
University
Chancellor
# UniversityChanoellor* Chanoellor
o ------------- ■ N am e* String

< Property>
+ UniveristyChanoellor 0* Chanoellor

Faculty

U niv ersity *
♦ -----------
CollectionB ase

Chancellor

• N am e * String
Same w ay* as another example* you can say that* there [is] !a#
composite relationship in#between !a#KeyValuePairCollection *and%!a#
KeyValuePair@*the^two mutually depend on each other@
N et *and%Java uses *the^ Com posite relation {to] define their
Collections@I have seen Composition [is] being used *in=many other
ways too@ However *the^more important factor*that most people forget
*is] *the^life time factor@*the^life time |of| *the^two classes that has bond
with !a#composite relation mutually depend on each other@
If you take the@net Collection {to] understand this*there you have
*the^Collection Element define inside (it [is]*an^inner part*hence*called
^it*[is]composed of) *the^Collection*farcing *the^Element {to] get disposed
with *the^Collection@ If not*as *an^example*if you define *the^Collection
{and} it@ s Element {to] be independent* then *the^relationship would be
more |of| !a# type Aggregation* than !a#Composition@So *the^point is* if
Computer Software Languages *and%Graphics Design 55

you want {to]bind two classes with Composite relation*more accurate


way [is] {to] have !a# one define inside *the^ other class (making {it]!a#
protected or private class)@
This way you {are] allowing *the^outer class {to] fulfill {its] purpose*
while tying *the^lifetime |of| *the^inner class with *the^outer class@
So *in=summary*we can say that aggregation [is]!a#special kind
|of| a*n&association *and%composition [is] !a#special kind |of| *an^aggregation@
(Association#>Aggregation#>Composition)

ABSTRACTION *and%GENERALISATION
Abstraction [is] *an^emphasis on *the^idea* qualities *and%properties
rather than *the^particulars (a suppression |of| detail)@*the^importance
|of| abstraction [is] derived {from] {its] ability {to] hide irrelevant details
and+^ from**the^use |of| names {to] reference objects@Abstraction [is] essential
*in^t*he^construction |of| programmes@{it]places *the^emphasis on what *an&
object [is] or does rather than how {it] [is] represented or how {it] works@
Thus* {it] [is] *the^primary means |of| managing complexity *in= large
programmes@
While abstraction reduces complexity {by] hiding irrelevant detail*
generalisation reduces complexity {by] replacing multiple entities
w h ich perform sim ilar fu nction s w ith !a# sin g le con stru ct@
Generalisation [is]*the^broadening |of| application {to] encompass !a#larger
domain |of| objects |of| *the^ same or different type@Programming
languages provide generalisation through variables* parame#
terisation*generics *and%polymorphism@{it]places *the^emphasis on *the^
similarities between objects@Thus*{it]helps {to] manage complexity *by^
collecting individuals into groups *and%providing !a#representative
which can be used {to] specify any individual |of| *the^group@Abstraction
56 Computer Software Languages *and%Graphics Design

and generalisation {are] often used together@Abstracts {are] generalised


through parameterisation {to] provide greater utility@*in=paramete#
risation*one or more parts |of| *an^entity {are] replaced with !a#name which
*is] new {to] *the^ entity@*the^name [is] used as !a# parameter@When *the^
parameterised abstract [is] invoked*{it][is]invoked with !a#binding |of| *the^
parameter {to] *an^argument@
AN ABSTRACT CLASS
Abstract classes* which declared with *the^ abstract keyword*
cannot be instantiated@{it]can only be used as !a#super#class {for} other
classes that extend *the^abstract class@ Abstract class [is]*the^concept and+
implementation gets completed when {it][is]being realised {by]!a#subclass@
*in&addition {to] this !a#class can inherit only {from] one abstract class
(but !a#class may implement many interfaces) *and%must override all
^its*abstract m ethods/ properties *and%may override virtual m ethods/
p rop erties@Abstract classes {are] id eal w h en im p lem en tin g
frameworks@As *an^example* let@ s study *the^ abstract class named
LoggerBase below@Please carefully read *the^comments as {it] {will] help
you {to] understand *the^reasoning behind this code@
p u b lic a b s tra c t c la s s L o g g e rB a s e
{
/// <summary>
/ / / f i e l d [ i s ] p r i v a t e * so { i t ] i n t e n d {t o ] u s e i n s i d e *the^
c l a s s o n ly
/ / / </summary>
p r i v a t e l o g 4 n e t @IL o g lo g g e r = n u l l ~
/ / / <summary>
/ / / p r o t e c t e d * so { i t ] o n ly v i s i b l e { f o r } i n h e r i t e d c l a s s
/ / / </summary>
p ro te c te d L o g g e rB a s e ()
{
// *the^ p r i v a t e o b j e c t [is ] c r e a t e d i n s i d e *the^ c o n s t r u c t o r
lo g g e r = lo g 4 n e t @Lo g M an ag er@G e t L o g g e r ( t h i s @L o g P r e f i x ) ~
// *the^ a d d i t i o n a l i n i t i a l i s a t i o n [ is ] done im m e d ia t e ly
a fte r
l o g 4 n e t @C o n f i g @D O M C o n fig u r a t o r @C o n f i g u r e () ~
}
/ / / <summary>
/ / / When you d e f i n e *the^ p r o p e r t y a s a b s t r a c t *
/// { it ] f o r c e s *the^ i n h e r i t e d c l a s s {to] o v e r r id e *the^ L o g P r e f ix
/ / / S o * w i t h *the^ h e lp |o f| t h i s t e c h n i q u e *the^ lo g ca n be
m ade*
Computer Software Languages *and%Graphics Design 57

/ / / i n s i d e *the^ a b s t r a c t c l a s s i t s e l f * i r r e s p e c t i v e |of| *it^


o r ig in @
/ / / I f yo u s t u d y c a r e f u l l y yo u { w i l l ] f i n d !a# r e a s o n *for^
n o t { t o ] h a v e $s e t $ m ethod h e r e @
/ / / </summary>
p r o t e c t e d a b s t r a c t S y s t e m @T yp e L o g P r e f i x
{
g e t~
}
/ / / <summary>
/ / / S im p le lo g m e th o d *
/ / / w h ic h [ i s ] o n ly v i s i b l e { f o r } i n h e r i t e d c la s s e s
/ / / </summary>
/ / / <param name=$m e s s a g e $></param>
p ro te c te d v o id L o g E r ro r(s trin g m essag e)
{
if ( t h i s @l o g g e r @I s E r r o r E n a b l e d )
{
t h i s @l o g g e r @E r r o r ( m e s s a g e ) ~
}
}
/ / / <summary>
/ / / P u b l i c p r o p e r t i e s w h ic h e x p o s e s { t o ] i n h e r i t e d c l a s s
/ / / *and% a l l o t h e r c l a s s e s t h a t h a v e a c c e s s {t o ] i n h e r i t e d
c la s s
/ / / </summary>
p u b lic b o o l Is T h is L o g E r r o r
{
get
{
re tu rn t h i s @l o g g e r @I s E r r o r E n a b l e d ~
}
}
}
The idea |of| having this class as *an^abstract [is]{to]define !a#framework
^for*exception logging@ This class {will] allow all subclass {to] gain access
*to^a#!common exception logging module *and%{will] facilitate {to]easily replace
*the^logging library@{by]*the^time you define *the^LoggerBase*you wouldn@ t
have *an^idea about other modules |of| *the^ system@But you do have !a#
concept *in=mind *and%that is*if !a#class [is] going {to] log *an^exception*they
have {to]inherit *the^LoggerBase@*in=other word *the^LoggerBase provide !a#
framework {for} exception logging@Let@ s try {to] understand each line
|of| t*he^above code@
58 Computer Software Languages *and%Graphics Design

Like any other class**an^abstract class can contain fields* hence I


used !a#private field named logger declare *the^ILog interface |of| *the^
famous log4net library@ This {will] allow *the^Loggerbase class {to] control*
what {to] use*{for}logging*hence* {will] allow changing *the^source logger
library easily@
The access modifier |of| *the^ constructor |of| *the^ LoggerBase *is$
protected@*the^public constructor has no use when *the^class [is] |of| type
abstract@*the^abstract classes {are] not allowed {to] instantiate *the^class@
So I went {for}*the^protected constructor@*the^abstract property named
LogPrefix [is] *an^important one@{it]enforces *and%guarantees {to] have !a#
value {for} LogPrefix (LogPrefix uses {to] obtain *the^detail |of| *the^source
class* which *the^exception has occurred) {for} every subclass* before
they invoke !a#method {to] log *an^error@*the^method named LogError
*is]protected*hence*exposed {to] all subclasses@You {are] not allowed or
rather you cannot make {it]public*as any class*without inheriting *the^
LoggerBase cannot use {it] meaningfully@
Let@ s find out why *the^property named IsThisLogError [is] public@
^it*may be important/ useful {for}other associated classes |of| *an^inherited
class {to] know whether *the^associated member logs {its] errors or not@
Apart {from] these you can also have virtual methods defined *in=*an&
abstract c la ss@ *the^ virtual m ethod m ay have {its] default
implementation*{where}!a# subclass can override {it] when required@
All *and%all**the^important factor here [is]that all OOP concepts should
be used carefully with reasons*you should be able {to] logically explain*
why you make !a#property !a#public or !a#field !a#private or !a#class *an&
abstract@ Additionally*when architecting frameworks**the^OOP concepts
can be used {to] forcefully guide *the^system {to] be developed *in=*the^way
framework architect@ s wanted {it]{to]be architected initially@
AN INTERFACE
In summary *the^ Interface separates *the^ implementation and+
defines *the^structure**and%this concept [is] very useful *in=cases *where^
you need *the^implementation {to] be interchangeable@Apart {from] that
*an&interface [is] very useful w hen *the^ im plem entation changes
frequently@Some say you should define all classes *in= terms |of|
interfaces* but I think recommendation seems !a#bit extreme@
Interface can be used {to] define !a#generic template *and%then one
or more abstract classes {to] define partial implementations |of| *the^
interface@Interfaces just specify *the^ method declaration (implicitly
Computer Software Languages *and%Graphics Design 59

public *and%abstract) *and%can contain properties (which {are] also


implicitly public *and%abstract)@Interface definition begins with *the^
keyword interface@*an^interface like that |of| *an^abstract class cannot
be instantiated@ If !a#class that implements *an^interface does not define
all *the^methods |of| *the^interface*then {it]must be declared abstract
and+t*he^method definitions must be provided {by] *the^subclass that extends
*the^abstract class@*in=addition {to] this *an^interfaces can inherit other
interfaces@*the^ sample below {will] provide *an^ interface {for} our
LoggerBase abstract class@
p u b lic in t e r f a c e IL o g g e r
{
bool Is T h is L o g E r r o r { g e t~ }
}

THE DIFFERENCE BETWEEN !a#CLASS *and%*an^INTERFACE


In @ N e t/ C# !a#class can be defined {to] implement *an^interface and+
also {it]supports multiple implementations@ When !a#class implements
*an&interface**an^object |of| such class can be encapsulated inside *an&
interface@
If MyLogger [is]!a#class*which implements ILogger* there w e can
write
IL o g g e r lo g = new M y L o g g e r ( ) ~
A class *and%*an^interface {are] two different types (conceptually)@
Theoretically !a# class emphasis *the^ idea |of| encapsulation* while *an&
interface emphasis *the^idea |of| abstraction (by suppressing *the^details
|of| t*he^implementation)@*the^two poses !a#clear separation {from] one *to^
another@Therefore {it] [is] very difficult or rather impossible {to] have *an&
effective meaningful comparison between *the^two*but {it][is]very useful
{and} also meaningful {to]have !a#comparison between *an^interface *and%*an&
abstract class@
3

C o m p u te r G r a p h ic s D e s ig n

{and} S y s t e m

INTRODUCTION
CGI was first used *in=movies *in=1973**in=*the^science fiction film*
Westworld@*the^film was *the^story |of| !a#society *in=which humans *and%robots
were integrated*working *and%living together@{its]sequel*Futureworld (1976)
featured *the^first use |of| 3D wireframe imagery@*the^third film ever {to] use
this technology was Star Wars (1977)* designing *the^Death Star *and%*the^
targeting computers *in=*the^X#wings *and%*the^Millenium Falcon*Han Solo@ s
ship@ Later on**the^Black Hole (1979) used raster wire#frame model rendering
^to*create !a#black hole onscreen@That same year*James Cameron@ s Alien
used *the^raster wireframe model {to]render *the^image |of| navigation monitors
*in&*the^scene{where}*the^ spaceship follows !a#beacon {for} landing guidance@
Long before this*computer engineers {at]MIT *and%Cornell were *in=*the^midst
|of| creating *the^very basics that eventually enabled these filmmakers *to^
utilize computer animation technology@{it]all began *in=1963@
1960s
• 1963* Ivan Sutherland presented his Ph@ D@dissertation**an&
interactive design on !a#vector graphics display monitor with !a#light
Computer Software Languages *and%Graphics Design 61

pen input device called Sketchpad@This instance [is] often credited as


*the^event that marks *the^beginning |of| computer graphics@
• Jack Bresenham develops !a# system |of| drawing lines *and%circles
on !a#raster device**and%Steve Coons introduces parametric surfaces
{and} computer#aided geometric design concepts@
• Arthur Appel {at] IBM introduces hidden surface *and%shadow
algorithms@
• The fast Fourier transform was discovered {by] J@W@Cooley and+
John Tukey* allowing computer engineers {to] better understand
signals {to] develop antialiasing techniques@
• Doug Englebart develops *the^mouse {at] Xerox PARC@
• Evans & Sutherland Corps@*and%GE start building flight simulators
with raster graphics@
1970s
• Rendering *and%!a# reflection m odel w ere discovered and+
developed {by] H @Gouraud *and% Bui Tuong Phong {at] *the^
University |of| Utah@
• Xerox PARC develops !a#$paint programme@ $
• Edward Catmull introduces parametric patch rendering* *the^ z#
buffer algorithm *and%texture mapping@
• Turner Whitted develops recursive ray tracing that would become
*the^standard {for} photorealism@
• Apple I *and%Apple II computers were *the^first commercially successful
options {for}personal computing@
• Arcade games Pong *and%Pac Man become popular@
1980s
• Microprocessors begin {to] take off but remain *in=early stages |of|
development@
• Loren Carpenter begins exploring fractals *in=computer graphics@
• Adobe formed {by] John Warnock*who discovers Postscript@Adobe
markets Photoshop@
• Steve Cook introduces stochastic sampling@
• Character animation becomes !a#goal {for} animators@
• Video arcade games take off@
• C++* C**and%MS#DOS programming gain popularity@
1990s
Shaded raster graphics appear *in=films@
62 Computer Software Languages *and%Graphics Design

• Computers have 24#bit raster display *and%hardware support *for^


Gouraud shading@
• Laser printers *and%single#frame video recorders become standard@
• Mosaic**the^first graphical internet browser [is] created@
• Dynamical systems that allowed programmers {to] animate
collisions* friction *and%cause *and%effects {are] introduced@
• Handheld computers {are] invented {at] Hewlett#Packard *and%zip
drives invented {at] Iomega@
• Nintendo 64 game console arrives on *the^market@
• Linux *and%open source software emerges@
• Pixar [is] first studio {to] fully embrace *an^ entirely computer
generated film with Toy Story@
2000s
• Graphic software reaches !a#peak *in=quality *and%user accessibility@
• PC displays support real#time texture mapping@
• Flatbed scanners*laser printers* digital video cameras*etc@*become
commonplace@
• Programme language moves towards Java *and%C++@
• 3D modeling captures facial expressions*human face* hair*water*
{and} other elements formerly difficult {to] render@
GRAPHICS SYSTEM
Let us consider *the^organization |of| !a#typical graphics system we
might use@As our initial emphasis {will] be on how *the^applications
programmer sees *the^system*w e shall omit details |of| *the^hardware@
The model [is] general enough {to] include workstations* personal
computers*terminals attached {to]!a#central time#shared computer* and+
sophisticated image#generation systems@*in=most ways* this block
diagram [is] that |of| !a#standard computer@
How each element [is] specialized {for} computer graphics *will^
characterize this diagram as one |of| !a# graphics system* rather than
one |of| !a#general#purpose computer@
Computer Software Languages *and%Graphics Design

Fig@*the^Graphic System

THE PROCESSOR
Within *the^processor box*two types |of| processing take place@*the^
first [is]picture formation processing@*in=this stage**the^user programme
or commands {are] processed@*the^picture [is] formed {from] *the^elements
(lines*text) available *in=*the^system using *the^desired attributes@Such
as line colour *and%text font@*the^ user interface [is] !a# part |of| this
processing@*the^picture can be specified *in=!a#number |of| ways* such
as through *an^interactive menu#controlled painting programme or
via !a#C programme using !a#graphics library@*the^physical processor
used *in=this stage [is] often *the^processor *in=*the^workstation or host
computer@
The second kind |of| processing [is] concerned with *the^display
|of| t*he^picture@*in=!a#raster system**the^specified primitives must be scan
converted@*the^screen must be refreshed {to] avoid flicker@Input
*from^th*e^user might require objects {to] be repositioned on *the^display@*the^
kind |of| processor best suited {for} these jobs [is] not *the^standard type
|of| processor found *in=most computers@Instead* special boards and+
chips {are] often used@As we have already noted*one |of| *the^elements
that distinguishes real#time graphics systems [is] their use |of| display
processors@Since we have agreed {to] stay {at] *the^block#diagram level
^for*now* however* we shall not explore these architectures *in=any
detail until later@
MEMORY
There {are] often two distinct types |of| memory em ployed *in^
graphics systems@{for} *the^processing |of| *the^ user programme* the
64 Computer Software Languages *and%Graphics Design

memory [is] similar {to] that |of| !a#standard computer* as *the^picture *is$
form ed {by] !a# standard type |of| arithmetic processing@D isplay
processing* however* requires high#speed display memory that can
be accessed {by] *the^display processor*and**in=raster systems*memory
^for**the^frame buffer@This display memory usually [is] different *in=both
^its*physical characteristics *and%{its] organization {from] what [is] used
*by^t*he^picture processor@{at] this point* we need not consider details |of|
how memory can be organized@You should be aware that *the^way
*the^internals |of| our processor *and%memory boxes {are] organized
distinguishes !a# slow system {from] !a# real#time picture#generating
system * such as !a# flight simulator@H owever* {from] our present
perspective*we shall emphasize that all implementations have {to] do
*the^same kinds |of| tasks {to] produce output@
OUTPUT DEVICES
Our basic system has one or more output devices@As raster
displays {are] *the^ dominant type* we shall assume there [is] !a#raster#
scan CRT on our system@We shall consider *the^frame buffer {to] be
part |of| *the^ display memory@*in=!a#self#contained system such as !a#
workstation* *the^ display [is] *an^integral part |of| *the^ system* so *the^
transfer |of| information {from] *the^processor {to] *the^display {will] happen
rapidly@When *the^ display [is] separate* such as w ith !a# graphics
terminal**the^speed |of| *the^connection [is]much slower@ Terminals with
raster displays usually must have their own frame buffers* so *the^
displays can be refreshed locally@*in=our simple system* we might
also have other displays* such as !a#plotter* {to] allow us {to] produce
hardcopy@
INPUT DEVICES
A simple system may have only !a#keyboard {to] provide whatever
input [is] necessary@Keyboards provide digital codes corresponding
^to*sequences |of| keystrokes {by] !a# user@These sequences {are] usually
interpreted as codes {for} characters@ If individual keystrokes or groups
|of| keystrokes {are] interpreted as graphical input**the^keyborad can be
used as !a# complex input device@{for} example* *the^ $arrow$ keys
available on most keyboards can be used {to] direct *the^movement
|of|a#!cursor on *the^screen@Most graphics systems {will] provide {at] least
one other input device@*the^most common {are]*the^mouse**the^lightpen*
*the^joystick* *and%*the^data tablet@Each can provide positional
Computer Software Languages *and%Graphics Design 65

information {to] *the^system *and%each usually [is] equipped with one or


more buttons {to] provide signals {to] *the^ p rocessor@{from] *the^
programmer@ s perspective*there {are] numerous important issues with
regard {to] *the^input *and%output devices@We must consider how *the^
programme can communicate with these devices@We must decide
what kinds |of| input *and%output can be produced@We {will] be
interested *in=how {to] control multiple devices* so that w e can choose
!a#particular device {for} our input**and%can direct our output {to] some
group |of| *the^available output devices@

HISTORICAL BACKGROUND
|of| COMPUTER GRAPHICS
Today there {are] very few aspects |of| our lives not affected *by^
computers@Practically every cash or monetary transaction that takes
place daily involves !a#computer@*in=many cases**the^same [is] true |of|
com puter graphics@W hether you see them on telev isio n **in^
newspapers**in=weather reports or while {at] *the^ doctor@ s surgery*
computer images {are] all around you@
$A picture [is] worth !a#thousand words$[is]!a#well#known saying* and+
highlights *the^advantages *and%benefits |of| *the^visual presentation |of|
our data@We {are] able {to] obtain !a#comprehensive overall view |of| our
data *and%also study features *and%areas |of| particular interest@
A w ell#chosen graph [is] able {to] transform !a# complex table |of|
numbers into meaningful results@Such graphs {are] used {to] illustrate
papers* reports* *and%theses* as w ell as providing *the^ basis *for^
p resen tation m aterial *in= *the^ form |o f| slid es *and% overhead
transparencies@!a#range |of| tools *and%facilities {are] available {to] enable
users {to] visualise their data**and%this document provides !a# brief
summary *and%overview @Computer graphics {are] used *in= many
disciplines *and%subjects but {for}*the^purpose |of| this document*we *will^
split *the^topic |of| computer graphics into *the^following fields*
CHARTING
One |of| *the^prime uses {for} graphical software {at] *the^University
*is$t^
o*produce graphs *and%charts@Everyone has data |of| one kind or
another*whether on paper**in=*the^computer* or just *in=*the^mind@We
often need {to] know *the^significance *and%properties |of| *the^data* or *to^
be able {to] compare different parts |of| {it] against other data sets@
66 Computer Software Languages *and%Graphics Design

One |of| *the^simplest aspects |of| data display [is] *the^production |of|
charts@ This [is]{where}you would want {to]put your data into !a#graphical
form {to] show relationships *and%comparisons between sets |of| values@
There may be !a#number |of| reasons w hy you would want {to] pu t your
data into !a#chart*
• To illustrate differences between different sets |of| data*
• To show trends between two variables*
• To show patterns |of| behaviour *in=one variable@
There {are] basically two broad areas |of| graphs*
• Presentation charts *and%graphs |of| *the^ kind used {to] illustrate !a#
few principal points@We see these on news *and%current affairs
programmes on television@!a#bar chart or !a#pie chart [is] used *to^
indicate results |of| data obtained so far *and%*the^general trends@
They {are] often liberally decorated with bright colours {to] increase
their visual appeal *and%attractiveness {to] *the^viewers *and%{to] hold
their attention@They {are] used {for} visual impact *and%getting !a#
simple point over clearly *and%effectively@
• Scientific charts *and%graphs {are] more concerned with ensuring
that *the^detail *in=*the^data [is] represented accurately *and%faithfully@
We may have some results obtained {from] experim ental
measurements *and%wish {to] display them@We may want *to^
compare *the^results {from] *the^ data measurements with *the^results
we would expect according {to] !a#particular theoretical model@We
may want {to] draw !a#curve through *the^data points (i@ e@interpolate
*the^data) *and%display this along with *the^original points@
The aims |of| *the^ two {are] different**and%so *the^facilities you *will^
want {from] your charting package {will] also be different@Presentation
charting has more {to] do with impressive presentation graphics *where^
*the^aim [is] {to] put !a#salient point across {to]*an^audience@As !a#result *the^
priority w ith this sort |of| charting [is] not alw ays accuracy |of|
representation@You want charts with strong colours**an^impressive
look *and%special effects@*the^effect |of| !a#presentation can be enhanced
^by*u sin g 3D graphs* adding pictures {to] *the^ graph* or usin g
pictograms@ These sorts |of| charts {are] rarely produced *in=isolation but
as part |of| !a# general presentation@Therefore* some presentation
packages also have their own charting module {for}this purpose@ Word
{and} PowerPoint use !a#module called Microsoft Graph *and%Excel@ s
charting module has some very powerful presentation graphics
features@Origin *and%Gsharp*both dedicated charting packages* also
provide professional presentation charting facilities on *the^ PC
Computer Software Languages *and%Graphics Design 67

systems@Gsharp [is] also available on *the^UNIX systems@*in=scientific


charting you want {to] display data as accurately as possible *in=order
^to*analyse {it] graphically or demonstrate clearly your comparisons
{and} results@As this sort |of| charting [is] done mainly {for} analysis*{it]*is$
rarely *an^ isolated activity but [is] often done alongside detailed
numerical analysis |of| your data@Two |of| *the^most powerful charting
packages available {are] Origin on *the^PC network *and%Gsharp on *the^
PC *and%UNIX systems@ Also*many numerical analysis packages have
their own charting modules integrated with *the^rest |of| *the^package@
It [is] clear that your choice |of| charting programme {will] depend
very much on what purpose you want *the^chart {to] fulfil**and%also
what other programmes you {are] already using@On *the^whole*if you
^are*already using !a#programme that has {its] own charting module*
use that@*the^table below gives some rough guidelines on your choice
|of| charting PC package*with *the^packages increasing *in=facilities and+
complexity going down *the^table@
Requirement Choice
Simple bar* column* line or Microsoft Graph *in=Word*
pie charts {to] integrate *in=a Charting Module *in=Excel
word processor
Charts {for}use in Microsoft Graph *in=Word or
a presentation PowerPoint* Charting Module *in=Excel*
Origin
Raw data requiring good quality Origin* Gsharp
scientific charting
Data requiring simple Charting Module *in=Excel*
mathematical or statistical Origin* Gsharp
analysis
Complicated statistical analysis Graphics module *in=SPSS
and good quality scientific charts

PRESENTATIONS
Presentation softw are [is] used {to] create m aterial used *in^
presentations*such as OHP transparencies *and%35mm slides@*the^term
*is]also commonly used when !a#presentation [is] given using *the^output
^from*!a#computer screen@*the^use |of| presentation software [is]becoming
|of| increasing importance as higher standards become expected *in^
courses *and%presentations@This {will] often include making use |of|
colour* graphics *and%*the^University logo@
Course materials produced using presentation packages can be
delivered *in=!a#number |of| w ays@*the^simplest way [is] {to] print the
Computer Software Languages *and%Graphics Design

material on !a#laser printer *and%then use !a#photocopier {to] produce


overhead projector (OHP) acetates (first making sure that *the^
photocopier can accept acetates)@ You can also use *the^output services
produced {by] Information Systems Services *and%University Media
Services {to] produce colour output or output on 35mm slides@
Alternatively you can give !a# desktop presentation using OHP
projection tablets or projection systems {to] deliver !a#presentation using
*the^ outpu t {from] !a# com puter system d irectly @*the^ sim p lest
presentation software [is]!a#word processor@ Word processing packages
such as Word* which can produce text *in=!a#variety |of| sizes* can be
used {to] create OHP transparencies@
Specialist presentation packages* such as PowerPoint*provide !a#
wider range |of| facilities than word processors and**in=general**are^
easier {to] use {for}*the^production |of| presentation materials@PowerPoint
*is]!a#presentation software programme that helps you quickly and+
easily create professional quality presentations@
Presentations can be transferred onto paper* overheads or
35mm slides* or they can be shown on !a#video screen or computer
m onitor@PowerPoint@ s printing options include formats ranging
^from* audience handouts {to] speaker@ s notes@

DRAWING*PAINTING *and%DESIGN
Drawing *and%painting software [is] available on most platforms
*at^t*he^U niversity@H ow ever* there {are] many differences betw een
software intended primarily {for} drawing *and%that intended *for^
painting@Drawing software {will] provide *the^ user w ith !a# set
|of|entities@
@ used {to]construct *the^drawing (an entity [is]!a#drawing element
such as !a#line*circle* or text string)@Drawing entities can range *from^
simple lines* points *and%curves *in=2D {to] their equivalents *in=3D and+
may include 3D surfaces@Advanced versions |of| drawing packages
used {for} design {are] referred {to] as Computer Aided Design (CAD)
systems@Painting software tends {to] work on !a#conceptually lower
layer@ Whilst {it]may provide some entities {for} constructing geometric
shapes (these tend {to] be 2D geometric shapes)*!a#painting package
^will* also provide control over individual pixels *in=*the^image* i@ e@*it^
provides direct control over *the^bitmap@{it][is]worth remembering that
opening any image *in=!a#painting package causes {it] {to] become
pixelated@
Computer Software Languages *and%Graphics Design 69

The following packages {are] available on *the^ISS N T Cluster Desktop*


• Paint Very basic painting programme@Can create simple pictures
{and} edit bitmaps@Only possible {to] read *in=*and%save files *in=!a#
BMP format@
• Picture Publisher Painting package used {to] edit *and%create
pictures@Can read *in=*and%save files *in=!a#number |of| different
formats@
• Paint Shop Pro Recommended as *the^main painting package on
*the^desktop@Used {to] edit *and%create pictures@Can read *in=and+
save files *in=!a#number |of| different formats@
• CorelDraw Recommended as *the^ main drawing package on *the^
desktop@Useful {for} editing vector graphics@ Can read *in=*and%save
files *in=both vector *and%bitmap formats@
• Micrografx Designer Drawing package used {for} technical drawing@
The following drawing *and%painting software [is] available on *the^Suns*
• Island Paint Painting programme that provides tools {for} creating
{and} editing images formed {by] monochrome *and%colour bitmaps@
Several painting tools can be used {to] create geometric *and%freehand
shapes@Scanned images *and%clip art can also be imported@
• Island Draw 2D drawing package@
• Island Paint General purpose CAD system *in=use *in=engineering*
{and} allows 3D solid modelling as well as 2D/3D draughting@*an&
extension* AEC* {for} architectural *and%construction applications*
*is]also available@
COMPUTER AIDED DESIGN *and%DRAWING
CAD system s p rovid e draw ing en tities w ith p ow erfu l
construction*editing *and%database techniques@CAD data can also be
output *and%read *in={by] other applications software {for} analysing *the^
CAD model@{for}example*!a#CAD system could be used {to] generate
!a#3D model which could then be read into !a#finite element analysis
package@!a#common requirement *in=engineering design [is]{to]produce
!a#drawing which [is] !a#schematic layout |of| components**and%which
accurately reflects *the^relative sizes *and%relationships |of| these parts@
Engineering drawing *and%draughting [is]!a#specialist area with {its] own
set |of| procedures *and%practices which have become de facto standards
*in&*the^engineering industry@ Manual methods {are] now being replaced
^by*computer#assisted methods**and%*the^software that [is]used {to] enable
these draw ings {to] be produced em bodies *the^ functions and+
capabilities that {are] required@
70 Computer Software Languages *and%Graphics Design

CAD applications {are] very powerful tools that can be used {by]!a#
designer@*the^speed *and%ease with which !a#drawing can be prepared
{and} modified using !a#computer have !a#tremendous advantage over
hand#based drawing techniques@ CAD#based drawings can be created
very easily using *the^ drawing primitives made available {by] *the^
software (2D /3D lines* arcs* curves* 3D surfaces* text etc@ )@*the^
drawing can be shared {by] !a#number |of| designers over !a#computer
network who could all be specialists *in=particular design areas and+
located {at] different sites@CAD also allows drawings {to] be rapidly
edited *and%modified* any number |of| times@
Drawings can also be linked into databases that could hold
material specifications* material costs etc@ * thereby providing !a#
comprehensive surveillance {from] design through {to] manufacturing@
*in&engineering applications*CAD system specifications can be passed
through {to] numerically controlled (NC) machines {to] manufacture
parts directly@
For creating three#dimensional objects* most CAD systems *will^
provide 3D primitives (such as boundary representations |of| spheres*
cubes* surfaces |of| revolution *and%surface patches)@They may also
provide !a# solid m odelling facility through Constructive Solid
Geometry (CSG)@Using CSG*basic 3D solids (usually cubes*spheres*
wedges* cones* cylinders *and%tori) more complex composite solids
can be created using three basic operations*joining (union) solids*
removing (subtraction) solids *and%finding *the^ common volume
(intersection) |of| solids@With solid modelling*mass properties |of| solids
(e@ g @moments |of| inertia* principal moments etc@ ) can be quickly
calculated@
There [is] virtually no limit {to] *the^kind |of| drawings *and%models
that can be prepared using !a#CAD system*if {it]can be created {by] hand*
!a#CAD system {will] allow {it] {to] be drawn *and%modelled@Some |of| *the^
applications{where}CAD [is] used are*architectural *and%interior design*
almost all engineering disciplines (e@ g @electronic* chemical* civil*
mechanical* automotive *and%aerospace)* presentation drawings*
topographic maps* musical scores* technical illustration* company
logos *and%line drawing {for} fine art@
Most CAD models can be enhanced {for} further understanding
{and} presentation {by] *the^ use |of| advanced rendering animation
techniques (by adding material specifications* light sources and
Computer Software Languages *and%Graphics Design 71

camera motion paths {to] *the^model) {to] produce realistic images and+
interactive motion through *the^ m odel@AutoCad [is] *the^ primary
general purpose CAD system *in=use *in=engineering**and%allows 3D
solid modelling as well as 2D /3D draughting@*an^extension* AEC*
^for*architectural *and%construction applications*[is] also available@
SCIENTIFIC VISUALISATION
Scientific Visualisation [is] concerned with exploring data and+
information graphically # as !a# means |of| gaining insight into and+
understanding *the^data@{by]displaying multi#dimensional data *in=*an&
easily#understandable form on !a#2D screen*{it] enables insights into
3D *and%higher dimensional data *and%data sets that were not formerly
p o ssib le@*the^ difference betw een scientific visualisation and+
presentation graphics [is] that *the^latter [is] primarily concerned with
*the^communication |of| information *and%results that {are] already
understood@*in=scientific visualisation we {are] seeking {to] understand
*the^data@
The recent upsurge |of| interest *in=scientific visualisation has been
brought about principally {by] *the^ provision |of| powerful *and%high#
level tools coupled with *the^availability |of| powerful workstations*
excellent colour graphics**and%access {to] supercomputers if required@
This symbiosis provides !a# powerful *and%flexible environment *for^
visualising all kinds *and%quantities |of| data@
This was once regarded as *the^exclusive domain |of| expert system
{and} application programmers who could write *the^large programmes
required* incorporate *the^algorithms {for} *the^graphics* get rid |of| *the^
bugs *in=*the^resulting programme (a non#trivial *and%time#consuming
task)**and%then process *the^ data@Most |of| this now comes already
available @ off *the^ shelf@# all *the^ users have {to] do [is] activate {it] and+
plug *in=their data sets@
Visualisation tools range {from] lower#level presentation packages*
through turnkey graphics packages *and%libraries* {to] higher#level
application builders@*the^former {are] used {for} simple *and%modest
requirements on small {to] medium sized data sets *and%{are] often used
on PCs@*the^second take larger *and%more complex data sets *and%have
!a#variety |of| facilities {for} analysis *and%presentation |of| *the^data *in=two
{and} three dim ensions@*the^ latter enable users {to] specify their
requirements *in=terms |of| their application *and%@build@!a#customised
72 Computer Software Languages *and%Graphics Design

system out |of| pre#defined components supplied {by] *the^software@This


can usually be done visually on *the^screen *and%then *the^data can be
read in* processed *and%view ed@You can interact with {it] {by] changing
parameters or altering values@
Presentation Packages
Many spreadsheet packages {for} *the^ PC have *the^ facilities *for^
doing elementary 2D graphics* i@ e@{to] take !a#table |of| X* Y data and+
show {it]*in=visual form on X*Y axes@This enables us {to] see *the^overall
form |of| *the^ data much more easily than looking {at] *the^ table |of|
numbers@
It also enables us {to] identify any kinks or unusual features and+
even missing or incorrect data@These facilities {are] also available *in^
PC graphics packages such as Origin # this [is] menu#driven *and%allows
users {to] read *in=data *and%select *the^ options required without any
programming knowledge@
Turnkey Graphics Packages *and%Libraries
Turnkey graphics packages include *the^ Uniras interactive
m odules Unigraph* Unimap *and%Gsharp@Unigraph [is] used *for^
scientific graphing *and%charting *in=two *and%three dimensions@
Unimap
*is]used {for} mapping*contouring *and%surface drawing@ Gsharp [is] used
^for*both@All these programmes contain advanced facilities *for^
p ro cessin g data *and%{for} *the^ selectio n |of| curve *and%surface
requirements@ No programming knowledge or experience [is] required~
*the^user interacts with *the^modules via menus on *the^screen@
Application Builders
These {are] large systems which contain !a#wide variety |of| pre
defined functions *and%facilities@Building *an^application consists |of|
visually selecting *the^ iconised functions on *the^ screen* connecting
them together {by] @pipes@*and%then activating *the^network {to] read
*in^t*he^data *and%feed {it]through *the^interconnected modules@Many state#
of#the#art functions {for} graphics*imaging*rendering*interfacing and+
displaying {are] contained *in=*the^system@ Users can extend *the^functions
available {by] writing their own modules *and%adding them {to] *the^
system@
Examples |of| visualisation application builders {are] AVS/Express
{and} IRIS Explorer@A V S/E xpress [is] *an^ advanced interactive
Computer Software Languages *and%Graphics Design 73

visualisation environment {for} scientists *and%engineers@AVS/Express


supports geometric* image *and%volume datasets@Modules can be
dynamically added* connected *and%deleted@Modules have control
panels {for} interactive control |of| input parameters *in=*the^form |of| on
screen sliders* file browsers* dials *and%buttons@AVS/Express has !a#
w ide range |of| data input* filter* mapper *and%renderer m odules@
Examples |of| mappers include isosurfaces |of| !a#3D field*2D slices |of| !a#
3D data volume *and%3D meshes {from] 2D elevation datasets@ Multiple
visualisation techniques can be selected {to] suit *the^ problem being
studied@User#written programmes or subroutines *in=FORTRAN or
C can be easily converted into AVS/Express modules which can then
be integrated into networks using *the^network editor@
IRIS Explorer provides similar visualisation *and%analysis
functionality@With IRIS Explorer* users view data *and%create
applications {by] visually connecting software modules into flow chart
configurations called module maps@Modules**the^building blocks |of|
IRIS Explorer* perform specific programme functions such as data
reading* data analysis* image processing* geometric *and%volume
rendering *and%many other tasks@
DESKTOP MAPPING *and%GIS
Graphs which {are] maps* or have !a#cartographic component*
*are^a#!special case |of| !a#2D graph which requires some special techniques@
Many people who {are] not geographers require this form |of| graph@
Mapping *and%GIS {are] two areas that benefit greatly {from] computer
processing |of| images@
It has been estimated that 85% |of| all *the^ information used *by^
private *and%public sector organisations contains som e sort |of|
geographic element such as street addresses*cities*states*postcodes
or even telephone numbers with area codes@ Any |of| these geographic
components can be used {to] help visualise *and%summarise *the^data
on !a#map display* enabling you {to] see patterns *and%relationships
*in^t*he^data quickly *and%easily@
MapInfo Professional [is]!a#comprehensive desktop mapping tool*
available on *the^PC network*that enables you {to] create maps*create
thematic maps*integrate tabular data onto maps* as well as perform
complex geographic analysis such as redistricting *and%buffering*
linking {to]your remote data*dragging *and%dropping map objects into
your applications**and%much more@!a#GIS (Geographical Information
74 Computer Software Languages *and%Graphics Design

System) [is] !a# system {for} sorting* m anipulating* analysing and+


displaying information w ith !a# significant spatial (map#related)
content@ArcView *and%ArcInfo {are] *the^two packages available *in=this
category@ArcView [is] !a# leading software package {for} GIS and+
mapping@
It gives you *the^power {to] visualise* explore* query *and%analyse
data geographically@ArcView also has three add#on packages #
Spatial* Network *and%3D Analyst # {for} more complicated queries@
ArcView [is] available on *the^ NT Cluster Desktop *and%on *the^ Sun
workstations@
ArcInfo [is] *an^advanced GIS that gives users |of| geographic data
one |of| *the^ best geoprocessing system s available {at] present@*it^
integrates *the^modern principles |of| software engineering* database
management *and%cartographic theory@Users {are] advised that this
*is$a#!very comprehensive GIS package *and%requires familiarity with and+
understanding |of| GIS concepts@ArcInfo [is] available on *the^ Sun
workstations@
SUBROUTINE LIBRARIES {for} GRAPHICS
Uniras *and%OpenGL {are] subroutine libraries which {are] available
^at*Leeds@*the^former [is] available on both *the^ Sun *and%*the^Silicon
Graphics workstations whilst *the^latter [is] only available on *the^Silicon
Graphics workstations@Both libraries have {at] least FORTRAN *and%C
bindings@This means that users have {to] embed their graphics
requirements into their own application programmes *and%write their
own programme code {to] do this@
In contrast* *the^interactive modules |of| Uniras (e@ g @Gsharp or
Unigraph) work entirely off data sets # you do not need {to] write !a#
programme@
If you have !a#pre#existing applications programme {for}which you
require graphical output*{it]may be easier just {to] produce !a#data file
^from**the^execution |of| this programme *and%then read this data file
into !a#software package@
It only becomes necessary {to] write your own programme (or
extend your existing programme {to] include calls {to] graphics library
routines) if you have {to] embed your graphics requirements {to] make
them *an^integral part |of| your application environment*or (in *the^case
|of| Uniras) you need *the^more advanced library functions which *are^
not available *in=*the^interactive modules@
Computer Software Languages *and%Graphics Design 75

Multimedia
There [is] joint provision {for} networked colour printing* graphics*
slides *and%video {by] Information Systems Services *and%*the^Print &
Copy Bureau@
On#line Services* Printers*Slide Makers *and%Scanners
A4 monochrome (black *and%white) *and%colour postscript printers
^are*available on *the^network@Users can send electronic picture and+
text information {for}direct output on {to]paper or OHP foil@
Additional
printing facilities {are] provided {by] Media Services{where}users can
also discuss converting draft electronic information into pre#designed
images with design staff@
Computer#Based Video Production
Data can be displayed or animated *in=real#time on !a#high#powered
workstation@However**the^audience [is] clearly limited {to] those who
can sit {at] *the^ w orkstation@{for} research sem inars* conference
presentations**and%grant proposals {it] [is] often more useful {to] be able
^to*record *the^real#time image sequences on video tape *and%present
them {to] *the^audience via !a#video player or video projector@{to]ensure
such presentations {are] effective* they have {to] be {at] !a#professional
standard |of| presentation@All |of| us have become unconsciously
accustom ed {to] !a# high quality |of| presentation {from] w atching
programmes on television@ Anything less than this immediately looks
inferior *and%can often reflect on *the^content |of| what [is]being presented@

SOFTWARE THAT CREATES


GRAPHIC ORGANIZERS
You probably have !a# lot |of| software on programmes on *the^
computer that you use that can create Graphic Organizers@
These include *the^Office Productivity Suite applications (Word
Processing* Spreadsheet**and%Presentation Programs)@If you use
Microsoft(TM) W indows* you probably have !a# low end drawing
programme called*$Paint@ $All these programmes can create Graphics
Organizers@
If you do not have this Office Suite* w e have included *an^Open
Source (Free) Office Suite called $Open Office@ $ This programme *is$
free {to] use *and%{to] share with others@Open Office applications also
76 Computer Software Languages *and%Graphics Design

can save your Graphic Organizer files *in=*the^PDF file format@If you
save Graphic Organizer files *in=*the^PDF format*you can share them
with everyone**and%*the^file {will] print exactly as you created it@
OPEN OFFICE (OPEN SOURCE)
The catch with sharing Graphic Organizers that {are] saved *in=*the^
PDF file format [is] that you cannot make changes {to] them without
expensive software@ However**the^viewer programme that opens and+
prints *the^files [is] free *and%most people who connect {to] *the^Internet
have *the^ Acrobat Reader programme@We have included *the^latest
version {to] save you {from] having {to] download {it] {from] *the^Internet@
SOFTWARE THAT [is] !a#GRAPHIC ORGANIZER
There {are] !a# lot |of| software products on *the^ market that *are^
Graphic Organizers@
The majority |of| these products call themselves*$Mind Mapping$
software@
The competition *in=this market [is]very strong*so all vendors seem
^to*offer free trials |of| their products@{it][is]possible that !a#teacher could
use !a#different trial version |of| these products each month**and%never
purchase !a#copy@
The only catch [is] that *the^ formats |of| *the^ various products *are^
proprietary@This means that you cannot open *the^ files you create
w ith another com p an y@ s p rod u ct@ Inspiration(TM ) and+
Kidspiration(TM) {are] products that fall into this category**and%these
products {are] often available *in= school districts@Inspiration and+
Kidspiration {are] easy {to] use*but low#end products@

GRAPHICS PIPELINE PERFORMANCE


Over *the^ past few years* *the^ hardware#accelerated rendering
pipeline has rapidly increased *in= com plexity* bringing w ith *it^
increasingly intricate *and%potentially confusing performance
characteristics@
Improving performance used {to] mean simply reducing *the^CPU
cycles |of| *the^inner loops *in=your renderer~now {it]has become !a#cycle
|of| determining bottlenecks *and%systematically attacking them@
This loop |of| identification *and%optim ization [is] fundamental *to^
tuning !a#heterogeneous multiprocessor system~*the^driving idea *is$
that !a#pipeline*{by] definition*[is]only as fast as {its] slowest stage@Thus*
Computer Software Languages *and%Graphics Design 77

while premature *and%unfocused optimization *in=!a#single#processor


sy stem can lead {to] on ly m in im al p erform ance g a in s**in=!a#
multiprocessor system such optimization very often leads {to] zero
gains@
W orking hard on graphics optim ization *and%seeing zero
performance improvement [is] no fun@*the^goal |of| this chapter [is]*to^
keep you {from] doing exactly that@
THE PIPELINE
The pipeline*{at] *the^very highest level* can be broken into two
parts**the^CPU *and%*the^GPU@ Although CPU optimization [is]!a#critical
part |of| optimizing your application* {it] {will] not be *the^ focus |of| this
chapter* because much |of| this optimization has little {to] do with *the^
graphics pipeline@
The GPU* there {are] !a# number |of| functional units operating *in^
p ara llel* w h ich essen tia lly act as separate sp e cia l#pu rpose
processors**and%!a#number |of| spots{where}!a# bottleneck can occur@
These include vertex *and%index fetching*vertex shading (transform
{and} lighting* or T&L)* fragment shading**and%raster operations
(ROP)@
Methodology
Optimization without proper bottleneck identification [is]*the^cause
|of| much wasted development effort**and%so we formalize *the^process
into *the^following fundamental identification *and%optimization loop*
1@ Identify *the^bottleneck@{for}each stage *in=*the^pipeline* vary either
^its*workload or {its] computational ability (that is* clock speed)@If
performance varies* you@ ve found !a#bottleneck@
2@ Optimize@Given *the^bottlenecked stage* reduce {its] workload until
performance stops improving or until you achieve your desired
level |of| performance@
3@ Repeat@Do steps 1 *and%2 again until *the^desired performance level
*is]reached@
LOCATING *the^ BOTTLENECK
Locating *the^bottleneck [is]half *the^battle *in=optimization*because
^it*enables you {to]make intelligent decisions about focusing your actual
optim ization efforts@!a#flow chart depicting *the^ series |of| steps
required {to] locate *the^ precise bottleneck *in=your application@Note
Computer Software Languages *and%Graphics Design

that we start {at] *the^back end |of| *the^ pipeline* with *the^frame#buffer
operations (also called raster operations) *and%end {at] *the^CPU@Note
also that while any single primitive (usually !a#triangle)*{by] definition*
has !a#single bottleneck*over *the^course |of| !a#frame *the^bottleneck most
likely changes@ Thus*modifying *the^workload on more than one stage
*in&*the^pipeline often influences performance@{for} example*!a#low#
polygon skybox [is] often bound {by] fragment shading or frame#buffer
access~!a#skinned mesh that maps {to] only !a#few pixels on screen *is$
often bound {by] CPU or vertex p rocessing@{for} this reason**it^
frequently helps {to]vary workloads on *an^object#by#object*or material#
by#material*basis@

Fig@
Bottleneck Flowchart
^for* each pipeline stage*we also mention *the^GPU clock {to] which
it@
s tied (that is* core or memory)@This information [is] useful *in^
conjunction with tools such as PowerStrip (EnTech Taiwan 2003)*
which allows you {to] reduce *the^ relevant clock speed *and%observe
performance changes *in=your application@
Raster Operations
The very back end |of| *the^pipeline*raster operations (often called
*the^ROP)*[is] responsible {for} reading *and%writing depth *and%stencil*
doing *the^depth *and%stencil comparisons*reading *and%writing colour*
{and} doing alpha blending *and%testing@As you can see* much |of| *the^
ROP workload taxes *the^available frame#buffer bandwidth@*the^best
way {to] test if your application [is] frame#buffer#bandwidth bound
*is$t^
o*vary *the^bit depths |of| *the^ colour or *the^depth buffers* or both@If
reducing your bit depth {from] 32#bit {to] 16#bit significantly improves
Computer Software Languages *and%Graphics Design 79

your performance* then you {are] definitely frame#buffer#bandwidth


bound@Frame#buffer bandwidth [is]!a#function |of| GPU memory clock*
so modifying memory clocks [is] another technique {for} helping *to^
identify this bottleneck@
Texture Bandwidth
Texture bandwidth [is] consumed any time !a#texture fetch request
goes out {to] memory@Although modern GPUs have texture caches
designed {to] minimize extraneous memory requests* they obviously
still occur *and%consume !a#fair amount |of| memory bandwidth@
Modifying texture formats can be trickier than modifying frame
buffer formats as w e did when inspecting *the^ ROP~ instead* we
recommend changing *the^ effective texture size {by] using !a# large
amount |of| positive mipmap level#of#detail (LOD) bias@This makes
texture fetches access very coarse levels |of| *the^ mipmap pyramid*
which effectively reduces *the^texture size@If this modification causes
performance {to] improve significantly* you {are] bound {by] texture
bandwidth@
Texture bandwidth [is] also !a#function |of| GPU memory clock@
Fragment Shading
Fragment shading refers {to] *the^ actual cost |of| generating !a#
fragment* with associated colour *and%depth values@This [is] *the^cost
|of| running *the^ $pixel shader$ or $fragment shader@$ Note that
fragment shading *and%frame#buffer bandwidth {are] often lumped
together under *the^heading fill rate* because both {are] !a#function |of|
screen resolution@H owever* they {are] two distinct stages *in=*the^
pipeline**and%being able {to] tell *the^ difference between *the^ two *is$
critical {to] effective optimization@
Before *the^advent |of| highly programmable fragment#processing
GPUs*{it] was rare {to] be bound {by] fragment shading@{it]was often
frame#buffer bandw idth that caused *the^ inevitable correlation
between screen resolution *and%performance@This pendulum [is] now
starting {to] sw ing towards fragment shading* how ever* as *the^
newfound flexibility enables developers {to] spend oodles |of| cycles
making fancy pixels@
The first step *in=determining if fragment shading [is]*the^bottleneck
*is]simply {to] change *the^resolution@Because w e@ ve already ruled out
frame#buffer bandwidth {by] trying different frame#buffer bit depths*
80 Computer Software Languages *and%Graphics Design

if adjusting resolution causes performance {to] change**the^culprit *is$


most likely fragment shading@!a#supplementary approach would be
^to*modify *the^length |of| your fragment programmes *and%see if this
influences performance@But be careful not {to] add instructions that
can easily be optimized away {by] !a#clever device driver@
Fragment#shading speed [is]!a#function |of| *the^GPU core clock@
Vertex Processing
The vertex transformation stage |of| *the^ rendering pipeline *is$
responsible {for} taking *an^input set |of| vertex attributes (such as model#
space positions*vertex normals* texture coordinates**and%so on) and+
producing !a#set |of| attributes suitable {for} clipping *and%rasterization
(such as homogeneous clip#space position* vertex lighting results*
texture coordinates**and%more)@Naturally*performance *in=this stage
*is]!a#function |of| *the^work done per vertex* along with *the^number |of|
vertices being processed@
With programmable transformations* determining if vertex
processing [is]your bottleneck [is]!a#simple matter |of| changing *the^length
|of| your vertex programme@If performance changes* you {are] vertex#
processing bound@
If you@ re adding instructions*be careful {to] add ones that actually
do meaningful work~ otherwise**the^instructions may be optimized
away {by] *the^compiler or *the^driver@{for}example*no#ops that refer *to^
constant registers (such as adding !a#constant register that has !a#value
|of| zero) often cannot be optimized away because *the^driver usually
doesn@ t know *the^value |of| !a#constant {at] programme#compile time@
If you@ re using fixed#function transformations*it@ s !a#little trickier@
Try modifying *the^load {by] changing vertex work such as specular
lighting or texture#coordinate generation state@Vertex processing
speed [is]!a#function |of| *the^GPU core clock@
Vertex *and%Index Transfer
Vertices *and%indices {are] fetched {by] *the^GPU as *the^first step
*in^t*he^GPU part |of| *the^pipeline@*the^performance |of| vertex *and%index
fetching can vary depending on{where}*the^ actual vertices *and%indices
^are*placed@ They {are] usually either *in=system memory $ which means
they {will] be transferred {to] *the^GPU over !a#bus such as AGP or PCI
Express $ or *in=local frame#buffer memory@Often* on PC platforms
especially* this decision [is] left up {to] *the^device driver instead |of| the
Computer Software Languages *and%Graphics Design 81

application* although modern graphics APIs allow applications *to^


provide usage hints {to] help *the^ driver choose *the^ correct memory
type@
Determining if vertex or index fetching [is] !a#bottleneck *in=your
application entails modifying *the^vertex format size@
Vertex *and%index fetching performance [is]!a#function |of| *the^AGP/
PCI Express rate if *the^data [is]placed *in=system memory~it@ s !a#function
|of| *the^memory clock if data [is] placed *in=local frame#buffer memory@
If none |of| these tests influences your performance significantly*
you {are] prim arily CPU b o u n d @You may verify this fact *by^
underclocking your CPU*if performance varies proportionally*you
^are*CPU bound@
OPTIMIZATION
Now that w e have identified *the^bottleneck* w e must optimize
that particular stage {to] improve application performance@*the^
following tips {are] categorized {by] offending stage@
Optimizing on *the^CPU
Many applications {are] CPU bound$ sometimes {for} good reason*
such as complex physics or AI**and%sometimes because |of| poor
batching or resource m anagem ent@If y o u @ ve found that your
application [is] CPU bound* try *the^following suggestions {to] reduce
CPU work *in=*the^rendering pipeline@
Reduce Resource Locking
Anytime you perform !a# synchronous operation that demands
access {to]!a#GPU resource*there [is] *the^potential {to] massively stall *the^
GPU pipeline* which costs both CPU *and%GPU cycles@CPU cycles
^are*wasted because *the^CPU must sit *and%spin *in=!a#loop*waiting
*for^t*he^(very deep) GPU pipeline {to] idle *and%return *the^ requested
resource@GPU cycles {are] then wasted as *the^ pipeline sits idle and+
has {to] refill@
This locking can occur anytime you
• Lock or read {from] !a# surface you were previously rendering to
• Write {to]!a#surface *the^GPU [is] reading from* such as !a#texture or !a#
vertex buffer@
In general* you should avoid accessing !a#resource *the^ GPU *is$
using during rendering@
82 Computer Software Languages *and%Graphics Design

Maximize Batch Size


We can also call this tip $Minimize *the^Number |of| Batches@$!a#
batch [is] !a#group |of| primitives rendered with !a#single API rendering
call (for example* DrawIndexedPrimitive *in=DirectX 9)@*the^size |of| !a#
batch [is] *the^number |of| primitives {it] contains@
As !a# wise man once said* $Batch* Batch* Batch$$@Every API
function call {to] draw geometry has *an^ associated CPU cost* so
maximizing *the^number |of| triangles submitted with every draw call
^will* minimize *the^CPU work done {for} !a#given number |of| triangles
rendered@
Some tips {to] maximize *the^size |of| your batches*
• If using triangle strips* use degenerate triangles {to] stitch together
disjoint strips@This {will] enable you {to] send multiple strips*
provided that they share material**in=!a#single draw call@
• Use texture pages@Batches {are] frequently broken when different
objects use different textures@{by] arranging many textures into !a#
single 2D texture *and% setting your texture coordinates
appropriately* you can send geometry that uses multiple textures
*in&!a#single draw call@Note that this technique can have issues
with mipmapping *and%antialiasing@One technique that sidesteps
many |of| these issues [is] {to] pack individual 2D textures into each
face |of| !a#cube map@
• Use GPU shader branching {to] increase batch size@Modern GPUs
have flexible vertex# *and%fragment#processing pipelines that
allow {for} branching inside *the^ shader@{for} example* if two
batches {are] separate because one requires !a#four#bone skinning
vertex shader *and%*the^other requires !a#two#bone skinning vertex
shader* you could instead write !a#vertex shader that loops over
*the^number |of| bones required* accumulating blending weights*
{and} then breaks out |of| *the^ loop when *the^weights sum {to] one@
This way* *the^ two batches could be combined into one@On
architectures that don@ t support shader branching* similar
functionality can be implemented*{at] *the^cost |of| shader cycles*
^by*using !a# four#bone vertex shader on everything *and%simply
zeroing out *the^ bone weights on vertices that have fewer than
four bone influences@
• Use *the^ vertex shader constant memory as !a# lookup table |of|
matrices@Often batches get broken when many small objects share
all material properties but differ only *in=matrix state (for example*
!a#forest |of| similar trees* or !a#particle system)@*in=these cases* you
Computer Software Languages *and%Graphics Design 83

can load n |of| *the^differing matrices into *the^vertex shader constant


memory *and%store indices into *the^constant memory *in=*the^vertex
format {for} each object@Then you would use this index {to] look up
into *the^constant memory *in=*the^vertex shader *and%use *the^correct
transformation matrix*thus rendering n objects {at] once@
• Defer decisions as far down *in=*the^pipeline as possible@It@ s faster
^to*use *the^alpha channel |of| your texture as !a#gloss factor* rather
than break *the^batch {to] set !a#pixel shader constant {for} glossiness@
Similarly* putting shading data *in=your textures *and%vertices can
allow {for} larger batch submissions@
Reducing *the^Cost |of| Vertex Transfer
Vertex transfer [is] rarely *the^bottleneck *in=*an^application*but it@
s
certainly not impossible {for} {it] {to] happen@
I f *the^transfer |of| vertices or* less likely* indices [is] *the^bottleneck *in=your
application* try *the^following*
• Use *the^ fewest possible bytes *in=your vertex format@Don@ t use
floats {for} everything if bytes would suffice (for colours**for^
example)@
• Generate potentially derivable vertex attributes inside *the^vertex
programme instead |of| storing them inside *the^input vertex format@
^for*example* there@ s often no need {to] store !a#tangent* binormal*
{and} normal* given any two* *the^ third can be derived using !a#
simple cross product *in=*the^vertex programme@This technique
trades vertex#processing speed {for} vertex transfer rate@
• Use 16#bit indices instead |of| 32#bit indices@16#bit indices *are^
cheaper {to] fetch* {are] cheaper {to] move around* *and%take less
memory@
• Access vertex data *in=!a#relatively sequential manner@Modern
GPUs cache memory accesses when fetching vertices@As *in=any
memory hierarchy* spatial locality |of| reference helps maximize
hits *in=*the^cache* thus reducing bandwidth requirements@
Optimizing Vertex Processing
Vertex processing [is] rarely *the^bottleneck on modern GPUs*but
^it*may occur*depending on your usage patterns *and%target hardware@
Try these suggestions if you@ re finding that vertex processing [is] *the^
bottleneck *in=your application*
• Optimize {for} *the^ post#T&L vertex cache@Modern GPUs have !a#
small first#in* first#out (FIFO) cache that stores *the^ result |of| *the^
most recently transformed vertices~!a#hit *in=this cache saves all
84 Computer Software Languages *and%Graphics Design

transform *and%lighting work* along with all work done earlier


*in^t*he^pipeline@{to] take advantage |of| this cache* you must use
indexed primitives**and%you must order your vertices {to] maximize
locality |of| reference over *the^ mesh@There {are] tools available$
including D3DX *and%NVTriStrip (NVIDIA 2003)$ that can help
you with this task@
• Reduce *the^ number |of| vertices processed@This [is] rarely *the^
fundamental issue*but using !a#simple level#of#detail scheme* such
as !a# set |of| static LODs* certainly helps reduce vertex#processing
load@
• Use vertex#processing LOD@Along with using LODs {for} *the^
number |of| vertices processed*try LODing *the^vertex computations
themselves@{for} example*{it] [is] likely unnecessary {to] do full four#
bone skinning on distant characters**and%you can probably get
away with cheaper approximations {for} *the^ lighting@If your
material [is] multipassed* reducing *the^number |of| passes {for} lower
LODs *in=*the^distance {will] also reduce vertex#processing cost@
• Pull out per#object computations onto *the^ CPU@Often*!a#
calculation that changes once per object or per frame [is] done
*in^t*he^vertex shader {for} convenience@{for} example* transforming !a#
directional light vector {to] eye space [is] sometimes done *in=*the^
vertex shader* although *the^result |of| *the^computation changes only
once per frame@
• Use *the^correct coordinate space@Frequently* choice |of| coordinate
space affects *the^ number |of| instructions required {to] compute !a#
value *in=*the^vertex programme@{for} example* when doing vertex
lighting* if your vertex normals {are] stored *in=object space *and%*the^
light vector [is] stored *in=eye space*then you {will] have {to] transform
one |of| *the^ two vectors *in=*the^vertex shader@If *the^ light vector
was instead transformed into object space once per object on *the^
CPU* no per#vertex transformation would be necessary* saving
GPU vertex instructions@
• Use vertex branching {to] $early#out$ |of| computations@If you *are^
looping over !a#number |of| lights *in=*the^vertex shader *and%doing
normal* low#dynamic#range* [0@ @1] lighting* you can check *for^
saturation {to] 1 $ or if you@ re facing away {from] *the^light$ and then
break out |of| further computations@!a#similar optimization can
occur with skinning*{where}you can break when your weights
sum {to] 1 (and therefore all subsequent weights would be 0)@Note
that this depends on how *the^GPU implements vertex branching*
{and} {it] isn@ t guaranteed {to] im prove performance on all
architectures@
Computer Software Languages *and%Graphics Design 85

Speeding Up Fragment Shading


I f you@ re using long *and%complex fragment shaders* {it] [is] often likely
that you@ re fragment#shading bound@I f so* try these suggestions*
• Render depth first@Rendering !a#depth#only (no#colour) pass before
rendering your primary shading passes can dramatically boost
performance* especially *in=scenes with high depth complexity**by^
reducing *the^amount |of| fragment shading *and%frame#buffer memory
access that needs {to] be performed@{to]get *the^full benefits |of| !a#depth#
only pass*it@ s not sufficient {to] just disable colour writes {to]*the^frame
buffer~ you should also disable all shading on fragments* even
shading that affects depth as well as colour (such as alpha test)@
• Help early#z optimizations throw away fragment processing@
Modern GPUs have silicon designed {to] avoid shading occluded
fragments*but these optimizations rely on knowledge |of| *the^scene
up {to] *the^ current point~ they can be improved dramatically *by^
rendering *in=!a#roughly front#to#back order@Also* laying down depth
first *in=!a#separate pass can help substantially speed up subsequent
passes (where all *the^ expensive shading [is] done) {by] effectively
reducing their shaded#depth complexity {to] 1@
• Store complex functions *in=textures@Textures can be enormously
useful as lookup tables**and%their results {are] filtered {for} free@*the^
canonical example here [is]!a#normalization cube map*which allows
you {to] normalize *an^arbitrary vector {at] high precision {for} *the^cost
|of| !a#single texture lookup@
• Move per#fragment work {to] *the^vertex shader@Just as per#object
work *in=*the^vertex shader should be moved {to] *the^CPU instead*
per#vertex computations (along with computations that can be
correctly linearly interpolated *in=screen space) should be moved
^to**the^vertex shader@Common examples include computing
vectors *and%transforming vectors between coordinate systems@
• Use *the^lowest precision necessary@APIs such as DirectX 9 allow
you {to] specify precision hints *in= fragment shader code *for^
quantities or calculations that can work with reduced precision@
Many GPUs can take advantage |of| these hints {to] reduce internal
precision *and%improve performance@
• Avoid excessive normalization@!a#common mistake [is] {to] get
$normalization#happy$* normalizing every single vector every step
|of| *the^ way when performing !a# calculation@Recognize which
transformations preserve length (such as transformations {by] *an&
orthonourmal basis) *and%which computations do not depend on
vector length (such as cube#map lookups)@
86 Computer Software Languages *and%Graphics Design

• Consider using fragment shader level |of| detail@Although {it] offers


less bang {for} *the^buck than vertex LOD (simply because objects
*in&*the^distance naturally LOD themselves with respect {to] pixel
processing* due {to] perspective)* reducing *the^ complexity |of| *the^
shaders *in=*the^distance**and%decreasing *the^number |of| passes over
!a#surface* can lessen *the^fragment#processing workload@
• Disable trilinear filtering{where}unnecessary@Trilinear filtering*
even when not consuming extra texture bandwidth* costs extra
cycles {to] compute *in=*the^fragment shader on most modern GPU
architectures@On textures{where}mip#level transitions {are] not
readily discernible* turn trilinear filtering off {to] save fill rate@
• Use *the^ simplest shader type possible@*in=both Direct3D and+
OpenGL*there {are]!a#number |of| different ways {to] shade fragments@
^for* example* *in=Direct3D 9* you can specify fragment shading
using**in=order |of| increasing complexity *and%power*texture#stage
states* pixel shaders version 1@ x (ps@ 1@1 # ps@ 1@ 4)* pixel shaders
version 2@ x@* or pixel shaders version 3@ 0@*in=general* you should
use *the^simplest shader type that allows you {to] create *the^intended
effect@*the^ simpler shader types offer !a# number |of| implicit
assumptions that often allow them {to] be compiled {to] faster native
pixel#processing code {by] *the^GPU driver@!a#nice side effect [is] that
these shaders would then work on !a#broader range |of| hardware@
Reducing Texture Bandwidth
If you@ ve found that you@re memory#bandwidth bound* but mostly when
fetching {from] textures* consider these optimizations*
• Reduce *the^size |of| your textures@Consider your target resolution
{and} texture coordinates@Do your users ever get {to] see your highest
mip level# If not* consider scaling back *the^size |of| your textures@
This can be especially helpful if overloaded frame#buffer memory
has forced texturing {to] occur {from] nonlocal memory (such as
system memory* over *the^ AGP or PCI Express bu s)@*the^
NVPerfHUD tool (NVIDIA 2003) can help diagnose this problem*
as {it] shows *the^ amount |of| memory allocated {by] *the^ driver *in^
various heaps@
• Compress all colour textures@All textures that {are] used just as
decals or detail textures should be compressed*using DXT1* DXT3*
orDXT5* depending on *the^specific texture@ s alpha needs@This step
^will* reduce memory usage* reduce texture bandwidth
requirements**and%improve texture cache efficiency@
• Avoid expensive texture formats if not necessary@Large texture
formats* such as 64#bit or 128#bit floating#point formats* obviously
Computer Software Languages *and%Graphics Design 87

cost much more bandwidth {to] fetch from@Use these only as


necessary@
• Always use mipmapping on any surface that may be minified@*in^
addition {to] improving quality {by] reducing texture aliasing*
mipmapping improves texture cache utilization {by] localizing
texture#memory access patterns {for} minified textures@If you find
that mipmapping on certain surfaces makes them look blurry*
avoid *the^ temptation {to] disable mipmapping or add !a# large
negative LOD bias@Prefer anisotropic filtering instead *and%adjust
*the^level |of| anisotropy per batch as appropriate@
Optimizing Frame#Buffer Bandwidth
The final stage *in=*the^pipeline* ROP* interfaces directly with *the^
frame#buffer memory *and%[is] *the^single largest consumer |of| frame
buffer bandwidth@{for} this reason* if bandwidth [is] *an^issue *in=your
application*{it]can often be traced {to] *the^ROP@
Here@ s how {to] optimize {for} frame#buffer bandwidth*
• Render depth first@This step reduces not only fragment#shading
cost* but also frame#buffer bandwidth cost@
• Reduce alpha blending@Note that alpha blending* with !a#
destination#blending factor set {to] anything other than 0* requires
both !a# read *and%!a#write {to] *the^ frame buffer* thus potentially
consuming double *the^bandwidth@Reserve alpha blending {for} only
those situations that require it**and%be wary |of| high levels |of| alpha#
blended depth complexity@
• Turn off depth writes when possible@Writing depth [is] *an&
additional consumer |of| bandwidth**and%{it] should be disabled *in^
multipass rendering (where *the^final depth [is] already *in=*the^depth
buffer)~ when rendering alpha#blended effects* such as particles~
{and} when rendering objects into shadow maps (in fact**for^
rendering into colour#based shadow maps*you can turn off depth
reads as well)@
• Avoid extraneous colour#buffer clears@If every pixel [is] guaranteed
^to*be overwritten *in=*the^frame buffer {by] your application*then avoid
clearing colour*because {it]costs precious bandwidth@Note*however*
that you should clear *the^depth *and%stencil buffers whenever you
can* because many early#z optimizations rely on *the^deterministic
contents |of| !a#cleared depth buffer@
• Render roughly front {to] back@*in=addition {to] *the^fragment#shading
advantages mention* there {are] similar benefits {for} frame#buffer
bandwidth@Early#z hardware optimizations can discard extraneous
Computer Software Languages *and%Graphics Design

frame#buffer reads *and%writes@*in=fact* even older hardware*which


lacks these optimizations* {will] benefit {from] this step*because more
fragments {will] fail *the^ depth test* resulting *in=fewer colour and+
depth writes {to] *the^frame buffer@
• Optimize skybox rendering@Skyboxes {are] often frame#buffer#
bandwidth bound* but you must decide how {to] optimize them*
(1) render them last* reading (but not writing) depth**and%allow
*the^early#z optimizations along with regular depth buffering *to^
save bandwidth~ or (2) render *the^ skybox first**and%disable all
depth reads *and%w rites@Which option {will] save you more
bandwidth [is]!a#function |of| *the^target hardware *and%how much
|of| t*he^skybox [is] visible *in=*the^final frame@If !a#large portion |of| *the^
skybox [is] obscured* *the^ first technique {will] likely be better~
otherwise**the^second one may save more bandwidth@
• Use floating#point frame buffers only when necessary@These
formats obviously consume much more bandwidth than smaller*
integer formats@*the^same applies {for} multiple render targets@
• Use !a#16#bit depth buffer when possible@Depth transactions {are]!a#
huge consumer |of| bandwidth* so using 16#bit instead |of| 32#bit
can be !a# giant win**and%16#bit [is] often enough {for} small#scale*
indoor scenes that don@ t require stencil@!a#16#bit depth buffer *is$
also often enough {for} render#to#texture effects that require depth*
such as dynamic cube maps@
• Use 16#bit colour when possible@This advice [is] especially
applicable {to] render#to#texture effects*because many |of| these* such
as dynamic cube maps *and%projected#colour shadow maps* work
just fine *in=16#bit colour@
As power *and%programmability increase *in=modern GPUs* so
does *the^complexity |of| extracting every bit |of| performance out |of| *the^
machine@ Whether your goal [is]{to]improve *the^performance |of| !a#slow
application or {to] look {for} areas{where}you can improve image quality
$for free*$!a#deep understanding |of| *the^inner workings |of| *the^graphics
pipeline [is] required@As *the^ GPU pipeline continues {to] evolve**the^
fundamental ideas |of| optimization {will] still apply*first identify *the^
bottleneck* {by] varying *the^load or *the^computational power |of| each
unit~ then system atically attack those bottlenecks* using your
understanding |of| how each pipeline unit behaves@
4

A lg o r ith m S o f t w a r e *in^

T e c h n o lo g y D e s ig n

OVERVIEW
Advanced distribution design *and%analysis software solutions
streamline *the^design |of| overhead *and%underground transmission and+
distribution lin es* optim ize designs {for} project cost* building
standards *and%system reliability**and%integrate seam lessly with
existing utility business systems {for} improved data accuracy and+
reliability throughout *the^utility@
LD#PRO
A powerful design solution {for} overhead *and%under#ground
electric distribution lines* gas distribution lines *and%joint use
applications@Capable |of| saving energy providers 15 {to] 20 Per cent
on materials *and%Labour* this application covers *the^ entire design
process@
LD#Pro [is] !a# p ow erfu l to o l {for} d esig n in g overhead and+
underground electric distribution lines* gas distribution lines and+
joint#use applications@LD#Pro integrates design data {from] multiple
sources *and%produces detailed* compliant designs@
90 Computer Software Languages *and%Graphics Design

Features & Benefits


Using LD#Pro {for} distribution line design [is] as easy as loading
your design criteria into *the^ system* hit optimize**and%watch *the^
system produce high#quality* consistent designs that {are] standards#
{and} code#compliant@Whether working *in=*the^field or *in=*the^office*
LD#Pro identifies *the^least#cost route *and%materials* sends *an^order
^to*your work m anagem ent application* updates GIS system s*
estimates building costs**and%produces detailed construction packets
on *the^spot@Ease |of| use *and%*the^ability {to] automate design tasks can
save you about 15 or 20 Per cent on materials *and%Labour@
When you use LD#Pro* you can*
• Design systems according {to] *the^standards you define *and%ensure
enterprise#wide compliance@
• Get more capacity out |of| existing infrastructure@
• Tackle overhead transmission lines* overhead *and%underground
distribution lines**and%gas distribution *and%transmission lines with
one tool@
• Interface with CAD* work management* materials management*
reporting**and%other systems@
• Consider alternate design scenarios quickly *and%easily@
• Eliminate redundant data entry@
LD#TRACK
Know{where}you@ re {at] *in=*the^LD#Pro design process with work
order tracking@Compare actuals {to] estimates *and%track projects with
this optional LD#Pro software tool@
LD#Track provides interactive *and%proactive feedback {to] LD#Pro
d esig n ers* en ablin g them {to] com pare d esign s {to] u tility #set
benchmarks and/or targets@Use LD#Track {to] compare costs* track
material usage**and%flag discrepancies {to] improve quality control@
Features & Benefits
LD#Track performs *the^necessary $checks *and%balances$ function
that allows !a#utility {to] track *and%measure how they {are] doing *in=their
design *and%cost control process using LD#Pro@
Use LD#Track {to] generate reports that track cost reductions*
standard material usage*comparison costs*design project status and+
company#wide savings using LD#Pro@
Computer Software Languages *and%Graphics Design 91

GREEDY ALGORITHM
Greedy algorithms {are] simple *and%straightforward@They *are^
shortsighted *in=their approach *in=*the^sense that they take decisions
on *the^basis |of| information {at]hand without worrying about *the^effect
these decisions may have *in=*the^future@They {are] easy {to] invent*easy
^to*implement *and%most |of| *the^ time quite efficient@Many problems
cannot be solved correctly {by] greedy approach@Greedy algorithms
^are*used {to] solve optimization problems
GREEDY APPROACH
Greedy Algorithm works {by] making *the^decision that seems most
promising {at]any moment~{it]never reconsiders this decision*whatever
situation may arise later@
As *an^example consider *the^problem |of| $Making Change$@
Coins available are*
• Dollars (100 cents)
• Quarters (25 cents)
• Dimes (10 cents)
• Nickels (5 cents)
• Pennies (1 cent)
Problem Make !a#change |of| !a# given amount using *the^ smallest
possible number |of| coins@
Informal Algorithm
• Start with nothing@
• At every stage without passing *the^given amount@
# Add *the^largest {to] *the^coins already chosen@
Formal Algorithm
Make change {for} n units using *the^least possible number |of| coins@
MAKE# CHANGE ( n)
C # {100* 2 5 * 10* 5 * 1 } / / c o n s t a n t @
Sol # {}~/ / s e t t h a t { w i l l ] h o l d *the^ s o l u t i o n
set@
Sum # 0 sum | o f | i te m *in= s o l u t i o n s e t
WHILE sum n o t = n
x = l a r g e s t i te m *in= s e t C su c h t h a t sum + x £
n
IF no s u c h ite m THEN
92 Computer Software Languages *and%Graphics Design

RETURN $No S o l u t i o n $
S # S {va l ue | o f | x}
sum # sum + x
RETURN S
Example Make !a#change {for} 2@89 (289 cents) here n = 2@89 *and%*the^
solution contains 2 dollars* 3 quarters* 1 dime *and%4 pennies@*the^
algorithm [is] greedy because {at] every stage {it]chooses *the^largest coin
w ithout worrying about *the^ consequences@Moreover* {it] never
changes {its] mind *in=*the^sense that once !a#coin has been included
*in^t*he^solution set*{it]remains there@
CHARACTERISTICS *and%FEATURES
To construct *the^solution *in=*an^optimal w ay@
Algorithm maintains
two sets@One contains chosen items *and%*the^other contains rejected
items@
The greedy algorithm consists |of| four (4) function*
• A function that checks whether chosen set |of| items provide !a#
solution@
• A function that checks *the^feasibility |of| !a#set@
• The selection function tells which |of| *the^ candidates [is] *the^ most
promising@
• An objective function*which does not appear explicitly* gives *the^
value |of| !a#solution@

STRUCTURE GREEDY ALGORITHM


• Initially *the^set |of| chosen items [is] empty i@
e@*solution set@
• At each step
# item {will] be added *in=!a#solution set {by] using selection function@
# IF *the^set would no longer be feasible
a) Reject items under consideration (and [is] never consider again)@
# ELSE IF set [is] still feasible THEN
a) Add *the^current item@
DEFINITIONS |of| FEASIBILITY
A feasible set (of candidates) [is] promising if {it]can be extended
^to*produce not merely !a#solution* but *an^optimal solution {to] *the^
problem@
In particular**the^empty set [is] always promising w hy# (because
*an&optimal solution always exists)
Computer Software Languages *and%Graphics Design 93

Unlike Dynamic Programmeming*which solves *the^subproblems


bottom#up* !a#greedy strategy usually progresses *in=!a#top#down
fashion* making one greedy choice after another* reducing each
problem {to] !a#smaller one@
Greedy#Choice Property
The $greedy#choice property$ *and%$optimal substructure$*are^
two ingredients *in=*the^problem that lend {to]!a#greedy strategy@
Greedy#Choice Property
It says that !a# globally optimal solution can be arrived {at] *by^
making !a#locally optimal choice@

SAMPLE PROBLEM
There [is] !a#long list |of| stalls* some |of| which need {to] be covered
with boards@ You can use up {to] N (1 ^ N ^ 50) boards*each |of| which
may cover any number |of| consecutive stalls@Cover all *the^necessary
stalls* while covering as few total stalls as possible@
THE IDEA
The basic idea behind greedy algorithms [is]{to]build large solutions
up {from] smaller ones@Unlike other approaches* however* greedy
algorithms keep only *the^best solution they find as they go along@ Thus*
^for**the^sample problem*{to] build *the^answer {for} N = 5* they find *the^
best solution {for} N = 4**and%then alter {it]{to]get !a#solution {for} N = 5@No
other solution {for}N = 4 [is]ever considered@ Greedy algorithms {are] fast*
generally linear {to] quadratic *and%require little extra m em ory@
Unfortunately* they usually aren@ t correct@But when they do work*
they {are] often easy {to] implement *and%fast enough {to] execute@
PROBLEMS
There {are] two basic problems {to] greedy algorithms@
How {to] Build
How does one create larger solutions {from] smaller ones#*in^
general* this [is] !a#function |of| *the^ problem@{for} *the^sample problem*
*the^most obvious way {to] go {from] four boards {to] five boards [is]*to^
pick !a#board *and%remove !a#section* thus creating two boards *from^
one@ You should choose {to] remove *the^largest section {from] any board
94 Computer Software Languages *and%Graphics Design

which covers only stalls which don@ t need covering (so as {to] minimize
*the^total number |of| stalls covered)@
To remove !a#section |of| covered stalls*take *the^board which spans
those stalls**and%make into two boards*one |of| which covers *the^stalls
before *the^section* one |of| which covers *the^stalls after *the^second@
WORK
The real challenge {for} *the^ Programmemer lies *in=*the^fact that
greedy solutions don@ t always work@Even if they seem {to] work
*for^t*he^sample input*random input**and%all *the^cases you can think of*if
there@ s !a#case{where}it w on@ t work*{at] least one (if not more$) |of| *the^
judges@test cases {will] be |of| that form@{for}*the^sample problem*{to] see
that *the^ greedy algorithm described above works* consider *the^
following* Assume that *the^ answer doesn@ t contain *the^ large gap
which *the^ algorithm removed* but does contain !a# gap which *is$
smaller@{by]combining *the^two boards {at] *the^end |of| *the^smaller gap
{and} splitting *the^board across *the^larger gap**an^answer [is] obtained
which uses as many boards as *the^original solution but which covers
fewer stalls@This new answer [is] better* so therefore *the^assumption
*is]wrong *and%w e should always choose {to] remove *the^largest gap@
If *the^answer doesn@ t contain this particular gap but does contain
another gap which [is] just as large* doing *the^ same transformation
yields *an^answer which uses as many boards *and%covers as many
stalls as *the^ other answer@This new answer [is] just as good as *the^
original solution but no better* so we may choose either@Thus* there
exists *an^optimal answer which contains *the^ large gap* so {at] each
step* there [is] always *an^optimal answer which [is] !a#superset |of| *the^
current state@Thus**the^final answer [is] optimal@
Algorithm
The sequence has three parts**the^part which {will] be 1 when *in^
sorted order* 2 when *in=sorted order**and%3 when *in=sorted order@
*the^ greedy algorithm swaps as many as possible |of| *the^1@ s *in=*the^2
part with 2@ s *in=*the^1 part* as many as possible 1@ s *in=*the^3 part with
3@ s *in=*the^1 part**and%2@ s *in=*the^3 part with 3@s *in=*the^2 part@
Once none |of| these types remains**the^remaining elements out |of|
place need {to] be rotated one way or *the^other *in=sets |of| 3@You can
optimally sort these {by] swapping all *the^1@ s into place *and%then all
*the^2@ s into place@
Computer Software Languages *and%Graphics Design 95

Analysis*Obviously*!a#swap can put {at]most two elements *in=place*


so all *the^swaps |of| *the^first type {are] optimal@Also*{it][is]clear that they
use different types |of| elements*so there [is] no $interference$ between
those types@
This means *the^ order does not matter@Once those swaps have
been performed**the^best you can do [is] two swaps {for} every three
elements not *in=*the^correct location* which [is] what *the^second part
^will* achieve (for example* all *the^1@ s {are] put *in=place but no others~
then all that remains {are] 2@ s *in=*the^3@
s place *and%vice#versa**and%which
can be swapped)@
Friendly Coins #!a#Counterexample [Abridged]
Given *the^denominations |of| coins {for}!a#newly founded country*
*the^Dairy Republic**and%some monetary amount* find *the^ smallest
set |of| coins that sum s {to] that am ount@*the^ Dairy Republic *is$
guaranteed {to] have !a#1 cent coin@
Algorithm * Take *the^ largest coin value that isn@ t more than *the^
goal *and%iterate on *the^total minus this value@
(Faulty) Analysis*Obviously*you@ d never want {to] take !a#smaller
coin value*as that would mean you@ d have {to] take more coins {to] make
up *the^difference* so this algorithm works@
Maybe not*Okay**the^algorithm usually works@*in=fact*{for}*the^U@ S@
coin system {1* 5*10* 25}*{it] always yields *the^optimal set@However*
^for*other sets*like {1*5*8*10} *and%!a#goal |of| 13*this greedy algorithm
would take one 10**and%then three 1@ s*{for}!a#total |of| four coins*when
*the^two coin solution {5* 8} also exists@
Topological Sort
G iven !a# collection |of| objects* along w ith som e ordering
constraints*such as $A must be before B*$ find *an^order |of| *the^objects
such that all *the^ordering constraints hold@
Algorithm*Create !a#directed graph over *the^objects*{where}there
*is]*an^arc {from] !a# {to] B if $A must be before B@ $ Make !a#pass through
*the^objects *in=arbitrary order@Each time you find *an^object with in
degree |of| 0*greedily place {it]on *the^end |of| *the^current ordering*delete
all |of| {its] out#arcs**and%recurse on {its] (former) children* performing
*the^same check@If this algorithm gets through all *the^objects without
putting every object *in=*the^ordering* there [is] no ordering which
satisfies *the^constraints@
96 Computer Software Languages *and%Graphics Design

SEQUENCE |of| OPERATIONS


Amortized analysis means analyzing time#averaged cost {for}!a#
sequence |of| operations@ Motivation [is]that traditional worst#case#per#
operation analysis can give overly pessimistic bound if *the^only way
|of| having *an^expensive operation [is]{to]have !a#lot |of| cheap ones before
it@
N ote*this [is] DIFFERENT {from] our usual notion |of| $average case
analysis$ $ w e@ re not making any assumptions about inputs being
chosen {at] random $ w e@ re just averaging over time@
The approach [is] going {to] be {to] somehow assign *an^artificial cost
^to*each operation *in=*the^sequence@This artificial cost [is] called *the^
_amortized cost_ |of| *an^ operation@*the^key property required |of|
amortized cost [is] that *the^total real cost |of| *the^ sequence should be
bounded {by] *the^total |of| *the^amortized costs |of| all *the^operations@
Then*
^for*purposes |of| analyzing *an^algorithm that* say* accesses !a# data
structure*{it][is]okay {to]just use *the^amortized cost instead |of| *the^actual
cost |of| *the^operation@This {will] give you correct results@
Note*There [is] sometimes flexibility *in=*the^assignment |of| amortized
costs@
There {are] going {to] be three approaches that we call*
The aggregate method *the^ banker@ s method (tokens *in=*the^data
structure) *the^physicist@ s method (potential functions) (The physicist@ s
method [is]just !a#slightly more formal version |of| *the^banker@ s method*
as w e@ll see@ )@
We@ ll illustrate these methods through some examples@
Example1*!a#binary counter@Say we want {to] store !a#big binary
counter *in=*an^array A *Start all entries {at]0@*the^operation we {are] going
^to*implement *and%Analyse [is] that |of| counting@
The algorithm w e@ ll use {for} incrementing this counter [is]*the^usual
one@We toggle bit A[0]@If {it]changed {from] 0 {to] 1* then we toggle bit
A[1]* etc@We stop when !a#bit changes {from] 0 {to] 1@*the^cost |of| *an&
increment [is] *the^number |of| bits that change@
A[m] A[m# 1 ] ................A[3] A[2] A[1] A[0] c o s t
0 0 0 0 0 01
0 0 0 0 0 12
0 0 0 0 1 01
0 0 0 0 1 13
0 0 0 1 0 01
Computer Software Languages *and%Graphics Design 97

0 0 0 1 0 1 2
0 0 0 1 1 0
The number |of| bits that change when *the^increment produces !a#
number n [is] {at] most 1+floor(lg n)@(That@ s just *the^number |of| bits
*in^t*he^binary representation |of| n@ ) Thus**in=!a#sequence |of| n increments*
worst#case cost per increment [is] bounded {by] n(1+floor(lg n)) = O(n
log n)@
But* what [is] our *amortized* cost per increment#
A nsw er* 2@
Proof 1 (aggregate method)*how often do we flip A[0]#
A nsw er* every time@how often do w e flip A[1]#
A nsw er* every other time@How often do w e flip A[2]#
A nsw er* every 4th time@Etc@So* total cost spent on flipping A[0]
*is]n* total cost |of| A[1] [is] floor(n/2)* total cost on A[2] [is] floor(n/4)*
etc@So**the^total cost is* total cost = n + floor(n/2) + floor(n/4) +@ @
@
total cost ^ n + n /2 + n /4 + n/8 +@ @@^ 2n
So *the^ total cost [is] 2n* which means *the^ amortized cost |of| *an&
increment [is] 2@
Proof 2 (banker@ s method)*Let@ s us !a#kind |of| accounting trick@On
every bit that [is]!a#1*let@ s keep !a#dollar on that bit@So {for} example*if *the^
current count [is] 6*w e@ d have*
$ $
a r r a y * 0 @@@@ 0 1 1 0
We@ ll use *the^convention that whenever we toggle !a#bit*w e must
pay !a#dollar {to] do that@
Let@ s say w e allocate $2 {to] do *an^increment@Let@ s see how much
^it*costs {to] do *the^ increment@*in=general*!a#bunch |of| low order bits
change {from] 1 {to] 0**and%then one bit changes {from] !a# 0 {to]!a#1**and%*the^
process terminates@{for}each |of| *the^bits that changes {from] 1 {to] 0*we
have !a#dollar sitting on *the^bit {to] pay {for} toggling that bit@{for}*the^bit
that changes {from] !a#0 {to]!a#1*w e have {to] pay !a#dollar {to] toggle *the^bit*
then put !a#dollar on that bit (for future use)@Thus* having allocated
$2 {for} *the^ increment always guarantees that we {will] have enough
money {to]pay {for}*the^work*no matter how costly *the^increment actually
is@ This completes proof 2 that *the^amortized cost |of| *the^increment [is]2@
Example 2*Implementing !a#FIFO queue with two stacks Say you
have !a#stack data type**and%you need {to] implement !a#FIFO queue@
*the^ stack has *the^usual POP *and%PUSH operations**and%*the^cost |of|
each operation [is] 1@
98 Computer Software Languages *and%Graphics Design

We can implement !a#FIFO queue using two stacks as follows@


*the^ FIFO has tw o o p era tio n s* ENQUEUE *and% DEQUEUE*
ENQUEUE(x)*Push x onto stack1@
DEQU EU E()*If stack2 [is] empty*then we POP *the^entire contents
|of| stack1 *and%PUSH {it]into stack2@Now simply POP {from] stack2 and+
return *the^result@
It@
s easy {to] see that this algorithm [is] correct@ Here w e@ ll just worry
about *the^running time@(I@ m going {to] ignore *the^cost |of| checking |of|
stack2 [is] empty**and%only measure *the^cost *in=terms |of| *the^number |of|
PUSHs *and%POPs that {are] done@ )
Claim**the^amortized cost |of| ENQUEUE [is] 3 *and%DEQUEUE [is] 1@
Proof 1 (aggregate method)*As *an^element flows through *the^two#
stack data structure*it@ s PUSHed {at] most twice *and%POPPed {at] most
tw ice@This shows that w e can assign *an^ amortized cost |of| 4 *to^
ENQUEUE *and%0 {to] DEQUEUE@
To get *the^desired result* note that if *an^element [is] not
DEQUEUED it@ s only PUSHED twice *and%POPPED once@So *the^
cost |of| 3 [is] paid {for} {by] *the^cost |of| 3 per ENQUEUE@*the^last POP *is$
paid {for} {by] *the^DEQUEUE (if {it] happens)@
Proof 2 (banker@ s method)* Maintain !a#collection |of| tokens on
stack1@*in=fact* keep 2 tokens {for} each thing *in=*the^stack@
When we ENQUEUE* we have three tokens {to] work with@We
use one {to] push *the^element onto stack1**and%*the^other two {are] put
on *the^element {for} future use@When we have {to] move stack1 into
stack2*w e have enough tokens *in=*the^stack {to] pay {for} *the^move (one
POP *and%one PUSH {for} each element)@
Finally**the^last pop done {by] *the^DEQUEUE [is] paid {for} {by] *the^1
w e allocated {for} it@QED@
Example 3*doubling array
We@ ll use *an^array {to] implement !a#stack that allows push and+
pop operations@ We represent *the^stack as *an^array*A[] *and%*an^integer
variable top that points {to] *the^top |of| *the^stack@
Here [is]!a#naive implementation |of| push *and%pop*
push(x)*top++~ A[top] = x~
pop~ top$~ return A[top+1]
These operations {are] both constant time (cost=1)@*the^problem
is*what happens when *the^array gets full# {to] deal with this*we keep
another variable L* storing *the^ size |of| *the^ array**and%!a#variable k
Computer Software Languages *and%Graphics Design 99

keeping count |of| *the^number |of| elements |of| *the^array that {are] *in=use@
When w e {are] about {to] overflow *the^available space (k=L)*we allocate
*an&array twice as large*move *the^data over {to] *the^new array*free *the^
old array**and%double L@This operation [is] called $doubling$@{it] *will^
be convenient {to] Analyse {it]as thought {it]was !a#separate operation on
*the^data strucure* that occurs only when k=L@
If *the^stack [is] full**and%has size L**and%w e apply *the^ doubling
operation**the^cost |of| *the^operation [is] L*because we have {to] move L
items into *the^new array@ (The cost |of| allocating *and%freeing *the^arrays
*is]O(L)@ )
Starting {from] *an^empty stack* doing any sequence n pushes and+
pops* how much does this cost#
First analysis* Total cost {for} pushes *and%pops [is] n@
Total cost {for} doubling [is] {at] worst 1 + 2 + 4 + @ @
@n / 2 + n < 2 n So*
*the^total cost [is] 3n@Therefore w e can say that *the^amortized cost
|of| a*n&operation [is] 3@Second an alysis* Again* w e use *the^ financial
approach@We@ ll keep money lying around *the^data structure *in=*the^
following w ay@
$ $ $ $
$ $ $ $
+-------------------------- +
|x|x|x|x|x|x|x|x|x|x|x|x| | | | |
+-------------------------- +
A
|
m id p o i n t
We@ ll keep $2 on each element stored *in=*the^stack that is
Beyond *the^ Midpoint |of| *the^ current array@*in=*the^normal case
when we do !a#push (the array [is] not full)*w e need $1 {to] do *the^work*
{and} then {at] most $2 {to] put onto *the^ the new item w e just pushed@
Thus *the^cost [is] $3@(pop [is] even cheaper@ ) Now what happens if we
have {to] do !a#doubling operation#
Before doubling*
$ $ $ $ $ $ $ $
$ $ $ $ $ $ $ $
+-------------------------- +
|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|
-------------------------- +
A
100 | Computer Software Languages *and%Graphics Design

m id p o i n t
<------------ L------------ >
Af t er d o u b lin g *
+-------------------------- +-------------------------- +
|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x|x| | | | | | | | | | | | | |
| | |
+-------------------------- +-------------------------- +
A
|
m id p o i n t
You can see that *the^money that w e had on *the^items (L) was
sufficient {to] pay {for} all *the^ work |of| doubling *the^ array (L)@We
conclude that if w e allocate $3 {for} each operation* w e@ ll never run
out |of| money@
Thus *the^amortized cost |of| *an^operation [is] 3@*in=these examples*
*the^financial m odel was not really necessary {to] get *the^ desired
results@However* later w e@ ll see examples{where}this approach *is$
necessary@

THE PHYSICIST’S METHOD


Let@
s say that instead |of| distributing our money all over *the^data
structure (as w e did above)* w e keep {it] all *in=!a#piggy bank@What@ s
really important [is] how much money [is]*in=*the^piggy bank@We@ ll call
*the^amount |of| money *in=this bank *the^$potential function$ (Phi)
*for^t*he^problem@
So {for} *the^ two problems above* we used *the^following two potential
functions*
P h i ( c o u n t e r ) = # | o f | one b i t s *in= *the^ c o u n t e r
P h i ( q u e u e ) = 2 * *t he^ s i z e | o f | s t a c k 1 @
[ 2 ( k#L / 2) i f k P L/ 2
Phi(stack) = [
[0 o t h e r w i s e
(Here L [is] *the^current array size**and%k [is]*the^number |of| elements
currently *in=*the^stack@ ) Using this formalism w e can define *the^
amortized cost |of| *an^operation@Say *the^system changes {from] state
S {to] state S@as !a#result |of| doing some operation@
W e define *the^amortized cost |of| *the^operation as follows*
a m o rtiz e d c o s t = a c tu a l c o s t + De l t a ( Phi ) =
= a c t u a l c o s t + P h i ( S @) # Phi ( S)
This [is] simply *the^amount |of| additional money that we need *to^
maintain our piggy bank *and%{to] pay {for} *the^work@
Computer Software Languages *and%Graphics Design 101

For *the^counter*with *the^potential function given above*


amortized cost |of| increment ^ 2
^for**the^ stack* with *the^potential function given above*
amortized cost |of| pop ^ 3
How [is] this amortized cost related {to] actual cost# Let@ s
sum *the^above definition |of| amortized cost over all *the^
operations*
Sigm a(am ortized cost) = Sigm a(actual cost) + Phi(final) #
Phi(initial) or Sigma(actual cost) = Sigma(amortized cost) + Phi(initial)
# Phi(final) If *the^potential [is] always non#negative**and%starts {at] zero
(as {it][is]*in=our examples)*then Sigma(actual cost) Sigma(amortized
cost) *in=this more general framework**the^potential can be negative*
{and} may not start {at] 0@So *in=general w e have {to] worry about *the^
initial *and%final potentials@
Summary |of| using potential functions {to] do amortized
analysis*
• Pick !a#potential function that@ s going {to] work (this [is] art)
• Using your potential function*bound *the^amortized
cost |of| *the^operations you@ re interested in@
• Bound Phi(initial) # Phi(final) *in=terms |of| (1)* one obvious point
*is]that if *the^actual cost |of| *an^operation [is] HIGH**and%you want
*the^amortized cost {to] be LOW*then *in=this case *the^potential must
DECREASE {by] !a#lot {to] pay {for} it@This [is] illustrated *in=both |of| *the^
examples *in=this lecture@
We@ ll see *in=*the^next lecture just how essential this formalism
*is$f^or*analyzing splay trees@
DYNAMIC ARRAY
When *an^array becomes full*just copy *the^array
elements {to] !a#larger array
A rra y s pointer {to] *an^array
Number ^ number |of| items *in=*the^array
Size ^ size |of| *the^array
AddToTable(x)
i f Number == Si z e t h e n
a l l o c a t e NewArray w i t h s i z e 2 * S iz e
i n s e r t a l l ite m s {from ] T a b le { to ] NewArray
f r e e A rray
A rray = NewArray
Si z e = 2 * Si z e
102 Computer Software Languages *and%Graphics Design

end i f
i n s e r t x i n t o A rra y
Number = Number + 1
end i n s e r t
In !a#sequence |of| operations on !a#data structure often *the^worst
case can not occur *in=each operation@*the^worst case cost |of| inserting
*an&element *in=!a#dynamic array [is] N + 1@
N = size |of| *the^array before *the^insertion
But you can@ t get two worst cases *in=!a#row$
Amortized Analysis gives *the^ average performance |of| each
operation *in=*the^worst case
Three methods used *in=amortized analysis*
• Aggregate Method
• Accounting Method
• Potential Method
Example*Incrementing !a#k#bit binary counter
Let A[0@ @
k#1] be *an^array |of| bits representing !a#number X
A[0] # low order bit* so
K# 1
X = ^ A[J]2j
J=0

length[A] = k
Start with X = 0
I n c r e m e n t (A)
J = 0
w h i l e J < le n g th [ A ] *and% A[ J] == 1 do
!a#[ J] = 0
J = J + 1
end w h i l e
i f J < l e n g th [ A ] t h e n
A[ J] = 1
end i f
end I n c r e m e n t
Count bits flipped@
Worst Case@
Increment flips k bits *in=worst case@
Sequence |of| n Increment operations takes O(nk)@
AGGREGATE METHOD
T(n) = all work done *in=worst case *in=sequence |of| n operations
Amortized cost per operation [is] T(n)/n
Computer Software Languages *and%Graphics Design 103

X A[4] A[3] A[2] A[1] A[0] Total Cost


0 0 0 0 0 0 0
1 0 0 0 0 1 1
2 0 0 0 1 0 3
3 0 0 0 1 1 4
4 0 0 1 0 0 7
5 0 0 1 0 1 8
6 0 0 1 1 0 10
7 0 0 1 1 1 11
8 0 1 0 0 0 15
9 0 1 0 0 1 16
A[0] flips each time Increment [is] called n
A [1] flips every other time*
n
2
A [1] flips every fourth tim e*
n
2T
A[J] flips every 2J time*
n
2J
Total number |of| flips is*
Llg n J n
ro #i

i
J=0 2J
J=0
< n $ ^2 J#= 2n

So amortized cost |of| each operation [is] 2 = O(1)


ACCOUNTING METHOD
Assign *an^amortized cost {to]each operation Amortized cost may be
more or less than *the^actual cost@ If amortized cost [is]more than *the^actual
cost |of| *the^operation assign *the^difference {to]part |of| *the^data structure as
!a#credit*No negative credit allowed@
Example # Binary Counter
Amortized cost |of| setting bit {to] 1 2 units
1 unit {to] pay {for} setting bit {to] 1
1 unit stored with bit
Amortized cost |of| setting bit {to] 0 0 units
Only !a#1#bit [is] set {to] 0*
104 Computer Software Languages *and%Graphics Design

All 1#bits have credit |of| one unit


This pays {for} setting bit {to] 0
Example Continued
I n c r e m e n t (A)
J = 0
w h i l e J < l e n g t h [ A ] *and% A[J] == 1 do
!a#[ J] = 0
Cost 0
J = J + 1
end w h i l e
i f J < length[A] then
!a#[ J] = 1
Cost 2
e nd i f
e nd I n c r e m e n t
X A[4] A[3] A[2] A[1] A[0] Amortized cost
0 0 0 0 0 0 0
1 0 0 0 0 1 (1) 2
2 0 0 0 1 (1) 0 4
3 0 0 0 1 (1) 1 (1) 6
4 0 0 1 (1) 0 0 8
5 0 0 1 (1) 0 1 (1) 10
6 0 0 1 (1) 1 (1) 0 12
7 0 0 1 (1) 1 (1) 1 (1) 14
8 0 1 (1) 0 0 0 16
9 0 1 (1) 0 0 1 (1) 18

POTENTIAL METHOD
Assign *an^amortized cost {to] each operation*If amortized cost *is$
more than *the^actual cost |of| *the^operation assign *the^difference *the^
entire data structure as potential energy ck= actual cost |of| operation
k
Ck = amortized cost |of| operation k
Dk = *the^state |of| *the^data structure after applying k@
th operation
^to*Dk*
O (Dk) = potential associated with Dk
c k + °( Dk ) # °(D k_ i)

£ C k = £ (Ck + O (D k) # O(Dk#i))
k=1 k=1

= £ ck + o(Dn) _ o (d o )
k=1
Computer Software Languages *and%Graphics Design 105

So if $ ( D n) ^ 0 then $ ( D 0) ^ 0 [is] *an^upper bound on total cost |of|


*the^algorithm
Example # binary counter
Potential = number |of| 1@s *in=*the^counter
if *the^k@
th operation sets tk bits {to] 0 *the^actual cost [is] tk+1
^ ( Dk) # Dk#i ) = 1 # tk
so*
Ck = ck + ^ ( Dk ) # ^ ( Dk#1) = 2
How {to] find $ ( Dk ) #
DYNAMIC TABLES
Table ^ pointer {to]!a#table
Number ^ number |of| items *in=*the^table
Size ^ size |of| *the^table
AddToTable(x)
if Number == Size then
allocate NewTable with size 2*Size
insert all items {from] Table {to] newTable
free Table
Table = NewTable
Size = 2 * Size
end if
insert x into Table
Number = Number + 1
end insert
INSERTS DONE {by] N ADDTOTABLE
Amortized Cost per AddToTable 3 inserts Table after moving
^from* size 4 {to] size 8 Perform 4 AddToTable operations
X X X X
X X X X Y(2)
X X X X Y(2) Y(2)
X X X X Y(2) Y(2) Y(2)
X X X X Y(2) Y(2) Y(2) Y(2)
1/2 *the^ table has 2 credits One credit per item {to] pay
for *the^ move {to] next size table
X X X x y y y y
106 Computer Software Languages *and%Graphics Design

TABLE EXPANSION *and%CONTRACTION

Policy
When table becomes full move {to] table twice *the^size When table
contracts {to] 1 /4 full*move {to] table 1 /2 size Let load = (Size |of| table)/
(number |of| items *in=*the^table) Amortized Cost*
Inserting when load ^ 1 / 2
3 units
Inserting when load < 1 /2
0 units
Deleting when load > 1 /2
0 units
Deleting when load ^ 1 / 2
2 units
X X X X
X X X X Y(2)
X X X X
X X X (1)
X X (1) (1)
X X
Approach

SOLUTION SPACES
Backtracking [is]!a#refinement |of| *the^brute force approach* which
systematically searches {for}!a#solution {to]!a#problem among all available
options@{it]does so {by] assuming that *the^solutions {are] represented *by^
vectors (vr @v v m) |of| values *and%{by] traversing**in=!a#depth first manner*
*the^domains |of| *the^ vectors until *the^ solutions {are] found@When
invoked**the^algorithm starts with *an^empty vector@{at] each stage *it^
extends *the^partial vector with !a#new value@Upon reaching !a#partial
vector (vv @*v t) which can@
@ t represent !a#partial solution**the^algorithm
backtracks {by] removing *the^trailing value {from] *the^ vector**and%then
proceeds {by] trying {to] extend *the^vector with alternative values@
ALGORITHM t r y ( v 1 @@@*v i)
IF ( v 1 @@@*v i ) [ is] !a# s o l u t i o n THEN RETURN
( v 1 @@@*vi )
FOR e a c h v DO
IF ( v 1 @@@*v i *v) [ i s ] a c c e p t a b l e v e c t o r THEN
s o l = t r y ( v 1 @@@*v i *v)
IF s o l $= () THEN RETURN s o l
END
Computer Software Languages *and%Graphics Design

END
RETURN ()
If Si [is] *the^domain |of| v #*then S1 x@
@
@x Sm[is] *the^solution space
|of| t*he^problem@*the^validity criteria used *in=checking {for} acceptable
vectors determines what portion |of| that space needs {to] be searched*
{and} so {it] also determines *the^ resources required {by] *the^ algorithm@
*the^ traversal |of| *the^ solution space can be represented {by] !a# depth#
first traversal |of| !a#tree@*the^tree itself [is] rarely entirely stored {by] *the^
algorithm *in=discourse~instead just !a#path toward !a#root [is] stored**to^
enable *the^backtracking@
LINKED LIST VS@DYNAMIC ARRAY LIST
Table@Amortized Costs Per Operation over n Operations
linked List Dynamic Array]
Insertion 1 call {to] new lg(n)/n call {to] new
set two links 3 data moves
Deletion two links 3 data moves
after find 1 delete lg(n)/n call {to] delete

TRAVELING SALESPERSON
The problem assumes !a#set |of| n cities**and%!a#salesperson which
needs {to] visit each city exactly once *and%return {to] *the^base city {at]*the^
end@*the^solution should provide !a#route |of| minimal length@
The route (a*b*d*c) [is] *the^shortest one {for}*the^following one*
and+i^
ts*length [is] 51@
108 Computer Software Languages *and%Graphics Design

The traveling salesperson problem [is] *an^NP#hard problem* and+


so no polynomial time algorithm [is] available {for} it@ Given *an^instance
G = ( V* E) *the^backtracking algorithm may search {for}!a#vector |of| cities
(v^@ *v | V |) which represents *the^best route@*the^validity criteria may
@
just check {for} number |of| cities *in=|of| *the^routes* pruning out routes
longer than | V | @*in=such !a#case**the^algorithm needs {to] investigate
| V I 1V 1vectors {from] *the^ solution space@

On *the^other hand**the^validity criteria may check {for} repetition


|of| cities**in=which case *the^number |of| vectors reduces {to] | V | $@

THE QUEENS PROBLEM


Consider !a# n {by] n chess board**and%*the^problem |of| placing n
queens on *the^board without *the^queens threatening one another@
Computer Software Languages *and%Graphics Design

The solution space [is] {1* 2* 3@ @@* n}n@*the^backtracking algorithm


may record *the^columns{where}*the^ different queens {are] positioned@
Trying all vectors (p1@ @
@* p n) implies nn cases@Noticing that all *the^
queens must reside *in=different columns reduces *the^number |of| cases
^to*n$@{for}*the^latter case**the^root |of| *the^ traversal tree has degree n*
*the^children have degree n # 1**the^grand children degree n # 2* and+
so forth@

Checking {for} threatening positions along *the^ way my further


reduce *the^number |of| visited configurations@

CONVEX HULL (GRAHAM’S SCAN)


The problem asks {to] construct *the^ shortest polygon w hich
encloses !a#given set |of| points on !a#plan@Intuitively**the^polygon can
be determined {by] placing !a#rubber around *the^set@
110 I Computer Software Languages *and%Graphics Design

Determine *an^extreme point with *the^largest x coordinate@Sort


*the^points *in=order |of| increasing angles* relatively {to] *the^ extreme
point@

Traverse *the^points *in=*the^sorted order*adding them {to]*the^partial


solu tion u pon m aking !a# turn |of| less than 180 d egrees* and+
backtracking when making !a#larger turn@

b •
b •
b

@
b Jo @
b

The algorithm requires O(n log n) time {for} sorting *the^points* and+
O(n) time {to] select *an^appropriate subset@
GENERATING PERMUTATIONS
A permutation can be obtained {by] selecting *an^element *in=*the^
given set *and%recursively permuting *the^remaining elements@
Computer Software Languages *and%Graphics Design 111

a i *( a 1/# / a i#1*a i+1/##/ a N ) ifN > 1


P ( a 1/ # / a N ) =
N ifN = 1

At each stage |of| *the^permutation process**the^given set |of| elements


consists |of| two parts*!a#subset |of| values that already have been
processed**and%!a#subset that still needs {to] be processed@This logical
seperation can be physically Realised {by] exchanging**in=*the^i@ th step*
*the^i@
th value w ith *the^ value being chosen {at] that stage@That
approaches leaves *the^ first subset *in=*the^first i locations |of| *the^
outcome@

p e r m u t e (i )
i f i == N o u t p u t A[N]
else
f o r j = i {to] N do
swap(A[i]* A[j])
permute(i+1)
swap(A[i]* A[j])

DESIGN *and%ANALYSIS TECHNOLOGIES


The Design *and%Analysis Technologies critical technology area
includes technologies or processes that {are] pervasive within *the^
aerospace *and%defence sector@*the^technology elements within *the^
Design Technologies critical technology area {are] depicted *in=*the^figure
below *and%described *in=subsequent paragraphs*
112 Computer Software Languages *and%Graphics Design

Multidisciplinary Design *and%Optimization


Multidisciplinary design *and%optimization [is]as *the^name implies*
*the^process |of| combining !a#full set |of| computational design tools *to^
create *an^ optimum design@*the^process [is] necessarily iterative *in^
nature *and%all |of| *the^disciplines normally utilized *in=*an^aircraft design
^are*computationally intensive@
An MDO approach {for} *an^aircraft could include aerodynamics*
structures**and%systems Computer Aided Engineering (CAE) tools@
Initial design assumptions would be input {to] each CAE toolset
and+t*he^constraints *and%parameters {to] be optimized defined@Each CAE
suite would then compute design parameters that would be utilized
^by**the^other CAE tools as !a#subset |of| their required inputs@
The ultimate design would theoretically be structurally sounder*
lighter *and%more cost effective {to] fabricate@*the^design timeframe
would be also very much shortened@*the^challenges {to] this process
^are**in=*the^exchange |of| data between *the^CAE applications *and%*the^
tuning |of| *the^ entire process {to] achieve convergence on *the^ final
solution set *in=*an^efficient manner@
Structural Analysis
The optimization |of| analytical design tools [is]!a#process that *will^
lead {to] shortened design time frames* lighter *and%more efficient
designs* with reduced production *and%life cycle costs |of| *the^ final
design@
The many analytical tools now available have been typically
developed {for} specific applications *and%{are] often not readily
applicable outside |of| their original design target arena@*an^example
lies *in=*the^structural analysis field{where}tools developed {for}metallics
^will*be much different {from] those developed {for} composite materials
^where* material properties may vary according {to] axis@
The ability {to] rapidly define *an^ optim ized aircraft structure
having light weight**and%improved fatigue *and%damage tolerance
capabilities*[is]!a#critical technology {to] maintain competitive leadership
*in&*the^development *and%supply |of| future new aircraft@This {will] be
achieved {by] *the^extensive use |of| computerized methods {for} structural
analysis *and%design optimization**and%*the^analysis |of| failure and+
fracture mechanics@*the^methods must be integrated with *the^in#house
design *and%manufacturing data bases**the^3#D CAD/CAMsystems*
Computer Software Languages *and%Graphics Design 113

and also be easy {to] use@Suppliers *and%partners {will] have access


*to^t*he^resulting design information via Technical Data Interchange (TDI)@
This {will] ensure consistency with *an^up#to#date knowledge |of| *the^
requirements {for} loads*interfaces *and%*the^space envelopes available
^for*their products@*the^immediate dissemination {to] suppliers |of|
information on design changes {will] help dim inish subsequent
redesign activity *and%*the^time *and%cost penalties incurred {for} rework@
The preliminary structural design {will] often use detailed Finite
Element Methods (FEM) {for} analysis* coupled with constrained
optimization**and%*the^process must be highly automated {for} rapid
creation |of| FEM meshing {for} models@*in=order {to] achieve shortened
design cycle time**the^loads *and%dynamics stiffness requirements must
become available much sooner than {at]present@ This {will] require early
development |of| MDO models {for} overall aerodynamic *and%structural
optimization that {will] define *the^static *and%dynamic loads {for} flight
{and} ground operations@ Trade#off studies must rapidly search {for}*the^
best designs *and%arrive {at] realistic structural sizes* providing space
envelopes *and%accurate weights {to] minimize subsequent redesign@
Structural Design*Analysis *and%Optimization
Shortened design cycle times {are] necessary {for} achieving market
advantage *in=*the^aerospace *and%defence sector@Improvements *in=*the^
structural analysis* design *and%optimization |of| gas turbine engines
*is] necessary {to] achieve these goals while also meeting *the^ overall
objectives |of| increased durability *and%efficiency {at] lower costs@
A Multi#disciplinary Design Optimization (MDO) approach that
combines finite element analysis *and%aerodynamic design techniques
*is]employed@MDO [is] necessary {to] rapidly determine *the^structure
|of| t*he^engine *and%identify critical areas requiring further or more
detailed analysis@Many |of| *the^ structural *and%aerodynamic codes
developed {by] companies {are] proprietary *in=nature *and%*the^integration
{and} refinement |of| these codes [is] *an^on#going challenge@

COMPUTATIONAL FLUID DYNAMICS


Computational Development *and%Validation
Computational Fluid Dynamics (CFD) has had *the^greatest effect
on both aircraft *and%engine design |of| any single design tool over *the^
past twenty#five years@Computational power *and%cost have enabled
114 Computer Software Languages *and%Graphics Design

w idespread application *and%developm ent |of| CFD techniques@


Computational fluid dynamics [is] basically *the^use |of| computers *to^
numerically model flows |of| interest@N odes *in=*the^flowpath *are^
identified *and%equations |of| motion solved {at]these locations {to] identify
flow parameters@
In essence !a#grid or mesh [is] defined over *the^surface |of| *the^object
that extends outwards into *the^flowfield containing *the^object@Flow
equations {are] then calculated {at]each node *in=*the^grid**and%iteratively
re#calculated until all results {for} each node {are] within *an^acceptable
variance@*the^equations used {are] either Euler based which do not
include viscous effects (boundary layers) directly* or Navier#Stokes
equations which include viscous effects *and%which produce more
accurate but computationally more dem anding solutions@Such
methods can be used {for}external flows about *an^aircraft or {for}internal
flows *in=!a#gas turbine including combustion@*the^Euler based analyses
^are*typically less computationally demanding but {are] less precise *for^
m odeling separated flow s on w ings *and%bodies* or {for} internal
reversed flows@{it]should be noted that Navier first developed his
equations *in= 1823 *and%that Stokes refined them *in= 1845@*the^
development |of| solutions {to] these equations was not feasible until
*the^latter part |of| this century@Today much R&D effort on NS methods
*is]expended on improving modeling |of| *the^turbulent flow terms *for^
specific problems@Numerous forms |of| Euler *and%Navier#Stokes
solutions have been developed {to] address particular design problems@
Solutions {to] these equations {are] dependent on experimentation *for^
both coefficients *and%{for} validation@Mesh selection *and%node
placement [is] critical {to] *the^solution |of| *the^flowfield@*the^automated
generation |of| meshes [is] now *in=wide spread use *and%can often be
linked {to] Computer Aided Engineering *and%Design tools@*the^form
|of| *the^equation used**the^density |of| *the^mesh or grid *and%convergence
requirements determine computational demands@Complete aircraft
solutions require huge computer resources *and%much R&D [is] aimed
^at*improving *the^speed |of| *the^solution@
Computational Fluid Dynamics # Gas Turbines
CFD [is] perhaps *the^single most critical technology {for} gas turbine
engines@Gas turbineCFD needs have typically posed *the^ greatest
challenges {to] engine designers**and%computational power *and%code
developers@ While CFD [is] |of| utmost importance {to]*the^engine designer
Computer Software Languages *and%Graphics Design 115

it [is]!a#very specific disciplinary design requirement *and%competence *is$


held {by]!a#very small number |of| engine design firms worldwide@
Computation techniques {for} gas turbine engines also tend {to] be
very module specific $ compressor* transition duct* combustor*
turbine *and%exhaust d u ct/m ilitary afterburner {are] exam ples@
Computational techniques {are] often also specific {to] engine size class
{and} thus Canada*focusing on small gas turbines*has !a#specific set |of|
technology requirements@
Advanced 3D CFD codes have been used {to]generate *the^following design
improvements*
• In *the^compressor {to] develop advanced swept airfoils capable |of|
high compression ratios that *in=turn yield higher efficiency {at] less
weight *and%with !a#smaller parts count (significant life cycle cost
factor)~
• In *the^combustor {for} higher intensity (smaller volumes with much
higher energy density) combustors that approach stoichiometric
conditions {to] yield higher efficiency with lower weight~ and
• In *the^ turbine {to] produce higher stage loading with reduced
turbine cooling air requirements that again reduces weight and+
cost while reducing fuel burn@
Combustion Systems Computation
The combustor |of| !a#gas turbine engine [is] that part |of| *the^engine
that receives *the^ compressed air {from] *the^ compressor@Energy *is$
added {to] *the^airflow *in=*the^combustor *in=*the^form |of| chemical energy
derived {from] fuel@*the^combustor discharge air [is] expanded across !a#
turbine or turbines{where}energy [is] extracted {to] drive *the^compressor
{and} gearbox |of| !a#turboshaft/turboprop engine*or {to]provide jet thrust
via !a#turbofan *and%core nozzle *in=!a#thrust engine@
Small gas turbines*|of| *the^size that have typically been designed
{and} built *in=Canada pose significant design challenges because |of| their
size@Pratt *and%Whitney Canada combustors {are] *the^highest intensity
combustors *in=*the^world*{where}intensity can be thought |of| as *the^
amount |of| energy converted per unit volume within *the^combustor@
*the^ design objectives {for} gas turbine engines* including small ones*
^are*{to] increase both overall pressure ratios *and%cycle temperatures*
which lead {to] increased efficiency *and%smaller size *and%weight*while
simultaneously producing reduced noise *and%noxious emissions
levels@
116 Computer Software Languages *and%Graphics Design

Combustor technology development challenges {for} Canadian


engine manufacturers include@
Computational flu id dynamics* CFD analyses {are] complicated
*by^t*he^reverse flow designs typically selected {to] m aintain short
combustors w ithin small volum es@Cooling flow *and%chemical
additions {to] *the^CFD design further complicate *the^ process as *the^
temperatures |of| gases {at] *the^ core |of| *the^ flows {are] w ell above *the^
melting temperatures |of| *the^combustor materials@ Pressure losses and+
co o lin g flo w requirem ents m ust be m in im ized {to] im prove
performance@
M a teria ls* Increasing compressor ratios result *in= increased
compressor discharge temperatures *and%decreased cooling capability@
These increased temperatures also push {for} higher fuel {to] air ratios
{and} higher temperatures within *the^combustor@Stoichiometric ratio
*is]that ratio when all oxygen [is] consumed *in=*the^combustion process
leaving less air {for} cooling@Materials challenges *in=this environment
^are**the^most demanding@ Fuel injection *and%mixing*CFD *and%injector
specific techniques {are] required@
Emissions*While not legislated *and%not contributing significantly
*in&absolute terms* there [is] !a# drive {for} lower emissions that drives
designs often *in=*the^opposite direction {to] those factors identified
above@

AERODYNAMICS *and%FLIGHT MECHANICS


Aerodynamics [is] *the^study |of| forces on wing bodies *and%controls
due {to] air pressure *and%viscous (drag) effects@ Flight mechanics [is]*the^
study |of| *the^resulting motion |of| objects through *the^air *and%includes
*the^ stability *and%control Behaviour@*the^ law s |of| m otion and+
aerodynamics {are] combined {to] ensure that *an^aircraft flies *in=*the^
intended manner@Much |of| *the^ aerodynamics *and%flight mechanics
work that [is] pursued {for} *the^purposes |of| aircraft designed *and%built
*in&Canada {will] pertain {to]such issues as *the^design |of| improved wings*
*the^integration |of| various components onto *an^aircraft or issues such
as flight *in=adverse conditions{where}*the^ handling qualities |of| *an&
aircraft {will] be adversely influenced {by] *the^ build up |of| ice on *the^
surface |of| *the^w ing@Advanced technology development *in=this field
^will* be directed towards supersonic transports *and%eventually
hypersonic flight@There {are] considerable differences between fixed
Computer Software Languages *and%Graphics Design 117

wing *and%rotary wing aircraft aerodynamics *and%flight mechanics


{and} both areas {are] |of| considerable interest {to]*the^Canadian aerospace
{and} defence industry@
Technologies relevant {to]Aerodynamics *and%Flight Mechanics *are^
described below*
Advanced Aerodynamics *and%Handling
Included here {are] technologies that {will] enable *the^ Canadian
Aerospace industry {to] contribute {to] *the^design |of| advanced concept
aircraft technologies or components or be *the^lead design integrator@
These enabling technologies should be pursued dependent on their links
to**and%pre#positioning {for} potential application {to] specific aircraft platforms
or types as follows*
• Future Transport Aircraft* Future transport aircraft {will] have *to^
demonstrate increased speed *and%load carrying capabilities over
greatly extended ranges@Specific targets have been set {by] *the^
U@ S@{for} next generation transport aircraft although no new
advanced concept transport aircraft {are] currently well advanced@
Wing loading factors {will] double over that |of| existing aircraft
with *the^development |of| materials new {to] *the^transport aircraft
envelope@{for} shorter#range aircraft*!a#key enabling technology
^will* be that |of| high efficiency turboprop engines with cruise
speeds above *the^ M@ 72 range@Propulsion technology and+
propulsion integration issues* aircraft design optimization* CFD*
{and} materials technology development *and%insertion {will] be key
^to**the^success |of| *the^future transport aircraft@
• Hypersonic Aircraft* Hypersonic aircraft {are] *in= exploratory or
advanced development model stage {at] this time *and%{will] be used
initially {for} low cost space launch *and%delivery platforms and+
subse#quently {for} commercial transport@Propulsion technologies
^are*significant {to] hypersonic vehicle feasibility *and%{are] now *the^
limiting factor@Variable cycle engines* advanced materials*
endotherm ic fuels *and%fuel control technologies {are] key
aeropropulsion technology elements{w here}significantR&D
remains unsatisfied@Numerous controls *and%materials research
topics require further investment as well* although less uncertainty
remains *in=these areas due {to] advances made through *the^shuttle
Programmes@
• Advanced Rotorcraft* Future rotorcraft {will] demon#strate increased
cruise speeds |of| 200 kts or greater w ith tiltrotor speeds
approaching 450 kts@These cruise speeds {will] be possible at
118 Computer Software Languages *and%Graphics Design

significantly reduced vibration levels *and%with greatly increased


range/fuel economy@Many |of| *the^ design concepts {for} attaining
these performance improvements {are] already *in= development*
however much work remains undone@
• Advanced Rotorcraft Flight Mechanics* {for} both conventional
helicopter *and%tiltrotor blades**the^wings *and%propulsion system
operate *in=!a#very complex aeromechanical environment@Aerodyn
amics* structures* vibration *and%acoustics parameters *are^
inseparable *and%typically drive *the^design |of| *the^entire air vehicle@
*in&trimmed forward flight *the^advancing blade tip {will] be moving
^at*near sonic velocities whilst *the^retreating blade [is] often *in=near
stall conditions@
Advanced Design *and%Development
General aviation aircraft pose specific design challenges *in=all
aspects |of| their design *and%fabrication@Increasing availability |of| low
cost *and%high performance avionics*advanced composite designs and+
powerplant integration all offer opportunities {for} general aviation
aircraft designers *and%builders@
Many |of| *the^ technologies being furthered {for} use *in=military
unmanned aerial vehicles {will] be |of| pertinence {to] general aviation
aircraft@
Low cost gas turbine technologies *and%composite structures
development *and%certification issues {will] likely be *the^technologies
|of| greatest interest@
The development |of| technologies {for} military purposes *will^
underwrite some |of| *the^costs |of| introduction |of| those design concepts
into general aviation use@
Experimental Assessment *and%Performance
Analytical design *and%analysis techniques {are] !a#prerequisite *to^
reductions *in=design cycle time* design *and%production costs* and+
improved safety *and%environmental impact@*the^development |of|
these analytical or numerical design techniques {will] remain heavily
d ep en d en t on experim ental v a lid ation |of| d esig n codes and+
performance targets {for} another 10#15 years@Whereas *in=*the^past*
experimental resources such as wind tunnels were used primarily
^for*design development *and%refinement**in=*the^future they may
increasingly be used {for} *the^ validation |of| computational design
tools@
Computer Software Languages *and%Graphics Design 119

Notwithstanding *the^ foregoing* there {will] continue {to] be !a#


requirement {for}national facilities including wind tunnels*engine test
facilities* flight test resources**and%specialized resources including
icing tunnels *and%rig test facilities {for} some time {to] come@
Experimental design *and%performance validation technology investment
^will* be required *in=*the^following areas {to] support *the^aerospace industry *in^
Canada *
• Data Capture *and%Analysis Automation* Automated methods *for^
intelligent data capture *and%analysis {will] be required {to] reduce
large facility run times *and%meet *the^ challenges |of| design tool
validation@This {will] require investment both *in= sensors *and%*in^
computational tools~
• Experimental Code Development* Increased data capture rates and+
fidelity {will] be required *and%{will] necessitate *the^development |of|
specific codes {for} experimental design *and%performance validation@
Facilities *and%infrastructure {will] have {to] be maintained or
enhanced {to] achieve these goals~ and
• Infrastructure Support**the^maintenance |of| critical national facilities
^will* have {to] be supported *in= concert with other government
departments *and%industry@*the^objective {will] not necessarily be
^to*create new facilities but rather {to] improve *the^functionality |of|
existing resources {to] m eet *the^ needs |of| new technology
developments@
Aeropropulsion Performance Assessment
Test cells utilized {for}Canadian aero#engine Programmes**and%also
those developed {for} sale*have typically been sea#level static facilities
offering little or no altitude* forward flight velocity or temperature
pressure simulation@Some limited flying test bed capability exists *in^
Canada {for} *the^testing |of| engines@
That being said**the^National Research Council has participated
*in&numerous international projects *in=*the^process ensuring that !a#
world leading test cell capability exists both {for} engine qualification
testing*performance testing *and%{for}*the^development |of| performance
assessment techniques@
Engine test cells take !a#number |of| forms@Sea level test facilities
^are*used {for}Engine Qualification Testing that involves *the^monitoring
|of| !a#relatively small number |of| parameters over long periods *where^
in #service usage [is] evaluated *in=!a# tim e com pressed m anner@
Qualification testing also involves *the^ ingestion |of| ice or water to
120 Computer Software Languages *and%Graphics Design

ensure that unacceptable engine degradation does not occur *in=those


instances@*the^NRC Institute {for} Aerospace Research has developed
world recognized icing testing competencies *and%icing test facilities
that {are] used {by] Canadian *and%off#shore engine manufacturers *for^
qualification testing@
Altitude test cells {are] used {to] qualify engines over !a#full flight
envelope as opposed {to] *the^ endurance type testing previously
described@
The National Research Council *in=colLabouration with Pratt and+
Whitney Canada have developed *and%operated one small altitude
test cell {at] NRC {for} some time@*an^initiative that began *in=2000 *will^
see *the^development *and%commissioning |of| !a#somewhat larger and+
more capable altitude facility* again as !a# colLabourative effort
between NRC *and%P&WC@
Test cells can also be used {for} *the^ analysis |of| problems or
validation |of| problem resolution@*in=these cases *the^ test cells often
require enhanced instrumentation suites *and%!a#much more careful
design {to]ensure that performance parameters {are] correctly measured@
World interest *in=advanced test cell technologies has been directed
^at*those required {to] support hypersonic vehicles {for} military uses or
^for*space launch vehicles@
This type |of| test cell [is] very resource intensive *and%highly
specialized *and%{will] likely be |of| little interest or utility {to] any but !a#
limited number |of| Canadian firms@*the^Short Take Off *and%Vertical
Landing (STOVL) version |of| *the^F35 Joint Strike Fighter has recently
posed new challenges *in=*the^world |of| aeropropulsion testing@{for}this
testing* in#flow preparation* exhaust treatment* fan drive systems*
{and} 6 axis thrust measurement *in=*the^vertical axis {will] all pose
significant new challenges {to]*the^performance assessment community@

ADVANCED CONCEPTS |of| DESIGN


Analysis *and%Design Integration
Advanced aerodynamics profile development *in=Canada {will] be
primarily directed {at] wing design {for} subsonic aircraft carrying less
than 120 passengers@*the^ objective |of| work done on advanced
aerodynamic profiles {will] be {to] increase efficiency *and%cruise speeds
through reduced drag w hile im proving structural *and%control
Computer Software Languages *and%Graphics Design 121

characteristics@Wing profile* control surface effectiveness* airframe


{and} engine interface effects with *the^wing *and%wing tip designs *are^
areas |of| research *and%development interest@Also* developments
improving wing#flap high lift performance {are] important areas *for^
minimizing wing size required *and%hence costs@
Laminar flow control [is]!a#term that deserves discussion@Airflow
over w ings begins as !a# laminar or ordered flow field *and%*will^
transition {to]!a#higher drag producing turbulent flow based on flow
characteristics such as speed *and%wing influences including wing
shape* surface roughness@{it]has been estimated that if laminar flow
could be maintained on *the^wings |of| !a#large aircraft* fuel savings |of|
up {to] 25% could be achieved@
Wing *and%flight characteristics |of| small aircraft {are] such that
laminar flow can be relatively easily maintained over much |of| *the^
flight envelope@!a#variety |of| methods can be used {to] increase laminar
flow regions on aircraft |of| larger size *and%having higher Reynolds
numbers *and%sweep angles@
Com putational fluid dynamics {will] be *the^ m ost important
technology relevant {to] *the^development |of| advanced aerodynamic
profiles@!a#number |of| areas require R&D activity *and%support *for^
aircraft design particular {to] Canadian aerospace interests@Large#
scaleCFD code refinement *and%validation [is] one area requiring work
^to*improve accuracy *and%reduce computational times {for} MDO *by^
more rapid design convergence@These CFD codes {will] also require
validation *in=Labouratories *and%*in=wind tunnels@
All#Electric Aircraft Concept Development
The all#electric aircraft {will] utilize electronic actuators {to] replace
equivalent hydraulic system components@*the^intent [is]{to]save weight
{and} increase reliability@{for} example* electrical generators would
provide pow er {to] electric actuators {for} flight control surface
movement rather than equivalent hydraulic powered components@
Electric power cables {are] lighter *and%less prone {to] damage or service
induced degradation such as fitting vibration that results *in=leakage
*in&hydraulic system s@Alternate power supply redundancy [is] *an&
additional advantage |of| this concept@ Challenges associated with this
type |of| technology insertion would be related {to] electromagnetic
interference (EMI)**and%rapid load fluctuations imposed on *the^power
generation engines@
122 Computer Software Languages *and%Graphics Design

Fly#by#Light Concept Development


Fly#by#Light (FBL) technology involves *the^ replacement |of|
electronic data transm ission* mechanical control linkages* and+
electronic sensors with optical components *and%subsystems@Benefits
include lower initial acquisition *and%life cycle costs*reduced weight*
{and} increased aircraft performance *and%reliability@
Fibre#optic cables {are] essentially immune {to] electromagnetic
interference *and%therefore not affected {by] fields generated {by] other
lines or electrical devices *in=close proximity* nor {are] they affected *by^
lightning strikes@
For flight controls*hydraulic or electric actuators {are] still employed
but receive their command inputs via fibre#optic cables@Weight
reductions {are] significant as *the^ fibre#optic cables need only be
protected {from] physical damage* whereas electric cables must be
insulated *and%shielded increasing weight significantly@ Also with !a#FBL
connection multiple routes can be readily provided that {are] well
separated {to] provide control redundancy@
There {are]!a#number |of| enabling technologies that must be developed
*in&order {to]enable photonics technology insertion@ Fibre#optic connectors
^for*in#line *and%end connections must be developed that {are] durable and+
insensitive {to] in#service maintenance activities@Fibre#optic sensors
development {will] also be necessary {to] allow *the^achievement |of| *the^full
range |of| benefits that can be obtained *in=fly#by#light aircraft@This
technology [is]usually associated with smart structures concepts such as
smart skins{where}fibre#optic cabling can be readily embedded *in=!a#
composite lay#up {to] achieve dispersed damage* stress* temperature or
vibration sensing capability@
Detection Management *and%Control Systems
Regional airliners *and%helicopters operating *in= lower level
airspace {are] increasingly exposed {to] hazardous icing conditions@ This
has increased *the^ need {for} technologies {for} proactive *and%reactive
ice detection *and%protection@Reactive technologies {are] those related
^to**the^detection |of| runback icing *and%attempt {to] monitor real#time or
infer likely aerodynamic performance degradation@
Proactive systems forecast *the^ potential {for} icing conditions
{and} provide on#board avoidance advisory information@Reactive
systems provide reasonable protection |of| *the^ aircraft within the
Computer Software Languages *and%Graphics Design 123

regulated flight envelope but {are] essentially g o /n o #go decision


aid s@Aircraft on Search *and%Rescue M issions *and%m ost civil
transport aircraft often do not have *the^ option |of| avoid in g
hazardous icing conditions *and%should have pro#active pilot
advisors *and%ice removal system s@
Reactive ice detection devices include* embedded sensors that *are^
mounted on *the^wing surface *in=!a#critical location *and%monitor ice
build#up~*and%aerodynamic performance sensors that typically
monitor pressure within *the^boundary layer |of| *the^wing {to] determine
lift performance degradation@
Proactive systems require *the^ remote measurement |of| Liquid
Water Content (LWC)* Outside Air Temperature (OAT) *and%Mean
Volume Diameter (MVD) |of| *the^ liquid water@Knowledge |of| these
three parameters [is] required {to] predict hazardous icing conditions@
Additional R&D work on MVD measurement [is] required@
Ice control *and%removal systems may use heated air {from] *the^engines
or electrical heat elements {to] remove ice {from] airfoil surfaces@Coatings
that {are] termed$iceophobic$ may also be applied {to] minimize ice build
up@
CFD tools {are] needed {to] Analyse ice#buildup characteristics*assess
aerodynamic degradation* *and%improve ice removal air supply
performance@This technology area [is] |of| particular interest because
|of| t*he^types |of| aircraft produced *in=Canada *and%because |of| climatic
conditions@
Design Techniques
A previously stated objective {for} noise reduction [is] *in=*the^order
|of| 6 EPNdB (Effective Perceived Noise *in=dB)@This objective can be
achieved through *the^ utilization |of| larger by#pass ratio fans*
innovative design concepts {for} turbo fans *and%sound conscious
designs *in=*the^combustor *and%exhaust n ozzles/liners@Generally
speaking*noise improvements *and%fuel efficiency must be improved
^to*meet future regulatory requirements without sacrifice |of| overall
engine efficiency@
Of special interest {will] be advanced ducted propulsors (ADF) that
offer both noise attenuation *and%increased efficiency potential@This
technology area {will] be heavily dependent on computational design
techniques *and%multidisciplinary design optimization@
124 Computer Software Languages *and%Graphics Design

The redu ction *in= aircraft em ission s [is] also !a# regulated
requirement@ While small aircraft engines contribute *an^insignificant
am ount |of| p o llu tio n they {are] still *the^ targets |of| increased
environmental scrutiny@Regulatory requirements {are] targeted *at^
Nitrous Oxides (NOx)*Carbon Monoxide (CO) *and%visible particulate
emissions@CFD analysis techniques specific {to] combustion processes
^will*be *the^major tool used {to] lower aeropropulsion emissions@
5

D e v e l o p m e n t |o f| C o m p u t e r

{and} S o f t w a r e E n g i n e e r in g

The whole design process has {to] be formally managed long


before *the^first line |of| code [is] written@Enormous design documents#
hundreds or thousands |of| pages long {are] produced using C@ A@S@
E@
(Computer Aided Software Engineering) tools then converted into
Design Specification documents which {are] used {to] design code@
C@ A@ S@ E suffers {from] *the^ $not quite there yet$ syndrome@There
^are* no system s that can take !a# set |of| design constraints and+
requirements then generate code that satisfies all *the^requirements
{and} constraints@
Its far too complex !a#process@So *the^available C@ A@S@E@systems
manage parts |of| *the^lifecycle process but not all |of| it@
One distinguishing feature |of| Software Engineering [is] *the^paper
trail that {it] produces@
Designs have {to] be signed off {by] Managers *and%Technical
Authorities all *the^way {from] top {to] bottom *and%*the^role |of| Quality
Assurance [is] {to] check *the^paper trail@
Many Software Engineers would admit that their job [is] around
70% paperwork *and%30% code@It@ s !a#costly way {to] write software
{and} this [is] why avionics *in=modern aircraft {are] so expensive@
126 Computer Software Languages *and%Graphics Design

SOFTWARE CHARACTERISTICS
SOFTWARE REQUIREMENT
• Microsoft Windows 98 SE* Me* NT4 (sp5+)* 2000 or XP*
• Word processing software (optional)*
• Spell checker (optional)*
• Spreadsheet (optional)* Microsoft Excel [is] necessary {to] generate
analysis reports
• Web browser (optional)* Internet Explorer 5 or Netscape 6 or
above*
• Adobe Acrobat (optional)@
HARDWARE REQUIREMENT
• PC compatible computer (Pentium II or compatible)*
• CD#ROM Drive*
• SVGA or XGA (1024 x 768) graphic screen *and%card*
• Floppy drive (optional*{for} Ethnos input transfer)*
• Printer port (parallel port RS232)@
MINIMUM ADVISED CONFIGURATION
Software Processor RAM Disk space System (3)
memory (1)
Tropes basic 200 Mhz 64 (128) Mb 16 Mb Win 98*
2000*XP
Tropes 200 Mhz 128 (256) Mb 50 Mb Win 98*
Zoom (2) 2000* XP
Ethnos 200 Mhz 128 Mb 50 Mb Win 98*
2000* XP
Acetic Index 400 Mhz 128 (256) Mb 2 Gb Win NT4
(SP6)* 2000*
XP*dedicated
Hardware appliance
• Under Windows 2000 *and%XP {it] [is] advised {to] install !a#minimum
|of| 256 Mb |of| RAM memory so that system works with optimal
performances@
• 512 Mb |of| memory RAM *and%2 Go |of| disk space |of| swapfile
advised {to] make decision#making analysis (on consequent
documentary bases) with Tropes Zoom@
• For Tropes* Zoom *and%Index**the^conversion |of| PDF files works
only under Windows 2000 or XP@
Computer Software Languages *and%Graphics Design 127

MAXIMUM VOLUMETRY

S o ftw a re T ex t N um ber N u m b e r |of| D a ta b a s e


S iz e |of| F ile s W o rd s S iz e
T ropes Zoom SE 32 Kb 100 100*000 100 tiles
T ropes basic 100 Mb 1 10*000*000 #
T ropes Zoom 100 Mb > 1*000*000 2*147*483*648 20 Gb
E thnos N /A U nlim ited N/A N /A
Acetic Index 100 Mb U nlim ited U nlim ited U nlim ited

By $unlimited$* we understand that *the^theoretical capacity |of|


these software packages widely exceeds what {it][is]possible {to] handle
on !a# current com puter@Your com puter naturally has lim ited
capacities@
For Zoom* w e indicate *the^ theoretical maximal capacity {for} !a#
single documentary base@Knowing that you can create *an^unlimited
number |of| documentary bases@{by] Database size* w e mean *the^
theoretical maximal capacity *in=terms |of| pure text indexed {by] *the^
software@Knowing that {it] can require terabytes |of| disc space@
LANGUAGES
L anguage T ro p es Basic T ro p es Z oom T ropes A cetic E thnos/
(Professional) Special Z oom In d ex S tat@
M ania
E d itio n (Professional)
English Ye s Ye s Ye s Ye s Ye s
French Ye s Ye s Ye s Ye s Ye s
Spanish Unavailable C ontact us Yes Ye s Ye s
*in&France (1)
Portuguese Unavailable Contact us Yes Ye s No
*in&France (1)
G erm an Unavailable unavailable Yes (2) Yes (2) Ye s
*in&France (1) *in&France (1)
Italian Unavailable unavailable Yes (2) Yes (2) No
*in&France (1) *in&France (1)

• These languages {are] not commercialized on this site *in=France*


but {are] available {for} certain our European partners@
• Language *in=*the^course |of| finalisation* available under conditions*
contact us@
TEXT ANALYSIS
• Minimum size advised {for}!a#text*less than 1 page (1 Kb)*
• Maximum size advised {for}!a#single text*5*000 pages (50 Mb)*
• Average analysis throughput* {from] 20*000 words/second (Pentium
III 733 MHz) {to] 80*000 words/second (Pentium IV 3@ 2 GHz* HT)
on local Web pages*{for}!a#single processor@
128 Computer Software Languages *and%Graphics Design

SEMANTIC SEARCH ENGINE



Automatic generation |of| hierarchical keywords*

Automatic information filtering (based on !a#pertinence treshold)*

Massive data analysis *and%information cartography (text#mining)*

Search improvement {for} *the^ references (nouns* trademarks and+
proper names)*
• Maximum numbers |of| text databases*unlimited*
• Average indexing throughput* {from] 1 Gb/hour (Pentium III 733
Mhz) {to] 4 Gb/hour (Pentium IV 3@ 2 GHz* HT) on local Web pages*
^for*!a#single processor@
OPTIONAL MODULES |of| MARKET
RESEARCH *and%ADVANCED STATISTICS

Broadcasting |of| surveys on Internet (Ethnos/Net Survey)

Optical Character Recognition |of| questionnaires (Ethnos/OMR
Manager)
• Panel management (Ethnos/Panel Manager)
• Management |of| phone inquiries (Ethnos/Catiopee)
• Datamining module (Data analysis* Stat@ Mania)
• Management |of| street surveys on PDA (Ethnos/CAPI)
OTHER FEATURES
• File formats converted {by] our linguistic softwares (Tropes* Zoom
{and} Index)* Adobe Acrobat* ASCII* ANSI* HTML* Macromedia
Flash* Microsoft Excel* Microsoft Powerpoint* Microsoft Word*
M icrosoft WordML (Word XML)* RTF* XML* SGML and+
Macintosh texts
• Automatic extraction |of| Microsoft Outlook messages via *an&
external utility (Zoom Semantic Search Engine)
• Automatic exportation |of| *the^results towards other software (Zoom
Semantic Search Engine)
• Indexing engine *in=batch mode (Acetic Index)
• Win32 Application Programming Interface (Acetic Index)
• Real time XML output interface (Acetic Index)
• Distributed fault tolerant *and%load#balancing Interface (CORBA*
Acetic Index)
• Runtime* operation on Intranet* HTML generation (contact us)
• Some features (for example* very large Text Mining) may require
*the^use |of| *an^additional statistics software* |of| data mining software
and/ or !a#RDBMS
Computer Software Languages *and%Graphics Design 129

SOFTWARE MEASUREMENT
{and} METRICS
The m easurem ent in form ation m od el [is] !a# structure
linking information needs {to] *the^relevant entities *and%attri#butes |of|
concern@Entities include processes*products*projects**and%resources@
*the^ m easurem ent in form ation m od el describes how *the^
relevant attributes {are] quantified *and%converted {to] indicators that
provide !a#basis {for} decision#making@
The selection or definition |of| appropriate measures {to] address
*an&information need begins with !a#measurable concept**an^idea |of|
which measurable attributes {are] related {to] *an^information need and+
how they {are] related@*the^measurement planner defines measurement
constructs that link these attributes {to] !a#specifiedinformation need@
Each construct may involve several types or levels |of| measures@
This measurement information model (see Figure) identifies *the^
basic terms *and%concepts with which *the^measurement analyst must
d e a l@*the^ m easurem ent m od elh elp s {to] determ ine w hat *the^
measurement planner needs {to] specify during measurement planning*
performance**and%evaluation@
ENTITY
An entity [is] *an^object (for example*!a#process* product* project*
or resource) that [is] {to] be characterized {by] measuring {its] attributes@
Typical software engineering objects can be classified as products
(e@ g@* design document* source code**and%test case)* processes (e@ g@*
design process* testing process* requirements analysis process)*
projects**and%resources (e@ g @**the^programmers *and%*the^testers)@
*an&entity may have one or more properties that {are] |of| interest {to]meet
*the^information needs@*in=practice**an^entity can be classified into
more than one |of| *the^above categories@
MEASURABLE ATTRIBUTE
An attribute [is] !a#property or characteristic |of| *an^entity that can
be distinguished quantitatively or qualitatively {by] human or
automated means@*an^entity may have many attributes* only some
|of| which may be |of| interest {for}measurement@*the^first step *in=defining
!a#specific instantiation |of| *the^measurement information model [is]*to^
select *the^ attributes that {are] m ost relevant {to] *the^ measurement
130 Computer Software Languages *and%Graphics Design

user@
s information needs@!a#given attribute may be incorporated *in^
multiple measurement constructs supporting different information
needs@
BASE MEASURE
A base measure [is] *an^attribute *and%*the^method {for} quantifying
it@!a#base measure [is] functionally independent |of| other measures@
!a#base measure captures information about !a#single attribute@Data
collection involves assigning values {to] base measures@ Specifying *the^
expected range an d/ or type |of| values |of| !a# base measure helps *to^
verify *the^quality |of| *the^data collected@
Measurement Method
A measurement method [is] !a# logical sequence |of| operations*
described generically* used *in=quantifying *an^attribute with respect
^to*!a#specified scale@
The operations m ay in v o lv e activities such as cou n tin g
occurrences or observing *the^passage |of| time@*the^same measurement
method may be applied {to] multiple attributes@
However*each unique combination |of| *an^attribute *and%!a#method
produces !a#different base measure@Some measure#ment methods may
be im p lem en ted * i n = m u ltip le w a y s @ !a# m easurem ent
procedure describes *the^specific implemen#tation |of| !a#measurement
method within !a#given organizatio#nal context@
Type |of| Measurement Method
The type |of| measurement method depends on *the^nature |of| *the^
operations used {to] quantify *an^attribute@Two types |of| method may
be distinguished*
1@ Subjective*Quantification involving human judgment
2@ Objective* Quantification based on numerical rules such as
counting@These rules may be implemented via human or
automated means@
Scale
A scale [is] *an^ordered set |of| values* continuous or discrete* or !a#
set |of| categories {to] which *the^attribute [is] mapped@*the^measurement
method maps *the^magnitude |of| *the^measured attribute {to]!a#value on
!a#scale@!a#unit |of| measurement often [is] associated with !a#scale@
Computer Software Languages *and%Graphics Design 131

Type |of| Scale


The type |of| scale depends on *the^ nature |of| *the^ relationship
between values on *the^scale@
Four types |of| scales {are] commonly defined*
1@ Nominal* *the^ measurement values {are] categorical@{for} example*
*the^classification |of| defects {by] their type@
2@ Ordinal* *the^ measurement values {are] rankings@{for} example**the^
assignment |of| defects {to]!a#severity level@
3@ Interval* *the^ measurem ent values have equal distances
corresponding {to] equal quantities |of| *the^ attribute@{for} example*
cyclomatic complexity has *the^ minimum value |of| one* but each
increment represents *an^additional path@
4@ Ratio* *the^ measurement values have equal distances
corresponding {to] equal quantities |of| *the^ attribute{where}*the^ value
|of| zero corresponds {to] none |of| theattribute@{for} example**the^size
|of| !a#software component *in=terms |of| LOC@
The method |of| measurement usually affects *the^type |of| scale that
can be used reliably with !a#given attribute@
For example* subjective methods |of| measurement usually only
support ordinal or nominal scales@
Unit |of| Measurement
A u n it |of| m easurem ent [is] !a# particular quantity* defined and+
adopted {by] convention*with which other quantities |of| *the^same kind
^are*compared *in=order {to] express their magnitude relative {to] that
quantity@ Only quantities expressed *in=*the^same units |of| measurement
^are*directly comparable@Example |of| units include *the^hour *and%*the^
meter@
DERIVED MEASURE
A derived measure [is]!a#measure that [is] defined as !a#function |of|
two or more base measures@Derived measures capture information
about more than oneattribute@
Simple transformations |of| base measures (for example*taking *the^
square root |of| !a#base measure) do not add information* thus do not
produce derived measures@
N o rm alization |o f | data often in v o lv es con vertin g base
m easures into derived m easures that can be used {to] compare
different entities@
132 Computer Software Languages *and%Graphics Design

Measurement Function
A measurement function [is]*an^algorithm or calculation performed
^to*combine two or more base m easures@*the^ scale *and%unit
|of| t*he^derived measure depend on *the^ scales *and%units |of| *the^ base
m easures {from] w hich {it] [is] com posed as w ell as how they *are^
combined {by] *the^function@
INDICATOR
A n indicator [ i s ] * a n ^ estim ate or evalu ation | o f |
sp ecified attributes d erived {from] !a# m od el w ith respect *to^
defined information needs@Indicators {are] *the^basis {for} analysis and+
d ecisio n #m ak in g@These {are] w hat sh ou ld be presented *to^
measurement users@
Measurement [is] always based on imperfect information* so
quantifying *the^uncertainty*accuracy* or importance |of| indicators
*is$a*n&essential component |of| presenting *the^ actual indicator value@
Therefore**an^interpretation |of| indicat#ors [is] performed {to] provide
*the^desired information product@
Measurement Model
A measurement model [is]*an^algorithm or calculation combining
one or more base and/ or derived measures with associated decision
criteria@{it][is]based on *an^understanding of* or assumptions about*
*the^expected relationship between *the^component measures and/ or
their behaviour over time@Models produce estimates or evaluations
relevant {to] defined information needs@*the^scale *and%measurement
method affect *the^choice |of| analysis techniques or models used *to^
produceindicators@
Decision Criteria
Decision criteria {are] numerical thresholds or targets used *to^
determine *the^need {for} action or further investigation* or {to] describe
*the^level |of| confidence *in=!a#given result@Decision criteria help *to^
interpret *the^ results |of| m easurem ent@Decision criteria may be
calculated or based on !a# conceptual understanding |of| expected
behaviour@
Decision criteria may be derived {from] historical data*plans* and+
heuristics* or computed as statistical control limits or statistical
confidence limits@
Computer Software Languages *and%Graphics Design

MEASURABLE CONCEPT
A m easurable con cept [is] *an ^ abstract relationsh ip
between attributes |of| entities *and%information needs@{for} example*
*an&Information need may be *the^ need {to] compare *the^ software
development productivity |of| !a# project group against !a#target rate@
*the^ Measurable Concept *in=this case [is] $software developm ent
productivity rate$@{to] evaluate *the^concept might require measuring
*the^size |of| *the^software products *and%*the^amount |of| resource applied
^to*create *the^ products (d ep en d in g on *the^ chosen m odel |of|
productivity)@Additional examples |of| Measurable Concepts include
quality*risk*performance*capability*maturity**and%customer value@

SOFTWARE METRICS
Effective management |of| any process requires quantification*
measurement**and%modeling@ Software metrics provide !a#quantitative
basis {for} *the^development *and%validation |of| models |of| *the^software
development process@Metrics can be used {to] improve software
productivity *and%quality@ This module introduces *the^most commonly
used software metrics *and%reviews their use *in=constructing models
|of| *the^software development process@
134 Computer Software Languages *and%Graphics Design

Although current metrics *and%models {are] certainly inadequate*


!a#number |of| organizations {are] achieving promising results through
their use@Results should improve further as w e gain additional
experience with various metrics *and%oftware metrics {are] numerical
data related {to] software developm ent@Metrics strongly support
software project management activities@
They relate {to] *the^four functions |of| management as follows*
1@ Planning* Metrics serve as !a# basis |of| cost estimating* training
planning* resource planning* scheduling**and%budgeting@
2@ Organizing* Size *and%schedule metrics influence !a# project@ s
organization@
3@ Controlling* Metrics {are] used {to] status *and%track software
development activities {for} compliance {to] plans@
4@ Improving* Metrics {are] used as !a# tool {for} process improvement
{and} {to] identify{where}improvement efforts should be concentrated
{and} measure *the^effects |of| process improvement efforts@
A metric quantifies !a# characteristic |of| !a# process or product@
Metrics can be directly observable quantities or can be derived *from^
one or more directly observable quantities@Examples |of| raw metrics
include *the^number |of| source lines |of| code*number |of| documentation
p a g es* num ber |of| staff#hours* num ber |of| tests* num ber |of|
requirements* etc@Examples |of| derived metrics include source lines
|of| code per staff#hour* defects per thousand lines |of| code* or !a#cost
perform ance in d e x @ *the^ term in d ic a to r [is] u sed {to] d en ote !a#
representation |of| metric data that provides insight into *an^ongoing
software development project or process improvement activity@
Indicators {are] metrics *in=!a# form suitable {for} assessing project
behaviour or process improvement@{for} example**an^indicator may
be *the^behaviour |of| !a#metric over time or *the^ratio |of| two metrics@
Indicators may include *the^comparison |of| actual values versus
*the^plan* project stability metrics* or quality metrics@Examples |of|
indicators used on !a# project include actual versus planned task
com pletions* actual versus planned staffing* number |of| trouble
reports written *and%resolved over time**and%number |of| requirements
changes over tim e@Indicators {are] used *in=conjunction with one
another {to] provide !a#more complete picture |of| project or organization
b eh aviou r@ {for} exam p le* !a# progress indicator [is] related *to^
requirements *and%size indicators@ All three indicators should be used
{and} interpreted together@
Computer Software Languages *and%Graphics Design 135

SOFTWARE COMPONENTS
A com puter system consists |of| three major com pon en ts*
hardw are* softw are* *and% hum ans (users* program m ers*
administrators*operators*etc@ )@Software can be further divided into
seven layers@Firmware can be categorized as part |of| hardware* part
|of| software* or both@
The seven layers |of| software {are] (top {to] bottom)* Programs~
System Utilities~ Command Shell~ System Services~ User Interface~
Logical Level~*and%Hardware Level@!a#Graphics Engine stradles *the^
bottom three layers@
Strictly speaking* only *the^ bottom two levels {are] *the^ operating
system* although even technical persons {will] often refer {to] any level
other than programs as part |of| *the^operating system (and Microsoft
tried {to] convince *the^ Justice Department that their web browser
application [is] actually !a#part |of| their operating system)@Because this
technical analysis concentrates on servers* Internet Facilities *are^
specifically separated out {from] *the^ layers@

Command Shell

System Services

li@
i Operating System

O 111 Operating System


----- Hardware Level

EXAMPLES
The following {are] examples |of| each category*
• Programs* Examples |of| Programs include your word processor*
spreadsheet* graphics programs* music software* games* etc@
• System Utilities* Examples |of| System Utilities include file copy*
hard drive repair**and%similar items@On *the^Macintosh* all *the^
Desk Accessories (calculator* key caps* etc@ ) *and%all |of| *the^Control
Panels {are] examples |of| System Utilities@
• Command Shell**the^Command Shell on *the^Macintosh [is] *the^Finder
{and} was *the^first commercially available graphic command shell@
On W indow s* *the^ Command Shell [is] !a# poorly integrated
comination |of| *the^File Manager *and%*the^Programme Manager@The
136 Computer Software Languages *and%Graphics Design

command line (C*\ prompt) |of| MS#DOS or Bourne Shell


|of| UNIX {are] examples |of| *the^ older style text#based command
shells@
• System Services*Examples |of| System Services {are] built#in data base
query languages on mainframes or *the^QuickTime media layer
|of| t*he^Macintosh@
• User Interface*Until *the^Macintosh introduced Alan Kay@ s (inventer
|of| *the^personal computer* graphic user interfaces* object oriented
programming* *and%software agents) ground breaking ideas on
human#computer interfaces* operating systems didn@ t include
support {for} user interfaces (other than simple text#based shells)@
*the^Macintosh user interface [is] called *the^Macintosh ToolBox and+
provides *the^ windows* menus* alert boxes* dialog boxes* scroll
bars* buttons* controls**and%other user interface elements shared
^by*almost all programs@
• Logical Level |of| Operating System**the^Logical Level |of| *the^operating
system provides high level functions* such as file management*
internet *and%networking facilities* etc@
• Hardware Level |of| Operating System* *the^ Hardware Level |of| *the^
operating system controls *the^ use |of| physical system resources*
such as *the^memory manager* process manager* disk drivers* etc@
• Graphics Engine**the^Graphics Engine includes elements {at] all three
|of| *the^ lowest levels* {from] physically displaying things on *the^
monitor {to] providing high level graphics routines such as fonts
{and} animated sprites@
Human users normally interact w ith *the^ operating system
indirectly* through various programs (application *and%system) and+
command shells (text* graphic* etc@ )* *the^ operating system provides
programs with services thrrough system programs *and%Application
Programme Interfaces (APIs)@

SOFTWARE DEVELOPMENT *in^


LIFE CYCLE MODELS
The Systems Developm ent Life Cycle (SDLC) [is] !a#conceptual
m odel used *in= project m anagem ent that describes *the^ stages
involved *in=*an^information system developm ent project {from] *an&
in itia l fe a sib ility stu d y th rou gh m ain ten an ce |of| *the^
completed application@Various SDLC m ethodologies have been
developed {to] guide *the^processes involved including *the^waterfall
model (the original SDLC method)*rapid application development
Computer Software Languages *and%Graphics Design

(RAD)* joint application developm ent (JAD)**the^fountain model


{and} *the^ spiral m odel@M ostly* several m odels {are] combined into
som e sort |of| hybrid m eth od ology@D ocum entation [is] crucial
regardless |of| *the^ type |of| m od el ch osen or d ev ised {for} any
application**and%[is] usually done *in=parallel with *the^development
process@

Fig@Briefly on different Phases@


Some methods work better {for} specific types |of| projects* but
*in^t*he^final analysis**the^most important factor {for}*the^success |of| !a#project
may be how closely particular plan was followed@*the^image above
*is]*the^classic Waterfall model methodology*which [is] *the^first SDLC
method *and%{it]describes *the^various phases involved *in=development@
FEASIBILITY
The feasibility study [is] used {to] determine if *the^project should
get *the^go#ahead@If *the^project [is]{to]proceed**the^feasibility study *will^
produce !a#project plan *and%budget estimates {for} *the^future stages |of|
development@
Requirement Analysis *and%Design
Analysis gathers *the^ requirements {for} *the^ system @This stage
includes !a#detailed study |of| *the^ business needs |of| *the^ organization@
Options {for} changing *the^business process may be considered@ Design
focuses on high level design like*what programs {are] needed *and%how
^are*they going {to] interact* low #level design (how *the^ individual
programs {are] going {to] work)*interface design (what {are] *the^interfaces
going {to]look like) *and%data design (what data {will] be required)@ During
these phases**the^software@ s overall structure [is] defined@Analysis and+
Design {are] very crucial *in=*the^whole development cycle@ Any glitch
*in^t*he^design phase could be very expensive {to] solve *in=*the^later stage of
138 Computer Software Languages *and%Graphics Design

the software development@Much care [is] taken during this phase@*the^


logical system |of| *the^product [is] developed *in=this phase@
Implementation
In this phase * t h e ^ d esign s { a r e ] translated into
c o d e @C om puter program s {are] w ritten u sin g !a# con ven tion al
programming language or *an^application generator@Progra#mming
tools like Compilers*Interpreters*Debuggers {are] used {to] generate *the^
code@ Different high level programming languages like C*C++*Pascal*
Java {are] used {for} coding@With respect {to] *the^type |of| application**the^
right programming language [is] chosen@
Testing
In this phase *the^system [is] tested@
Normally programs {are] written
as !a# series |of| individual m odules* these subject {to] separate and+
detailed test@*the^system [is] then tested as !a# w hole@*the^separate
modules {are] brought together *and%tested as !a#complete system@*the^
system [is] tested {to] ensure that interfaces between modules work
(integration testing)**the^system works on *the^intended platform and+
with *the^expected volume |of| data (volume testing) *and%that *the^system
does what *the^user requires (acceptance/beta testing)@
Maintenance
Inevitably *the^ system {will] need maintenance@Software *will^
definitely undergo change once {it][is]delivered {to]*the^customer@There
^are*many reasons {for} *the^change@
Change could happen because |of| some unexpected input values
into *the^system@*in=addition**the^changes *in=*the^system could directly
affect *the^software operations@*the^software should be developed *to^
accom m odate changes that cou ld happen during *the^ p ost
implementation period@
DESCRIPTION

Curtain Raiser
Like any other set |of| engineering products* software products
^are*also oriented towards *the^customer@{it][is]either market driven or
^it*drives *the^market@Customer Satisfaction was *the^buzzword |of| *the^
80@ s@Customer Delight [is] today@s buzzword *and%Customer Ecstasy
*is$t*he^buzzword |of| *the^new millennium@
Computer Software Languages *and%Graphics Design 139

Products that {are] not customer or user friendly have no place


*in^t*he^market although they {are] engineered using *the^best technology@
*the^interface |of| *the^product [is] as crucial as *the^internal technology
|of| t*he^product@
Market Research
A market study [is] made {to] identify !a#potential customer@ s need@
This process [is] also known as market research@Here* *the^already
existing need *and%*the^possible *and%potential needs that {are] available
*in&!a#segment |of| *the^society {are] studied carefully@*the^market study *is$
done based on !a#lot |of| assumptions@
Assum ptions {are] *the^ crucial factors *in= *the^ developm ent or
inception |of| !a#product@ s development@Unrealistic assumptions can
cause !a#nosedive *in=*the^entire venture@
Though assumptions {are] abstract* there should be !a# move *to^
develop tangible assumptions {to] come up with !a#successful product@
Research *and%Development
Once *the^Market Research [is] carried out**the^customer@ s need *is$
g iv en {to] *the^ Research & D ev elo p m en t d iv isio n (R&D) *to^
conceptualize !a#cost#effective system that could potentially solve *the^
customer@ s needs *in=!a#manner that [is] better than *the^one adopted
*by^t*he^competitors {at] present@
Once *the^ conceptual system [is] developed *and%tested *in=!a#
hypothetical environment**the^development team takes control |of| it@
*the^ development team adopts one |of| *the^ software development
methodologies that [is] given below* develops *the^proposed system*
{and} gives {it] {to] *the^customer@
The Sales & Marketing division starts selling *the^software {to]*the^
available customers *and%simultaneously works {to] develop !a# niche
segment that could potentially buy *the^ software@*in=addition**the^
d iv isio n also passes *the^ feedback {from] *the^ custom ers {to] *the^
developers *and%*the^R&D division {to]make possible value additions
*to^t*he^product@
While developing !a#software**the^company outsources *the^non
core activities {to] other companies who specialize *in=those activities@
This accelerates *the^ software development process largely@Some
companies work on tie#ups {to] bring out !a#highly matured product
*in^a#!short period@
140 Computer Software Languages *and%Graphics Design

SOFTWARE DEVELOPMENT MODELS


The following {are] some basic popular models that {are] adopted
^by*many software development firms
• System Development Life Cycle (SDLC) Model
• Prototyping Model
• Rapid Application Development Model
• Component Assembly Model
SYSTEM DEVELOPMENT LIFE CYCLE MODEL
A software life cycle model depicts *the^significant phases or activities
|of| !a#software project {from] conception until *the^product [is] retired@*it^
specifies *the^relationships between project phases*including transition
criteria* feedback mechanisms* milestones* baselines* reviews* and+
deliverables@Typically*!a#life cycle model addresses *the^ phases |of| !a#
software project* requirements phase* design phase* implementation*
integration*testing*operations *and%maintenance@ Much |of| *the^motivation
behind utilizing !a#life cycle model [is] {to] provide structure {to] avoid *the^
problems |of| *the^ $undisciplined hacker$ or corporate {it] bureaucrat
(which [is]probably ten times dangerous then undisciplined hacker)@ As
always* it@ s !a#matter |of| picking *the^right tool {for} *the^job* rather than
picking up your hammer *and%treating everything as !a#nail@
System/Information Engineering *and%Modeling
As software [is] always |of| !a#large system (or business)*work begins
^by*establishing *the^ requirements {for} all system elements *and%then
allocating some subset |of| these requirements {to] software@This system
view [is] essential when *the^software must interface with other elements
such as hardware*people *and%other resources@System [is] *the^basic and+
very critical requirement {for}*the^existence |of| software *in=any entity@
So
if *the^system [is] not *in=place**the^system should be engineered *and%put
*in&place@*in=some cases*{to] extract *the^maximum output**the^system
should be re#engineered *and%spruced up@Once *the^ ideal system *is$
engineered or tuned* *the^ development team studies *the^ software
requirement {for}*the^system@
Software Requirement Analysis
This process [is] also known as feasibility study@*in=this phase**the^
development team visits *the^customer *and%studies their system@ They
Computer Software Languages *and%Graphics Design 141

investigate *the^need {for} possible software automation *in=*the^given


system @{by] *the^end |of| *the^ feasibility study* *the^ team furnishes !a#
document that holds *the^different specific recommendations {for}*the^
candidate system@{it]also includes *the^personnel assignments* costs*
project schedule*target dates etc@ @@@*the^requirement gathering process
*is]intensified *and%focussed specially on software@
To understand *the^nature |of| *the^ programme(s) {to] be built**the^
system engineer or $Analyst$ must understand *the^ information
domain {for} *the^ software* as w ell as required function* behaviour*
performance *and%interfacing@*the^essential purpose |of| this phase
*is$t^
o*find *the^need *and%{to] define *the^problem that needs {to] be solved@
System Analysis *and%Design
In this phase**the^software development process**the^software@ s
overall structure *and%{its] nuances {are] defined@*in=terms |of| *the^client/
server technology* *the^ number |of| tiers needed {for} *the^ package
architecture**the^database design**the^data structure design etc@ @@*are^
all defined *in=this phase@
A software development model [is] thus created@Analysis and+
Design {are] very crucial *in=*the^whole development cycle@Any glitch
*in&*the^design phase could be very expensive {to] solve *in=*the^later
stage |of| *the^ software development@Much care [is] taken during this
phase@*the^logical system |of| *the^product [is] developed *in=this phase@
Code Generation
The design must be translated into !a#machine#readable form@
*the^ code generation step performs this task@If *the^ design *is$
p erform ed *in= !a# d eta iled m anner* cod e g en era tio n can be
accomplished without much com plication@Progra#mming tools
like compilers*interpreters*debuggers etc@@@{are]used {to] generate *the^
code@
Different high level programming languages like C*C++*Pascal*
Java {are] used {for} coding@With respect {to] *the^type |of| application**the^
right programming language [is] chosen@
Testing
Once *the^ code [is] generated* *the^ software programme testing
begins@Different testing methodologies {are] available {to] unravel *the^
bugs that were committed during *the^ previous phases@Different
142 Computer Software Languages *and%Graphics Design

testing tools *and%m ethodologies {are] already available@Some


companies build their own testing tools that {are] tailor made {for} their
own development operations@
Maintenance
The software {will] definitely undergo change once {it] [is] delivered
^to**the^customer@There can be many reasons {for} this change {to] occur@
Change could happen because |of| some unexpected input values into
*the^system@*in=addition**the^changes *in=*the^system could directly affect
*the^software operations@*the^ software should be developed *to^
accom m odate changes that cou ld happen during *the^ p ost
implementation period@
PROTOTYPING MODEL
This [is] !a#cyclic version |of| *the^ linear model@*in=this model* once
*the^requirement analysis [is] done *and%*the^design {for} !a#prototype *is$
made**the^development process gets started@
Once *the^ prototype [is] created* {it] [is] given {to] *the^ customer *for^
evaluation@*the^customer tests *the^package *and%gives his/her feed
back {to] *the^ developer who refines *the^ product according {to] *the^
customer@ s exact expectation@After !a#finite number |of| iterations**the^
final software package [is] given {to] *the^customer@
In this methodology**the^software [is]evolved as !a#result |of| periodic
shuttling |of| information between *the^customer *and%developer@This
*is] *the^most popular development model *in=*the^contemporary *it^
industry@
Most |of| *the^ successful software products have been developed
using this model # as {it] [is] very difficult (even {for} !a# whiz kid$) *to^
comprehend all *the^requirements |of| !a#customer *in=one shot@
There {are] many variations |of| this model skewed with respect
*to^t*he^project management styles |of| *the^companies@New versions |of| !a#
software product evolve as !a#result |of| prototyping@
The goal |of| prototyping based development [is]{to]counter *the^first
two limitations |of| *the^ waterfall model discussed earlier@*the^basic
idea here [is] that instead |of| freezing *the^requirements before !a#design
or coding can proceed*!a#throwaway prototype [is] built {to] understand
*the^requirements@ This prototype [is] developed based on *the^currently
known requirements@Developm ent |of| *the^ prototype obviously
undergoes design* coding *and%testing@
Computer Software Languages *and%Graphics Design 143

But each |of| these phases [is] not done very formally or thoroughly@
^by*using this prototype* *the^client can get *an^ $actual feel$ |of| *the^
system*since *the^interactions with prototype can enable *the^client *to^
better understand *the^requirements |of| *the^desired system@
Prototyping [is] *an^ attractive idea {for} complicated *and%large
systems {for} which there [is] no manual process or existing system *to^
help determining *the^requirements@
In such situations letting *the^ client $plan$ with *the^ prototype
provides invaluable *and%intangible inputs which helps *in=determining
*the^requirements {for} *the^ system@{it] [is] also *an^ effective method *to^
demonstrate *the^feasibility |of| !a#certain approach@
This might be needed {for} novel systems{where}it [is]not clear those
constraints can be met or that algorithms can be developed *to^
implement *the^requirements@*the^process model |of| *the^prototyping
approach [is] shown *in=*the^figure below@
Start
Requirement Quick Building
Gathering Design Prototype
i

r
Stop Refining Customer
Engineer
Product Prototype Evaluation

Prototyping Model

Fig@Prototyping Model@
The basic reason {for} little common use |of| prototyping [is] *the^
cost involved *in=this built#it#twice approach@However*some argue
that prototyping need not be very costly *and%can actually reduce
*the^ overall developm ent co st@*the^ prototype {are] usually not
com plete system s *and%many |of| *the^ details {are] not built *in=*the^
p r o to ty p e @ *the^ g oal [is] {to] p r o v id e !a# sy ste m w ith o v era ll
functionality@
In addition**the^cost |of| testing *and%writing detailed documents
^are*reduced@These factors helps {to] reduce *the^cost |of| developing *the^
prototype@On *the^ other hand* *the^ experience |of| developing *the^
prototype {will] very useful {for} developers when developing *the^final
system@
This experience helps {to] reduce *the^cost |of| development |of| *the^
final system *and%results *in=!a#more reliable *and%better designed
system @
144 Computer Software Languages *and%Graphics Design

Advantages |of| Prototyping


Creating software using *the^prototype model also has {its] benefits@
One |of| *the^key advantages !a#prototype modeled software has [is] *the^
tim e frame |o f | d ev elo p m e n t@Instead |o f | concentrating on
documentation*more effort [is] placed *in=creating *the^actual software@
This way**the^actual software could be released *in=advance@
The work on prototype models could also be spread {to] others
since there {are] practically no stages |of| work *in=thismodel@Everyone
has {to] work on *the^same thing *and%{at] *the^same time* reducing man
hours *in=creating !a#software@*the^work {will] even be faster *and%efficient
if developers {will] collaborate more regarding *the^status |of| !a#specific
function *and%develop *the^ necessary adjustments *in= time {for} *the^
integration@
Another advantage |of| having !a#prototype modeled software *is$
that *the^ software [is] created using lots |of| user feedbacks@*in=every
prototype created* users could give their honest opinion about *the^
software@If something [is] unfavorable*{it]can be changed@Slowly *the^
programme [is] created with *the^customer *in=mind@
• Users {are] actively involved *in=*the^development
• It provides !a#better system {to] users* as users have natural tendency
^to*change their mind *in=specifying requirements *and%this method
|of| developing systems supports this user tendency@
• Since *in= this methodology !a# working model |of| *the^ system *is$
provided**the^users get !a#better understanding |of| *the^system being
developed@
• Errors can be detected much earlier as *the^ system [is] mode side
^by*side@
• Quicker user feedback [is] available leading {to] better solutions@
Disadvantages
Implementing *the^ prototype model {for} creating software has
disadvantages@ Since {its] being built out |of| concept*most |of| *the^models
presented *in=*the^early stage {are] not complete@ Usually they lack flaws
that developers still need {to] work on them again *and%again@Since *the^
prototype changes {from] time {to] time* it@ s !a# nightmare {to] create !a#
document {for} this software@
There {are] many things that {are] removed* changed *and%added
*in^a#!single update |of| *the^prototype *and%documenting each |of| them has
been proven difficult@
Computer Software Languages *and%Graphics Design 145

There [is] also !a#great temptation {for} most developers {to] create !a#
prototype *and%stick {to] {it] even though {it] has flaws@Since prototypes
^are*not yet complete software programs*there [is] always !a#possibility
|of| !a#designer flaw@When flawed software [is] implemented*{it] could
mean losses |of| important resources@
Lastly*integration could be very difficult {for}!a#prototype model@
This often happens when other programs {are] already stable@*the^
prototype software [is] released *and%integrated {to] *the^company@ s suite
|of| software@But if there@ s something wrong *the^prototype* changes
^are*required not only with *the^ software@It@ s also possible that *the^
stable software should be changed *in=order {for} them {to] be integrated
properly@
Prototype Models Types
There {are] four typ es |o f | P rototype M odels based on
their development planning**the^Patch#Up Prototype*Nonoperational
Prototype* First#of#a#Series Prototype *and%Selected Features
Prototype@
Patch Up Prototype
This type |of| Prototype Model encourages cooperation |of| different
developers@Each developer {will] work on !a# specific part |of| *the^
programme@
After everyone has done their part* *the^ programme {will] be
integrated with each other resulting *in=!a#whole new programme@ Since
everyone [is] working on !a#different field*Patch Up Prototype [is]!a#fast
development model@
If each developer [is] highly skilled*there [is] no need {to] overlap
*in^a#!specific function |of| work@
This type |of| software development model only needs !a# strong
project m anager w h o can m onitor *the^ d evelop m en t |of| *the^
programme@*the^manager {will] control *the^work flow *and%ensure there
*is]no overlapping |of| functions among different developers@
Non#Operational Prototype
A non#operational prototype model [is] used when only !a#certain
part |of| *the^programme should be updated@Although it@ s not !a#fully
operational programme**the^specific part |of| *the^programme {will] work
or could be tested as planned@*the^main software or prototype [is] not
146 Computer Software Languages *and%Graphics Design

affected {at] all as *the^ dum m y programme [is] applied w ith *the^
application@ Each developer who [is] assigned with different stages *will^
have {to] work with *the^dummy prototype@This prototype [is] usually
im plem ented w hen certain problems *in=!a# specific part |of| *the^
programme arises@Since *the^software could be *in=!a#prototype mode
^for*!a#very long time* changing *and%maintenance |of| specific parts *is$
very important@ Slowly {it]has become !a#smart way |of| creating software
^by*introducing small functions |of| *the^software@
First |of| !a#Series Prototype
Known as !a#beta version* this Prototype Model could be very
efficient if properly launched@*in=all beta versions* *the^software *is$
launched *and%even introduced {to] *the^ public {for} testing@It@ s fully
functional software but *the^aim |of| being *in=beta version [is] {to] as *for^
feedbacks* suggestions or even practicing *the^firewall *and%security
|of| *the^ software@{it]could be very successful if *the^First |of| !a# Series
Prototype [is] properly done@But if *the^programme [is] half heartedly
done* only aiming {for} additional concept* {it] {will] be susceptible *to^
different hacks* ultimately backfiring *and%destroying *the^prototype@
Selected Features Prototype
This [is] another form |of| releasing software *in= beta version@
However*instead |of| giving *the^public *the^full version |of| *the^software
*in&beta* only selected features or limited access {to] some important
tools *in=*the^programme [is] introduced@
Selected Features Prototype [is] applied {to] software that {are] part
|of| !a#bigger suite |of| programs@Those released {are] independent |of| *the^
suite but *the^full version should integrate with other software@This
*is]usually done {to] test *the^independent feature |of| *the^software@
RAPID APPLICATION DEVELOPMENT
(RAD) MODEL
The RAD modelis !a# linear sequential software development
process that emphasizes *an^extremely short development cycle@
The RAD m odel [is] !a# $high speed$ adaptation |of| *the^ linear
sequential model *in=which rapid development [is] achieved {by] using
!a#com ponent#based construction approach@Used primarily *for^
information systems applications**the^RAD approach encompasses
*the^following phases*
Computer Software Languages *and%Graphics Design 147

Business Modeling
The information flow among business functions [is] modeled *in=!a#
way that answers *the^following questions*
• What information drives *the^business process#
• What information [is] generated#
• Who generates it#
• Where does *the^information go#
• Who processes it#
Data Modeling
The information flow defined as part |of| *the^business modeling
phase [is] refined into !a#set |of| data objects that {are] needed {to] support
*the^business@*the^characteristic (called attributes) |of| each object *is$
identified *and%*the^relationships between these objects {are] defined@
Process Modeling
The data objects defined *in= *the^ data#m odeling phase *are^
transformed {to] achieve *the^information flow necessary {to] implement
!a#business function@Processing *the^ descriptions {are] created *for^
adding* modifying* deleting* or retrieving !a#data object@
Application Generation
The RAD model assumes *the^use |of| *the^RAD tools like VB*VC++*
Delphi etc@ @
@rather than creating software using conventional third
generation programming languages@*the^RAD model works {to] reuse
existing programme components (when possible) or create reusable
components (when necessary)@*in=all cases*automated tools {are] used
^to*facilitate construction |of| *the^software@
Testing *and%Turnover
Since *the^RAD process emphasizes reuse*many |of| *the^programme
components have already been tested@ This minimizes *the^testing and+
development time@
COMPONENT ASSEMBLY MODEL
Object technologies provide *the^ technical framework {for} !a#
component#based process model {for} software engineering@*the^object
oriented paradigm emphasizes *the^creation |of| classes that encapsulate
both data *and%*the^algorithm that {are] used {to] manipulate *the^data@If
148 Computer Software Languages *and%Graphics Design

properly designed *and%implemented* object oriented classes *are^


reusable across different applicationsand computer based system
architectures@Com ponent A ssem bly M odel leads {to] software
reusability@*the^integration/ assembly |of| *the^already existing software
components accelerate *the^ development process@Nowadays many
com ponent libraries {are] available on *the^ Internet@If *the^ right
components {are] chosen**the^integration aspect [is]made much simpler@
All these different software development models have their own
advantages *and%disadvantages@Nevertheless**in=*the^contemporary
commercial software evelopm ent world* *the^fusion |of| all these
methodologies [is] incorporated@Timing [is] very crucial *in=software
development@If !a# delay happens *in=*the^development phase**the^
market could be taken over {by] *the^competitor@Also if !a#@bug@filled
product [is] launched *in=!a#short period |of| time (quicker than *the^
competitors)*{it] may affect *the^reputation |of| *the^company@So* there
should be !a#tradeoff between *the^development time *and%*the^quality
|of| *the^product@Customers don@ t expect !a#bug free product but they
expect !a#user#friendly product@

SOFTWARE LIFE CYCLE MODELS


WATERFALL MODEL
The least flexible |of| *the^life cycle models@Still {it][is]well suited *to^
projects which have !a#well defined architecture *and%established user
interface *and% perform ance req u irem en ts@ *the^ w aterfall
model does work {for} certain problem domains* notably those *where^
*the^requirements {are] well understood *in=advance *and%unlikely *to^
change significantly over *the^ course |of| developm ent@Software
products {are] oriented towards customers like any other engineering
products@{it] [is] either driver {by] market or {it] drives *the^ market@
Customer Satisfaction was *the^ main aim *in=*the^1980@ s@Customer
Delight [is] today@ s logo *and%Customer Ecstasy [is] *the^new buzzword
|of| *the^new millennium@Products which {are] not customer oriented
have no place *in=*the^market although they {are] designed using *the^
best technology@*the^front end |of| *the^ product [is] as crucial as *the^
internal technology |of| *the^ product@!a#market study [is] necessary *to^
identify !a#potential customer@ s need@This process [is] also called as
market research@*the^already existing need *and%*the^possible future
Computer Software Languages *and%Graphics Design

needs that {are] combined together {for} study@!a#lot |of| assumptions *are^
made during market study@Assumptions {are] *the^ very important
factors *in=*the^development or start |of| !a#product@
s development@*the^
assumptions which {are] not realistic can cause !a#nosedive *in=*the^entire
venture@Although assumptions {are] conceptual* there should be !a#
move {to] develop tangible assumptions {to] move towards !a#successful
product@ Once *the^Market study [is] done**the^customer@ s need [is] given
^to**the^Research *and%Development Department {to] develop !a# cost#
effective system that could potentially solve customer@ s needs better
than *the^competitors@Once *the^system [is] developed *and%tested *in=!a#
hypothetical environment**the^development team takes control |of| it@
*the^ development team adopts one |of| *the^ software development
models {to] develop *the^proposed system *and%gives {it]{to]*the^customers@

Fig@Waterfall Life Cycle Model@

Advantages
Simple *and%easy {to] use@
Easy {to] manage due {to] *the^rigidity |of| *the^model # each phase has
specific deliverables *and%!a#review process@
Phases {are] processed *and%completed one {at]!a#time@
Works well {for} smaller projects{where}requirements {are] very well
understood@
Disadvantages
Adjusting scope during *the^life cycle can kill !a#project
No working software [is] produced until late during *the^life cycle@
High amounts |of| risk *and%uncertainty@
Poor model {for} complex *and%object#oriented projects@
Poor model {for} long *and%ongoing projects@
Poor model{where}requirements {are] {at] !a#moderate {to] high risk |of|
changing@
150 Computer Software Languages *and%Graphics Design

EXTREME PROGRAMMING (XP)


Is *the^latest incarnation |of| Waterfall model *and%[is]*the^most recent
software fad@Most postulates |of| Extreme programming {are] pure
fantasy@{it]has been w ell known {for} !a# long time that big bang or
waterfall models don@ t work well on projects with complex or shifting
requirements@
The same [is] true {for} XP@Too many shops implement XP as *an&
excuse {for} not understanding *the^user requirements@XP try improve
classic waterfall model {by] trying {to] start coding as early as possible
but without creating !a#full#fledged prototype as *the^first stage@*in=this
sense {it] can be considered {to] be variant |of| evolutionary prototyping
(see below)@Often catch phase $Emergent design$ [is] used instead |of|
evolutionary prototyping@{it]also introduces !a#very questionable idea
|of| pair programming as *an^ attempt {to] improve extremely poor
communication between developers typical {for} large projects@ While
communication *in=large projects [is] really critical *and%attempts *to^
improve {it] usually pay well* $pair programming$[is] !a#questionable
strategy@
There {are] two main problems here*
1@ In !a#way {it] can be classified as !a# hidden attempt {to] create one
good programmer out |of| two mediocre@But *in=reality {it][is] creating
one mediocre programmer {from] two or one good@No senior
developer [is] going {to] put up with some jerk sitting on his lap
asking questions about every line@{it] just prevents *the^ level |of|
concentration needed {for} high quality coding@Microsoft@ s idea |of|
having !a# tester {for} each programmer [is] more realistic* one
developer writes tests@
2@ The actual code {to] be tested@This forces each |of| them *to^
communicate *and%because tester has different priorities then
developer such communication brings *the^ developer !a#new and+
different perspective on his code* which really improves quality@
This combination |of| different perspectives [is] !a#really neat idea as
you can see {from] *the^ stream |of| Microsoft Office products and+
operating systems@
THROWAWAY PROTOTYPING MODEL
Typical implementation language [is] scripting language *and%Unix
shell (due {to] availability huge amount |of| components that can be used
^for*construction |of| *the^prototype)@
Computer Software Languages *and%Graphics Design

SPIRAL MODEL
The spiral model [is] !a#variant |of| $dialectical spiral$*and%as such
provides useful insights into *the^ life cycle |of| *the^ system @Can be
considered as !a#generalization |of| *the^proto#typing model@That why
^it*[is]usually implemented as !a#variant |of| prototyping model with *the^
first iteration being !a#prototype@*the^spiral model [is] similar {to] *the^
incremental model*with more emphases placed on risk analysis@
The spira l m odel has fo u r p h a ses * Planning* Risk A n alysis*
Engineering *and%Evaluation@!a#software project repeatedly passes
through these phases *in=iterations (called Spirals *in=this model)@*the^
baseline spiral* starting *in=*the^planning phase* requirements *are^
gathered *and%risk [is] assessed@
Each subsequent spirals builds on *the^baseline spiral@ Requirements
^are*gathered during *the^planning phase@*in=*the^risk analysis phase*!a#
process [is] undertaken {to] identify risk *and%alternate solutions@
A prototype [is] produced {at] *the^end |of| *the^ risk analysis phase@
Software [is] produced *in=*the^engineering phase* along with testing
*at^t*he^end |of| *the^phase@
The evaluation phase allows *the^customer {to] evaluate *the^output
|of| *the^project {to] date before *the^project continues {to] *the^next spiral@
*in^t*he^spiral model**the^angular component represents progress**and%*the^
radius |of| *the^spiral represents cost@

Planning Risk Analysis

Evaluation Engineering

Fig@Spiral Life Cycle M odel@


152 Computer Software Languages *and%Graphics Design

Advantages
• High amount |of| risk analysis
• Good {for} large *and%mission#critical projects@
• Software [is] produced early *in=*the^software life cycle@
Disadvantages
• Can be !a#costly model {to] use@
• Risk analysis requires highly specific expertise@
• Project@s success [is] highly dependent on *the^risk analysis phase@
• Doesn@ t work well {for} smaller projects@
EVOLUTIONARY PROTOTYPING MODEL
This [is] kind |of| m ix |of| W aterfall m odel *and%prototyp in g@
Presuppose gradual refinement |of| *the^ prototype until !a# usable
product em erge@Might be suitable *in= projects{where}*the^ main
problem [is] user interface requirements* but internal architecture *is$
relatively w ell established *and%static@Can help {to] cope w ith
organizational sclerosis@One variant involves so called $binary$
software implementation model using !a# scripting language plus
statically typed language@
In this case system first [is] coded *in=!a#scripting language and+
then gradually critical com ponents {are] rewritten *in= *the^ lower
language@
OSS DEVELOPMENT MODEL
It [is] *the^ latest variant |of| evolutionary prototype m odel@
*the^waterfall
$ model$ was probably *the^first published model *and%as !a#
specific model {for} military {it]was not as naive as some proponents |of|
other models suggest@
The model was developed {to] help cope w ith *the^ increasing
complexity |of| aerospace products@*the^waterfall model followed !a#
documentation driven paradigm@
Prototyping model was probably *the^first realistic |of| early models
because many aspects |of| *the^ syst4m {are] unclear until !a#working
prototype [is] developed@
A better model* *the^$spiral model$ was suggested {by] Boehm *in^
1985@*the^spiral model [is]!a#variant |of| $dialectical spiral$*and%as such
provides useful insights into *the^life cycle |of| *the^system@
Computer Software Languages *and%Graphics Design 153

But {it] also presuppose unlimited resources {for} *the^ project@No


organization can perform more then !a#couple iterations during *the^
initial development |of| *the^system@*the^first iteration [is] usually called
prototype@
Prototype based development requires more talented managers
{and} good planning while waterfall model works (or does not work)
with bad or stupid managers works just fine as *the^ success *in=this
model [is] more determined {by] *the^nature |of| *the^task *in=hand then any
organizational circumstances@
Like always humans {are] flexible *and%programmer *in=waterfall
model can use guerilla methods |of| enforcing !a#sound architecture
as manager [is] actually !a#hostage |of| *the^model *and%cannot afford *to^
look back *and%re#implement anything substantial@
Because *the^life cycle steps {are] described *in=very general terms*
*the^models {are] adaptable *and%their implementation details {will] vary
among different organizations@
The spiral model [is] *the^most general@Most life cycle models can
*in&fact be d erived as special instances |of| *the^ spiral m o d el@
Organizations may mix *and%match different life cycle models *to^
develop !a#model more tailored {to] their products *and%capabilities@
There [is] nothing wrong about using waterfall model {for} some
components |of| *the^complex project that {are] relatively well understood
{and} straightforward@But mixing *and%matching definitely needs !a#
certain level |of| software management talent@
V#SHAPED MODEL
Just like *the^waterfall model**the^V#Shaped life cycle [is]!a#sequential
path |of| execution |of| processes@ Each phase must be completed before
*the^next phase begins@Testing [is] emphasized *in=this model more so
than *the^waterfall model though@
The testing procedures {are] developed early *in=*the^life cycle before
any coding [is]done*during each |of| *the^phases preceding implementation@
Requirements begin *the^life cycle model just like *the^waterfall model@
Before development [is] started*!a#system test plan [is] created@*the^test
plan focuses on meeting *the^functionality specified *in=*the^requirements
gathering@*the^high#level design phase focuses on system architecture
{and} design@*an^integration test plan [is] created *in=this phase as well *in^
order {to] test *the^pieces |of| *the^software systems ability {to] work together@
Computer Software Languages *and%Graphics Design

The low#level design phase [is]{where}*the^ actual software components


^are*designed**and%unit tests {are] created *in=this phase as w ell@*the^
implementation phase is* again*{where}all coding takes place@Once
coding [is] complete**the^path |of| execution continues up *the^right side
|of| t*he^V{where}*the^ test plans developed earlier {are] now put {to] use@

Advantages
• Simple *and%easy {to] use@
• Each phase has specific deliverables@
• Higher chance |of| success over *the^ waterfall model due {to] *the^
development |of| test plans early on during *the^life cycle@
• Works well {for} small projects{where}requirements {are] easily
understood@
Disadvantages
• Very rigid*like *the^waterfall model@
• Little flexibility *and%adjusting scope [is] difficult *and%expensive@
• Software [is] developed during *the^ implementation phase* so no
early prototypes |of| *the^software {are] produced@
• Model doesn@ t provide !a# clear path {for} problems found during
testing phases@
INCREMENTAL MODEL
The incremental model [is] *an^intuitive approach {to] *the^waterfall
model@ Multiple development cycles take place here*making *the^life cycle
!a#$multi#waterfall$ cycle@Cycles {are] divided up into smaller*more easily
managed iterations@Each iteration passes through *the^requirements*
design* implementation *and%testing phases@!a#working version |of|
software [is] produced during *the^first iteration* so you have working
software early on during *the^software life cycle@Subsequent iterations
build on *the^initial software produced during *the^first iteration@
Computer Software Languages *and%Graphics Design

Fig@Incremental Life Cycle Model@

Advantages
• Generates working software quickly *and%early during *the^software
life cycle@
• More flexible*Less costly {to] change scope *and%requirements@
• Easier {to] test *and%debug during !a#smaller iteration@
• Easier {to] manage risk because risky pieces {are] identified and+
handled during {its] iteration@
• Each iteration [is] *an^easily managed milestone@
Disadvantages
• Each phase |of| *an^iteration [is] rigid *and%do not overlap each other@
• Problems may arise pertaining {to] system architecture because not
all requirements {are] gathered up front {for} *the^entire software life
cycle@
6

C o m p u t e r G r a p h i c s S o f tw a r e

The graphics software [is] *the^collection |of| programmes written *to^


make {it]convenient {for}!a#user {to] operate *the^computer graphics system@
^it*includes programmes {to] generate images on *the^ CRT screen**to^
manipulate *the^images**and%{to]accomplish various types |of| interaction
between *the^user *and%*the^system@*in=addition {to]*the^graphics software*
there may be additional programmes {for} implem enting certain
specialized functions related {to] C A D / CAM@These include design
analysis programmes (e@ g@* finite#element analysis *and%kinematic
simulation) *and%manufacturing planning programmes (e@ g@
*automated
process planning *and%numerical control part programming)@
The graphics software {for}!a#particular computer graphics system
*is]very much !a#function |of| *the^type |of| hardware used *in=*the^system@
The software configuration |of| !a#graphics system@
The graphics software can be divided into three modules*
• The graphics package (the graphics system)@
• The application programme
• The application database@
Functions |of| !a#Graphics Package
The graphics package m ust perform !a# variety |of| different
functions@These functions can be grouped into function sets@Each
Computer Software Languages *and%Graphics Design

set accomplishes !a#certain kind |of| interaction between *the^user and+


*the^system@Some |of| *the^ common function sets are* Generation |of|
graphic elements*Transformations*Display control *and%windowing
functions*Segmenting functions *and%User input functions@

USING *the^ ACM@


GRAPHICS PACKAGE
A simple example |of| how {to] write graphical programmes* but
does not explain *the^ details behind *the^ methods {it] contains@*the^
purpose |of| this chapter [is] {to] give you !a#working knowledge |of| *the^
facilities available *in=*the^acm@ graphics package *and%how {to] use them
effectively@*the^class structure |of| acm@ graphics package appears@ Most
|of| *the^ classes *in=*the^package {are] subclasses |of| *the^ abstract class
GObject {at] *the^ centre |of| *the^ diagram @C onceptually* GObject
represents *the^ universal class |of| graphical objects that can be
displayed@ When you use acm@ graphics*you assemble !a#picture *by^
constructing various GObjects *and%adding them {to] !a#GCanvas
*at^t*he^appropriate locations@*the^general m odel *in=more detail offer
!a#closer look {at] *the^individual classes *in=*the^package@

Fig@Class Diagram {for}*the^acm@


graphics Package

THE ACM@
GRAPHICS MODEL
When you create !a#picture using *the^acm@ graphics package*you
do so {by] arranging graphical objects {at] various positions on !a#
background called !a#canvas@*the^underlying model [is] similar {to] that
|of| !a#collage *in=which *an^artist creates !a#composition {by] taking various
objects *and%assembling them on !a#background canvas@
Computer Software Languages *and%Graphics Design

In *the^ w orld |of| *the^ collage artist* those objects m ight be


geometrical shapes* words clipped {from] newspapers* lines formed
^from* bits |of| string* or im ages taken {from] m agazines@*in=*the^
acm@ graphics package* there {are] counterparts {for} each |of| these
graphical objects@
The “FeltBoard” Metaphor
Another metaphor that often helps students understand *the^
conceptual model |of| *the^acm@ graphics package [is] that |of| !a#felt board$
*the^sort one might find *in=*an^elementary school classroom@!a#child
creates pictures {by] taking shapes |of| coloured felt *and%sticking them
onto !a#large felt board that serves as *the^background canvas {for}*the^
picture as !a#whole@
The pieces stay{where}*the^ child puts them because felt fibres
interlock tightly enough {for} *the^pieces {to] stick together@!a#physical
felt board with !a#red rectangle *and%!a#green oval attached@*the^right
side |of| *the^ figure [is] *the^ virtual equivalent *in=*the^acm@ graphics
w orld@
To create *the^ picture* you would need {to] create two graphical
objects $ !a# red rectangle *and%!a#green oval $ *and%add them {to] *the^
graphical canvas that forms *the^background@
B O O F e llB o f d

Fig@Physical FeltBoard *and%{its] Virtual Equivalent


*the^ code {for}*the^FeltBoard example appears@ Even though you have
not yet had !a#chance {to] learn *the^ details |of| *the^ various classes and+
methods used *in=*the^programme* *the^ overall framework should
nonetheless make sense@
The programme first creates !a#rectangle* indicates that {it] should
be filled rather than outlined*colours {it]red**and%adds {it]{to]*the^canvas@
^it*then uses almost *the^same operations {to] add !a#green oval@Because
*the^oval [is]added after *the^rectangle*{it]appears {to]be *in=front*obscuring
part |of| *the^rectangle underneath@This behaviour* |of| course*[is] exactly
what would happen with *the^physical felt board@ Moreover*if you were
^to*take *the^oval away {by] calling
Computer Software Languages *and%Graphics Design 159

r e m o v e (o v a l ) ~
the parts |of| *the^ underlying rectangle that had previously been
obscured would reappear@
In this tutorial* *the^ order *in=which objects {are] layered on *the^
canvas {will] be called *the^ stacking order@(In more mathematical
descriptions* this ordering [is] often called z#ordering* because *the^z#
axis [is] *the^one that projects outward {from] *the^ screen@ ) Whenever !a#
new object [is] added {to] !a#canvas*{it] appears {at] *the^front |of| *the^stack@
Graphical objects {are] always drawn {from] back {to] front so that *the^
frontmost objects overwrite those that {are] further back@
/*
* F i l e * F e l t B o a r d @ja v a
*
* Thi s programme o f f e r s !a# s i m p l e example |of| *the^ acm@ graphics
package
* t h a t draws ! a # r e d r e c t a n g l e *and% !a# g r e e n o v a l @ *the^
d i m e n s i o n s of
* t h e r e c t a n g l e { a r e ] c h o s e n so t h a t { i t s ] s i d e s {are] *in^
proportion to
* t h e $g o l d e n r a t i o $ t h o u g h t {by] *the^ Greeks { t o ] r e p r e s e n t
*the^ most
* a e s t h e t i c a l l y p le a sin g geometry@
*/
i m p o r t acm@ p r og r a m m e @* ~
i m p o r t acm@ g r a p h i c s @* ~
i m p o r t j a v a @a w t @* ~
p u b l i c c l a s s F e l tB o a r d ex te n d s GraphicsProgram {
/ ** Runs *t he^ programme * /
p u b l i c v o i d r u n () {
GRect r e c t = new G R e ct (1 00 * 50* 100* 100 / P H I ) ~
r e c t @s e t F i l l e d ( t r u e ) ~
r e c t @s e t C o l o r ( C o l o r @ RED) ~
add(rect)~
GOval o v a l = new G 0 v a l ( 1 5 0 * 50 + 50 / PHI* 100* 100 /
PHI)~
o v a l @s e t F i l l e d ( t r u e ) ~
o v a l @s e t C o l o r ( C o l o r @ GREEN) ~
add(oval)~
}
/ ** C o n s t a n t r e p r e s e n t i n g *the^ g o l d e n r a t i o */
p u b l i c s t a t i c f i n a l d o u b l e PHI = 1 @618~
}
Program m e*Code {for} *the^ FeltBoard@
Computer Software Languages *and%Graphics Design

The Coordinate System


The acm@ graphics package uses *the^same basic coordinate system
that traditional Java programmes do@ Coordinate values {are] expressed
*in&terms |of| pixels* which {are] *the^individual dots that cover *the^face
|of| *the^screen@Each pixel *in=!a#graphics window [is] identified {by] {its] x
{and} y coordinates*with x values increasing as you move rightward
across *the^window *and%y values increasing as you move down
*from
^th
*e^top@*the^point (0*0)$ which [is] called *the^origin$ is *in=*the^upper
left corner |of| *the^ window @This coordinate system [is] illustrated
*by^t*he^diagram * w hich sh ow s only *the^ red rectangle {from] *the^
FeltBoard@ java programme@*the^location |of| that rectangle [is] (100*50)*
which means that {its] upper left corner [is] 100 pixels {to] *the^right and+
50 pixels down {from] *the^ origin |of| *the^graphics window @

Fig@*the^Java Coordinate System


*the^ only difference between *the^coordinate systems used *in=*the^
acm @ graphics package *and%Java@ s Graphics class [is] that *the^
acm@ graphics package uses doubles {to] represent coordinate values
instead |of| ints@This change makes {it] easier {to] create figures whose
locations *and%dimensions {are] produced {by] mathematical calculations
*in&which *the^results {are] typically not whole numbers@As !a#simple
example**the^dimensions |of| *the^red rectangle {are] proportional {to] *the^
golden ratio* which Greek mathematicians believed gave rise {to] *the^
most pleasing aesthetic effect@*the^golden ratio [is]approximately equal
^to*1@618 *and%[is] usually denoted *in=mathematics {by] *the^ symbol f@
Because *the^acm@ graphics package uses doubles {to] specify coordinates
{and} dimensions**the^code {to] generate *the^rectangle looks like this*
new GRect (100* 5 0 * 100* 100 / PHI)
In *the^integer#based Java model*{it]would be necessary {to] include
explicit code {to] convert *the^height parameter {to]*an^int@*in=addition *to^
adding com plexity {to] *the^ cod e* forcing stud ents {to] convert
Computer Software Languages *and%Graphics Design 161

coordinates {to] integers can introduce rounding errors that distort *the^
geometry |of| *the^displayed figures@
Judging {from] *the^ experience |of| *the^ instructors who tested *the^
acm@ graphics package while {it]was *in=development**the^change *from^
ints {to] doubles causes no confusion but instead represents *an&
important conceptual sim plification@*the^ only aspect |of| Java@ s
coordinate system that students find problematic [is] *the^fact that *the^
origin [is]*in=!a#different place {from] what they know {from] traditional
Cartesian geometry@Fortunately*{it] doesn@ t take too long {to] become
familiar with *the^Java model@
The GPoint* GDimension**and%GRectangle Classes
Although {it] [is] usually possible {to] specify individual values *for^
coordinate values*{it] [is] often convenient {to] encapsulate *an^x *and%!a#y
coordinate as !a# point*!a#w idth *and%!a#height value as !a# composite
indication |of| *the^ dimensions |of| *an^ object* or all four values as *the^
bounding rectangle {for}!a#figure@Because *the^coordinates {are] stored
as doubles *in=*the^acm@ graphics package* using Java@ s integer#based
Point* Dim ension**and%Rectangle classes w ould entail !a# loss |of|
precision@{to] avoid this problem *the^acm@ graphics package exports
*the^classes GPoint* GDimension**and%GRectangle* which have *the^
same semantics as their standard counterparts except {for}*the^fact that
their coordinates {are] doubles@
As *an^example**the^declaration
GDimension g o l d e n S i z e = new GDimension(100* 100 / P H I ) ~
introduces *the^variable goldenSize *and%initializes {it]{to]!a#GDimension
object whose internal width *and%height fields {are] *the^dimensions
|of| t*he^golden rectangle illustrated *in=*the^earlier example@*the^advantage
|of| encapsulating these values into objects [is] that they can then be
passed {from] one method {to] another using !a#single variable@
The GMath Class
Computing *the^coordinates |of| !a#graphical design can sometimes
require *the^use |of| simple trigonometric functions@Although functions
like sin *and%cos {are] defined *in=Java@
s standard Math class* students
find them con fu sin g *in= graphical ap p lication s becau se |of|
inconsistencies *in=*the^way angles {are] represented@*in=Java@
s graphics
libraries* angles {are] measured *in=degrees~*in=*the^Math class* angles
must be given *in=radians@{to]minimize *the^confusion associated with
162 Computer Software Languages *and%Graphics Design

this inconsistency |of| representation* *the^ acm@graphics package


includes !a#class called GMath* which exports *the^methods@Most |of|
these methods {are] simply degree#based versions |of| *the^ standard
trigonometric functions*but *the^distance*angle**and%round methods
^are*also worth noting@
Trigonometric Methods *in=Degrees
static double s in D e g re e s (d o u b le angle)
Returns *the^trigonometric sine |of| *an^angle measured *in=degrees@
static double c osD eg re e s(double angle)
Returns *the^trigonometric cosine |of| *an^angle measured *in=degrees@
static d o u b l e t a n D e g r e e s ( d o u b l e an g le )
Returns *the^ trigonometric tangent |of| *an^ angle measured *in^
degrees@
static double toD egrees(double rad ia n s)
Converts *an^angle {from] radians {to] degrees@
static double toR adians(double degrees)
Converts *an^angle {from] degrees {to] radians@
Conversion Methods {for} Polar Coordinates
d o u b l e d i s t a n c e ( d o u b l e x * d o u b l e y)
Returns *the^distance {from] *the^ origin {to] *the^point (x*y)@
double distance(double x0* double y0* double x 1 * d o u b le
y 1)
Returns *the^distance between *the^points (x0*y0) *and%(x1*y l)@
d o u b l e a n g l e ( d o u b l e x * d o u b l e y)
Returns *the^angle between *the^origin *and%*the^point (x*y)*measured *in^
degrees@
Convenience Method {for} Rounding {to] *an^Integer
static int r o u n d ( d o u b l e x)
Rounds !a#double {to] *the^nearest int (rather than {to]!a#long as *in=*the^
Math class)@
Programme@Static Methods *in=*the^GMath Class

THE GCANVAS CLASS


In *the^ acm@
graphics m odel* pictures {are] created {by] adding
graphical objects$ each |of| which [is] *an^instance |of| *the^GObject class
^to*!a#background canvas@That background$ the analogue |of| *the^felt
board *in=*the^physical world $ [is] provided {by] *the^GCanvas class@*the^
GCanvas class [is]!a#lightweight component *and%can be added {to] any
Computer Software Languages *and%Graphics Design 163

Java container *in=either *the^java@ awt or javax@ swingpackages* which


makes {it]possible {to] use *the^graphics facilities *in=any Java application@
^for**the^most part* however* students *in=introductory courses won@ t
u se *the^ G Canvas class d irectly but {w ill] in stead use *the^
GraphicsProgram class*which automatically creates !a#GCanvas and+
installs {it] *in=*the^programme w in d ow * as illustrated *in= several
preceding examples@
The GraphicsProgram class forwards operations such as add
andremove {to] *the^embedded GCanvas so that students don@ t need
^to*be aware |of| *the^underlying implementation details@
The most important methods supported {by] *the^GCanvas class@
Many |of| these methods {are] concerned with adding *and%removing
graphical objects@ These methods {are] easy {to] understand*particularly
if you keep *in=mind that !a#GCanvas [is] conceptually !a#container *for^
GObject values@
The container metaphor explains *the^functionality provided
*by^t*he^add* rem ove* *and%rem oveA ll* w hich {are] analogous {to] *the^
identically named methods *in=JComponent *and%Container@
Constructor
new GCanvas()
Creates !a#new GCanvas containing no graphical objects@
Methods {to] Add *and%Remove Graphical Objects {from] !a# Canvas
v o i d a d d ( G O b j e c t g ob j )
Adds !a# graphical object {to] *the^ canvas {at] {its] internally stored
location@
v o i d a d d ( G O b j e c t g o b j * d o u b l e x * d o u b l e y) or add(GObject
g o b j * GPoint p t)
Adds !a#graphical object {to] *the^canvas {at] *the^specified location@
v o i d r e m o v e ( G O b j e c t g ob j )
Removes *the^specified graphical object {from] *the^ canvas@
v o i d removeAll ()
Removes all graphical objects *and%components {from] *the^ canvas@
Method {to] Find *the^Graphical Object {at]!a#Particular Location
GObject getElementAt(double x* double y) or
getE lem entA t(G Point pt)
Returns *the^topmost object containing *the^specified point*or null
if no such object exists@
164 Computer Software Languages *and%Graphics Design

Useful Methods Inherited {from] Superclasses


i n t g e t W i d t h ()
Return *the^width |of| *the^canvas**in=pixels@
i n t getH eight()
Return *the^height |of| *the^canvas**in=pixels@
v o i d s e t B a c k g r o u n d ( C o l o r bg)
Changes *the^background colour |of| *the^canvas@
The add method comes *in=two forms* one that preserves *the^
internal location |of| *the^graphical object *and%one that takes *an^explicit
x *and%y coordinate@ Each method has {its] uses**and%{it][is]convenient *to^
have both available@
The first [is] useful particularly w hen *the^ constructor {for} *the^
GObject specifies *the^location* as {it] does* {for} example**in=*the^case
|of| *the^GRect class@If you wanted {to] create !a#100 x 60 rectangle
*at^t*he^point (75* 50)* you could do so {by] w riting *the^ follow in g
statement*
add(new G R e ct ( 75 * 50* 100* 6 0 ) ) ~
The second form [is] particularly useful when you want {to] choose
*the^coordinates |of| *the^object *in=!a#way that depends on other properties
|of| *the^ object@{for} exam ple* *the^ follow ing code taken {from] *the^
HelloGraphicsexample centres !a#GLabel object *in=*the^w indow *
GLabel l a b e l = new G L a b e l ( $h e l l o * w o r l d $ ) ~
double x = (getWidth() # l a b e l @ getWidth() ) / 2 ~
double y = (getHeight() + l a b e l @ getAscent() ) / 2~
ad d (lab el* x* y ) ~
Because *the^placement |of| *the^label depends on {its] dimensions*
*it^i*s]necessary {to] create *the^label first *and%then add {it] {to] !a#particular
location on *the^canvas@
The GCanvas method getElement(x* y) returns *the^ graphical
object on *the^canvas that includes *the^ point (x* y)@If there [is] more
than one such object* getElement returns *the^one that [is] *in=front
|of| t*he^others *in=*the^stacking order~ if there [is] no object {at] that position*
getElement returns null@
This method [is] useful*{for}example*if you need {to] select *an^object
using *the^mouse@Several |of| *the^most useful methods *in=*the^GCanvas
class {are] those that {are] inherited {from] {its] superclasses *in=Java@ s
component hierarchy@{for} example* if you need {to] determine how
big *the^graphical canvas is* you can call *the^methods getWidth and+
getHeight@
Computer Software Languages *and%Graphics Design 165

Thus*if you wanted {to]define !a#GPoint variable {to]mark *the^centre


|of| *the^canvas*you could do so with *the^following declaration*
GPoint c e n t r e = new G P o i n t ( g e t W i d t h ( ) / 2 @0 * g e t H e i g h t ( )
/ 2 @0 ) ~
You can also change *the^ background colour {by] calling
setBackground(bg)*{where}bg [is] *the^new background colour {for}*the^
canvas@
THE GOBJECT CLASS
The GObject class represents *the^universe |of| graphical objects that
can be displayed on !a#GCanvas@*the^GObject class itself [is] abstract*
which means that programmes never create instances |of| *the^GObject
class directly@Instead* programmes create instances |of| one |of| *the^
GObject subclasses that represent specific graphical objects such as
rectangles* ovals**and%lines@
The most important such classes {are] *the^ones that appear {at]*the^
bottom |of| *the^class diagram*which {are] collectively called *the^shape
classes@Before going into those details* however*{it] makes sense *to^
begin {by] describing *the^characteristics that {are] common {to]*the^GObject
class as !a#whole@
Methods Common {to] all GObject Subclasses
All GObjects $ no matter what type |of| graphical object they
represent$ share !a# set |of| common properties@{for} example* all
graphical objects have !a#location* which [is] *the^x *and%y coordinates *at^
which that object [is]drawn@ Similarly*all graphical objects have !a#size*
which [is]*the^width *and%height |of| *the^rectangle that includes *the^entire
object@
Other properties common {to]all GObjects include their colour and+
how *the^objects {are] arranged *in=terms |of| their stacking order@Each
|of| these properties [is] controlled {by] methods defined {at] *the^GObject
level@
Useful Methods Common {to] all Graphical Objects
Methods {to] Retrieve *the^Location *and%Size |of| !a#Graphical Object
d o u b l e ge t X()
Returns *the^x#coordinate |of| *the^object@
d o u b l e g e t Y ()
Returns *the^y#coordinate |of| *the^object@
166 Computer Software Languages *and%Graphics Design

d o u b l e g e tW i d th ( )
Returns *the^width |of| *the^object@
double getH eight()
Returns *the^height |of| *the^object@
GPoint g e t L o c a t i o n ( )
Returns *the^location |of| this object as !a#GPoint@
GDimension g e t S i z e ( )
Returns *the^size |of| this object as !a#GDimension@
GRectangle getBounds()
Returns *the^bounding box |of| this object@
Methods {to] Change *the^Object’s Location
v o i d s e t L o c a t i o n ( d o u b l e x * d o u b l e y) o r s e t L o c a t i o n ( G P o i n t
pt )
Sets *the^location |of| this object {to] *the^specified point@
v o i d m o v e ( d o u b l e d x * d o u b l e dy)
Moves *the^object using *the^displacements dx *and%dy@
void movePolar(double r * double th e ta )
Moves *the^object r units *in=direction theta*measured *in=degrees@
Methods {to] Set *and%Retrieve *the^Object’s Colour
v o i d s e t C o l o r ( C o l o u r c)
Sets *the^colour |of| *the^object@
Colour getC olor()
Returns *the^object colour@If this value [is] null**the^package uses
*the^colour |of| *the^container@
Methods {to] Change *the^Stacking Order
v o id sendToFront() o r s e n d T o B a c k ()
Moves this object {to]*the^front (or back) |of| *the^stacking order@
v o i d s e nd For w a rd () o r s e n d B a c k w a rd ()
Moves this object forward (or backward) one position *in=*the^
stacking order@
Method {to] Determine whether *an^Object Contains !a#Particular Point
boolean contains(double x * double y) or c o n t a i n s ( G P o i n t
pt )
Checks {to] see whether !a#point [is] inside *the^object@
Determining *the^Location *and%Size |of| !a#GObject
The first several methods make {it] possible {to] determine *the^
location *and%size |of| any GObject@*the^getX* getY* getWidth* and
Computer Software Languages *and%Graphics Design 167

getHeight methods return these coordinate values individually* and+


*the^getLocation* getSize**and%getBounds methods return composite
values that encapsulate that information *in=!a#single object@
Changing *the^Location |of| !a#GObject
The next three methods offer several techniques {for}changing *the^
location |of| !a#graphical object@*the^setLocation(x*y) method sets *the^
location {to]*an^absolute coordinate position on *the^screen@{for}example*
*in&*the^FeltBoard example* executing *the^statement
r e c t @s e t L o c a t i o n ( 0 * 0 ) ~
would move *the^rectangle {to]*the^origin *in=*the^upper left corner |of| *the^
window@
The move(dx* dy) method*{by] contrast* makes {it] possible {to] move
*an&object relative {to] {its] current location@*the^effect |of| this call [is]{to]shift
*the^location |of| *the^object {by] !a#specified number |of| pixels along each
coordinate axis@{for}example**the^statement
oval@
m o v e ( 10* 0 ) ~
would move *the^oval 10 pixels {to]*the^right@*the^dx *and%dy values
can be negative@Calling
rect@
m o v e (0* # 2 5 ) ~
would move *the^rectangle 25 pixels upward@
The movePolar(r*theta) method [is]useful *in=applications *in=which
you need {to] move !a#graphical object *in=!a#particular direction@
The name |of| *the^ method comes {from] *the^ concept |of| polar
coordinates *in=mathematics**in=which !a#displacement [is] defined {by]!a#
distance r *and%*an^angle theta@Just as {it][is]*in=traditional geometry**the^
angle theta [is]measured *in=degrees counterclockwise {from] *the^+x axis@
Thus**the^statement
rect@
m ovePolar(10* 4 5 ) ~
would move *the^ rectangle 10 pixels along !a# line *in=*the^45°
direction*which [is] northeast@
Setting *the^Colour |of| !a#GObject
The acm@ graphics package does not define {its] own notion |of|
colour but instead relies on *the^Colour class *in=*the^standard java@
awt
package@*the^predefined colours are*
Color@BLACK
Color@DARK_GRAY
Color@GRAY
168 Computer Software Languages *and%Graphics Design

Color@ LIGHT_GRAY
Color@ WHITE
Color@ RED
Color@ YELLOW
Color@ GREEN
Color@ CYAN
Color@ BLUE
Color@ MAGENTA
Color@ ORANGE
Color@ PINK
It [is] also possible {to] create additional colours using *the^
constructors *in=*the^Colour class@*in=either case*you need {to] include
*the^import line
import j a v a @a w t @* ~
at *the^beginning |of| your programme@
The setColor method sets *the^colour |of| *the^ graphical object
*to^t*he^specified value~*the^corresponding getColor method allows you
^to*determine what colour that object currently is@
This facility allows you {to] make !a# temporary change {to] *the^
colour |of| !a# graphical object using code that looks something like
this*
Colour oldColor = g o b j @ getC olor() ~
gob j @s e t C o l o r ( C o l o r @ RED) ~
@@ @ *and% t h e n { a t ] some l a t e r t i m e @ @ @
g o b j @s e t C o l o r ( o l d C o l o r ) ~
Controlling *the^Stacking Order
A set |of| methods that make {it] possible {to] control *the^stacking
order@*the^sendToFront *and%sendToBack methods move *the^object
^to**the^front or back |of| *the^stack*respectively@*the^sendForward and+
sendBackward methods move *the^ object one step forward or
backward *in=*the^stack so that {it]jumps ahead |of| or behind *the^adjacent
object *in=*the^stack@
Changing *the^stacking order also redraws *the^display {to] ensure
that underlying objects {are] correctly redrawn@
For example* if you add *the^statement~
o v a l @s e n d B a c k w a rd ( ) ~
to *the^end |of| *the^FeltBoard programme**the^picture on *the^display
would change as follows*
Computer Software Languages *and%Graphics Design 169

Checking {for} Containment


In many applications $ particularly those that involve
interactivity |of| *the^ sort $ {it] [is] useful {to] be able {to] tell whether !a#
graphical object contains !a#particular point@This facility [is] provided
^by*thecontains(x*y) method*which returns true if *the^point (x*y) *is$
inside *the^figure@{for}example*given !a#standard Java MouseEvent e*
you can determine whether *the^mouse [is] inside *the^rectangle rect
using *the^followingif statement*
if ( r e c t @c o n t a i n s ( e @g e t X ( ) * e @g e t Y ( ) ) )
Even though every GObject subclass has !a#contains method**the^
precise definition |of| what {it] means {for} !a#point {to] be $inside$*the^
object differs depending on *the^class@*in=*the^case |of| !a# GOval**for^
example*!a#point [is] considered {to] be inside *the^ oval only if {it]*is$
mathematically contained within *the^elliptical shape that *the^GOval
draws@Points that {are] inside *the^bounding rectangle but outside
|of| t*he^oval {are] considered {to]be $outside@
$Thus*{it][is]important {to]keep
*in&mind that
g o b j @c o n t a i n s ( x * y)
and
gobj@ g e t B o u n d s ( ) @c o n t a i n s ( x * y)
do n o t n e c e s s a r i l y r e t u r n *t he^ same a n s w e r @
The GFillable*GResizable**and%GScalable Interfaces
You have probably noticed that several |of| *the^examples you@ ve
already seen *in=this tutorial include methods that do not appear@*for^
example* *the^FeltBoard programme includes calls {to] !a# setFilled
method {to] mark *the^rectangle *and%oval as filled rather than outlined@
^it*appears that *the^GObject class does not include !a#setFilled method*
which [is] indeed *the^case@
As *the^caption makes clear**the^methods listed *in=that table
*e^ones that {are] common {to]every GObject subclass@
*are^th While {it][is]always
possible {to] set *the^location |of| !a#graphical object*{it][is]only possible *to^
fill that object if *the^idea |of| $filling$ makes sense {for} that class@
Filling [is] easily defined {for} geometrical shapes such as ovals*
rectangles*polygons**and%arcs*but {it][is]not clear what {it]might mean
^to*fill !a#line**an^image*or !a#label@ Since there {are] subclasses that cannot
give !a#meaningful interpretation {to] setFilled* that method [is] not
defined {at]*the^GObject level but [is]instead implemented only {for}those
subclasses {for} which filling [is] defined@
170 Computer Software Languages *and%Graphics Design

At *the^same time*{it][is]important {to] define *the^setFilled method


so that {it] works *the^same way {for} any class that implements it@If
setFilled*{for} example* worked differently *in=*the^GRect *and%GOval
classes* trying {to] keep track |of| *the^different styles would inevitably
cause confusion@{to] ensure that *the^model {for} filled shapes remains
consistent**the^methods that support filling {are] defined *in=*an^interface
called GFillable*which specifies *the^behaviour |of| any fillable object@
*in&addition {to] *the^setFilled method that you have already seen**the^
GFillable interface defines *an^isFilled method that tests whether *the^
object [is] filled*!a#setFillColor method {to] set *the^colour |of| *the^interior
|of| *the^object**and%!a#getFillColor method that retrieves *the^interior fill
colour@*the^setFillColor method makes {it]possible {to] set *the^colour
|of|a*n&object@ s interior independently {from] *the^colour |of| {its] border@*for^
example*if you changed *the^code {from] *the^FeltBoard example so that
*the^statements generating *the^rectangle were
GRect r e c t = new G R e c t (1 0 0 * 50* 100* 100 / P H I ) ~
r e c t @s e t F i l l e d ( t r u e ) ~
r e c t @s e t C o l o r ( C o l o r @ RED) ~
r @s e t F i l l C o l o r ( C o l o r @MAGENTA) ~
you would see !a#rectangle whose border was red *and%whose interior
was magenta@
In addition {to] *the^GFillable interface**the^acm@ graphics package
includes two interfaces that make {it]possible {to] change *the^size |of| *an&
object@Classes *in=which *the^dimensions {are] defined {by] !a#bounding
rectangle$ GRect* GOval**and%GImage$ implement *the^GResizable
interface* which allows you {to] change *the^size |of| !a#resizable object
gobj {by] calling
g o b j @s e t S i z e ( n e w W i d t h * n e w H e i g h t ) ~
A much larger set |of| classes implements *the^GScalable interface*
which makes {it]possible {to]change *the^size |of| *an^object {by] multiplying
^its*width *and%height {by]!a#scaling factor@*in=*the^common case *in=which
you want {to] scale *an^object equally *in=both dimensions*you can call
g o b j @s c a l e ( s f ) ~
which multiplies *the^width *and%height {by] sf@{for}example*you could
double *the^size |of| !a#scalable object {by] calling
g o b j @s c a l e ( 2 ) ~
The scale method has !a#two#argument form that allows you *to^
scale !a#figure independently *in=*the^x *and%y directions@*the^statement
g o b j @s c a l e ( 1 @0 * 0 @5 ) ~
leaves *the^width |of| *the^object unchanged but halves {its] height@
Computer Software Languages *and%Graphics Design 171

The methods specified {by] *the^ GFillable* GResizable* and+


GScalable interfaces {are] summarize@
Methods Defined {by] Interfaces
G F i l l a b l e ( i m p l e m e n t e d { b y ] GArc* GOval* GPen* GP ol yg on *
{and} GRect)
void s e tF ille d (b o o le a n f i l l )
Sets whether this object [is] filled (true means filled* false means
outlined)@
boolean i s F i l l e d ( )
Returns true if *the^object [is] filled@
v o i d s e t F i l l C o l o r ( C o l o r c)
Sets *the^colour used {to] fill this object@If *the^colour [is] null*filling
uses *the^colour |of| *the^object@
C ol ou r g e t F i l l C o l o r ( )
Returns *the^colour used {to] fill this object@
G R e s i z a b le (implem ent e d {by] GImage* GOval* *and% GRect)
v oid s e tS iz e (d o u b le w id th * double height)
Changes *the^size |of| this object {to]*the^specified width *and%height@
v oid setSize(GDimension size)
Changes *the^size |of| this object as specified {by] *the^GDimension
parameter@
void setBounds(double x * double y * d o u b l e w i d t h * d o u b le
height)
Changes *the^bounds |of| this object as specified {by] *the^individual
parameters@
v o i d s e t B o u n d s ( G R e c t a n g l e bounds)
Changes *the^bounds |of| this object as specified {by] *the^GRectangle
parameter@
G S c a l a b l e ( i m p l e m e n t e d {by] GArc* GCompound* GImage* GLi ne *
GOval* GPolygon* *and% GRect)
v o i d s c a l e ( d o u b l e sf )
Resizes *the^object {by] applying *the^scale factor *in=each dimension*
leaving *the^location fixed@
void scale(double s x * d o u b l e sy)
Scales *the^object independently *in=*the^x *and%y dimensions {by]*the^
specified scale factors@
DESCRIPTIONS |of| *the^ INDIVIDUAL SHAPE CLASSES
So far* this tutorial has looked only {at] methods that apply {to] all
GObjects* along with !a#few interfaces that define methods shared by
172 Computer Software Languages *and%Graphics Design

some subset |of| *the^GObject hierarchy@*the^most important classes *in^


that hierarchy {are]*the^shape classes that appear@*the^sections that follow
provide additional background on each |of| *the^shape classes *and%include
several simple examples that illustrate their use@
As you go through *the^ descriptions |of| *the^ individual shape
classes*you {are] likely {to] conclude that some |of| them {are] designed *in^
ways that {are] less than ideal {for}introductory students@*in=*the^abstract*
this conclusion [is] almost certainly correct@
For practical reasons that look beyond *the^introductory course*
*the^Java Task Force decided {to] implement *the^shape classes so that
they match their counterparts *in=Java@ s standard Graphicsclass@
In particular**the^set |of| shape classes corresponds precisely {to]*the^
facilities that *the^Graphics class offers {for}drawing geometrical shapes*
text strings**and%images@Moreover**the^constructors {for} each class
take *the^ same parameters *and%have *the^ same semantics as *the^
corresponding method *in=*the^Graphics class@Thus* *the^ GArc
constructor $ which [is] arguably *the^most counterintuitive *in=many
ways$ has *the^structure {it]does*not because we thought that structure
was perfect* but because that [is] *the^structure used {by] *the^drawArc
method *in=*the^Graphics class@{by]keeping *the^semantics consistent
with {its] Java counterpart**the^acm@ graphicspackage makes {it] easier
^for*students {to] move on {to]*the^standard packages as they learn more
about programming@
The GRect Class *and%{its] Subclasses
The simplest *and%most intuitive |of| *the^shape classes [is]*the^GRect
class*which represents !a#rectangular box@This class implements *the^
GFillable* GResizable**and%GScalable interfaces* but otherwise
includes no other methods except {its]constructor*which comes *in=two
forms@*the^most common form |of| *the^constructor is
new G R e ct ( x * y * w i d t h * h e i g h t )
which defines both *the^location *and%size |of| *the^GRect@*the^second
form |of| *the^constructor is
new G R e c t ( w i d t h * h e i g h t )
which defines !a#rectangle |of| *the^specified size whose upper left corner
*is]{at]*the^origin@If you use this second form* you {will] typically add
*the^GRect {to] *the^canvas {at]!a#specific (x*y) location@
You have already seen one example |of| *the^use |of| *the^GRect class
*in&*the^simple FeltBoard example@!a#more substantive example [is] the
Computer Software Languages *and%Graphics Design

Checkerboard programme* which draws !a#checkerboard that looks


like this*

Code {for} *the^Checkerboard example


/*
* F i l e * C h e c k e r b o a r d @ja v a
*
* T h i s programme draws !a# c h e c k e r b o a r d @ *the^ d i m e n s i o n s o f

* c h e c k e r b o a r d [ i s ] s p e c i f i e d {by] *the^ c o n s t a n t s NROWS and


* NCOLUMNS* *and% *the^ s i z e |of | *the^ s q u a r e s [ i s ] c h o s e n so
* t h a t * t h e ^ checkerboard f i l l s * t h e ^ a v a ila b le v e r t i c a l
space@
*/
i m p o r t acm@ p r o gr am me @*~
i m p o r t acm@g r a p h i c s @*~

p u b l i c c l a s s Checkerboard ex te n d s GraphicsProgram {
/** Runs *t he^ programme */
public void ru n () {
do u b l e s q S i z e = (double) g e t H e i g h t ( ) / NROWS~
^for* ( i n t i = 0~ i < NROWS~ i ++) {
f o r ( i n t j = 0 ~ j < NCOLUMNS~ j++) {
double x = j * s q S i z e ~
double y = i * s q S i z e ~
GRect sq=new GRect(x* y * s q S i z e * s q S i z e ) ~
s q @s e t F i l l e d ( ( i + j) % 2 $= 0 ) ~
add(sq)~
}
}

/* P r i v a t e c o n s t a n t s */
p r i v a t e s t a t i c f i n a l i n t NROWS = 8 ~ / * Number | o f | rows */
p r i v a t e s t a t i c f i n a l i n t NCOLUMNS = 8 ~ / * Number | o f |
columns */
}
174 Computer Software Languages *and%Graphics Design

The diagram |of| *the^graphics class hierarchy**the^GRect class has


two subclasses$ GRoundRect *and%G3DRect$ that define shapes that
^are*essentially rectangles but differ slightly *in=*the^way they {are] drawn
on *the^screen@*the^GRoundRect class has rounded corners**and%*the^
G3DRect class has beveled edges that can be shadowed {to] make *it^
appear raised or lowered@ These classes extend GRect {to]change their
visual appearance *and%{to]export additional method definitions that
make {it] possible {to] adjust *the^properties |of| one |of| these objects@*for^
GRoundRect* these properties specify *the^ corner curvature~*for^
G3DRect**the^additional methods allow *the^client {to]indicate whether
*the^rectangle should appear raised or lowered@ Neither |of| these classes
^are*used much *in=practice*but they {are] included *in=acm@ graphics *to^
ensure that {it] can support *the^full functionality |of| Java@ s Graphics
class*which includes analogues {for} both@
The GOval Class
The GOval class represents *an^elliptical shape *and%[is]defined so
that *the^parameters |of| {its] constructor match *the^arguments {to] *the^
drawOval method *in=*the^standard Java Graphics class@This design
*is]easy {to] understand as long as you keep *in=mind *the^fact that Java
defines *the^dimensions |of| *an^oval {by] specifying *the^rectangle that
bounds it@Like GRect**the^GOval class implements *the^GFillable*
GResizable**and%GScalable interfaces but otherwise includes no
methods that {are] specific {to] *the^class@
The GLine Class
The GLine class [is] used {to] display !a#straight line on *the^display@
*the^standard GLine constructor takes *the^x *and%y coordinates |of| each
end point@{for}example*{to] draw !a#line that extends diagonally
^th
*from *e^origin |of| *the^canvas *in=*the^upper left {to]*the^opposite corner *in=*the^
lower right*you could use *the^following code*
GLine d i a g o n a l = new G L in e ( 0 * 0* g e t W i d t h ( ) * g e t H e i g h t ( ) ) ~
add(diagonal) ~
On *the^whole**the^GLine class makes intuitive sense@There are* however*
!a#few points that {are] worth remembering*
• Calling setLocation(x* y) or move(dx* dy) on !a#GLine object moves
*the^line without changing {its] length or orientation@If you need *to^
move one |of| *the^endpoints without affecting *the^other* you can do
so {by] calling *the^methods setStartPoint(x*y) or setEndPoint(x* y)@
Computer Software Languages *and%Graphics Design 175

• The GLine class implements GScalable $ which expands or


contracts *the^line relative {to] {its] starting point$ but not GFillable
or GResizable@
• From !a# mathematical perspective* !a# line has no thickness and+
therefore does not actually any points@*in=practice* however*{it]*is$
useful {to] define any point that [is] no more than !a#pixel away
*from
^th
*e^line segment as being part |of| *the^ line@This definition makes
^it*possible*{for} example*{to] select !a#line segment using *the^mouse
^by*looking {for} points that {are] $close enough$ {to] *the^ line {to] be
considered as being part |of| it@
• As with any other GObject* applying *the^getWidth method {to]!a#
GLine returns {its] horizontal extent on *the^canvas@There [is] no way
*in&acm@ graphics {to] change *the^thickness |of| !a#line*which [is] always
one pixel@
Even though *the^GLine class [is] conceptually simple* you can
nonetheless create wonderfully compelling pictures with it@*for^
example* shows !a#drawing made up entirely |of| GLine objects@*the^
programme {to] create this figure $ which simulates *the^process |of|
stringing coloured yarn through !a#series |of| equally spaced pegs
around *the^border$ appears@
MODERN COMPUTER GRAPHICS
MOTION CAPTURE
Two programmes useful {for} *the^realization |of| !a#motion capture
^are*MotionBuilder *and%FaceRobot@FaceRobot [is] !a#new computer
graphics software {for} digital acting* intended {for} professional
character animators *in=*the^film *and%game industries@{it]addresses *the^
technical problems |of| creating life#like facial animation {for} realistic
human characters with !a#novel set |of| algorithms@{for}motion capture
animation*FaceRobot requires !a#smaller number |of| markers (only 25
^to*30) than traditional high#end approaches@
FaceRobot provides*
• Fast organization |of| *the^ work {to] create !a# grid face # animators
can quickly import !a# character *and%immediately proceed *to^
realistic facial animation*
• Support *the^processes |of| creating animations |of| Autodesk Maya*
• Support {for} motion capture *and%key frame animation {to] achieve
optimal results |of| *the^work*
• Optimize {for} game development@
176 Computer Software Languages *and%Graphics Design

MotionBuilder [is] professional 3D character animation software@


^it*[is]used {for} motion capture *and%traditional keyframe animation@
*it^is*]used *in=*the^production |of| games* films**and%other multimedia
projects@ Functionality includes real#time display *and%animation tools*
facial *and%skeletal animation* ragdoll physics* inverse kinematics*
story timeline editing etc@

Fig@Face Created with *the^Programme FaceRobot

Simulation |of| Crowd Behavior


Let us look {at] three programmes {for} simulation |of| collective
behaviour |of| graphical objects@Autodesk Kynaps [is] *the^artificial
intelligence middleware product@{its] purpose [is] {to] facilitate *the^
implementation |of| *the^ mobility function on *the^scene *in=real#time
characters who {are] not direct players@
Kynapse includes*
• An automatic AI data generation tool*
• A complete 3D pathfinding*
• Spatial reasoning*
• The management |of| dynamic *and%destructible terrains*
• Streaming mechanisms {to] handle very large terrains@
MASSIVE (Multiple Agent Simulation System *in= Virtual
Environment) [is] !a# high#end computer animation *and%artificial
intelligence software package used {for} generating crowd#related
visual effects {for} film *and%television@{its]main feature [is]*the^ability *to^
quickly *and%easily create thousands |of| agents that all act as
individuals@Through *the^use |of| fuzzy logic**the^software enables
every agent {to] respond individually {to] {its] surroundings* including
other agents@These reactions affect *the^agent@ s behaviour*changing
how they act {by] controlling pre#recorded animation clips*which can
come {from] motion#capture sessions*or can be hand#animated *in=other
3D animation software packages@
Computer Software Languages *and%Graphics Design 177

APPLICATIONS |of| COMPUTER GRAPHICS


Computers have become !a# powerful tool {for} *the^ rapid and+
economical production |of| pictures@
Advances *in=computer technology
have made interactive computer graphics !a#practical tool@Today*
computer graphics [is] used *in=*the^areas as science* engineering*
medicine* business* industry* government* art* entertainment*
advertising*education**and%training@
COMPUTER AIDED DESIGN
A major use |of| computer graphics [is] *in= design processes*
particularly {for}engineering *and%architectural systems@{for}some design
applications~ objects {are] first displayed *in=!a#wireframe outline form
that shows *the^overall sham *and%internal features |of| objects@Software
packages {for} CAD applications typically provide *the^designer with !a#
multi#window environment@ Each window can show enlarged sections
or different views |of| objects@Standard shapes {for}electrical*electronic*
{and} logic circuits {are] often supplied {by] *the^ design package@*the^
connections between *the^components have been mad automatically@
• Animations {are] often used *in=CAD applications@
• Real#time animations using wire frame displays {are] useful *for^
testing performance |of| !a#vehicle@
• Wire frame models allow *the^designer {to] see *the^interior parts
|of| t*he^vehicle during motion@
• When object designs {are] complete* realistic lighting models and+
surface rendering {are] applied@
• Manufacturing process |of| object can also be controlled through CAD@
• Interactive graphics methods {are] used {to] layout *the^buildings@
• Three#dimensional interior layouts *and%lighting also provided@
• With virtual#reality systems**the^designers can go {for}!a#simulated
walk inside *the^building@
Presentation Graphics
• It [is] used {to] produce illustrations {for} reports or {to] generate slide
^for*with projections@
• Examples |of| presentation graphics {are] bar charts* line graphs*
surface graphs* pie charts *and%displays showing relationships
between parameters@
• 3#D graphics can provide more attraction {to] *the^presentation@
178 Computer Software Languages *and%Graphics Design

Computer Art
• Computer graphics methods {are] widely used *in=both fine {are] and+
commercial art applications@
• The artist uses !a#combination |of| 3D modelling packages* texture
mapping* drawing programmes *and%CAD software@
• Pen plotter with specially designed software can create $automatic
art$@
• $Mathematical Art$ can be produced using mathematical
functions* fractal procedures@
• These methods {are] also applied *in=commercial art@
• Photorealistic techniques {are] used {to] render images |of| !a#product@
• Animations {are] also used frequently *in=advertising**and%television
commercials {are] produced frame {by] frame@Film animations
require 24 frames {for} each second *in=*the^animation sequence@
• A common graphics method employed *in=many commercials *is$
morphing*{where}one object [is] transformed into another@
Entertainment
• CG methods {are] now commonly used *in=making motion pictures*
music videos *and%television shows@
• Many TV series regularly employ computer graphics method@
• Graphics objects can be combined with !a#live action@
Education *and%Training
• Computer#generated models |of| physical* financial *and%economic
systems {are] often used as educational aids@
• For some training applications* special systems {are] designed@
Eg@Training |of| ship captains* aircraft pilots etc@
• Some simulators have no video screens* but most simulators
provide graphics screen {for} visual operation@Some |of| them
provide only *the^control panel@
Visualization
• The numerical *and%scientific data {are] converted {to] !a#visual form
^for*analysis *and%{to] study *the^behaviour called visualization@
• Producing graphical representation {for} scientific data sets {are] calls
scientific visualization@
• And business visualization [is] used {to] represent *the^ data sets
related {to] commerce *and%industry@
• The visualization can be either 2D or 3D@
Computer Software Languages *and%Graphics Design 179

Image Processing
• Computer graphics [is] used {to] create !a#picture@
• Image processing applies techniques {to] modify or interpret
existing pictures@
• To apply image processing methods**the^image must be digitized
first@
• Medical applications also make extensive use |of| image processing
techniques {for} picture enhancements* simulations |of| operations*
etc@
Graphical User Interface
• Nowadays software packages provide graphics user interface
(GUI) {for} *the^user {to] work easily@
• A major component *in=GUI [is]!a#window@
• Multiple windows can be opened {at]!a#time@
• To activate any one |of| *the^ window**the^user needs just {to] check
on that window@
• Menus *and%icons {are] used {for} fast selection |of| processing
operations@
• Icons {are] used as shortcut {to] perform functions@*the^advantages
|of| icons {are] which takes less screen space@
• And some other interfaces like text box* buttons**and%list {are] also
used@

You might also like