l 1 The cyclomatic com plexity M of a detailed design is the number of binary deci- ' sions predicat es plus l EM ccabe, 1 9761 or, equi val ently, the number of branches in the module..
Trang 1t Ia l@ TKSTI N/ PURI N/ TH: DESI *N PHA:K
'
:f
! The goal of est i ng i n t he des i gn phase i t o ver i y t hat he speci scat i ons have been
j I! accurately and completely i ncorporated int o the design as wel l as t o ensure the
cor-.
i rectness of the design itself For exam ple, the design must have no logic faults and
l al1 interfaces m ust be correctly defined It is im portant that any faults in the design
I
. be detected before eoding com mences otherwise the cost of fixing the faults will
!
1 means of design inspections as w ell as design walkthroughs Design inspections are
i shoul d reiect t hi s IBeizer, 19901 Inspecti ons that include a1l possi bl e transact ion
!
t ypes s houl d be schedul ed The r evi ewer s houl d r el at e each t r ansact i on i n t he 1
de-j sign to t he specif ication, showing how the transaction arises from the specit ieat ion
j j ' document For example, if the applicat ion i s an automated t eller machine, a
transac-' t on cor r esponds o each oper at i on t he cust omer can pedbr m, such as deposi to or )
! i system deciding to change a particular light from red to green in l5 seconds, then
,t further im pulses from that sensor pad may be ignored.Conversely, to speed trafhc
To take an extreme exam ple,he specilications for the traffic-light controller may
,between l 1:00 P.M and 6:00 A.M., all lights are to llash yellow in one !
direction and red in the other direction lf the designers overlooked this stipulation
,
l hen clock-generated transactions at l 100 P.M. and 6:00 A.M
would not be included
( j
' in the design', and if these transactions w ere overlooked, they could not be tested in
' des gn i inspecti ons that are just transaction dri ven' , specihcat ion-dri ven inspecti ons
- 1
.
( also are essential to ensure that no statement in the speci scati on document has been
l either overlooked or m isinterpreted.
!
W hat therefore is needed is a CA SE tool that can be used both for the specihcation
Trang 2f
: l'
Iaaa M ETRIKS FoR THE DESIGN PHM E *%@ I 1
opposed to a back-end or 1owerCASE tool, which assists with the im plem entation, ) j
' A number of uppercAsE tools are on the m arket.Some of the m ore popular # :
in the specifications and conversely that every item in the specifications appears in
g ë
. every item are in the data dictionary, the CASE tool easily can generate the code for j
i nting the report or displ aying the input screen according to the cli ent' s wishes y ) l pr
. lS
om e uppercAsE products also incorporate m anagem ent tools for estim ating and I
: I
'
3 ( ( la
cohesion and coupling are measures ot the quality of the design, as are fault statistics ; t
As w ith all other types of inspection, it is vitalto keep a record of the num ber and type 1
-1
code inspections of the product and in design inspections of subsequent products l
1
The cyclomatic com plexity M of a detailed design is the number of binary deci- '
sions (predicat es) plus l EM ccabe, 1 9761 or, equi val ently, the number of branches in
the module It has been suggested that cyclom atic complexity is a m etric ot design j iquality: the lower the value of M , the better An advantage of this metric is that it ' '
!
is easy to compute. However, it has an inherent problem Cyclomatic com plexity is ; ! y
p '
a measur e purel y of he cont r ol compl exi t y' , t he dat a compl exi t y i sgnor ed That ss l i
M does not m easure the com plexity of a m odule that is data driven such as by the : j,values in a table For example suppose a designer is unaware ot the C++ library 1 l '(
functi on t oascii and desi gns a modul e from scratch that reads a character input by ' 1 '
Trang 3! A SCII code order and utilize a loop to com pare the character input by the user wit
.Neve'rtheless
,experiments have shown that this m etric is no'
li paradigm is used.For exampl e, the cyclomati c compl exi ty of a cl ass usuall y i s l ow,
! because many cl asses ypi cal l y i ncl ude a l ar ge number ofsmal l st rai ght f or war d met
h-1
h
i ods Furtherm ore, as previously pointed out, cyclomatic complexity ignores data
: compl exi ty Because data and actions are equal partners wi thin the object-oriented
j
: i paradi gm, cycl omatic compl exi ty overl ooks a major component that coul d cont ri but e
: l jj to the compl exi ty of an objeet Therefore, metri es for elasses that incomorate
cyclo-i m atic com plexity generally are ot little use
i A number of objeet -oriented desi gn metrics have been put forward
,for example,
!
q both t heoreti cal and experimental grounds gBi nkley and Schach, 1996 , 1997 , 19981.
$ is shown in Figure l 3 8 The sequence di agram was constructed by taking each
statement in t he scenario and drawi ng an arrow between the instances of the relevant i
lasses In more detail, f irst the actors of t he scenario were determi ned: Possenger,
Trang 4- E !
Aaaa AIR GOURMG CM E STUDY: O BJK T-O RIENTED DESIGN *QX ' ' l
!
p :
! !
I I
lz three actors are placed at the top of Figure l3.8 and vertical double lines drawn y j
kt in Now each event of the scenario is exam ined and entered in the sequence dia- ! i
! ' j
xram For example, in the first event, the passenger calls a phone operator to make a
Trang 5l request reservati on The remainder of the sequence di agram is equall y strai ght
for- i I
'1 1 The collaboration diagram for the scenario for returning and scanning a postcard
) (Fi gur e 12 1 4) i s s hown i n Fi gur e 13 1 9 As wi t h t he sequence di agr am of Fi gur e .
1 l.l 8, the f irst st ep in construct ing the coll aborati on diagram is to examine t he ex- ' 1
i tended scenario (Figure l.l4) and determine the actors. In this case. they are found .i
.) actors are draw n in Figure 13 l9 Next each event is exam ined and entered in the
I diagram ln event l a mem ber of the Air Gourm et staff mails a postcard to each
i passenger w ho received a special m eal.First, a line is drawn between Air Gourmei
;
!
j staff member sends a postcard to the passenger
j The second event is the passengerreceivi ng the postcard, fill ing i t i n, and returni ng
I it to the staff mem ber.This is denoted by the arrow in the reverse direction with the
I
h label 2 ret urn post card.
1 The third event is the staff m ember receiving the postcard and updating the
I
l relevant flight record to refleet the passenger's opinion of the special m eal he or she
l
) received A vertical line is drawn between the icon representing the Air Gourmet .
1 s.ep Q toss,rve e e p-ol led tl oss pl ogrom The det ai l ed cl ass di
a-1 g r am f or he c++ i mpl ement at i on i s shown i n Fi gur e 13 20 and for he Java i mpl
e-.1 jl mentation in Figure 13.21 One difference between the two figures is that Java has
Trang 6' h '
i
'
) :Date Flight Record Passenger
month : short passenger ID : string passenger ID : string !
!
' month name : string reservotion ID : string first name : s'ring k
day : short fght number : string middfe initial : char ' '
!
year : short flighi date : string Iast name : string I 1
ber : st ri ng 1 * suf fi x : st ri ng 1
st c dat e : str i ng seat num
meal type : m-type address 1 : string
et month () meol Ioaded : boolean address 2 : string j ii
9
. s et mont h ( ) on boar d : bool ean ci t y : st ri ng I j
t mon t name per c meal quol i i s at e/pr ovi n ce : ù ng ' ' '
t s ef monf h nome ( posàalcode : sàring
'
9
s et st r dat e () set f l ght numLer ( ) get as t name ( ) 1 .
get meal I oaded ( ) @ et count r y () j ;
i
j
get per c meal qual i y () get pass enger () '
t erc meal qualiy () get descripfon () ',: l 1
I l
'
ge# juol i cof i ons ( ) i ' J '
P
1 ,I
Flgvre 1a.Q@ Detailed class diagram for C++ implementction of the Air Gourmet product
j '
Trang 7ualies for report()q
.1
pri nt recor d () l
'
l Iouded as specifed
, i
1 pussengeron board, quaIes f or report ( ) quol i es f or report ( )
:
'
j not oa e j t j t j : nt a j
I
, ! pri nt ( ) i
whereas a user-defined class Do1 is needed in the C+ + im plem entation Another :
'I difference is that Java is a pure object-oriented language, that i s, a Java program
l consists of a set of classes,w hereas C+ + supports functions. W ith regard to this
'
l The methods for the product appear in the various interaction diagrams
.The task
of the designer is to decide to which class each m ethod should be assigned ln the
Trang 8meal type : m-type address 1 : string jmeal Ioaded : boolean address 2 : string i
Air Gourmet Utilies
get charact er ( ) P ost ol code : str i ng E I
r ead st ri ng () get passenger I D () count ry : st ri ng 1 '
'
pr es s ent er () get reservat i on I D () get passenger I D ( ) 1.
display main menu () set reservation ID () getfirst name () 1
' display report menu () getflight number () get middle inifal () '
set flight number () get Iastname () l y
'
set flisht date () get address 1 () ( '
get perc meal qualiy () getpassenger () ! l
scan postcard ()
print record ()Flgvee la.Ql Detailed closs diogram forJava implementaiion of the Air Gourmet product j
1
Trang 9j ualifications ()
, qualifies for report() quolies for reporf () :
ej qual i fi cati ons ()
,i ! I case of the Air Gourmet product, the assi gnments of methods to classes is
straight-k q forward For example, method get passenger I D clearly belongs in cl ass Pcssenger.
.
i
'
s'ep a peslgn :l xe produe In Tey-s ol oblees d Th@lr tII@nI,
1 The thi rd step of OOD i s to design the product i n terms of objects and thei r cli ent s,
Trang 10: I
! .
laaa A IR GOURMET CAS: STUDY: O BJK T-O RIENTED DKSIGN #2T i ;
2 '
percentage Not-Loaded onboard ; 1
i :
- Caterer Poor-o uality Low-sodium l:
E
' j
I q: ,
!
-1 t
-i
r
g ; lR
t l.i
i .
' ' ' j
: ' i
-are not U M L diagram s They are included in this book because m y experience is that , !' diagram s of this kind can assist in gaining an understanding of how the various pieces ' ij
The client-objeet relation di agrams were construeted by taking each CRC card !
and determ ining w hich methods of other classes are invoked by methods of thatclass
' I I
I
I .
1 '
i ;
Trang 111 In general, if CRC cards have not been constructed, then class diagrams can be used '
l
I The rapid prototype of the Air G ourmet product (Appendices C and D) showed '
! that a menu-driven design would be feasible The m ain menu allows the user to select
t
i s:@p * pe:elled peslsn Fi nall y, the detail ed design i s buil t A compl ete
!
j I (for implementation in Java) The detailed design was built by taking each method
i or function and determ ining what it does The tabular notation for the detailed design
I
j may seem somew hat cum bersom e, but its form ality aids the program m ers
'
i Now t hat t he desi gn i s appar ent l y compl et e, al 1 as pect s of t he desi gn mus t
I be rechecked.No faults are found Nevertheless, it is possible that the design will
Trang 12' )
: l la
.1* ZHALL:N/'S @F THz D E/I/N PHA*: : I l
of the design phase ln the design phase, the design team can go wrong in two ways: !! ! I '
by doing too m uch and by doing too little
Consider the PDL (pseudocode) detailed design of Figure l3.7 The temptation is '
it e the detailed desi gn in C++ or E strong for a designer who enjoys programming to wr
f sketching the detailed design in pseudocode, 1Java
, rather than PDL.That is instead o
l e This takes longer t o wri te thanjust outli ni ng !
t he desi gner may al l but code the modu I'the module and l onger to t ix if a faul t is detect ed i n the desi gn (see Fi gure l 5) Like j.the speeification team , the m em bers of the design team m ust firm ly resist the urge to :
'
Atthe same tim e,the design team m ustbe careful notto do too little Consider the 1tabular detailed design of Figure 13.6 If the design team is in a huny it m ay decide f r
:
to shrink the detai led design to just the narrative box It even may deci de that the i
program mers should do the detailed design by them selves Either of these decisionswould be a mistake A prim ary reason for the detailed design is to ensure that all ( k
'
interfaces are correct The narrative box by itself is inadequate for this purpose; no i I
$ 1
detailed design at al1 clearly is even less helpful Therefore, one challenge of the 1 ': l
1 ; (
design phase is for the designers to do just the correct amount of work : ! ,. j
In addition, there is a m uch m ore significant challenge ln his tûNo Silver Bul- ! I
ers
,that is, designers w ho are signihcantly m ore outstanding than t e ot er mem - !,I
I bers of the design t eam ln Brooks's opi nion, t he success of a software project de- E , (
! l pends criti cally on whether the design team is 1ed by a great designer.
sign can be taught', great design is produced only by great designers and they are : l
The challenge, then, is to grow greatdesigners They should be identihed as early ;
I
mentor,provided with a form al education as wellas apprenticeships to greatdesigners, 1
an
! for these designers
, and the rewards they receive should be com m ensurate with the j
cont r but i on t hat onl y a great desi gner can make t o a s oft war e devel opment pr ojeet j
i ! i
t
: ;The design phase consists of architectural design
,followed by det ail ed design (Sec- ) ( ;
' i
l.2) data-ori ented design (Secti on l 3 5), and object-ori ented desi gn (Seetion l 3 6) ;
: JE
! L
I
Trang 13l 3 3) and r ans a t on ana l ys i ( Se c i on 1 3 4) Obj ec t or i ent e de s gn s ap pl i d t
1 t he el eva t or pr obl em i se ct i on l.7 Techniques for detailed design are put forward a
.
j ) i n sect i on 13 8 Real - me syst em desi gn i s descri bed i n Sect i on l 3 9 n Sect i on
E i i the object-ori ent ed design of the Air Gourmet Case Study (Secti on 13 13) and a
'1 di scuss i on of he chal l enges of t he des i gn phase ( Sect i on 1 3.14). 3@3
Turning now to object -orientcd design, i nformati on can be obt ained from 3.# .l
r $ l' Mel l or, 1992, and Jacobson, Booch, and Rumbaugh, 19991 Compari sons of var i
ety of techniques for object-oriented desi gn appear in r M onarchi and Puhr, 1992, and 1: l
w al ker, 19921 A compari son of bot hobject-orientedand structureddesi gn t echniques j j
; I W ith regard to reviews during the design process, the original paper on design
,19761 , detai led i nformati on can be obtained from that paper.
: i
.13)
j Later advances in review techniques are described in rFagan
,
19861 The use of wal
s pe ci hc e hni ques ar e t o be ound i r Wa r
:
1,j four real - ti me desi gn t echni ques i sound i n ( Kel l y and Sheri f, 19921 The Sept ember
l 1992 issue of IEEE Software contains a number of art icl es on the desi gn of real-ti me
!
t syst ems, as does t he June 1995 i ssue of EEE Comput er The desi gn of di s ri but ed
-I
19991 1
j M etri cs for the design phase are deseribed i n îl - lenry and Kafura, 1981; Brandl,
.
1 1990 , Henry and Seli g, 1990, and Zage and Zage, 19931 M etrics for object-ori ent ed
'
,1994, and Binkley and Schach,.)
')! The proceedings of the International W orkshops on Software Specihcation and
k Design are a comprehensi ve source for informati on on desi gn techniques.
Trang 14: t
'
!
: i11
.1 Starting with your D FD for Problem l l.6, use data flow analysis to design a product j
E
11.2 Use transaction analysis to design the software to contro an
; r k
11.3 Now take your design for Problem l3.2 and add m odules to perform error handling ( 1 1Carefully exam ine the resulting design and determine the cohesion and coupling of ' 1:
. the m odules Be on the Iookout for situations such as that depicted in Figure 13.1 (
i I 13
.3 (Figures 13.6 and l3.7) Com pare and contrast the two techniques 1.11.5 Starting with your data flow diagram for the autom ated library circulation systenz !
!(Problem l l.8), design the circulation system using data flow analysis. ( ,
.7 St arting with your object-oriented anal ysis for the automated library ci rculation sys- 1 j tem (Probl em l 2.2), design the library system using object-ori ented design 1 '
11 8 Desi gn the ATM software (Problem 8 9) using object-oriented design ' i
i l 11
.9 (Term Project) Starting wi th your specif icati ons of Probl em l l l 5 or l 2 9, desi gn the j j
' i tal product (Appendix A) Use the design technique 1 ' 1
1 !
: ) I
.1 1 (Case Study) Redesign the Air Gourmet product using transaction analysis : '1.12 (Case Study) The detailed designs ot Appendices H and Appendix l are represented in I
tabular form.Represent the design using a PDL (pseudocode) of your c
p l
r epresent at i on i s super i or? Gi ve r easons for your answer
1 13 ( Readi ngs n Sof t war e Engi neer i ng) Your nst ruct or wi l di si but e copi es of St ol per , 1 !
l 9991 W hat are your vi ews regarding the introducti on ot the object-ori ented paradigm i E : ;
(
Trang 151 i ndi vi dual,the process is relatively well understood But m ost real-life products today are too large to be
im plem ented by one program m er within the given tim e constraints lnstead,the product is im plemented by a
l t eam, worki ng at the same time on different components of the product.This is termed programm ing-in-t
be-1 l many Issues assoc iated with programming-in-the-many are examined in this chapter '
i Sm alltalk.Perhaps, in the opinion of the development team , Smalltalk is entirely
un-i suitable forthe product Such an opinion is irrelevantto the client.M anagementof the
l lf no other language is available, either because no compiler has yet been written for
any high-level language on that com puter or m anagem ent is not prepared to pay fornew C+ + com piler for the stipulated computer then again clearly the issue of choice
of program m ing language is not relevant
A more interesting question is this: A contract specifies that the product is to be' implemented in Sûthe m ost suitable''program m ing language.W hat language should be
Trang 16mean having to hire new programm ers or, at the very least, existing staff w ould have ' 1
Nevertheless all the existing COBOL products would have to be m aintained There '
2 Ithen would be two classes of program mers
,COBO L m aintenance program mers and ' i i: Java programm ers writing the new applications.Quite undeservedl y, maintenance i rj
!alm ost always is considered inferiorto developing new applications
ldistinct unhappiness am ong the ranks of the COBOL program mers This unhappiness
E I
l than COBOL programmers because Java programmers are in short supply
aS excellcnt development tools for COBO L, a Java compiler would have to f
be purchased, as well as appropriate Java CASE tools Additi onal hardware may ' 1
:
all, QQQ has accumul at ed hundreds of person-years of COBOL expert ise, t he kind I
of expertise that can be gained only through hands-on experience, such as what to J
o w hen a certain cryptic en'or m essage appears on the screen or how to handle the :
d he m ost suitable'' program m ing i, 1quirks of the compiler ln brief, it would seem that t
language could only be COBOL- any other choice would be linancial suicide, either ' from the viewpoint ol the costs involved or as a consequence of plum m eting staff ''
i
And yet, the most su
project may indeed be some language other than COBOL Notwi thstandi ng its po- : ! i. )
'
' ware products,data-processing applicat ions. But if QQQ Corporat i on has software 5 l i 1 I
, l
needs out s de t hi s cl as s, hen COBOL rapi dl y l os es i t at t act i veness For exampl e, j )
if QQQ wishes t o construct a knowledge-based product using artil icial intelligence i !: C
' I
unsuitable for AI applications If large-scale com m unications software is to be built, I
the world, then a language such as Java would prove to be far more suitable than ! 1:
f iting systems software such as op- ' iCOBOL
If QQQ i s to go into the business o wr j
erating system s, com pilers, and linkers, then CO BO L very delinitely is unsuitable j
:.
soon discover that COBOL sim ply cannot be used for real-time embedded software iThe issue of w hich programm ing language to use often can be decided by using
cost of an im plementation in CO BOL as well as the dollar benehts, present and j
( ! future
consi derati on The l anguage with t he largest expected gai n, that is, the di ff erence I j ( between esti mated benehts and est imated costs, i s t he appropriate impl ementation l (
l anguage Another way Of decidi ng whi ch programming language t o sel ect i s to use ' 1 2 l
I : Irisk analysis For each language under consideration, a list is m ade of the potential : q
!
i.
i :
I
Trang 17JusT IN G sz Yov W Axlzp To K wow
Far more code has been writen in COBOL than all Anotherreason forthe popularity of CoBol-aisthat
l other programmi ng Ianguages put toget her COBOL COBOL frequentl y i s t he best l anguage tor i mpl ement
-l is the most widely used langtlage primarily because ing a data-processing product.In particular, CO BO L
OL was ap- er rorscannot be all owedto creep i n Therefor e, alI
com-I 1 Rear-Admi ral Grace Murray Hopper, COB
@1 Proved by DoD in 1960.Thereaft er t he DoD woul d not putati ons have t o be performed usi ng integerarit hmet ic.
l
i buy har dwar e or runni ng dat a pr oces si ng appl i cat i ons COBOL suppor t i nt eger ar i hmet i on ver y I ar ge
num-l unl es s hat har dwar e had a COBOL compi l er Sammet, bers (that is, billions of dollars). ln addition. COBOL
J 19781 DoD was, and sti ll is t he world s largest pun can handl e very smal l numbers such as, fract ions of
l
: chaser of computer hardwar e; and in t he 1960s, a con- a cent Banki ng regul ati ons r equi re i nt erest comput
a-l siderable proportion of DoD software was w ritten for tions to be calculated to at least four decim al places of
t da t a pr ocess i ng As a r es ul t COBOL compi l er s wer e a cent and COBOL can do t hi s ar i hmet i wi t h eas e s
when the only alternative language usually was assem- generation language (or high-level language- see
Sec-bler, resulted in COBOL becoming the world's most tion 14.2) Al1 these reasons have made COBOL an '
'( 1 a1 programmi ng language
. excellent choice for im plem enting a data-processing '
'$ l POPU
.i Languages such as C, C++, Java, and the 4GLs product
1 undoubtedly are growing in popularity for new applica- As mentioned in Section 8.7.4, the upcoming
à.j ti ons Nevert hel ess, maint enance st ill i s t he major soft- COBOL l anguage standard is for an object-ori ented
t ware activity, and this maintenance is being perforlued language This standard surely will further boost the
:
.
rl on exi st ing COBOL soft war e In short, the DoD put popul ari ty of COBOL.
1 is stamp onto the worldgs software via its hrst major
programming language, COBOL
1 Currentl y, soft ware organi zations are under pressure to devel op new software i n
i is thi s: W hich is t he appropriate object-oriented language? Twenty years ago, t here '
i really was only one choice,smal l tal k Today, however, he maj ori t y of obj ect - or i ent ed
1
software is bei ng writ ten in c++ There are a number of reasons for t hi s One is the 1
.widespread availability of C+ + compilers ln fact many C+ + com pilers simply
,1 translate the source code from C+ + into C, then invoke the C eompiler Therefore,
I any com puter with a C compiler essentially can handle C+ +
.This is unfortunate, in that a num ber of managers view C++ sim ply as a superset.k
1 of C and, therefore, conelude that any program mer who know s C can quickly pick
1 up the additional pieces.Indeed, from just a syntact ical viewpoi nt, C++ essent ial l
y compi l er Concept ual l y, however , C++ i t ot al l y di f erent om C C i s a pr oduct ef
Trang 18is organi zed around objects and classes, not modules ;
Therefore, before an organization adopts C+ + it is essential that the relevant
software professionals be trained i n the object-oriented paradigm It is parti cularl y p
importantthat the information ot Chapter 7 be taught Unless itis clear to all involved, j
and part icularly to management, that t he object-oriented paradi gm i s a di fferent way ;
of developing software and w hat the precise ditferences are, the structured paradigm
I just will conti nue to be used but with the code writt en i n C++ rat her than C.W hen j
organi zations are disappoi nted wi th the resul ts of swit ching from C to C++ a major I 1I
contributory factor is a lack of educati on i n t he object-ori ented paradi gm 1
Suppose t hat an or gani zat i on deci des o adopt Java l n t hat case i inot possi bl e 1
di gm to the object-ori ented paradigm Java 1
to move gradual ly from the structured para
1 :
is a pure object-ori ent ed programming language; idoes not support the funct ions and j procedures of the st ructured paradigm Unli ke a hybrid object-oriented language such
as C++, Java programmers have to use the object-oriented paradi gm (and onl y the object-oriented paradi gm) from the very begi nning Because of the necessity of an :!
abrupt transition from the one paradigm to the other, education and training is even r
more important when adopting Java (or other pure object-ori ent ed language such as I i : Small tal k) than i f the organi zation were to swi tch to a hybrid object-ori ented l anguage ! , 1
.
'
i l
i j i
!: l . l
1 I I< 2 F@URTH-/ ENERATI@N N/UA/ES : 1 #
-'
1 I
The fi rst computers had nei ther int erpreters nor compil ers They were programmed ) '
binary either hardw ired w ith plug boards or by setting sw itches Such a binary ' i
in
lwere assemblers,devel oped i n t he I at e 1940: and earl y l 950s I nst ead of havi ng t o : t ; i
program in binary, instructions could be expressed in sym bolic notation such as '
' j
l
1
In general, each assem bler instruction is translated into one machine code instruction 1
So although assem bler was easier to write than m achine code and easier for m ainte- l
: : I
as many as 5 or 10 machine code i nstructi ons (this i s another example of abstraction',
.!
: 1
! !
j
Trang 19( i st ati on i n New York Ci t y, and said to t he dri ver, ' ' Pl ease sul t I qui ckl y r eplaced my nonprocedural request by
ke me to Lincoln Centen'' This was a nonprocedural a procedural request of the form, ''Straight, straight '
1 l t ur ned out t hat he dr i ver was an i mmi gr ant f r om down For hea ven s s ake, ow down and so on, unt i
( Cent r al Eur ope who had been n Amer ica Iess than two w e finally reached Lincoln Center.
1 months and knew virtually nothing aboutthe geography
!' efm aintenance.t ci ent as he equi va l nt s e mbl e ode ge ner al l ma l pr i e t pa y f or as e n
Thi s concept was taken further in the late l970s A major objecti ve in the designof
'4l1 afourt h-generation language (4GL) is that each 4GL st at ement should be equi valent
.# to 30,or even 50, m achine code instructions Products written in a 4G L such as Focus
J,) or Nat u a ar e s hor t er nd hcnc e qu i ker o dc ve l op nd eas i r o mai nt ai n.
j
j It i s difficult t o program i n machine code It is somewhat easi er to program i n
1 l assembl er and easi er still to use a high-l evel l anguage A seccmd major design
objec-tive of a 4GL is ease in program ming In particular, m any 4GLs are nonprocedaral1
i
: y'Or exam p ,le consider the com mand shown in Figure 14.1 lt is up to the compiler of
r
J the 4GL to translate this nonprocedural instruction into a sequence of machine code
I instructions that can be executed procedurally.
I
! Success stories abound from organizations that have switched to a 4GL A few
1! t a ph t reviously used COBOL have reported a lo-fold increase in productivity through
1 use of a 4GL M any organizations have found that their productivity indeed increased
.1' pr i at e for a1 l pr oducts On t he cont rar y, mport ant o sel ect he cor r ect 4GL f or he
j specific product For example, Playtex used IBM 'S A pplication Developm ent Facili
(ADF) and reported an 80 to 1 produetivi ty increase over COBOL Notwi thstandi ng
Trang 20' , 1
: C
l l*.Q FOURTH-GENERATION LANGUAGES *3@ !
- i istentresults is thatm any 4GLs are supported by ! 2
A second reason tor these ncons
, 1
powerful CASE workbenches and environments (Section 5.5) CASE workbenches
. and environments can be both a strength and a weakness As explained in Section i
I2
.1 l ,t is inadvisable to introduce large-scale CASE w ithin an organization with a low Imaturity level The reason is that the purpose of a CA SE workbench or environm ent ,
is to surmort the soft ware orocess An oruanizat ion at l evel l does not have a software l ' ' ' ' ''
process in pl ace It at this point CASE is introduced as part of t he transi tion t o a 4GL, '
; t hi s wil l impose a process onto an organizati on not ready for any sort of process J
.
: jThe usual consequences at best are unsatisfactory and can be disastrous.ln fact, a
numberof reoorted 4GL failures can be ascribed to the etfects of the associated CA SE l
p :
:I: was found that use of a 4GL reduced user frustration because the data-processing y l
l
' depaftment could respond m ore quickly when a user needed inform ation extracted :
, from the organization's database However, there also were a number of problem s !
1
Som e 4GLs proved to be slow and inefticient, w ith long response tim es One product jconsumed 60 percentof the CPU cycles on an lBM 433 l m ainfram e,while supporting, ;'
!
at m ost, 12 concurrent users O verall, the 28 organizations that had been using a 4GL ë
ifor over 3 years felt that the benefits outweighed the costs
, jselecting the correct 4GL Of course, few organizations can afford to support m ore 1
esign objecti ve of many 4GLs is end-user programmi ng, that is, programming by I
the person w ho will use the product For exam ple, betore the advent of 4G Ls, the !
: f or pr oduct hat woul d di s pl ay er t i nf or ma t on gar di ng e bond por t ol i o The j
' i ves t men t mana ger he n woul d wa i a ye ar or o f or he dat a pr oc es s ng gr oup o
jfind the tim e to develop the product.A 4GL was desired that would be so simple to luse that the investm ent m anager, previously untrained in programm ing, could write i
.End-user program ming was intended to help reduce thedevelopm ent backlog, leaving the professionals to m aintain existing products @i
i
when all product developm ent is performed by com puter professionals Com puter ;.i
q P rofessionals are trained to m istrust com puter output A fter all, probably less than l i:' l
' g