A Web Applcatn wrk fr Reservatn Systems and ts Reusablty Evaluatn Feng Zhu and Takesh Chush Abstract Web applcatn s d n varus busness felds n the Internet and ntranets. It s an effcent way t develp Web applcatn n the base f a framewrk. In ths paper, after the well desgnng f ts archtecture, a dman specfc framewrk fr reservatn s develped based n a meetng rm reservatn system. Then, the framewrk s appled t tw types f reservatn systems, an nlne bk stre system and a sccer tcket reservatn system, and ts reusablty s evaluated. Wth the result f 62 and 65 respectvely, hgh reusablty f the framewrk has been cnfrmed. In addtn, anther framewrk fr tme-based reservatn, was develped, and the trade-ff relatnshp between the range f the dman and the reusablty has been cnfrmed. Fnally, a vsual tl s develped t generate the surce cde fr the database access transactn. Keywrds: framewrk, reservatn, reusablty, trade-ff 1. INTRODUCTION Wth the wdespread f the Internet and ntranets, the number f web applcatns such as BBS, shppng ste, has been ncreasng. Hwever, t s dffcult t develp thse web applcatns separately wthut any supprt technlgy. A web applcatn framewrk prvdes an abstractn n whch cmmn cde prvdng generc functnalty can be selectvely verrdden r specalzed by the develpers. Furthermre, the verall cntrl flw f the applcatn s dctated by the framewrk. As the repettus wrk s avded, the mre effcent t becmes t develp web applcatns based n a framewrk. In ur research [1][2] untl nw, cmpared t the mre general framewrks lke Struts[3] and Hbernate[4], we develped a framewrk fr a mre narrwed dman reservatn. It s a feld that s experencng great demand, lke classrm reservatn n a schl, tcket reservatn fr a tran and s n. Beca the dman t be appled has been narrwed, t shuld be mre effcent t develp such applcatns usng ths framewrk. The framewrk s appled wth several types f reservatn systems t cnfrm ts reusablty. Related wrks nclude thse lke an Ajax framewrk develped and then appled wth a sample system t evaluate ts reusablty [5]. A mult-layer framewrk amng at hgh perfrmance was desgned and mplemented fr cmmn nfrmatn system based n.net, and the perfrmance Manuscrpt receved December 8, 2008. F. Zhu and T. Chush are wth the Department f Cmputer Scence, Mej Unversty, Kawasak, Japan. mprvement was fgured ut [6]. Ths paper presents the archtecture f the framewrk n Sectn 2, the descrptn f reservatn n Sectn 3, the develpment and reusablty evaluatn f the framewrk n Sectn 4 and Sectn 5, the trade-ff relatnshp between the dman and the reusablty n Sectn 6 and a vsual cde generatn tl n Sectn 7. 2. ARCHITECTURE DESIGN In a narrwed dman, beca the data flw s smlar frm ne applcatn t anther, we can desgn the archtecture n the framewrk level. Therefre, the develpers wll be released frm the archtecture desgnng wrk wth a well desgned archtecture already avalable frm the framewrk. 2.1 Mult-layer archtecture Mult-layer archtecture s a clent-server archtecture n whch, the presentatn, the applcatn prcessng and the data management are lgcally separate prcesses. The fllwng are the prncples we fllwed t desgn the framewrk s archtecture. The lwer layer prvdes ts nterfaces t the upper layer. It`s nt aware f upper layers. The upper layer desn t need t knw the detal f the lwer layer. The nly necessary nfrmatn s the lwer layer s nterfaces. The upper layer nly needs t knw the nterface f the layer drectly beneath t. Fllwng these prncples, we were able t make ur framewrk mre understandable, extensble, and hence, mre effcent. Our mult-layer archtecture s made up frm 3 layers. The presentatn layer deals wth the r nterfaces. The busness lgc layer cntrls an applcatn s functnalty by perfrmng detaled prcessng. The data access layer prcesses the data wth the relatnal database. 2.2 Presentatn layer The presentatn layer deals wth the r nterfaces. There are many exstng general framewrks fr ths layer, amng them, the mst famus ne s Struts. Web applcatns based n Java Server Pages smetmes cmmngle database cde, page desgn cde, and cntrl flw cde, s they becme dffcult t mantan. Struts s a free pen-surce framewrk fr creatng web applcatns. It s desgned t help develpers create web applcatns that utlze a MVC archtecture, whch can slve the abve prblems well. In ur framewrk, we develped ths layer based n Struts,
Clent Mappng AP Server DB Server see Web Brwser Request Servlet call Set frm data Call actn 遷 移 先 返 答 FrmBean Retreve/ update data Respnse JSP Sessn Lgc prcessng data prcessng Lgc Class DAOFactry Dman bject Generate DAO class DAO Calss SQL Prcessng RDB RDBMS Fg.1. The archtecture f ur framewrk usng sme f the lbrares frm t. S the MVC mdel s adpted n ur framewrk. 2.3 Data access layer The data access layer prcesses the data wth the relatnal database. The cmmn ways t handle ths peratn are JDBC r bject-relatnal mappng framewrk lke Hbernate, Bats. In ur framewrk, we adpted the Data Access Object (DAO) pattern [7] n ths layer, and als n Sectn 6, a vsual tl wll be develped t generate the cde autmatcally. As ne f the J2EE cre patterns, DAO abstracts and encapsulates all access t the database. It manages the cnnectn wth the database t btan and stre data. DAO can be hghly flexble by adptng the Abstract Factry and the Factry Methd [8] patterns. As we nly relatnal databases, the Factry Methd pattern adpted DAO s selected fr ur framewrk. In ths strategy, a DAO Factry prduces a varety f DAOs needed by the applcatn, s t becmes much mre cnvenent and easer fr extensn and mantenance. 2.4 wrk`s archtecture Wth the 3 layer dvsn, and after adptng Struts t the presentatn layer and DAO pattern t the data access layer, the archtecture f ur framewrk s n n Fgure 1. 3. RESERVATION SYSTEM 3.1 The system f reservatn In ths paper, reservatn s defned as the clam t btan a future f certan resurces fr a perd f tme n advance. And cmpared t the cnventnal way by paper recrds, we realze ths clam by Web applcatn. As the cnceptual mdel beng n n Fgure 2, there are end-rs wh fllw certan cndtns t make the reservatn. There are resurces beng dvded nt reservable frames. End-r Fg.2. Cnceptual mdel f reservatn Accrdng t the type f frame whch the resurces have been dvded nt, the system f reservatn s dvded nt 3 categres. Space-based reservatn refers t the systems that chse the resurce frst accrdng t tme, and then chse the frame accrdng t space. Tcket reservatn s a sample n ths categry. Tme-based reservatn refers t the systems that frst chse the resurce accrdng t space and then chse the frame accrdng t tme. Meetng rm reservatn s a sample n ths categry. In addtn, the systems that dn`t belng t these tw categres, lke the shppng system, refer t the thers. Fgure 3 s the system f reservatn. tme space 1 * Cndtns space 1 * tme thers thers Fg.3. The system f reservatn 1 * 0 *
mappng Frm Lgn AuthFrm Frm Reservatn Frm Frm Servlet JSP: welcm: Template & header & lgn & resurcelst & wel Reservatn lst Template & header & lgn & resurcelst & reservelst Cmmn entry-template & header & resurcelst Check: entry.jsp New: entrysuccess.jsp Mdfy: updatesuccess.jsp Delete: deletesccess.jsp Cmmn errr:entry-template & header & resurcelst & errr.jsp stp.jsp Sessn Lgn Lgn Lgut Lgc Lgn AuthLgc Database Access Object ShwAct n lgc Detal ShwActn DAOFactry Lgc check EntryShw new Entry mdfy Entry delete Entry Dman Object Grup Member Tles-defs.xml Lgn Reservatn MemberDAO DAO DAO MemberDAOImp DAOImp DAOImp DB Rles+ Member Grup Fg.6. The extracted fles fr the framewrk 3.2 Functn specfcatn In reservatn systems, there are cmmn r functns and system admnstratr functns, respectvely. The functn specfcatn s n n Table 1. Table.1. Functn specfcatn f reservatn User admnstratng admnstratng functn Cmmn r Lgn/lgut Admnstratr Lgn/lgut User regster/ mdfy/delete - regster/ New reserve Reservatn check/ mdfy/delete mdfy/delete New reserve All reservatn`s check/ mdfy/delete Our framewrk nly cvers the mst cmmn r` functns. These are r lgn and lgut, a new reservatn, and check, mdfy and delete f the reservatns. 4. FRAMEWORK DEVELOPMENT T develp the framewrk, frst, a sample system s develped based n the archtecture and functn specfcatn n Sectn 2 and 3. Then, the fle s extracted frm the sample system. Fnally, the framewrk s realzed cmpletely. 4.1 A sample system We chse a meetng rm reservatn system, whch belngs t the tme-based reservatn categry, as a sample system, frm whch the fles the framewrk needs can be extracted. Sme f the frnt nterfaces are n n Fgure 4 and 5. Fg.4. Reservatns n mnthly calendar frmat The tp page s made up f a header, a lgn part, a man part and a fter. When ne f the meetng rms has been chsen, the reservatns f ths rm wll be n n mnthly calendar frmat. Next the end-r can mdfy r delete the reservatns when he/she lgs n. Fg.5. Detals f a reservatn
4.2 Extractn f the fles Based n the meetng rm reservatn system develped, the fles whch are needed n a reservatn framewrk are extracted. The extracted fles are n n Fgure 6. 4.3 Cmpletn f the framewrk When the fles have been extracted, the detaled cntents f each fle shuld be added and mdfed s that they can be d as a framewrk. We mdfed sme f the cntents f the fle s that they can be verrdden as base classes r cnfgure fles. And sme f the fles were made nt lbrares s the develpers can chse t. The detals f the framewrk wll nt be ncluded n ths paper, hwever, except the lbrares frm the nner framewrk Struts, the number f the rgnal steps wrtten by us s 996. 5. REUSABILITY EVALUATION WITH APPLICATION TEST In the frmer sectns, we develped a reservatn framewrk. Next, we wll carry ut applcatns t see f t s usable n reservatn systems. As the sample system frm whch the framewrk was extracted belngs t the tme-based categres, we apply t t tw systems belngng t space-based reservatn and the thers, respectvely. 5.1 Applcatn test n space-based categry In the frst applcatn test, we wll see f ur framewrk s reusable n the space-based reservatn categry A sccer tcket reservatn system was chsen. The end-r frst chse the match accrdng t the tme, then the seat whch s a space ntn wll be reserved. The functns as a reservatn system t cmmn rs such as reservatn check, mdfcatn, deletn and s n are realzed. The percentage that the framewrk suppled n the system s n n Table 2. Overall system wrk specalzed Percentage f framewrk Table.2. Reusablty f applcatn test 1 290 245 45 Frm 94 Dma n bject 182 98 46 Lgc class 139 90 49 65 DAO 419 294 125 Vew 397 175 222 44 Mapp ng 70 61 9 87 Ttal 1591 996 595 62 Accrdng t Table 2, we can see that as a ttal the system has 1591 steps, amng thse 996 steps are suppled by the framewrk. In ther wrds, a 62 reusablty s realzed. S, the reusablty n space-based reservatn systems s ndeed cnfrmed. 5.2 Applcatn test n the thers categry Fllwng the frst applcatn test, the secnd ne wll be carred ut n the thers categry. Ths tme an nlne bk stre system s chsen. As nthng t d wth tme r space, the end-r chse the bk frst, then, decded hw many f the same bk t buy. In addtn, the ther functns f reservatn plus a search functn was realzed. The percentage that the framewrk suppled n the system s n n Table 3. Overall system wrk specalzed Percentage f framewrk 286 245 41 85 Table.3. Reusablty f apply test 2 Frm 37 56 Dma n bject 168 Lgc class 124 90 34 72 DAO 402 294 108 73 Vew 402 175 227 43 Mapp ng 70 61 9 87 Ttal 1536 996 540 65 As n n Table 3, amng the 1536 steps f the ttal system, nly 540 steps are custmzed. Accrdng t a reusablty f up t 65, we cnfrmed that the framewrk s als reusable n the thers categry. 5.3 Overall evaluatn Includng the meetng rm reservatn sample system, the reusablty f ur framewrk s n n Fgure 7. 100 90 80 60 40 30 20 10 0 64 62 65 MeetngRm Tcket BkStre Fg.7. Reusablty f the 3 systems MeetngRm Tcket BkStre The percentages f the cde that the framewrk suppled, are 64, 62, and 65 respectvely and the hgh reusablty was cnfrmed. Als, t has the fllwng advantages. After ne system frm ne categry f the reservatn system has been appled respectvely, we cnfrmed that ur framewrk can be appled t a wde range f reservatn systems. Beca the archtecture has been well desgned n the framewrk level, the wrk can be released t the develpers. As a result, a new well-desgned system can be develped much faster, and easer fr extensn and mantenance. 6. THE TRADE-OFF RELATIONSHIP Beca we narrwed the dman t reservatn, ur framewrk can gan a much hgher reusablty than the general
framewrks. As all f us can see, the narrwer the dman s, the hgher the reusablty wll be. In ths sectn we wll develp anther framewrk n a mre narrwed dman, the tme-based reservatn framewrk, whch s nly ne categry n the reservatn system, t cnfrm the trade-ff relatnshp between the range f the dman and the reusablty. The purpse f ths sectn s t fgure ut the parts that can be made mre reusable n a dman specfc framewrk. 6.1 A tme-based framewrk A new framewrk fr tme-based reservatn s develped. Beca t s a chld dman f reservatn, we develped t based n the same sample system, meetng rm reservatn system, whch als belngs t ths dman. Cmpared t the reservatn framewrk, the new parts added n ths framewrk nclude the repeated tme check functn, calendar page generatng lbrary and s n. The number f steps fr the new framewrk becmes 1227. 6.2 Applcatn test The new framewrk wll be appled wth a system named classrm reservatn system. The man dfference t the meetng rm reservatn system s that the reserve frame becmes tme perd, rather than the real tme. Besdes ths, there are als ther dfferences such lke the nfrmatn needed fr a reservatn. The percentage that the new framewrk suppled n the system s n n Table 4. Overall system wrk specalzed Percentage f framewrk Table.4. Reusablty f the new framewrk 296 245 51 83 Frm 98 51 48 Dma n bject 119 35 Lgc class 116 100 16 72 DAO 396 316 80 79 Vew 459 372 87 81 Mapp ng 63 63 0 100 Ttal 15 1227 320 79 As we can see, the percentage f the cde suppled by the framewrk s hgher, up t 79. S f a tme-based reservatn system needs t be develped, ths new framewrk n a narrwer dman s mre ful. 6.3 The trade-ff relatnshp After the framewrk fr reservatn and anther tme-based reservatn framewrk as a chld dman f reservatn, have been develped and appled wth several applcatns, we wll cmpare them n each part. Fgure 8 s the cmpared results. The fgures f the percentage f the reservatn framewrk refer t the average f the tw applcatn tests - the sccer tcket reservatn system and the nlne bk-stre. 100 90 80 60 40 30 20 A c t n A c t n F r m D b j m e a c t n L g c D A O V e w M a p p n g Fg.8. Reusablty cmparsn T t a l Reservatn Tme-based reservatn Frm Fgure 8, we can see that, the vew part changed mstly, that s t say that when the dman s narrwed, we can make ths part mre reusable wth the framewrk. As fr the dman bjects, the lgc classes and the actn mappng are als where we can pay mre attentn t make the framewrk mre reusable. Frm the detals f the DAO classes, we knw that nly the prpertes f the enttes are dfferent. S we wll develp a vsual tl t generate the DAO cde n the next sectn. 7. A VISUAL CODE GENERATION TOOL The database access layer prcesses the data wth the relatnal database. The basc functns f ths layer nclude the functns t create, read, update r delete ne r several rws f data n the database. If these functns are realzed n ths layer, then all f the ther cmplex functns can be realzed n the lgc layer usng these methds. Snce we have learned that nly the prpertes f the enttes are needed t be custmzed n ths layer, and the mnmal necessary enttes needed n a reservatn system usng ur framewrk are member, grup, resurce and reservatn, we develped a vsual tl s that the surce cde f ths layer can be generated autmatcally. The surce cde generated by ur vsual tl ncludes the database prcessng functns, thse are creatng, updatng, deletng ne rw n the relatve table, and retrevng ne r several rws frm the relatve table. Snce the dman bjects wll als be generated, the retreved data wll be returned as an bject r a lst f bjects, s the bject relatnal mappng functn has als been realzed wth ur vsual tl. A sample prcessng flw f the vsual tl s n n Fgure 9. Whle all f the 4 enttes needng t be custmzed, Fgure 9 s the prcessng flw f nly ne - Reservatn. When the Reservatn buttn s clcked n the tp page, the custmzng page wll be n. As the mnmum necessary prpertes have already been added by the tl autmatcally, the develpers nly need t add the ther prpertes lke date,
Fg.9. The prcessng flw f the vsual tl address, pstal-cde, they want. After the prpertes have been added, the lcatn where the surce cde wll be generated shuld be chse. And after all the ther 3 enttes are custmzed smlarly, the surce cde can be generated by clckng the generate buttn n the tp page. We take the nlne bk stre fr an applcatn test. After the DAO and dman bjects surce cde are generated by the vsual tl, the ther parts were als develped, and the ttal system wrks as well as f t were all cded by hands. Snce the cde fr the data access layer and dman bject were generated autmatcally, the reusablty rate s hgher up t 77.3 n ths test. Wth the bject relatnal mappng functn, we can develp the ther layers mre cnvenently by nly usng bject rented technques. Prcessng (ISIP), 2008 Internatnal Sympsum Vlume, Issue, 23-25, 2008 [7] Deepak Alur, Jhn Crup and Dan Malks, Cre J2EE Patterns: Best Practces and Desgn Strateges, Prentce Hall/Sun Mcrsystems Press, 2003. [8] Erch Gamma, Rchard Helm, Ralph Jhnsn, and Jhn Vlssdes, Desgn Patterns: Elements f Reusable Object-Orented Sftware, Addsn Wesley, 1995. 8. CONCLUSION In ths paper, we develped a framewrk fr reservatn systems, wth a vsual cde generatn tl. Thrugh the applcatn tests, the hgh reusablty n a wde range has been cnfrmed. In addtn, the parts that can be made mre reusable n a dman specfc framewrk have als been cnfrmed, thrugh the cmparsn between tw framewrks. REFERENCES [1] T. Chush, H. Tsuku, Reusablty f Web applcatn framewrk fr reservatn systems (n Japanese), IEICE, Vl.J88-D-I, N.5, pp.930-939, 2005 [2] F. Zhu, T. Chush, The reusablty evaluatn f a dman-specfc Web applcatn framewrk, (n Japanese), IPSJ SIG Techncal Reprt, pp. 63 70, 2008 [3] The Apache Sftware Fundatn, http://struts.apache.rg/ [4] Red Hat, Inc, http://www.hbernate.rg/ [5] T. Matsutsuka, A framewrk fr AJAX-enabled busness applcatns, (n Japanese), IPSJ, Vl.49 N.7, pp.2360-2371, 2008 [6] J. Zha, N. Xa, Study n wrk f Scalable Hgh Perfrmance Mult-layer and Mult-pattern Infrmatn Systems Infrmatn