App||cat|ons us|ng Cb[ectCr|ented 1echn|ques |n C++ 8? ZC?A A 8lZvl 8oll no 130 ML CAu/CAM Introduct|on to C++ We use C++ Lo creaLe graphlcal and numerlcal bulldlng blocks whlch can Lhen be assembled Lo form porLable flexlble and cosLeffecLlve soluLlons Lo a number of realllfe problems where graphlcs plays an essenLlal role W Lg AuLoCAu C8ILC1IVLS W C++ ls becomlng Lhe language of cholce for many appllcaLlons W Cne of Lhe reasons for lLs success ls LhaL lL ls compaLlble wlLh C W 1hls means LhaL new appllcaLlons whlch need Lo be wrlLLen ln C++ can use oldsLyle C llbrarles and sofLware wlLhouL havlng Lo do a rewrlLe W ln facL C++ can be used as a beLLer C by uslng Lhe lmproved synLax sLyle and Lype checklng feaLures 8uL C++ can also be used Lo wrlLe ob[ecLorlenLed appllcaLlons Lhus offerlng programmers and organlsaLlons many advanLages such as lmproved sofLware quallLy ShorLer lead Llmes More reusable sofLware SaLlsfled cusLomers C++ AppllcaLlon W MosL graphlcs appllcaLlons aL Lhe presenL Llme are wrlLLen ln C (see for example Lhe serles of books ln Lhe Craphlcs Cems serles from Academlc ress) whlle C++ ls slowly beglnnlng Lo make lnroads ln cerLaln places W We shall see a gradual LranslLlon Lo C++ ln Lhe comlng years as Lhe developer communlLy becomes acqualnLed wlLh Lhe ob[ecLorlenLed paradlgm ConLlnued W Many of Lhe successful graphlcs and CAu packages ln Lhe markeLplace daLe from Lhe 1970s and 1980s W MosL of Lhese were developed ln procedural languages such as C ascal or lorLran W 1he resulLlng producLs were dlfflculL Lo exLend and Lo malnLaln furLhermore lL Look a loL of efforL Lo exLracL and reuse parLs of such sysLems malnly due Lo Lhe facL LhaL poLenLlally reusable deslgns and code were lnLerwoven wlLh Lhe conLexLs ln whlch Lhe sofLware was Lo operaLe W 1he only alLernaLlve Lo copylng Lhe code and edlLlng lL Lo sulL Lhe new slLuaLlon was Lo do a compleLe rewrlLe W 1hls resulLed ln much code dupllcaLlon longer lead Llmes and mlssed opporLunlLles AdvenL of C++ W We can creaLe appllcaLlons whlch can be easlly cusLomlzed exLended and reused ln changlng world W CusLomers are demandlng appllcaLlons whlch be easlly plugged lnLo oLher appllcaLlons W ln oLher words no longer wlll we have Lo deal wlLh large and lnflexlble programs buL lnsLead we shall be able Lo buy sofLware componenLs from dlfferenL vendors and where we can comblne Lhese componenLs Lo creaLe appllcaLlons whlch sulL our own needs(due Lo Lhe reusablllLy of C++ classes) repare for LranslLlon W CrganlsaLlons wlshlng Lo Lake advanLage of Lhe beneflLs of ob[ecLorlenLed Lechnology should be warned however LhaL Lhey musL prepare Lhemselves well for Lhe LranslLlon from a procedural frame of mlnd Lo one where concepLs and domaln knowledge are Lhe mosL lmporLanL parLs of Lhe sofLware llfecycle roblems faced by CAu Cost neutra| f||e format D|rect trans|ators W A Lyplcal slngleuser sLaLlon could cosL anyLhlng from 03 mllllon dollars Lo 4 mllllon dollars lnLerfaces beLween Lhe CAu sofLware and oLher appllcaLlons (such as Lhose for manufacLurlng (CAM) and flnlLe elemenL sLress programs (lLM)) were wrlLLen on a oneoff basls W 1hls meanL LhaL proprleLary producL daLa exchange LranslaLors needed Lo be wrlLLen beLween each palr of appllcaLlons 1he maln problem wlLh Lhls Lype of LranslaLor ls LhaL ln a sysLem of n appllcaLlons n(n1) lnLerface programs are needed W lurLhermore changes ln Lhe daLa formaL of one appllcaLlon (new daLa Lypes added new sLrucLure eLc) lmplled LhaL all Lhe lnLerfaces uslng LhaL appllcaLlon needed Lo be modlfled and reLesLed W 1he alLernaLlve Lo Lhls adhoc sLraLegy ls Lo creaLe a publlc domaln neuLral lnLermedlaLe formaL Lg lCLS vuA SL1 ConLlnued roblem 2 vlrLual Memory m/c WlLh Lhe advenL of vlrLual memory machlnes (such as rlme and vAx sysLems) Lhe slLuaLlon dld noL lmprove very much and englneerlng operaLlons sLlll had Lo wrlLe and malnLaln Lhese lnLerfaces 1he advenL of sulLable neLwork proLocols such as uLCneL and 1C/l only meanL LhaL daLa could be copled from one machlne Lo anoLher one buL Lhe problem of lnLeroperablllLy beLween appllcaLlons sLlll remalned ConLlnued W Many companles are beglnnlng Lo reallze LhaL CC offers many advanLages for sofLware developmenL for CAu ConLrary Lo popular bellef wrlLlng sofLware for CAu ls dlfflculL because aLLenLlon needs Lo be pald Lo a number of areas such as Lhe consLrucLlon and manlpulaLlon of geomeLrlc and nongeomeLrlc ob[ecLs Lhelr represenLaLlon and user lnLeracLlons wlLh Lhe sysLem lurLhermore complex maLhemaLlcal algorlLhms need Lo be deslgned and lnLegraLed lnLo Lhe appllcaLlon lL ls lmporLanL Lo separaLe Lhe appllcaLlon from lLs envlronmenL (whlch ls volaLlle) 1he maln volaLlle elemenLs ln an appllcaLlon are Lyplcally 1he user lnLerfaces (Wlndows uCS MoLlf) 1he underlylng daLabase (8u8MS Cu8MS proprleLary) 1he algorlLhms and daLa sLrucLures belng used ln Lhe appllcaLlon ConLlnued W 1he reason LhaL we wlsh Lo have Lhls separaLlon of concerns ls LhaL appllcaLlons need Lo work under dlfferenL Lypes of hardware and sofLware envlronmenLs W ln order Lo achleve Lhese ends we apply Lhe MvC paradlgm or one of lLs varlaLlons W 1hls can be done ln C++ by uslng Lhe socalled mulLlple polymorphlsm prlnclple or by Lhe creaLlon of absLracL daLa vlews and absLracL daLa ob[ecLs W A number of ma[or CAu vendors are already worklng on ob[ecL orlenLed verslons of Lhelr producLs lor example AuLouesk has released lLs ob[ecLorlenLed verslon of Lhe popular CAu sysLem AuLoCAu and lL ls be posslble Lo creaLe drawlng wlLh lnbullL lnLelllgence whlch ls made posslble by Lhe facL LhaL lLs CAu drawlngs conLaln embedded ob[ecLs ADVAN1AGLS CI C++ W 1he maln advanLages of uslng C++ as opposed Lo C or AuLoLlsp lle ln Lhe supporL lL offers for wrlLlng classes Cnce a class ls wrlLLen lL can be used ln many dlfferenL appllcaLlons wlLhouL change ln oLher words we do noL have Lo relnvenL Lhe wheel by copylng chunks of code modlfylng lL and Lhen reLesLlng 1he classes can be used wlLhouL any change whaLsoever! lurLhermore code wrlLLen ln C++ Lends Lo be more easlly malnLalned Lhan code whlch ls wrlLLen ln nonob[ecL orlenLed languages C++ ls fasL becomlng Lhe de facLo sLandard programmlng language 1he compller runs on many dlfferenL hardware plaLforms and hlgh schools and unlverslLles are Lralnlng sLudenLs ln lLs use ln Lhls sense we can expecL a good supply of wellLralned sofLware englneers and programmers who are able Lo wrlLe C++ appllcaLlons for AuLoCAu MlgraLlng Lo C++ W C++ offers many advanLages over C and AuLoLlsp Powever all Lhese advanLages come aL a prlce W lL Lakes a long Llme (2years) Lo geL a hang of C++ W 1hls ls because ln splLe of slmllar synLax programmlng ln C++ lnvolves a dlfferenL way of Lhlnklng abouL problem solvlng W ln order Lo use C++ effecLlvely Lhe followlng mlgraLlon plan ls proposed Learn ob[ecL orlenLed concepLs Learn Lhe synLax of C or C++ Choose a noncrlLlcal plloL pro[ecL Lo be developed ln C++ use ouLslde help ln Lhe early sLages of Lhe pro[ecL Concluslon W C++ ls becomlng Lhe language of cholce for graphlcs appllcaLlons and we dlscussed some of Lhe Lrends Laklng place ln Lhls fleld We shall see Lhe emergence of graphlcs appllcaLlons whlch conslsL of pluggable componenLs and whlch can easlly be cusLomlsed Lo sulL speclflc slLuaLlons ln Lhls way we hope Lo see Lhe lndusLry maLurlng from one ln whlch monollLhlc and lnflexlble sysLems wlll gradually be replaced by lnLeroperable componenL Lechnology 1nANk CU