正在加载图片...
PUBLIC ANSWERS TO EXERCISES Generic mechanism, given two cities, that would calculate how many points would be required to fly between them for free for a given user. This would be called when customers are doing queries and also when a person actually books a free flight to determine how many points to deduct This would call the first slot below to do detailed calculations Generic mechanism, given two cities, that would calculate how many points to credit to a particular frequent flier who pays for a ticket. It would be called when the user is making queries, and also when a person actually takes a flight, in order to credit points. This would call the second slot below for detailed calculations Generic mechanism that runs every month, calling the slot(below) for producing reports, and the hooks(below) for deleting inactive accounts, and perhaps promoting users to different classes i1. Slots(code that must be provided) a method to evaluate rules regarding how many points are required to fly certain routes for free A method to evaluate rules regarding how many points are obtained from flying certain routes (might be specific to certain classes of frequent flier, certain times, etc. A method to produce a formatted printout of a frequent fliers account(each airline may want to make these appear stylistically different from other airlines). Note that instead of creating a slot, this functionality could be left out of the framework entirely Note that the user interface would have to be provided but would probably not actually appear as slots in the basic system; the user interface would be a separate subsystem that would simply call the iii. Hooks(places where optional add-ons can easily be plugged in) Ability to manage additional types of information about frequent fliers(e. g. work address, email, ) beyond the basic minimum information. Different airlines might want to keep different kinds of information for use in marketing etc ability to have different classes of users (e.g. prestige users who have accumulated large numbers of Mechanism to delete accounts after a certain time period with no activity(this might be activated by the monthly run that prnts reports) ability to add different kinds of points to be used for different purposes(e.g. some airlines, in addition to miles, also keep track of a separate count of miles flown in first class; such points might have different rules, such as expiring after the end of a year) E3.7 P. 70 Eraluating whether or not one should first develop a framework when designing an application a)* Arguments in favourof developing a full frequent flier framework Developing the framework improves your overall design. Since you would have to build flexibility into the framework to allow it to be used by others, you would benefit from that flexibility when you have to make changes yourself As a consequence of the above, you would expect maintenance costs to be reduced; you would also expect to be able to respond faster to market-driven requirements changes You might be able to sell your framework to others, or to provide frequent-flier services to other smaller airlines Should two airlines using the same framework decide to work together in an alliance(or to merge)their systems would be more compatible with each other, reducing costs E3.8 P 74 Evaluating whether an application should be designed as a client-server system or not a ) *Word processors are not normally designed using a client-server architecture. The following are some of the reasons why not People typically use word processors on laptop computers or other machines that may not be connected to any network Although people do share word-processed data, most people work on their own local copy and then share it when they are finished It might be beneficial to allow a word processor to optionally connect to a server to do such things as load and save data, or to enable two people to edit the same document concurrently. However it would still be necessary to ensure that the user could operate the program while not connected THESE ANSWERS SUPPORT THE BOOK OBJECT ORIENTED SOFTWARE ENGINEERINGPUBLI C A NSW ERS T O EX E RCISE S PA8 T HE SEAN SW E RS SU PPORTT HEBO OK O BJ ECT O RI E NTEDSO FTW AR E E NG INE ER ING : • G ener ic me c ha nism, give n two c ities, tha t w ould ca lcula te how many points w ould be re quire d to f ly be tw ee n the m f or fr ee for agive n use r. T his w ould be ca lle d w he n c ustomer s a re doing que rie s, a nd a lso w hen a pe rson ac tua lly books a f re e f light to deter mine how ma ny points to de duct. T his w ould ca ll the f ir st slot be lowto do de taile d c alc ulations. • G ener ic me c ha nism, give n two c ities, tha t w ould ca lcula te howmany points to c re dit to apa rtic ula r f re que nt f lie r w ho pa ys f or a tic ke t. It would be c alle d w he n the user is ma king quer ies, a nd a lso w he n aper son a c tually ta kes aflight, in orde r to cr edit points. This would c all these cond slot be low f orde ta ile d ca lcula tions. • G ener ic me c ha nism tha t runs eve ry month, c alling the slot ( be low ) f or pr oduc ing r e ports, and the hooks (below)f or de leting ina c tiveac counts, and per ha ps pr omoting use rs to dif f er ent c la sse s. ii. Slots (c odetha t must be provided) • Amethod to e va lua terule s r ega rding how ma ny points ar ere quire d to fly c er tain r oute s f orfr ee . • A method to e va lua te rule s r ega rding how ma ny points ar e obta ined fr om flying ce r ta in route s ( might be spe cif icto c er tain c la sse s offr equent f lier , c er tain times, e tc .) • A method to produc e a f or matte d pr intout of a fr e quent f lie r’ s a cc ount (e a ch a irline may wa nt to make the seappe a r stylistica lly dif f er ent f rom othe r air line s). N otethat instea d of c re ating a slot, this f unctionality c ould be le f t out of thef r amew ork e ntire ly. • N ote tha t the user inter fa c e would ha ve to be provided, but w ould proba bly not ac tua lly a ppe ar a s slots in the ba sicsystem; theuserinte r fa cewould be asepa ra tesubsystem that would simply c a ll the ser vic es. iii. Hooks (pla c es w her e optional a dd- ons c an ea sily be plugged in) • A bility to ma na ge additional type s of inf or ma tion a bout fr equent f lier s ( e.g. wor k addre ss, e ma il,), beyond the ba sic minimum inf or mation. Dif fe re nt air line s might wa nt to ke ep diff e re nt kinds of inf or mation f oruse in ma r ke ting etc . • A bility to ha vediff er e nt c lasse s of use rs (e .g. pre stigeuser s w ho ha veac cumulate d la r genumber s of points) • Mec ha nism to de lete a cc ounts a f te r ac er tain time per iod w ith no a ctivity ( this might bea c tiva ted by themonthly r un that pr ints re por ts) • A bility to a dd diff e re nt kinds of points to be use d for dif f er ent pur poses (e .g. some a ir lines, in a ddition to mile s, a lso ke ep tr ac k of a separ a tec ount of miles f low n in fir st c lass; such points might have dif fe r ent r ules, suc h a s e xpir ing a f te r thee nd ofa ye a r) . E 3.7 p. 70 Ev aluating whe the r or not oneshould first de ve lop a fram eworkwhen de signing an applic ation. a )* A r gume nts in favour ofde ve loping af ull f re que nt flie rf ra mew or k: • D e ve loping thef r amew ork impr ove s your ove ra ll de sign. Sinc e you w ould have to build f lexibility into the f ra me w or k to allowit to be use d by othe r s, you would be ne fit f rom tha t f le xibility w hen you ha ve to ma ke c ha nge s yourself . • A s a c onse que nc eof thea bove , you would e xpe ct ma inte nance costs to be re duc ed; you would a lso e xpe ct to beableto r e spond f asterto mar ket-dr iven re quire me nts c hange s. • Y ou might be able to se ll your fr ame work to othe rs, or to pr ovide fr equent- f lier se rvice s to other smalle r a ir lines. • Should two airline s using the same f ra me w or k dec ide to w or k together in a n a llia nce ( or to me rge ) the ir syste ms would bemor ec ompatible with ea c h other , r educ ing c osts. E 3.8 p.74 E valuating whether an applic ation should bede signe d as a client- serve r systemor not. a )*Wor d proce ssors ar e not normally de signe d using a c lient-ser vera r chite ctur e . Thef ollow ing a re some of ther e asons w hy not: • Peopletypica lly use word pr oc essor s on la ptop compute r s orothe rmac hines that ma y not bec onnec te d to any netw or k. • A lthough pe ople do shar e w or d- proce sse d data, most pe ople wor k on their own loca l c opy a nd then sha reit w hen they a r e finishe d. I t might bebene ficia l to allowaw or d proc essorto optionally conne ct to ase rver to do suc h things a s loa d a nd sa ve da ta , or to enable tw o people to e dit the sa me document c oncur re ntly. H owe ve r it w ould still be nec essar y to ensur e tha t theuserc ould ope ra te theprogra m w hilenot c onne c te d
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有