scieee AI-readable full text Open interactive document viewer

How to develop a web -application for traveling solutions with the most innovative technologies

Lacort Collado, Héctor Yone

Abstract

[EN] It will be presented the frame where Waymate was born as a conceptual idea, an application which offers solutions to travel from a city to another by different means of transportation in an easy and smart way. This platform supports web and mobile client applications. However, this document describes the procedure for building up the clientside for the web app and the server-side, which is employed for all the different clients The different techniques of Software Development Life Cycles will be described and the selection of the different methods for the purpose which concerns the application development justified. There exist several platforms and technologies for building up such a complex application for the client and server-side, but which of them are the most appropriate and innovative? This document will tackle the description of different alternatives for implementing different features and functionalities required for this kind of applications, specifying the upsides and downsides which present, the reasons because they’ve been selected and the benefits which bring to the application functionality. All these features described in the following points are considered in the vanguard from several developer communities:  Server-side framework. Ruby on Rails provides several features which allow implementing a complete server and client-side, either included in the framework or as external libraries. Among these features, it should be mentioned datastorage, RESTful services, internationalization, assets configuration, deployment, testing and the Model/View/Controller pattern.  Client-side technologies. Libraries which include innovative patterns to organize the code and the files within the project, as well as a highly interactive user interface.  Deployment. Exposing the latest strategies and procedures to carry out this process in a smart and reliable way. How to test before deploying, why using multi-staging, test-monitoring once the new version is on the live system after being deployed and how to configure all these frameworks.  Performance improvements of the application on the client-side by means of different technologies employed.  Different procedures to test all the testable code, following the Test-Driven and Behavior-Driven Development methodologies, for the client and server-side code, as well as the workflow. Regarding these technologies, technical insights and advices for their integration and implementation will be described in a way that could help to a developer who wants to use them. Finally the workflow and the different stages along the application will be described. For the different stages it’s been necessary to include external services to facilitate the user experience along the process, such as Google APIs. The pros and cons of all these features will be contrasted.

Full text

 W T   Au Di r Co  H O W E B T R A W u thor: H r ecto r ‐dire c O W B ‐ A A VE W I T I N TE C H écto r r :Davi c tor:J u TO PP L LI N T H T N N O C H N r Yon e d de A u anCa r [1]   D E L IC A N GS T H E O V A N O L  e Laco r A ndré s rlosR E VE L A TI O OL U E M O A TI V L OG r tColl s Mart í u izG a L O P O N F U TI O O S T V E IES a do í nez a rcía P A F O R O N S T  R  S  [2]  Resumen Se presentará el marco donde Waymate nació como idea conceptual, una aplicación que ofrece soluciones para viajar de una ciudad a otra mediante diferentes medios de transporte de una forma fácil en inteligente. Esta plataforma soporta aplicaciones cliente para web y dispositivos móviles. Sin embargo, este documento describe el procedimiento para crear la parte del cliente para la aplicación web, además de la parte del servidor, la cual es empleada para los diferentes clientes. Las diferentes técnicas del Ciclo de Vida de Desarrollo de Software serán descritas y la selección de estos diferentes métodos para éste propósito que concierne al desarrollo de la aplicación justificados. Existen diversas plataformas y tecnologías para implementar una aplicación de tal complejidad para la parte del cliente y del servidor, pero ¿cuáles de ellas son las adecuadas e innovadoras? Este documento abordará la descripción de diferentes alternativas para la implementación de diferentes características y funcionalidades requeridas para este tipo de aplicaciones, especificando las ventajas y desventajas que presentan, la razones porque han sido elegidas y los beneficios que aportan a la funcionalidad de la aplicación. Todas estas características descritas en los siguientes puntos, están consideradas a la vanguardia por diferentes comunidades de desarrolladores:  Framework para el desarrollo de la parte del servidor. Ruby on Rails proporciona diversas características que permiten la implementación de una completa aplicación, en cuanto a cliente y servidor, ya sean incluidas en el mismo framework o en librerías externas. Entre estas funcionalidades, cabría destacar el almacenamiento de datos, servicios RESTful, internacionalización, configuración de activos, despliegue de nuevas versiones, testeo y el patrón de diseño y estructura de código MVC.  Tecnologías de la parte del cliente. Librería que incluyen patrones innovadores para organizar el código y los archivos, como también una interfaz de usuario altamente interactiva.  Despliegue de versiones. Exponiendo las últimas estrategias y procedimientos para llevar a cabo este proceso de una forma inteligente y fiable. Cómo testear antes de desplegar una nueva versión, porque usar multi‐staging, monitorizar pruebas una vez la nueva versión es accesible a través de una URL a todos los usuarios y como configurar estos frameworks.  Mejora del rendimiento de la aplicación en la parte del cliente gracias a diferentes tecnologías empleadas.  Diferentes procedimientos para testear todo el código posible, siguiendo metodologías de Desarrollo Guiado por Pruebas o por Comportamiento, para el código del cliente y servidor, además del flujo de datos. Con respecto a todas estas tecnologías, se proveerá de una descripción de consejos para su integración e implementación, de forma que un desarrollador de software pueda llevarlo a la práctica. Finalmente el flujo de datos y las diferentes etapas a lo largo de la aplicación serán descritos. Para las diferentes etapas ha sido necesario incluir servicios externos para facilitar la experiencia del usuario, tales como APIs proporcionadas por Google. Sus ventajas e inconvenientes también serán contrastados. [3]  Abstract It will be presented the frame where Waymate was born as a conceptual idea, an application which offers solutions to travel from a city to another by different means of transportation in an easy and smart way. This platform supports web and mobile client applications. However, this document describes the procedure for building up the clientside for the web app and the server-side, which is employed for all the different clients The different techniques of Software Development Life Cycles will be described and the selection of the different methods for the purpose which concerns the application development justified. There exist several platforms and technologies for building up such a complex application for the client and server-side, but which of them are the most appropriate and innovative? This document will tackle the description of different alternatives for implementing different features and functionalities required for this kind of applications, specifying the upsides and downsides which present, the reasons because they’ve been selected and the benefits which bring to the application functionality. All these features described in the following points are considered in the vanguard from several developer communities:  Server-side framework. Ruby on Rails provides several features which allow implementing a complete server and client-side, either included in the framework or as external libraries. Among these features, it should be mentioned datastorage, RESTful services, internationalization, assets configuration, deployment, testing and the Model/View/Controller pattern.  Client-side technologies. Libraries which include innovative patterns to organize the code and the files within the project, as well as a highly interactive user interface.  Deployment. Exposing the latest strategies and procedures to carry out this process in a smart and reliable way. How to test before deploying, why using multi-staging, test-monitoring once the new version is on the live system after being deployed and how to configure all these frameworks.  Performance improvements of the application on the client-side by means of different technologies employed.  Different procedures to test all the testable code, following the Test-Driven and Behavior-Driven Development methodologies, for the client and server-side code, as well as the workflow. Regarding these technologies, technical insights and advices for their integration and implementation will be described in a way that could help to a developer who wants to use them. Finally the workflow and the different stages along the application will be described. For the different stages it’s been necessary to include external services to facilitate the user experience along the process, such as Google APIs. The pros and cons of all these features will be contrasted.    [4]   Index Resumen........................................................................................................................................1 Abstract.........................................................................................................................................3 Tableofimages.............................................................................................................................6 Tableofcodesnippets..................................................................................................................7 1.INTRODUCTION.........................................................................................................................8 Waymateasaconceptualidea.................................................................................................9 Documentstructure................................................................................................................10 2.SOFTWAREDEVELOPMENTLIFECYCLE...................................................................................11 3.SERVER‐SIDE............................................................................................................................14 Alternativesfordevelopingawebapplication.......................................................................14 RubyonRails...........................................................................................................................16 3.1.Railscomponents.........................................................................................................16 3.2.Railsenvironments.......................................................................................................18 3.3.MVCinRails..................................................................................................................19 3.4.Railsinternationalization..............................................................................................32 3.5.Testing..........................................................................................................................34 3.6.AssetPipeline...............................................................................................................39 4.DEPLOYMENTPROCESS...........................................................................................................42 4.1Web‐basedhostingservice...............................................................................................42 4.2.Git.Distributedrevisioncontrol.......................................................................................43 4.2.1.Git’sdatastructures..................................................................................................44 4.2.2.Gitfromtheconsole..................................................................................................45 4.2.3.Conflicts.....................................................................................................................48 4.3.Capistranodeployment....................................................................................................49 4.4.Multistage........................................................................................................................52 4.5.Testingbeforedeploying..................................................................................................53 4.5.Websitemonitoringsystem.............................................................................................54 TinyMon..............................................................................................................................54 5.APIsdataabstractionintoacommonobject..........................................................................56 5.1.DeutscheBahnAPI...........................................................................................................56 [5]  5.2.YpsilonAPI........................................................................................................................57 6.CLIENT‐SIDE.............................................................................................................................59 6.1HTML.................................................................................................................................59 6.2.HTMLappearanceelements............................................................................................60 6.2.1.CSS.............................................................................................................................60 6.1.2.SASS...........................................................................................................................61 6.3.Dynamicweb‐site.............................................................................................................64 6.3.1.JavaScript...................................................................................................................64 6.3.2.AJAX...........................................................................................................................64 6.3.3.jQuery........................................................................................................................65 6.3.4.Backbone...................................................................................................................66 6.3.5.Testingtheclient‐side...............................................................................................76 7.Waymate.Howitworks..........................................................................................................79 7.1.Objectmodelsontheserver‐side....................................................................................79 7.2Workflowalongtheentireprocess...................................................................................83 7.2.1.Landingpage.............................................................................................................84 7.2.2.Searchpage...............................................................................................................86 7.2.3.Resultspage..............................................................................................................92 7.2.4.Detailspage...............................................................................................................96 7.2.5.Bookingform.............................................................................................................99 7.2.6.Tickets.....................................................................................................................104 7.2.7.Hotelsbooking........................................................................................................105 Conclusion.................................................................................................................................106 References.................................................................................................................................108        [6]  Tableofimages Image1:Newfeaturedevelopmentcycle..................................................................................13 Image2:Bug‐fixingcycle.............................................................................................................13 Image3:Requestforgeryattack.................................................................................................29 Image4:Gitstates,workflowandareas.....................................................................................44 Image5:Masteranddevelopbranches......................................................................................46 Image6:HierarchyofobjectmodelswhichcomposeanOrder.................................................80 Image7:HierarchyofobjectmodelswhichcomposeaTour.....................................................81 Image8:Landingpage................................................................................................................84 Image9:Emailsubscription........................................................................................................84 Image10:Loginwindowinlandingpage...................................................................................85 Image11:Searchpage.GooglePlacesauto‐completion............................................................86 Image12:Searchpage.Calendar................................................................................................89 Image13:Searchpage.Travelers...............................................................................................90 Image14:Resultspage.MapandNavigationtabs.....................................................................92 Image15:Resultspage.Travelerconnectionpreferences.........................................................93 Image16:Meanoftransportationfilters....................................................................................93 Image17:Durationsliderfilter...................................................................................................93 Image18:Pricerangesliderfilter...............................................................................................93 Image19:Timesliderfilter.........................................................................................................94 Image20:Sortingfunctions........................................................................................................94 Image21:Travelersprofilecustomization..................................................................................94 Image22:SpecialPricecheckbox...............................................................................................95 Image23:Resultspage.Connectionsframe...............................................................................95 Image24:Detailspage................................................................................................................96 Image25:Detailspage.Generalrepresentationofaconnection..............................................97 Image26:Detailspage.Connectiondetailsexpanded...............................................................97 Image27:Detailspage.Priceswitching......................................................................................97 Image28:Detailspage.Conditionsforatypeofprice...............................................................97 Image29:Detailspage.Travelersprofileset..............................................................................98 Image30:Bookingform.Travelerprofilesetanddetailsviewforselectedconnections.........99 Image31:Bookingform.Seatreservationconditions..............................................................100 Image32:Bookingform.Seatselection....................................................................................100 Image33:Bookingform.Customerpersonaldataandaddress...............................................101 Image34:Bookingform.Creditcardinformation....................................................................101 Image35:Bookingform.Onlineidentification.........................................................................101 Image36:Bookingform.Travelers’personalinformation.......................................................102 Image37:Bookingform.Termsandconditions.......................................................................102 Image38:Pop‐uperrorswhenvalidationfails.........................................................................103 Image39:Tickets.Travelerspreferencessetanddetailsviewforpurchaseconnections.......104 Image40:Tickets.Ticketspurchaselinksandinformation......................................................104 Image41:Hotelsbooking..........................................................................................................105  [7]  Tableofcodesnippets Codesnippet1:Databaseconfigurationfordevelopmentenvironment...................................18 Codesnippet2:Migrationfiletemplate.....................................................................................22 Codesnippet3:Layoutfileskeleton...........................................................................................24 Codesnippet4:Bookobjectboundtoaform............................................................................26 Codesnippet5:Resourcesdefinedunderthe‘admin’scope....................................................30 Codesnippet6:Routenamesspecifiedexplicitlyfor‘login’and‘logout’..................................30 Codesnippet7:ChunkfromtheEnglishtranslationfile............................................................32 Codesnippet8:Implementationtosetthelocalefromthebrowserheader............................32 Codesnippet9:Localescopedefinitionforthelanguagessupported.......................................33 Codesnippet10:UnittestwithtwoassertionsforaCustomerTestmodel...............................35 Codesnippet11:RequiredlinesforBDDlibrariesinclusionintheBDDtestingenvironment...37 Codesnippet12:Scenarioexample............................................................................................38 Codesnippet13:Stepdefinitionsforascenario........................................................................38 Codesnippet14:JavaScriptfilesinclusionintheprojectfromtheapplication.jsfile................40 Codesnippet15:JavaScriptfilesorganization............................................................................40 Codesnippet16:Compressionlibrariesinclusionintheproductionenvironment...................41 Codesnippet17:Repositorycreationingit................................................................................45 Codesnippet18:TemplatetoproxytheMongrelwithawebsite.............................................51 Codesnippet19:Multistagingconfigurationfortwodifferentstages.......................................52 Codesnippet20:IntegrateTyniMonintheproductionstage....................................................55 Codesnippet21:ExceptionNotifierconfiguration......................................................................55 Codesnippet22:SASS.Variabledefinitionexample..................................................................62 Codesnippet23:SASS.Nestingclasesexample.........................................................................62 Codesnippet24:SASS.Mixinfunctionexample.........................................................................63 Codesnippet25:JavaScriptlibraryinclusionfromaHTMLtemplate........................................65 Codesnippet26:Backbone.JavaScriptfilesorganization..........................................................66 Codesnippet27:Backbone.Modeldefinition............................................................................69 Codesnippet28:Backbone.Routerdefinitionexample............................................................74 Codesnippet29:Backbone.Viewdefinitiontemplate...............................................................75 Codesnippet30:Testsuitedefinitionwith4Specs...................................................................77 Codesnippet31:Migrationfileexamplewhichintroducesorremovesanairline....................80 [8]  1.INTRODUCTION Nowadays,peopleareusedtotravelquiteoftengiventhefacilitiesthatdifferent meansoftransportationoffer.OnlyinsidetheGermanboundaries,alongoneyear,10billion oftravelsarecarriedout.However,thereisnoacompletesupportfromtheexisting technologiesalongthejourneysinthemarket. Whentravelerslandinanunknowncity,theycouldfeellostandasktosomepeople howtogettotheirdestination.Theywon’tprobablyfindthefastandcheapwaytotravel withinthecityfromonepointtoanother.Howthiscanstillhappeninsuchacomputerized world?  Currently,withthefastevolutionoftechnologies,smartphonesarebecomingmore powerfulasdaysgoby.Thesemobilephonesprovidemuchmorethanjustmakingcallsor sendingmessages.Itcanbeusedforcommunicationandcomputingpurposes,becausethey runacompleteoperatingsystem,canconnecttointernetandnavigate,haveGPS,andmore otherfeatures.Theycouldbeconsideredassmallcomputersgiventhecapabilitieswhich presentandpossibilitieswhichoffer.  Thenumberofuserswhoownasmartphoneisgrowingcontinuouslydayafterday. Peoplegoeseverywherewithasmallcomputerintheirpocket.Dueitspower,it’semployfor makinglifeeasierhavingalargeamountofapplicationwhichhelpsdailytomillionsofusers.  Nevertheless,travelersdon’thaveyetanapplicationavailableinthemarketwhich providesacompletesupportwhentravelingforlongandshortdistance,allinone.  Inthemarket,thereexistapplicationswhichoffertravelsolutionsforlongdistance fromwebandmobileappsinasmartway,suchas“Hipmunk”. Forshortdistance,usingpublictransportation,thereexistseveralapplications,but usuallyonlysupportasinglecity.Googleisinprogressofdeveloping“GoogleTransit”offering alltheconnectionsfordeterminedcitiesallovertheworld,buttherearealotofcitiesmissing inGermany,andnotallthepublicmeansoftransportationareincluded. Italsoexistwebapplicationswhichincludetravelsolutionsforshortandlong distance,butthewaytheypresenttheinformationisnotsoclear,suchas“Rome2rio”. Otherapplicationsofferinformationaboutdifferentkindsofplacesnearbysuchas “Google+Local”.  Thenimagineanapplicationavailableforwebandmobiledeviceswhichincludesall thesefeaturesinone,offeringaclearandfancyinterfaceaswellasasimpleinteraction. HereiswhereWaymateasaconceptualideabegins.         [9]  Waymateasaconceptualidea Themainideaistobuildupanapplicationwhichpresentsdoor‐to‐doortravel solutions,includingshortandlongdistance,inaclearandsmartwaywheretheusercould perceiveadvantagesforitspreferredconditions. Besides,theapplicationwillpresentdifferentsolutionsforgoingfromanorigintoa destinationpoint.Alltheexistingmeansoftransportationwhichhelptocoverthejourneywill beincluded,suchastrains,flights,publictransport,car‐sharing,car‐renting,andsoon.Within thissetofsolutionsuserswillbeabletosettheirpreferences.Hence,thesolutionswhichfit betteraccordinglytotheuserpreferenceswillbepresented. Ticketspurchasewillbebundledinonesinglebookingprocess,insteadofbuyingeach ticketseparately,makingtheprocesseasierandfaster.  Awebandmobileclientapplicationwillsupportshortandlong‐distance.However,the mainfunctionalitywhichuserswillemployintheweb‐applicationwillbetoplaninadvance long‐distancejourneys.Ontheotherhand,mobileapplicationwillbemeanttoprovide supportduringthejourney,suchasfindingplacesnearby,representationofthecurrentstage alongthejourneysuchasremainingtimeandcurrentlocation,aswellasofferinstantaneous solutionsforshortdistance. Itwillbepossibletoplanthetripregardingtheconnectionsthetravelerwilltake beforestartingit.Thismeanswhentheuserarrivestoacitywherethereisnointernetaccess throughhissmartphone,thepathoverthemapwithalltheconnectionsandinformationwill besaved  Thiswillbethedevelopingprocessfortheweb‐application,becomingmorecompleteafter eachstep: 1) ThefirstversionwillcovercompletelylongdistancewithinEuropebyflights,but outsidetheGermanboundaries,trainconnectionswillbeofferedonlyforimportant cities. 2) Thesecondversionwillcoverlongdistancebyflightsallovertheworld. 3) ThethirdwillincludesolutionsforshortdistanceinsideGermany. 4) Inthefollowingversions,onceGermanyisfullycovered,theapplicationwillexpand theboundariestotheadjacentcountriesfortrainandpublictransport.  Inparallelwilltakeplacethedevelopmentoftheapplicationformobiledevices.This developmentwillfollowthesamesteps,thanthewebappandasthehardworkforgettingall thatfunctionalityisimplementedontheserverside.Then,itwillbetimefordevelopingthe featuresmentionedpreviouslyforgivingsupporttotravelersalongthejourneyaseverything isadvancinginthewebapp.  Thebusinessmodelistogetapercentageofthetrainandflightticketsboughtthroughthe platform,aswellashotelsbooking.Lookingforward,probablythisplatformwouldoffer discountsforgoingtoarestaurant,forshoppinginadeterminedshopordoingwhatever activityinthedestinationcity.  [16]  RubyonRails RubyonRailsisanopensourcefull‐stackwebapplicationdevelopmentframework writtenintheRubylanguage.ItgivestotheWebdeveloperthefullabilitytogather informationfromthewebserver,talkingorqueryingthedatabaseandtemplaterenderingout ofthebox. InRailsprevailsConventionoverConfiguration,whichmeansmakingassumptions aboutwhatandhowtodoit,ratherthanrequiringspecifyingeverylittlethingthroughendless configurationfiles. RailsincludesapackagemanagecalledRubyGemsfortheRubyprogramminglanguage whichprovidesastandardformatfordistributingRubyprogramsandlibraries,inaself‐ containedformatcalledagem.Thistoolwasdesignedtoeasilymanagetheinstallationof gems,andaserverfordistributingthem.Forinstallinganduninstallingagem,intheconsole it’styped: geminstall<gem_name>orgemuninstall<gem_name>  3.1.Railscomponents3 Action Pack ActionPackisasinglegemthatcontainsActionController,ActionViewandActionDispatch, whichisthe“VC”partof“MVC”. 1. ActionControlleristhecomponentthatmanagesthecontrollersinaRailsapplication. TheActionControllerframeworkprocessesincomingrequeststoaRailsapplication, extractsparameters,anddispatchesthemtotheintendedaction.Servicesprovidedby itincludesessionmanagement,templaterendering,andredirectmanagement. 2. ActionViewmanagestheviewsoftheRailsapplication.Itcancreate bothHTMLandXMLoutputbydefault.ActionViewmanagesrenderingtemplates, includingnestedandpartialtemplates,andincludesbuilt‐inAJAXsupport. 3. ActionDispatchhandlesroutingofwebrequestsanddispatchesthemasyouwant, eithertoyourapplicationoranyotherRackapplication. Action Mailer ActionMailerisaframeworkforbuildinge‐mailservicelayers.Theselayersareusedto consolidatecodeforsendingoutforgottenpasswords,welcomesforsigningup,inboxesfor billingoranyothernotification.Itprovidesawaytomakeemailsusingtemplates.Itcanalso beusedtoreceiveandprocessincomingemail.   3RubyonRailscomponents:http://guides.rubyonrails.org/getting_started.html [17]   Active Model ItprovidesadefinedinterfacebetweentheActionPackgemservicesandObject RelationshipMapping(ORM)gemssuchasActiveRecord.ActiveModelallowsRailstoutilize otherORMframeworksinplaceofActiveRecordiftheapplicationneedsit. Active Record ItisthebaseforthemodelsinaRailsapplication.Itprovidesdatabaseindependence, thefourbasicfunctionsofpersistencestorage,create,read,updateanddelete(CRUD), advancedfindingcapabilities,andtheabilitytorelatemodelstooneanother,amongother services. Active Resource Itprovidesaframeworkformanagingtheconnectionbetweenbusinessobjectsand RESTful(Representationalstatetransfer)webservices,anapproachforgettinginformation contentfromtheserver‐side.Itimplementsawaytomapweb‐basedresourcestolocal objectswithCRUDsemantics. Active Support AnextensivecollectionofutilityclassesandstandardRubylibraryextensionsthatare usedinRailsbythecorecodeandapplications. Railties RailtiesisthecoreRailscodethatbuildsnewRailsapplicationsandgluesthevarious frameworksandpluginstogetherinanyRailsapplication.         [18]  3.2.Railsenvironments Railshastheconceptofenvironmentstorepresentthestagesofan application’slifecycle.Itincludesasdefaultthesethreeenvironments:  Test,usedforrunningRailsbuiltintestsuite.  Development,isthedefaultenvironment,optimizedforrunninglocally.Full errormessagesaredisplayed,cachingisdisabled,andclassesare automaticallyreloaded,meaningthatit’snotnecessarystartandstoprunning thelocalserverforupdatingthechanges.  Production,configuredforspeedandsecurity.Cachingisenabled,classesnot reloaded,anderrormessagesonlyhavesimpleerrorcodes,insteadoffullback tracesandsessioninformation. Eachenvironmenthasacorrespondingenvironmentfile config/environments/environment_name.rbwithitsparticularconfigurationcode.Every environmenthasitsowndatabaseaswell,definedinconfig/database.yml.Fordevelopment, thesectionfortheproductiondatabaseisconfiguredasfollows: development: adapter:mysql2 database:db_development username:root password: host:127.0.0.1 encoding:utf8 Codesnippet1:Databaseconfigurationfordevelopmentenvironment  Intheconsole,thiscommandneedstobeintroducedforstartingtheserverinthe otherdifferentenvironmentthandevelopment: rails server --environment test or rails server –environment production         [19]  3.3.MVCinRails4 RailsusestheModel/View/Controller(MVC)architecturepatterntoorganizeapplication programming.ThebenefitswhichMVCincludesare:  Isolationofbusinesslogicfromtheuserinterface.Itkeepsseparatedthe representationofinformation,logicanduserinteraction.  EasytokeeptheDRY(Don’tRepeatYourself)philosophy.Theideabehindistoreuse thedifferentmodulesinseveralplaces,avoidingcoderepetition.  Makingitclear,wherecodeiswellstructuredandorganizedproperlyintheir correspondingmodules. 3.3.1MVCcomponents 1. Modelsrepresenttheinformationordataoftheapplicationandtherulesto manipulatethatdata.InRailstheyareusedformanagingtherulesof interactionwithacorrespondingdatabasetable.Inmostcases,eachtablewill correspondtoonemodelintheapplication. 2. Viewsrepresenttheuserinterfaceoftheapplication.InRails,viewsareoften HTMLfileswithembeddedRubycodethatperformtasksrelatedsolelytothe presentationofthedata.Theyprovidedatatobethedisplaytotheweb browser. 3. Controllersarethelinkbetweenmodelsandviews.InRails,controllersare responsibleforprocessingtheincomingrequestsfromthewebbrowser, askingtomodelsfordataandpassingthatdataontotheviewsfor representation.          4MVCinRails:http://guides.rubyonrails.org/getting_started.html#the‐mvc‐architecture [20]  3.3.2Models AmodelisanActiveRecordobjectwhichincludeshooksintothisobjectlife cycletothedatabasepersistency,controllingtheapplicationanditsdata. Creatingandsavinganewrecord,RailswillsendautomaticallyanSQLINSERT operationtothedatabase.UpdatinganexistingrecordwillsendanSQLUPDATE.Ifany validationsfail,theobjectwillbemarkedasinvalidanditwon’tperformanyoperation.  3.3.2.1 Validations Validations5arepreconditionsdefinedintheclassmodel,whichareassociatedto attributesandshouldbeaccomplishedbytheattributevaluebeforebeingstoredinthe database.Thesevalidationsaredefinedinthefilewhichcontainstheclassandinthesameline thanthecorrespondingattributewhichwillbeassociated.ActiveRecordusesthemtoensure thatonlyvalidobjectsaresavedintothedatabase. ActiveRecordofferspre‐definedvalidationhelpersthatcanbeuseddirectlyinthe classdefinitions.Thesearemostcommonhelpers: 1. format=>attribute’svaluesshouldmatchtoagivenregularexpression. 2. length=>thevalueshouldhavethesamelengththantheonespecified. 3. numericality=>shouldonlycontainnumericvalues. 4. presence=>theattributeisnotempty. 5. uniqueness=>theattribute’svaluemustbeunique.  3.3.2.2 Database RailsincludesasdefaultRelationalDatabaseManagementSystem(RDBMS)SQLite3.  Thisapplicationismeanttohavemanyclientsaccessingtoacommondatabase, writingandreadingconcurrentlyoveranetwork.Hence,itwillbeneededaRDBMSwhichwill allowaparallelaccesstodifferentusers. SQLiteisanembeddedrelationaldatabaseintowhichrunsin‐processwiththe applicationandreadsandwritesasingledatabasefile.SQLitewillworkoveranetwork filesystem,butbecauseofthelatencyassociatedwithmostnetworkfilesystems,performance willnotbegreat.Furthermore,SQLiteshouldn’tbeusedwhenaccessingthedatabase simultaneouslyfromdifferentcomputersoveranetworkfilesystem,duetowhenuserswrite, lockontheentirefile.  5Modelvalidations:http://guides.rubyonrails.org/active_record_validations_callbacks.html [21]  Ontheotherhand,MySQLisarelationaldatabaseserverthatisaccessedviaa networkconnection.Itrunsaserverprovidingmulti‐useraccess,giventhatwebserverscan handlemultiplerequestsconcurrently,andeachofthesecouldbeconnectedtothedatabase. Summarizing,SQLiteistheproperRDBMStoworkwithstandaloneapplications.For client‐serverapplicationsandmorecomplexdeploys,itshouldbeusedMySQL.  3.3.2.3 Database migrations Databasemigrations6areaconvenientwaytoalterthedatabaseinastructuredand organizedway.ActiveRecordtrackswhichmigrationshavealreadybeenrun. Forrunningmigrationsalreadycodedbutnotexecuted,it’sjustneededtotyperake db:migrateandRailswilldotherest,workingoutmigrationswhichstillneedstoberun,updating thedatabaseandthefiledb/schema.rb,whichcontainsthestructureofthedatabase application. Whenthereismorethanonemigrationtobeexecuted,theywillrunsequentiallyas theywereimplementedintime.Ifsomethingfailsinthisprocess,migrationscompletely executedwillchangethedatabase,butnotthoseimplementedaftertheonewhichprovoke theerror,includingitself. ActiveRecord’sfunctionalityabstractthesyntaxinawaythatthestructuredefined andcommandsCRUDareindependentoftheRDBMSemployed.ItcanbeusedSQLitefor developmentenvironmentandMySQLforproduction. MigrationsaresubclassesofActiveRecord.Eachofthemimplementsthemethodup, toperformthepertinenttransformationsanddown,torevertthechanges.Thesearethe functionstomodifythedatabasewhichActiveRecordprovides: add_colum,add_index,change_colum,change_table,create_table,drop_table, remove_column,remove_index,rename_columandrename_table. ItispossibletodefinemigrationswritingtheSQLcodewithoutthehelpofthe functionsmentionedpreviously.Therefore,Railskeepsprovidingflexibilitywhendefininga newmigration. Wheneveramigrationisrun,canbeundonebytypingrakedb:rollback.Forthosecases whereadeveloperusesthemethodswhichActiveRecordsupply,Railshasintroducedthe changemethodwhichknowshowtorevertthechangesautomatically,withouttheneedof writingtheupanddownmethods.Ifothermethodsarerequireditisnecessarytoprogram theproperdownfunctioninordertogetthepreviousstateinthedatabaseincasethose changeshaven’tbeenexecutedasitwasexpected.   6Databasemigrations:http://guides.rubyonrails.org/migrations.html [22]  Railsincludesamigrationgenerator.Itmustbeexecutedintheconsolethefollowing tocreateanewone:railsgeneratemigration<name_migration> Afilewhichwouldlikethis class<name_migration><ActiveRecord:Migration defchange end end Codesnippet2:Migrationfiletemplate willbestoredinthedb/migratedirectoryintheform YYYYMMDDHHMMSS_<migration_name>.rb,includingthetimestampandmigrationname. Theyareorderedinthisdirectoryastheyoccurredintime,soadeveloperhasabetter understandingabouthowthedatabasehasbeenmodifiedregardingthetimeline. Specificindividualorsetsofmigrationscanberunorreverted.Specifyingatarget version,ActiveRecordwillruntherequiredmigrations(up,downorchange)untilithas reachedthestipulated. Givenallthissetoffunctionalities,Railsallowsretrievingthedesiredpreviousstate andkeepingtrackofeverychangewhichmodifiedthedatabase. Itishighlyrecommendedjustcreatingthestructureofthedatabaseandnotinserting datafrommigrations.Ifnewdevelopersjointheteam,orthesystemneedstobesetitup againforsomereason,executingthecommandrakedb:setupshouldexecuteallthemigrations sequentiallyuntilgetthecurrentstate.However,whenintroducingdatabymigrations,thisis notpossiblealways,giventhatatsomepoint,asinglemigrationcouldinterrupttheprocessif itcannotbeexecuted.Inthiscase,thedatabasecanbesetproperlywithadumpofthe currentversionfromtheproductionenvironmentorfromotherprogrammerwhoownsa databasewiththecurrentstate. 3.3.2.4 Associations InRailsanassociation7isaconnectionbetweentwoActiveRecordmodels. Associationsareusedinordertoaddfeaturestothemodelsdeclaratively.Theseare supportedtypes: 1. belongs_to=>one‐to‐oneconnectionwhereeachinstanceofthedeclaringmodel “belongsto”oneinstanceoftheothermodel 2. has_one=>one‐to‐oneconnectionwhereeachinstanceofamodelcontainsor possessesoneinstanceofanothermodel. Aninstancecanalsobematchedbyproceedingthoughathirdmodelbyhas_many :through.  7Associations:http://guides.rubyonrails.org/association_basics.html [23]  3. has_many=>Createsaone‐to‐manyconnectionandeachinstanceofthemodelhas zeroormoreinstancesofanothermodel. Intancescanalsobematchedbyprocedingthoughathirdmodelbyhas_many:through. 4. has_and_belongs_to_many=>Createsadirectmany‐to‐manyconnectionwithanother model,withnointerveningmodel.                       [24]  3.3.3Views ViewsinRailsareHTMLcodeaccompaniedofEmbeddedRubycode,whichallowsto accessinformationwhichislocatedontheserver‐sidefromthetemplates.Railscanmake templatesmoredynamicdueRubycodecouldbeusedwithinthem.Alltheviewsfeaturesin Railsaredescribedinthesub‐sectionsbelow. 3.3.3.1 Layouts and Rendering in Rails Thecodewhichrenderstheviewsisplacedinthecorrespondingcontroller.Bydefault, controllersautomaticallyrenderthelayoutfile,namedas<controller_name>.html.erb,which islocatedunderthedirectoryapp/views/layoutsandifitdoesn’texistalayoutwithaname whichiscorrespondedtothatcontrollerwillrendertheapplication.html.erblayoutfile.This happenswherethereisnocalltothefunctionrenderspecifyingexplicitlywhatit’swantedto display.Nevertheless,itcouldbedefinedrenderedadifferentlayoutfile,byrender:layout=> “<layout_name>”,whichhastobeunderthedirectoryspecifiedpreviously,orrenderatemplate whichcorrespondstothenameofthecontroller,withoutrenderinganylayoutwithrender :layout=>false Withinthecontextofalayout,yieldidentifiesasectionwherethecontentfromthe viewshouldbeinserted.Thesimplestwaytoproceedis: <html> <head> </head> <body> <%=yield%> </body> </html> Codesnippet3:Layoutfileskeleton Fileswithhtml.erbextension,HTMLEmbeddedRuby,areHTMLfileswhichcancontain RubycodeanditshelpersforHTMLelements.Thesefilesareevaluatedontheserverside,so variablesdefinedinthecontrolleritselforinadifferentfile,canbeusedwithinthesefiles.To triggerRubycodeinthistemplatesmustbeembeddedinsidethetags<%…%>,fornot displayinganycontent,beingusefulforoperatingwithvariables,creatingloops,if‐else conditions,andsoon.Forvisualizingoutputinsidethistag<%=…%>  3.3.3.2 Render method Therendermethod8doesaheavyliftingofrenderingtheapplication’scontentfor beingusedbyabrowser.IttellsRailswhichvieworassettousewhenconstructingthe response.Themostcommonwaystocustomizethisfunction:  Torendertheviewthatcorrespondstoadifferentactionwithinthesame template: render:editorrender:neworrender:edit,etc.  8Rendermethod:http://guides.rubyonrails.org/layouts_and_rendering.html#using‐render [25]   Torenderatemplatefromadifferentcontroller: render‘<controller_name>/<action_view>’  ForrenderingaresponsewhenusingaRESTfulservice,inJSONorXMLformat: render:json=>@class_to_be_renderedorrender:xml=>@class_to_be_rendered  Forrenderingadeterminetemplateorlayout,whichisnotanaction’sview andit’slocatedunderthedirectoryapp/views/<controller_name>or app/views/layout: render:layout=>‘<template_name>’ Ifitwouldbeinadifferentfile render:layout=>‘<controller_name>/<template_name>’  AnotherwaytohandlereturningresponsestoanHTTPrequestiswithredirect_to.This methodtellsthebrowsertosendanewrequestforadifferentURL.Comparingthemethod renderwithredirect_to,thedifferenceisbasicallythatthecodestopsrunningandwaitsfora newrequestforthebrowser.  3.3.3.3 Partials Partialtemplatesareanotherfeatureforbreakingtherenderingprocessinto moremanageablechunks.Furthermore,itmakeseasierthereusabilityofsnippetswhichare repeatedindifferentfiles.Forinstance,forcontentthatissharedamongallpagesinthe application,suchasafooter,partialscanbeuseddirectlyfromlayouts. Partialscanevenreceiveasargumentslocalvariables,makingthemmorepowerful andflexible. <%=render:partial=>“book”,:locals=>{author:@book.author,title:@book.title}%> Otherimportantfeaturewhichpartialsincludeistorendercollections.Whena collectionispassed,thepartialwillbeinsertedonceforeachmemberwithinthecollection. <%=render:partial=>“book”,:collection=>“library”%>  3.3.3.4 Action View Helpers9 Railsprovidesabunchofhelpersforgeneratingformelementssuchascheckboxes, textfields,radiobuttonsanddropdownlists.Theirnamesendwith_tag,suchas text_field_tag,whichgeneratesasingle<input>element.Railsusesconventionstomake possibletosubmitparameterssuchasarraysorhashesthatwillbeaccessibleinparams.  9Actionviewhelpers:http://guides.rubyonrails.org/form_helpers.html [32]  3.4.Railsinternationalization Inordertoprovideamulti‐languagesupportfortheapplication,RailsincludesaRuby gem,so‐calledI18n15,whichprovidesaneasy‐to‐useandextensibleframeworkfortranslating theapplication.  Foreachlanguagesupported,afilewiththeformatYAMLandextension.ymlmustbe includedunderthedirectoryconfig/locales.Thesefilesarenamedwiththe:localeofthe languagethatwillsupportandcontainthetranslationstrings.Thefilewhichcontainsthe Englishtranslationswouldlooklikethis: en: login: username:“Username” pass:“Password” Codesnippet7:ChunkfromtheEnglishtranslationfile  Indentationisquiteimportant,becauseitallowsnestingtranslation,implementinga betterstructuretothefile.Butifthereissomelinewithwrongindentation,theapplication complainstriggeringanexception. Thewayitworksisabstractingallstringandotherlocalespecificfeatures,suchasdate orcurrencyformats,intheapplication.Railsaddsthefilesmentionedabove,tothe translationsloadpath(I18n.load_path)automaticallyandmakesthemavailableinthe application.Thentranslationsarelookedupbykeys,gettingthepropervaluesand instantiatingthevariablesdefinedintheviewtemplate. To<%=t‘login.pass’%>,ifthelocaleissetto:en,itwillprintPassword. Ifthedefaultlocaleisnotspecifiedexplicitly,itwillsetas:en(English).However, Waymatehasthedefaultas:de(German).Tosetthisvalue,thislineisaddedinapplication.rb: config.i18n.default_locale=:de It’swasconsideredconvenienttogetthelocalefromtheclientsuppliedinformation. ThisinformationmaycomeeitherfromtheIPorthebrowser.Togetthelocalefromtheuser’s preferredlanguageinthebrowserisagoodsolutionandsimpler,becauseotherwisetheIP havetobelookedupinadatabasetoidentifyfromwhichcountrycomestherequesttothe server.Atrivialimplementationisprovidedinthissnippet: defset_locale logger.debug"*Accept‐Language:#{request.env['HTTP_ACCEPT_LANGUAGE']}" I18n.locale=extract_locale_from_accept_language_header logger.debug"*Localesetto'#{I18n.locale}'" end private defextract_locale_from_accept_language_header request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a‐z]{2}/).first end Codesnippet8:Implementationtosetthelocalefromthebrowserheader   15RailsinternationalizationwithI18n:http://guides.rubyonrails.org/i18n.html [33]   Toaddthelocaletotheroutesthescopelocalemustwrapallthecontentdefinedwithinit. scope'/:locale',:locale=>Regexp.new(I18n.available_locales.join('|'))do #declaredroutes end Codesnippet9:Localescopedefinitionforthelanguagessupported Thislineavoidsthematchingwithlocalesnotdefinedorsupported,settingas availableintheapplicationenandde.                      [34]  3.5.Testing Runningtestsitensuresthatthecodeadherestothedesiredfunctionalityandmakes easiertodetectbugs.Railsprovidesaskeletontestcodeinthebackgroundwhenmodelsand controllersarecreated. 3.5.1Test‐DrivenDevelopment  Ontheserver‐side,WaymatedevelopersfollowtheTest‐DrivenDevelopment(TDD)16 assoftwareprocess.Inthisprocess,firstthedeveloperwritesan(initiallyfailing)automated testcasethatdefinesadesiredimprovementornewfunction,thenproducestheminimum amountofcodetopassthattestandfinallyrefactorsthenewcodetoacceptablestandards. Though,sometimesdevelopersfollowthelogictheotherwayaround,implementing functionalityandthencreatingtests.Intheend,themainideaisnotaddingnewfunctionality withouthavingbeentested. Tomakethisprocesspossible,Railsprovidesthefollowingcomponents: 3.5.1.1 Fixtures Fixtures17allowpopulatingthetestingdatabasewithpredefineddatabeforethetests runandaredatabaseindependent.FixtureareYAML‐formatted,beinghuman‐friendlyfor describerdata. Bydefault,Railsloadallfixturesfromthetest/fixturesforunitandfunctionaltests.The threestepswhichinvolvethisprocessare:  Removeanyexistingdatafromthetablecorrespondingtothefixture.  Loadthefixtureintothetable.  Dumpthefixturedataintoavariableincaseofaccessingitdirectly.  TheirformatisasaHashobject.Neverthelessfixturescanalsotransformthemselves intotheformoftheoriginalclass,havingaccesstothemethodsforthatclasstoo. 3.5.1.2 Unit testing Unittests18areusefulfortestingsmallchunksofcode.Adevelopermustprogram testablecode,becauseotherwisethesekindoftestwillbedifficulttowriteornotpossibleat all. InRailsunittesting’scommonuseisforindividualfunctions,whereideallyeachtest caseisindependentfromtheother.Asagoodpractice,atitshouldbecreatedatleastonetest forvalidationsandforeverymethodwithinthemodel  16Test‐DrivenDevelopment:http://en.wikipedia.org/wiki/Test‐driven_development 17Fixtures:http://guides.rubyonrails.org/testing.html#the‐low‐down‐on‐fixtures 18Unittesting:http://guides.rubyonrails.org/testing.html#unit‐testing‐your‐models [35]  Unittestingfilesareusedfortestingmodels.Itmustbeincludedinthefirstlinerequire ‘testhelper’,giventhefactthatthefiletest_helper.rb,specifiesthedefaultconfigurationto runthetests.Aunittestexample: classCustomerTest<ActiveSupport::TestCase test"shouldinitializeattributes"do customer=Customer.new(:first_name=>'John',:last_name=>'Doe') assert_equal'John',customer.first_name assert_equal'Doe',customer.last_name end end Codesnippet10:UnittestwithtwoassertionsforaCustomerTestmodel Howtoexecutetests:  Torununittestsfromtheconsole: raketest:units  Foranindividualunittestfile: raketestTEST=path_to_test_file  Tocallanspecifictestmethod: ruby‐I"lib:test"path_to_test_file‐nname_of_the_method"  3.5.1.3 Functional tests Functionaltests19aremeantfortestingvariousactionsofasinglecontroller.Some featureswhichshouldbetested:  Successfulrequest.Therearefiverequesttypessupportedfortesting(get,post,put, headanddelete).  Correctredirection.  Successfulauthentication.  Correctobjectstoredintheresponsetemplate.Afterarequesthasbeenmadeand process,thereexist4Hashobjectsfortheiruse: o assigns.Objectsstoredasinstancevariablesinactionsforusingviews. o cookies. o flash.Objectslocatedintheflash. o session.Objectslivinginsessionvariables   Propermessagedisplayedtotheuserintheview,byassertingthepresenceofkey HTMLelementsandtheircontent.   19Functionaltests:http://guides.rubyonrails.org/testing.html#functional‐tests‐for‐your‐controllers [36]  Forfunctionaltestsarealsoavailablethreeinstancevariables,quiteself‐explainable:  @controller,forthecontrollerprocessingrequest.  @request,therequestitself.  @response,theresponse.  Thistaskwillbeexecutedforrunningfunctionaltests:raketest:functional  3.5.2Behavior‐DrivenDevelopment Behavior‐DrivenDevelopment(BDD)20isaspecializedversionofTDDwhichfocuses onbehavioralspecificationofsoftwareunitsandincludessomefeaturesfromDomain‐Driven Design(DDD)aswell.  DDDfocusesonthestrengthsofobject‐orientedsoftwaredevelopmenttechniquesto simulatethecoreoftheproblem.Thus,itscorebuildsaproblemsimulationdomain, minimizingtechnicalinfluencesinordertomakemoreunderstandablebetweenusers, analystsanddevelopers.Thisaimisachievedusingacommonvocabulary,calledUbiquitous Language. Hence,BDDisacombinationoftwopowerfulapproachesforsoftwaredevelopment integratedintoone.  Railsdoesn’tincludeaframeworktosupportBDD.However,thereexistafewlibraries whichmakeitpossible.Thereexistmorethanasinglealternative,butthesetoflibraries chosenforBDDinWaymateare:  Cucumber21.Itletstodescribehowsoftwareshouldbehaveinplaintext.The textiswritteninabusiness‐readabledomain‐specificlanguageandservesas documentation,automatedtestsanddevelopment‐aid,allrolledintoone format. geminstallcucumber   Webmock.It’salibraryforstubbingandsettingexpectationsonHTTPrequests inRuby. geminstallwebmock   Capybara22.IthelpstotestRailsapplicationsbysimulatinghowarealuser wouldinteractwiththeapplication.Itisagnosticaboutthedriverrunning tests.WebKitissupportedthroughPoltergeist. geminstallcapybara    20Behavior‐DrivenDevelopment:http://en.wikipedia.org/wiki/Behavior‐driven_development 21Cucumber:http://cukes.info/ 22Capybara:https://github.com/jnicklas/capybara [37]   Poltergeist23.It’sadriverforCapybara.ItallowstorunCapybaratestsona headlessWebKitbrowser,providedbyPhantomJS. geminstallpoltergeist   PhantomJS24.Ithasseveralfeatures,buttheoneinvolvedinthiscaseisSite Scraping.Themeaningofthisfeatureistoaccessandmanipulateweb‐pages withthestandardDOMAPI,orwithusuallibrarieslikejQuery.  AllthefilesconcerningBDDwillbeunderthedirectoryfeatures.Thefiletoconfigure theenvironmentwheretheBDDwillexecuteisnamedenv.rbandlocatedunder features/support.Therelevantlinestoincludethelibrariesexplainedaboveare: require'cucumber/rails' require'webmock/cucumber' Capybara.default_selector=:css require'capybara/poltergeist' Capybara.javascript_driver=:poltergeist Codesnippet11:RequiredlinesforBDDlibrariesinclusionintheBDDtestingenvironment Oncetheselinesareincludedonthetopoftheconfigurationfile,dependingwhatis wanted,thisenvironmentcouldbeconfiguredinseveralways.It’sconsideredasnotnecessary tospecifyallthedetailsregardingthisconfiguration. BDDtestinginvolvesanimitationofservercontrollersinRailsandclientpages.There existthreekindoffiles:  Fixtures,withtheaimofsimulatingrealdata,suchasresponses,object modelsandsoon.Theycanbefoundunder/features/fixtures.   Stepdefinitionsarean analogoustoamethoddefinition/functiondefinitioninany kindofOO/proceduralprogramminglanguage.Theycantake0ormore argumentsareidentifiedbyRegexpmatching.Locatedinthe /features/step_definitionsfolder.   Featuresdescribethestepsthatshouldhappenbeforethescenario’ssteps starttoexecute.Thesestepswillmatchwitharegularexpressiondefinedin thestepdefinitioninordertoexecutethecorrespondinglines. Scenariosarecomposedbystepsaswell.Theyaremeanttoimitateuser interactionoverdynamicpagescontainingJavaScriptcode. Featuresandscenariosaredefinedinthesamefile.Featuresareonlydefined ifsomepreconditionsareneededbeforeexecutingthescenario’ssteps.These filesarelocatedunder/featuresdirectory.   23Poltergeist:https://github.com/jonleighton/poltergeist 24Phantominstallationguide:http://phantomjs.org/download.html [38]   AnexampleofaScenariowithitscorrespondingStepdefinitionsbelow: @javascript Scenario:Login GivenIamauser AndIamontheloginpage WhenIlogin ThenIshouldbeonthesearchpage Codesnippet12:Scenarioexample Given/^Iamauser$/do name="user#{rand(Time.now.to_i)}" @user=User.create!(:login=>name,:password=>'password',:password_confirmation=> 'password',:email=>"#{name}@email.com") end  Given/^Iamontheloginpage$/do visitlogin_path(:locale=>'en') end  Given/^Iamaloggedinuser$/do step"Iamauser" step"Iamontheloginpage" step"Ilogin" end  When/^Ilogin$/do fill_in'user_session_login',:with=>@user.login fill_in'user_session_password',:with=>@user.password click_on'ANMELDEN' end Codesnippet13:Stepdefinitionsforascenario          [39]  3.6.AssetPipeline Theassetpipeline25providesaframeworktoconcatenateandcompressJavaScriptand CSSassets.Inproductionisessentialtoincludesuchframework,dueitreducesthenumberof requeststhatcanbemadeinparallel,increasingthespeedloadingtheapplication. RailsisintegratedwithalibrarycalledSprocketswhichprovidesthisfunctionality.By defaultisenabled,butifit’sneededtobedisabled,inconfig/application.rb: config.assets.enabled=false  3.6.1Fingerprinting Intheproductionenvironment,RailsinsertsanMD5fingerprint,intoeachfilename andthefileiscachedinthebrowser.Fingerprintingisatechniquewhichmakesthenameofa filedependentonthecontentsofthefile,henceifthecontentchangesthefingerprintwill changeaswell.Besides,HTTPheaderscanbesettoencouragecachestokeeptheirowncopy ofthecontent,reducingtherequests.  3.6.2Location Assetsindevelopmentshouldbeplacedunderapp/assetsfolder.Inproduction,Rails precompilesthesefilesandplacesthemunderpublic/assetsdirectory,wherethecopieswith thefingerprintincludedarethenservedasstaticassetsbythewebserver.  3.6.3Assetsinclusionfortheirusage AssetsarelinkedfromtheHTMLlayoutortemplatefiles.WithintheHTMLtag<head> </head>mustbeaddedthefollowinglines,specifyingthenameofthefilewithoutits extension:  Cssfiles:<%=stylesheet_link_tag"stylesheet1",“stylesheet2”%>  JavaScriptfiles:<%=javascript_include_tag"javascript_file1",“javascript_file2”%> Sprocketsusesmanifestfilestodeterminewhichassetstoincludeandserveoverthe entireapplication.Manifestfilescontaindirectiveswhichtellthefilestorequireinorderto buildaCSSorJavaScriptfile.Itisverycommontohaveauniquefileunderthedirectory app/assets/javascriptsnamedasapplication.jswhichcontainsallthenecessarydirectivesto precompiletheassets.Intheapplicationthisfilelookslikethis:    25Assetpipeline:http://guides.rubyonrails.org/asset_pipeline.html [40]  //Librariesrequired //=requirejquery //=requirejquery_ujs //=requirejquery‐ui  //=requireunderscore //=requirebackbone //=requiremustache  //Filesrequired //=requireapp //=requireapp_router //=require_tree./lib //=require_tree./models //=require_tree./views //=require_tree./collections Codesnippet14:JavaScriptfilesinclusionintheprojectfromtheapplication.jsfile AsJavaScriptfilescontainsjQuery,Backbone,MustacheandUnderscoremethodsmustbe placedbeforerequiringtheJavaScriptfileswhichmakeuseofthem.Thesixformers//=require includethelibraries(whichwillbeexplainedintheclienttechnologiessection). TheotherlinesspecifytheJavaScriptfileswhichusethementionedlibraries.Thesesetof //=requirelinesexplainactuallyhowthefoldersandfilesareorganizedwithin app/assets/javascriptsdirectory. app/ assets/ images/ javascripts/  collections/  lib/  models/  views/  app.js  app_router.js  application.js stylesheets/ Codesnippet15:JavaScriptfilesorganization Thereby,beforeservingtheassets,theselibrariesmustberequired,otherwise,itwon’t identifytheirmethodsandwillproduceseveralerrors.      [41]  3.6.4Compressionlibraries ForCSSfilesthereexistsagemcalledYUIwhichprovidesminification,removingall unnecessarycharactersfromthesourcecodewithoutchangingthefunctionality. ForJavaScript,thereareseverallibraries,buttheonewhichobtainsbetter performanceisUglifierandit’salreadyincludedinthedefaultGemfile.Itprovidesminification andotheroptimizations. 3.6.5Environmentconfiguration It’scrucialtohaveconfiguredtheassetsproperlyfortheproductionenvironment, giventheenhancedperformancethatcanprovidetotheapplication. Inconfig/environments/production,theselineswillbenecessarytocompresstheCSS andJavaScriptlibrariescommentedpreviously: config.assets.compress=true config.assets.css_compressor=:yui config.assets.js_compressor=:uglifier Codesnippet16:Compressionlibrariesinclusionintheproductionenvironment  Tospecifytheassetstobeprecompiled,thenameofthefiles,accompaniedwiththe extension,mustbeincludedwithinthebracketsofthefollowingcommand: config.assets.precompile+=%w(<assetsinclusion>)  Ifthereismissingasinglefileinthissection,theapplication,intheproductionenvironment, willfailwhenisneeded. Forgettingfingerprintingenabled: config.assets.digest=true  Aslivecompilationisnotneededinthisapplication,whichwoulddecrease substantiallytheperformance,so: config.assets.compile=false      [48]  Theyarenotreferencedactually.Togetthechangesbackagaingitreflog 4.2.2.5Rebasing   Combineadeterminenumberofcommitsintoone. gitrebase–iHEAD~<number>   Rebasingbranches.Torewritehistory,sothatitlookslikeabranchwasoriginated fromanothercommit. gitcheckout<branch_name> gitrebasemaster   Ifthere’saconflict,rebasestops.Conflictsmustbesolved,changescommittedandthe run. gitrebase‐‐continue    Tocanceltherebaseifaconflictoccurs. gitrebase‐‐abort ThereactuallyexistmoreadvancedtopicsandcommandswhichGitsupports. Nevertheless,withtheonespreviouslycommented,adeveloper’steamhaveanadvance controlandgoodmanagementovertherepositorywheretheydevelopsimultaneously.  4.2.3.Conflicts Severaldevelopersworkingconcurrentlyinthesameprojectrequirecoordinationin thedeploymentprocess.Sometimesitisnecessarythatdevelopersprogramdifferent functionalitiesinthesamefilessimultaneously.Thisfactcouldcauseconflictsmergingthese filesinthelocalversionsoftheapplicationwhichhaveeachdeveloper.Fortunately,GitHub helpstosolvethisproblem.Itcontainsanalgorithmwhichtriestomergeautomaticallythose filesthathavebeenmodifiedfordifferentdevelopers. Thisalgorithmdoesn’tworkalways,duetoitonlyworkswhendifferentmodulesor functionsforaspecificfilehavebeenmodified.Thiscasehappenswhensomespecificlinesof thecodehavebeenmodifiedbytwoormoredevelopersandthechangeshaven’tbeenpulled beforestartingtomodifythatsnippetofthecode.Hence,whenanewversionfromaworking copyiscommittedandpulledafterwards,inordertogettheupdatedversion,thelocalversion oftheapplicationgetsaconflictwhichhastobefixedmanually.Oncetheconflictsarefixedby thedeveloper,thechangescouldbecommitted.Thenanotherpullisrequiredtomergethe fileswhichcontainedconflictspreviouslyandthereupon,thesecommitswillbepushed, updatingtoanewversionthehostedrepository.   [49]  4.3.Capistranodeployment Capistrano26isanopensourcetoolforrunningscriptsonmultipleserverssuchasthe casewhichconcernus,todeploywebapplications.Itautomatestheprocessofmakinganew versionofanapplicationavailableonawebserver. ItiswritteninRubyanddistributedusingtheRubyGems.Togetitinstalledasrails gem,it’sjustneededtotypegeminstallCapistrano.Toconfigureit’snotstraightforward.ss TheuseimplementationisbyBashcommandline.Thisframeworkincludesthe executionofcommandsinparallelonmultipleremotemachinesviaSSH.Itusesasimple domain‐specificlanguage(DSL),programminglanguagededicatedtoaparticularsolution technique. Itsimplifiesandautomatesthedeploymenttodistributedenvironmentsandcome bundledwithasetoftasksdesignedfordeployingRailsapplications. Italsoincludessupportingtaskssuchas:  Databasesmigrations.Ifanewreleasehassomependingmigrations,theycan berunontheserver. capdeploy:migrateorcapdeploy:migrations Migrationscouldbeconfiguredtobeexecutedafterthecodeisupdatedon theserverautomaticallybyaddingthislinethefiledeploy.rb: after‘deploy:update_code’,‘deploy:migrate’   Startandstoptheapplicationservers. capdeploy:start capdeploy:stop   Assetpipelineprecompilation.In./Capfileshouldbethislineincluded load‘deploy/assets’   Cleaning‐upoldreleases. capdeploy:cleanup   Rollbackdeploymentofthepreviousversion. capdeploy:rollback   Debuggingdeploymentswhichfailed capdeploy‐d   Testdeploymentdependencies,whichchecksdirectorypermissions, necessaryutilitiesandreportsthingsthatappeartobeincorrectormissing. capdeploy:check    26Capistranoguide:https://gist.github.com/2161449 [50]   Copytheprojectandupdatethesymlinktothemostrecentlydeployed version.Thesymboliclinkisaspecialfilewhichcontainsareferencetothe directoryintheformofanabsoluteorrelativepath. capdeploy:update Toupdatethesymlinkexplicitly,whichwillberarelyexecuted. capdeploy:symlink  Toconfigurethistoolisnotquitestraightforward.OnceCapistranoisalreadyinstalledin thelocalmachine,thesearethestepstoconfigureitproperly: 1) SetupSSHaccess.ToallowCapistranotologintotheOCSserverandruntheproper commands,theeasiestwayisbygeneratinganSSHkey.  2) Server‐sidepreparations: a. RequestaportforMongreltolistenon.Mongrelisalibraryandwebserver writteninRubytorunwebapplicationsandpresentsastandardHTTP interface. b. CachetheSVNcredentials.Everytimeanewversionisdeployedwiththis framework,itchecksoutanewversionfromtheSubversionrepository.To makethisprocesswork,ithastobecheckeditoutmanuallyontheserver. Hence,thecredentialsusedarecachedanditwon’tcauseanyproblem afterwards.Tocheckoutmanuallythefollowingstepshavetobefulfilled: i. LogintotheremoteserverviaSSH. ii. Checkoutacopyofthetrunk. svnco–usernameUSERhttp://svn.domain.com/path/to/repo/trunk iii. Letitruntilltheentirethingischeckedoutandthendeletethefolder rm–rftrunk/  3) Capifytheapplication ToaddCapistranosupporttotheapplicationthenextstepsshouldbefollowedafter typingintheterminal: capify. a. Customizethedeploymentrecipe.Thefileconfig/deploy.rbwhichCapistrano hasaddedtotheapphastobecustomizedtogetitconfiguredforthe application.Inthisfilehastobespecifiedthingssuchas: i. Repositorylink. ii. Portnumber. iii. Websitemonitoringsystemcallback. iv. Differentstages. Andotherdifferentfeaturestomakeitworkproperly.Herethedeveloperhas kindoffreedombecausehecouldconfigureitdifferently. b. Setuptheremotedirectorystructure.Thisactionwillautomaticallyloginto theOCSserverandcreateanewfolderwithnamespecifiedunder set:deploy_to.Inthisfoldermustbecreatedthefolders“releases”and [51]  “shared”.Furthermore,thefiledatabase.ymlshouldbecreatedintheserver side,whichisthedatabaseusedbytheapplicationhosted.  4) Deploythewebsite.Fordeployingthefirsttimeit’snecessarytodeploya‘cold’ application.Itwilldeploythecode,runpendingmigrationsanditwillinvokedeploy:start tofireupapplicationservers. capdeploy:cold  5) Testthedeployedwebsite.InordertomakesurethatMongrelisservingupthe websitecorrectly,inabrowsercouldbeopenedwiththisurl http://website.com:60040.IftheRailsapplicationappears,everythingwentright.  6) Settingupaproxyforthewebsite.Fornotreferencingthesitebyportnumberfor anythingotherthantestitisnecessarytoproxytheMongreltothewebsite.Tohave thewebsitegototheRailsappwithouttheport,itneedstobecreatedthe.htaccess fileinthepublic_htmlfolderandplacethiscodechunkinside:  RewriteEngineon RewriteCond%{HTTP_HOST}^www.domain.com$[OR] RewriteCond%{HTTP_HOST}^www.domain.com$ RewriteRule^(.*)$htpp://127.0.0.1:port_number%{REQUEST_URI}[P,QSA,L] Codesnippet18:TemplatetoproxytheMongrelwithawebsite 7) StartingtheapplicationonReboot.OncetheMongrelinstanceisrunning,it recommendedmakingsurethatgetsstartedagainiftheserverhastoreboot.             [52]  4.4.Multistage Astageisaversionoftheweb‐hostedapplicationrepositorywhichcanbeaccessed fromthebrowser.Itisrecommendedtohaveatleasttwodifferentstages,oneforthelive system,so‐calledproductionstage,thatuserswillaccessandtheotheronefortesting,which isnamedstaging. Developersalwayshaveaccesstothelatestversionoftherepositoryintheirlocal repository.Fromtimetotime,thenewestversiondevelopedsofarit’sdeployedonstaging.As otherteammembers,whoarenotdevelopers,wanttohaveaccessandseehowthe developmentprocessisgoinginthehalfwayofgettinganewfeaturewhichisalreadynot deployedinthelivesystem,theycouldaccesstothestagingserver,witharelativenewversion andevaluatetheprogresstotakedeterminedecisionsintheirwork.Hence,thestagingserver itismainlyusedforlettingotherteammemberstestthecurrentstateofthedevelopment processtowardstheversionthatwillbeliveeventuallywiththenewrequiredfunctionalities. Oncethenewfeaturesdevelopedforthewebapplicationhavebeentestedbythe entireteam,includingnotdevelopersaswell,andnobugsaredetected,thenewversionis deployedonthelivesystemandaccessibletotheusers. Capistranoprovidessupporttomultistagewithaseparateextension.Itisneededto installanadditionalRubyGemwhichisintegratedinthesystembytypinggeminstall capistrano‐ext Toconfigurethismultistagefeatureitwouldbenecessarytoaddin“config/deploy.rb” thesecommandlinesforhavingthestagingandproductiondifferentstages: set:stages,%w(productionstaging) set:default_stage,“staging” require‘capistrano/ext/multistage’ Codesnippet19:Multistagingconfigurationfortwodifferentstages Afterwards,underthefolderconfig/deploywillbeallocatedthefilesproduction.rband staging.rbwherethecustomstage‐specificcodewillbeplaced. Finally,fordeployingintheproductionstageit’sneededtotypeintheconsole capproductiondeployandtofollowsuitforthestagingcapstagingdeployorcapdeploy,as stagingisthedefaultstage,specifiedinthelinetwoofthesnippetabove.       [53]  4.5.Testingbeforedeploying Itisn’tpossibletoguaranteeacompletelyversiondeploymentwhichwillworkwithout triggeringanexception.However,itispossibletoenhancethereliabilityoftheprocessby testingtheapplicationbeforethedeploymentfromthelocaltothehostedrepositoryand fromthehostedrepositorytotheliveversionwhichtheusersaccessfromtheirbrowsers. Onceadeveloperdecidestodeploytheversionwhichisinthehost‐basedrepository, executescapproductiondeploy.Nevertheless,thisnewversionisnotdeployedinstantly,dueto itshouldbeensuredtopasstestsbeforehavingthefreshversiononthelivesystem.To achievethispurpose,Jenkinstriggersalltheexistingtests.  UnitandFunctionaltestsfortheserver‐side.  Unittestsfortheclient‐side.  Behavior‐Driventestsforboth,clientandserver‐side. Inordertodeploythelatestversion,allthetestsshouldpass.Incaseofasingletestfails, thecorrespondingcodeshouldbefixed,changespushedtothehost‐basedrepositoryand thendeploythenewversionagain. Jenkins27isanopen‐sourcecontinuousintegrationservicestoolforsoftwaredevelopment. Itisaserver‐basedsystemrunninginaservlet,Java‐basedserver‐sidewebtechnology.It supportsrevisioncontrol(SCM)suchasGit.                27Jenkinsguide:https://wiki.jenkins‐ci.org/display/JENKINS/Use+Jenkins [54]  4.5.Websitemonitoringsystem Howadevelopercouldknowthattheapplicationwhichrunsonthelivesystem doesn’ttriggeranyexception? Evenafterallthetestingbeforegettingthenewversionrunningonlivecouldbe somethingwhichstillcouldfail.Inordertokeeptrackoftheexceptionsproducedinthe websiteapplication,thesystemmustbemonitored. TinyMon TinyMon28isafull‐stackwebsitemonitoringsystem.Whilemonitoring,itsimulatesa webbrowserandperformscomplexconfigurablesteps. Itdoesn’tmonitortheindividualcomponentsthatbuildupthewebsite.Instead,it takestheuserperspectiveandtestswhetherallcomponentsareworkingtogethertogenerate theexpectedbrowsingexperience.Itisn’tareplacementofsoftwaretest,butanimportant addition. Featuresincludedinthisframework:  Fillinloginformsandloginusingatestaccount.  Completetransactionforonlineshopping.  Monitorthesignupprocess.  Monitorexternalwebsitesorservicesthesystemdependson. Tosetthiswebsitemonitoringtoolupfortrackingtheapplicationthesearethesteps thatshouldbefollowed: 1) Createanewaccount.Anewaccountrepresentsaclusterofwebsitesbelongingto thesameclient.ItholdstheaccessrightstositesandHealthCheckswithinsites.A userthatisgivenaccesstoanaccountcanalwaysseeallsitesandcheckswithinthis account.  2) Createanewsite.ItprovidesabaseURL,soasubdomainwouldbeanewSiteunless it’sprovidedafullpathinvisitstepsforHealthChecksforaSitessubdomain.The cleanwayistotreatsubdomainslikeanewSite.  3) CreateanewHealthCheck.Itcanbechoseneitherfromafewpredefinedtemplates orcreateafirststepfromthescratch.Inthetemplatemustbeprovidedapathforthe visitstepandastringforthecheck‐contentstep.   4) TestdrivefortheHealthCheck.It’sjustneededtoclick“Information”andthen“Run”. Afterawhilethepageshouldberefreshedorclick“Checkruns”toseehowthetests workedout.Iftestspassed,thecheckcanbeenabled.  28TinyMon:http://www.tinymon.org/pages/faq [55]   5) Integrateitintheapplicationcode.Thissnippetmustbeaddedinthefile config/deploy.rb: 1 task:markdo 2ifstage=='production' 3callback_url= 'http://mon.tinymon.org/deployments/510478e487b921349e0599bfb64fef45' 4system"curl‐Fdeployment[revision]=#{current_revision}‐F deployment[schedule_checks_in]=3#{callback_url}" 5end 6end Codesnippet20:IntegrateTyniMonintheproductionstage Thesecondlinespecifiesthatthecallbackitisonlyexecutedfortheproductionstage, whichistheoneusedforthelivesystem.Thefourthlinesetsthedeploymentrevisionfor whichthecallbackshouldbeexecuted. Forsendingemailstoallteamofdevelopers,inconfig/environment/production.rb,it’s beenincludedthischunkofcode: config.middleware.useExceptionNotifier, :email_prefix=>"[Exception]", :sender_address=>%{"ExceptionNotifier"<[email protected]>}, :exception_recipients=>%w{[email protected]} Codesnippet21:ExceptionNotifierconfiguration Theselinesspecifythesubject,thesenderandtheaddresstobesentwhenTinyMon detectsanexception. Tosetthisusefulandimportanttoolup,itisquitestraightforwardandprogrammingskills arenotneededatall.Oncethisframeworkiscompletelysetup,ifanerroroccursonthelive system,everydeveloperwillreceiveanemailwithanerrordescriptionaboutwhatitfailed. ThisfunctionalityisintegratedbyExceptionNotifierPluginforRails,whichprovidesa mailerobjectandadefaultsetoftemplatesforsendingemailnotificationswhenerrorsoccur. Bydefault,thenotificationemailincludestherequest,session,environmentandbacktrace. Nevertheless,eachofthosesectionscanbecustomizedrenderingapartialwiththenameof thepartthatwantstobemodified(e.g.,_session.html.erb)underthefolder app/views/exception_notifier.Theinformationavailablefromthesepartialsisthefollowing:  @controller:thecontrollerthatcausedtheerror.  @request:thecurrentrequestobject.  @exception:theexceptionthatwasraised.  @backtrace:asanitizedversionoftheexception'sbacktrace.  @data:ahashofoptionaldatavaluesthatwerepassedtothenotifier.  @sections:thearrayofsectionstoincludeintheemail.    [56]  5.APIsdataabstractionintoacommonobject DatathatcomesfromdifferentAPIstorepresentconnectionsfordifferentmeansof transportationorcompaniesisprovidedindifferentformats,structuresandattributes.Thisis aproblem,becausehavingdifferentobjectmodelsforeachAPImakestheback‐endeven moredifficulttomaintainandtest.Maintenancegetsmorecomplicatedduetodifferent objectmodelshavetobetreatedwithdifferentlogic.ConsideringthatinthefuturemoreAPIs willbeincluded,thisfactimpliesadditionallogicforthefunctionalityachievedsofar, specificallyforthenewobjectmodel. Therefore,havingasingleobjectmodelwhichencompassesintoonethedatathat comesfromdifferentAPIspresentsthefollowingadvantages:  Savescodeduplication,duethedeveloperonlyhastomakethenewobjectmodelfit intheglobal.  Functionsaremoretestable.Havingdifferentobjectsthecodeincludesalotof comparisonif‐else,whicharenotsoeasytotest.  Theprojectremainsbetterstructured.  Thecodeiscleanerandhence,morereadable.   Intheoldapproachtrainsandflightsweredifferentobjectmodels,butit’sbeenmanaged toconvergethesetwodifferentobjectsintoaflexibleandconsistentsingleobjectmodel. Probablyitseemstobeeasy,becausealotofattributesaresharedsuchasorigin,destination, departure,timeandsoon.Themaindifficultywasfoundatthetimetocreateasub‐objectfor tariffsandprices.  ForeachAPIwherethedataisretrieved,anindependentfileisneededtoparsethe responseandtransformitintoacommonobjectmodel.Regardingthedatastructuretostore alldifferentpossibilitiesandtheglobalconnectionobjectmodelisconfidential,sonomore furtherdetailswillbeexplained.  Waymateofferstravelsolutions,connectingcitiesalloverEuropeandsomecities outsidetheboundariesfromtheoldcontinent.Theseconnectionsarecoveredbytrainand flights.But,fromwhichAPIsdoesthisdatacomefrom? 5.1.DeutscheBahnAPI DeutscheBahnAG(DB)isthebiggestGermannationalrailwaycompany.Theyoffer connectionsbytraingivingfullcoverageoverGermanyandsomeimportantcitieswithin Europe.However,destinationororiginmustbeaGermancity,implyingthatthereisnotrain connectionwhichlinkstwocitiesasoriginanddestinationouterfromGermany.  DBBahnhasopeneditsAPItoWaymate,providingallthedetailsinformationfor differentconnectionstotravelinadeterminedate,fromoneplacetoanother.Togetaccess tothisAPIWaymateandDBformalizedacontract,providinginthefirstinstanceaccesstoa testingserver.Afterbeingdevelopingwiththetestingserver,DBtesttheapplicationandif [57]  thereisnobugsoranincorrectwayintheprocess,suchashowtoshowtheconditions,the realAPIisopened. Foreachrequestisneededtoincludeauser,passwordandkey(providedbyDBafter signingacontract)inthebodyofeachrequestandbesidestwoXMLfilestemplatesfilledwith theproperattributestocomposetherequest.Toguaranteetheencryptionofconfidential information,suchascreditcardnumbers,theprotocolHTTPSisusedforsendingthis information.ThisprotocoladdsthesecuritycapabilitiesofSSL/TSLtothestandard.The responseofthisAPIforadetermineconnectionincludes:  Trainschedules.Inordertoconnecttwodifferentcities,thereisnotalwaysadirect train,hence,someconnectionscontainmorethanonetrainschedule,makingoneor morestopoversinothercities.Eachschedulecontains: o Arrivalanddeparturetimeanddate. o OriginanddestinationtrainstationsnameandEVA(uniquetrainstation identifier). o Traincategoryandnumber.  Asetofschedules(orasingleoneifthereisadirecttrain),composeaconnection.A connectionincludestheelementofferwith: o Totalprice. o Offercodeanditsdescription. o Class(1stor2nd). o Codesforlong‐distancetrains. o Typesofpossiblepayments. 5.2.YpsilonAPI YpsilonisacompanywhichprovidesaccesstoitsInternetBookingEngine.ItsAPI providesflightconnectionscoveragebetweencitiesalloverEurope,includingseveralairlines. ItalsocanprovidesomeconnectionsfromEuropetoothercontinentortheotherwayaround, aswellasmulti‐currencytohandlethebookingprocessfortheseflights. Alltheprocessregardingthecontractandstartinggettingdatafromatestingserver followsthesamelogicthanwithDB,soisnotnecessarytorepeatitagain. Forsendingrequestsit’sneededtoincludeanauthorizationcodeinthebody,withthe nameofthecompanyfollowedbyacodeprovidedbyYpsilon,specifyaport,asecureport,a host,asecurehostandaclientcertification.It’ssentbyHTTPSaswell,buttheencryptionit’s strongergiventheclientcertificationusage. [64]   6.3.Dynamicweb‐site WithHTMLandCSSstaticweb‐sitescanbebuiltup,howeverthereisnologicincluded andlimitedinteraction.Inordertoincludedataprocessingwithitscorrespondinglogicand userinteraction,thefollowingtechnologiesareincludedintheproject.  6.3.1.JavaScript JavaScript(JS)32isaprototype‐basedscriptingandmulti‐paradigmlanguage,supporting object‐oriented,imperativeandfunctionalprogrammingstyles.It’sdynamic,weaklytyped (supportingimplicittypingconversionandprovidingalotofflexibilitywhenoperatingwith differenttypes)andhasfirst‐classfunctions.ItssyntaxisinfluencedbyCandJava,butboth areactuallyunrelatedandhaveverydifferentsemantics. JavaScriptdoesn’thaveclasses,insteadusesprototypes,whichcansimulatemanyclass‐ basedfeatures. It’smainlyusedforprogrammingclient‐sidesforwebpagesandapplicationsandcan respondtouseractionquickly,makinganapplicationmoreresponsive. JavaScriptisimplementedaspartofaWebbrowser,whichworksasarun‐time environmentitself,providingobjectsandmethodsbywhichscriptscaninteractwiththe “outsideworld”inordertogiveenhanceduserinterfacesanddynamicwebsites.Thefunctions areembeddedinHTMLpagesandinteractwiththeDocumentObjectModel(DOM),cross‐ platformandlanguage‐independentconventionforrepresentingandinteractingwithobjects inHTML,XMLandXHTMLdocuments.Inaddition,isabletodetectuseractionwhichHTML cannotdobyitself,suchasindividualkeystrokes.  6.3.2.AJAX AsynchronousJavaScriptandXML,commonlyknownasAJAX33,isagroupof interrelatedwebdevelopmenttechniquesusedontheclient‐sidetocreateasynchronousweb applications.Therefore,webapplicationscansenddatato,andretrievedatafrom,aserver asynchronously(inthebackground),withoutinterferingwithdisplayandbehaviorofthe existingpage.DatacanberetrievedusingtheXMLHttpRequestobject,however,despitethe name,theformatoftenusedisJSON. Thistechnologyenhancestheuserinteractionalongtheapplication,avoiding unnecessaryfullpagesreloads,duetoXMLHttpRequestobjectprovideamethodfor exchangingdataasynchronouslybetweenbrowserandserver.  32JavaScript:http://en.wikipedia.org/wiki/JavaScript 33AJAX:http://en.wikipedia.org/wiki/Ajax_(programming) [65]   6.3.3.jQuery jQuery34isamulti‐browserJavaScriptlibrarydesignedwiththeintentiontosimplify theclient‐sidescripting.It’sthemostpopularandusednowadays,dueitallowsthecreationof powerfuldynamicwebpagesandwebapplications. Itssyntaxmakeseasytonavigateadocument,selectDOMelements,create animations,handleelementsanddevelopAjaxapplications.Italsoprovidescapabilitiesto extenditsfunctionalitycreatingplug‐insontopoftheJavaScriptlibrary,sodeveloperscan createabstractionsforlow‐leverinteraction,advancedeffectsandanimations. ToincludethisJavaScriptlibrary,oranotherone,intotheprojectit’snecessaryto includethislinebetweentheheadtags. <head> <scripttype="text/javascript"src="jquery.js"></script> </head> Codesnippet25:JavaScriptlibraryinclusionfromaHTMLtemplate ThewaytointroduceajQueryfunctionistousethe.ready()function.Then,whenthe pageisloaded,thecodewithinthissectionwillbeexecuted.Functionswillbedefinedoutof it. $(document).ready(function(){ //codegoeshere }); ToaccessandmanipulateDOMnodesjQueryprovidesthe$function.Itiscalledwitha CSSselectorstringfortheclassoridoftheDOMelement,resultinganobjectreferenceafter thematching. $(‘#navigation.element’).addClass(‘selected’); Thislineaddtheclass“selected”toallchildrenDOMelementsundertheonewithid “navigation”whichcontaintheclass“element”. Thislibraryprovidesalargesetofmethodsfor:  SelectingDOMelementsandmanipulatethem.  Gettingandsettingattributesforinputelementssuchascheckboxes,input fields,radiobuttonsanddropdownlists.  GettingandsettingtheCSSstylingforHTMLelements.  Eventsmethodswhichregisterbehaviorstotakeeffectwhentheuser interactswiththeelementsandmanipulatethoseregisteredevents.  34jQuery:http://en.wikipedia.org/wiki/Jquery [66]   Visualeffectsforaddinganimationtoawebpage,fromsimplestandard animationstosophisticatedcustomeffects.  AJAXcapabilities,toallowloadingdatafrom/totheserverwithoutbrowser pagerefresh. ThereexistsastandardbundleofjQuerylibrarytointeractwithUIelements.Inthis application,theDraggableplugin,whichmakesselectedelementsdraggablebymouseis included. Regardingwidgetplugins,theonesincludedare:  Datepicker,aconfigurableandcustomizablecalendartoselectspecificdates orrangedates.  Slider,whichmakesselectedelementsintosliderandprovidesvariousoptions suchasmultiplehandlesandranges.  6.3.4.Backbone Backbone35isaJavaScriptframeworkbasedonthemodel‐view‐controller(MVC) applicationdesignparadigm.Itisdesignedfordevelopingsingle‐pagewebapplications(SPA) andforkeepingvariouspartsofwebapplicationssynchronized.Itgivesstructuretoweb applicationsbyprovingmodelwithkey‐valuebindingandcustomevents,collectionwitha completeandusefulAPIoffunctions,viewswithdeclarativeeventhandling,andconnectsitall totheserverAPIthroughaRESTfulJSONinterface. WithBackbone,JavaScriptfilesmustbefollowaspecificorganization,divingplacing themundermodels,collections,helperlibrariesandviewsfolders.Havingagoodfiles organizationwillhelptofindfilesfasterandmaintainthem. app/ assets/ images/ javascripts/  collections/  lib/  models/  views/  app.js  app_router.js  application.js Codesnippet26:Backbone.JavaScriptfilesorganization 6.3.4.1.ImportanceofusingaMVCframeworkinthefront‐end TheentireapplicationinvolvesalotofJavaScriptcodeandthisgenerallyimpliestoend upwithtangledpilesofjQueryselectorsandcallbacks,alltryingtokeepdatain synchronizationbetweentheHTMLUI,JavaScriptlogicandtheserverdatabase.Nevertheless  35Backbone:http://backbonejs.org/ [67]  itisnotrecommendedtotiethedatatoDOMelementsandforrichclient‐sideapplications,a morestructuredapproachishelpful. BackbonerepresentsthedataasModels,whichcanbecreated,validateddestroyed andsavedtotheserver.ItalsoprovidesViewsthatdisplaysthemodel’sstateandcanbe notifiedofthechangeofthemodelinordertobeabletorespondandre‐rendertheviewfor thenewmodeldata.Hence,intheenditwon’tbenecessarytowritethecodethatlooksinto theDOMtofindanelementwithanidandupdatetheHTMLmanually,giventhatwhenmodel changes,theviewsupdatesbythemselves. Theadvantageofhavingasingle‐pagewebapplicationistoprovideamorefluiduser experience,duetochangesareperformedloadingnewcodeondemandfromthewebserver, drivenbyuseractions.Continualpageredrawsdisrupttheuserexperienceduetothenetwork latenciescannotbehidden.Thepagedoesn’tautomaticallyreloadduringuserinteractionwith theapplication,thereforenounnecessarydatare‐transmitionitisperformance.Thetechnique whichallowsthiscontinuousandfluiduserexperienceisAJAX,allowingasynchronous communicationbetweenclientandserver. 6.3.4.2Comparisonwithsimilarframeworks AlotofMVCframeworksforJavaScripthavecomeuplately.Themostfamous frameworks,inadditiontoBackbone,areSpine,AngularJSandEmber. Actuallythereisnobestchoiceamongthese4alternatives,duetheyofferthesame interestingfeaturesforsuchkindofframework,butinwithdifferentsyntax. So,howtoselectthebestchoice? WaymatedeveloperswereaskingthroughtheRailscommunityinordertofinda unanimousanswer.However,itdidn’thappen,differentdeveloperswerepromotingdifferent frameworks. ThesecondideawastoaskinaRubyconference,wherealotofprestigiousRubyon Railsprogrammersusetoattend.IthappenedthesameasintheRailscommunity. So,finally,WaymatedevelopersdecidedtochooseBackboneforthreereasons:  It’swelldocumented.  Theclient‐sideofprestigiousprojectshavebeenbuiltupusingthisframework.  It’sthemostpopularamongallthealternatives.         [68]  6.4.3.3.Backbonecomponents 6.4.3.3.1 Backbone.sync Backbone.syncisthefunctionthatBackbonecallseverytimeitattemptstoread orsaveamodeltotheserver.Bydefault,ituses(jQuery/Zepto).ajaxtomakeaRESTfulJSON requestandreturnsajQueryXMLHttpRequestobjectby$.ajax(jqXHR). sync(method,model,[options])  Themethodcouldbeeithercreate,read,updateordelete.  Themodeltobesavedorcollectiontoberead.  Theoptionsaresuccess,errorcallbacksandotherjQueryrequestoptions ThismethodcouldbeoverriddengloballyasBackbone.sync,oratafiner‐grained level,byaddingasyncfunctiontoaBackbonecollectionortoanindividualmodelforusinga differentpersistencystrategysuchasWebSockets,XMLtransportorLocalStorage. Thedefaultimplementationsendsuparequesttosaveamodel,itsattributeswillbe passed,serializedasJSONadsentintheHTTPbodywithcontent‐typeapplication/json.When aJSONresponseisreturned,senddowntheattributesofthemodelthathavebeenchanged bytheserver,andneedtobeupdatedontheclient.Furtheron,itwillbeexplainhowcouldbe fulfilledbymeansofaBackbone.Model. ThedefaultsynchandlermapsCRUDtoRESTlikeso:  create‐>POST/collection  read‐>GET/collection[/id]  update‐>PUT/collection/id  delete‐>DELETE/collection/id  6.4.3.3.2 Backbone.Events Backbone.Eventsisamodulethatcanbeassociatedtoanyobject,givingtheabilityto bindandtriggercustomnamedevents.Theydon’thavenecessarilytobedeclaredbeforethey areboundandcantakepassedarguments.  Acallbackfunctioncouldbeboundtoanobject,soitwillbeinvokedwheneverthe correspondingeventisfired. object.on(event,callback,[context]) Tosupplyacontextvalueforthiswhenthecallbackisinvoked,inthethirdargument [context]shouldbepassedthis. Callbacksboundtothespecialalleventswillbetriggeredwhenanyeventoccursand arepassednameoftheeventasthefirstargument. [69]   Removeapreviously‐boundcallbackfunctionfromanobject: object.off([event],[callback],[context]) Ifnocontextisspecified,alloftheversionsofthecallbackwithdifferentcontextswill beremoved.Ifnocallbackisspecified,allcallbacksfortheeventwillberemovedand obviouslyifnoeventisspecified,alleventcallbacksontheobjectwillberemoved.  Triggeringcallbacksforthegivenevent,orspace‐delimitedlistofevents. Furthermore,subsequentargumentstotriggerwillbepassedalongtheevent callbacksseparatedwithcomas. object.trigger(event,[*args])   6.4.3.3.3 Backbone.Model Modelscontaintheinteractivedataaswellasalargepartofthelogicsurroundingit suchasconversions,validations,computedpropertiesandaccesscontrol.ABackbone.Model providesabasicsetoffunctionalityformanagingchanges.Nevertheless,tocreateanewone shouldbeextendedwiththeirownspecificmethods. TocreateacustomizedModelclass,Backbone.Modelshouldbeextendedandinstance propertiesprovided.Hence,thedefinitionofanewmodelwithitsownfunctionsshouldlook somethinglikethis: varname_model1=Backbone.Model.extend({ initialize:function(){…}, name_function1:function(){…}, name_function2:function(param1,param2,..){…} } Codesnippet27:Backbone.Modeldefinition Accordingly,extendcorrectlysetsuptheprototypechain,sosubclassescreatedwith extendcanbefurtherextendedasfarasadeveloperwants. varname_model2=name_model1.extend({…}) Whenamodelinstanceiscreated,optionalclassPropertiescanbeattacheddirectlyto theconstructorfunction. newModel([attributes])  Theseattributescouldbeasimpleattribute,anarrayorevenanothermodel,which willbesetonthemodelinwhichhavebeenpassed.Ifaninitializefunctionhasbeendefined,it willbeinvokedwhenthemodeliscreated varinstance_model=newname_model2({attribute1:‘value1’,attribute2:‘value2’,…})   [70]  Modelfunctionsinterface  Gettingthecurrentvalueofanattributefromthemodel. model.get(attribute)   Settingahashofattributes(oneormany)onthemodel. model.set(attributes,[options])    Ifanattributeissettoanon‐nullornon‐undefinedvalue,thisfunction returnstrue. model.has(attribute)    Removeanattributebydeletingitfromtheinternalattributeshash.Firesa changeeventaswell. model.unset(attribute,[options])    Removeallattributesfromthemodel.  Thedefaultsfunction(orhash)canbeusedtospecifythedefaultattributes forthemodelwhencreatinganinstanceofthemodel. model.defaultsormodel.defaults()    Forvalidatingamodelthismethodshouldbeoverridden.Thismethodwillbe calledalwaysbeforesettingorsavingamodel.Ifitfailsitreturnsanerror, otherwiseanything. model.validate(attributes)    Checkifthemodelisvalid. model.isValid()    GettherelativeURLwherethemodelwouldbelocatedontheserver. model.url()   SpecifyaurlRootifthemodelit’splacedoutsideofacollection. model.urlRootormodel.urlRoot()    Parsethemodeldatawhenthemodelisfetchedorsaved.Fromtheserver sideinRails,itexiststheimplementationto_jsonforincludingmodel’s attributesunderanamespace. model.parse(response)    Returnanewinstanceofthemodelwiththesameattributes. model.clone()    Checkifthemodelhasalreadybeensavedontheserver.Itreturnsfalsein thatcase,otherwisetrue. model.isNew()  [71]    Manuallytriggerthechangeevent. model.change()   Checkwhetherthemodelhaschangedsincethelastchangeevent. model.hasChanged([attribute])    Retrieveahashofthemodel’sattributesthathavechanged. model.changedAttributes([attributes])    Getthepreviousvalueofachangedattribute. model.previous(attribute)    Getacopyofthemodel’spreviousattributes. model.previousAttributes()    Returnacopyofthemodel’sattributesforJSONstringification. model.toJSON()   Resetthemodel’sstatefromtheserverbydelegatingtoBackbone.sync.Itis usefuleitherifthemodelneverhasbeenpopulatedwithdataorforensuring thatithasthelatestserverstate. model.fetch(model,response)    Saveamodeltothedatabaseserver(persistencelayer),bydelegatingto Backbone.sync.Thehashattributesshouldcontainthosedesiredtochange.If themodelhasavalidatemethod,andvalidationfails,themodelwon’tbe saved.IfthemodelisNew,thesavewillbeacreate(HTTPPOST)andifit alreadyexistedwillbeanupdate(HTTPPUT). model.save([attributes],[options])    DestroysthemodelontheserverbydelegatinganHTTPDELETErequestto Backbone.sync. model.destroy([options])  Ifanyoftheattributeschangethemodelsstate,achangeeventwillbetriggered, unless{silent:true}ispassedasanoption.       [72]  6.4.3.3.4 Backbone.Collection Collectionsareorderedsetsofmodels.Itcouldbeboundchangeeventswhenany modelinthecollectionhasbeenmodified,listenforaddandremoveevents,fetchthe collectionfromtheserveranduseafullanUnderscore.jsmethodinterface. Anyeventtriggeredonamodelwithinacollectionwillalsobetriggeredonthe collectiondirectly,allowinglisteningforchangestospecificattributesinanymodelwhichthe collectioncontains.  TocreateaCollection,Backbone.Collectionshouldbeextended,providing instanceproperties,aswellasoptionalclassProperties,asinthe Backbone.Modelcreation,tobeattacheddirectlytothecollection’s constructorfunction. Backbone.Collection.extend(properties,[classProperties])    Themodelclasswhichthecollectionwillcontainshouldbespecified. collection.model    WhencreatingaCollection,thearrayofmodelcouldbepassedasan argument.Iftheinitializefunctionisdefined,itwillbeinvokedaswell. newCollection([models],[options])    Addamodeloranarrayofmodelstothecollection.Modelswillbeinserted regardingthedefinitionofthecomparatorfunction. collection.add(models,[options])    Addamodeloranarrayofmodelsattheendofthecollectionoratthe beginningofthecollectionrespectively. collection.push(model,[options]) or collection.unshift(model,[options])  Thesethreelattermethodsfiretheeventadd.   Bydefaultthereisnocomparatorfunctiononacollection.Ifthisfunctionis definedwithinthecollection,itwillbeusedtomaintainthecollectionin sortedorder. collection.comparator   Forceacollectiontore‐sortitselfwhenitisinvoked. collection.sort([options])    Removeamodeloranarrayofmodelsfromthecollection. collection.remove(models,[options])    Removeandreturnthelastorthefirstmodelofacollectionrespectively. collection.pop([options]) or collection.shift([options]) Thelatterthreemethodsfirearemoveevent.   [73]   Returnanarrayofallmodelswhichmatchthepassedattributes. collection.where(attributes)    SettheURLtoreferenceitslocationontheserver. collection.urlorcollection.url()   Getamodelfromthecollection,specifiedeitherbyid,indexorclientid.The latterisusefulwhenthemodelhasn’tbeensavedontheserverside. collection.get(id) , collection.at(index) and collection.getByCid(cid)   RawaccesstotheJavaScriptarrayofmodelsinsidethecollection. collection.models    Returnanarraycontainingthehashattributesofeachmodelinthe collection. collection.toJSON()   Fetchthedefaultsetofmodelsforthiscollectionfromtheserverresetting thecollection.ItdelegatestoBackbone.syncunderthecoversforcustom persistencestrategies.Italsocallsautomaticallytoparse,whichreturnsthe arrayofmodelattributestobeaddedtothecollection. collection.fetch([options])    Createanewinstanceofamodelwithinacollection. collection.create(attributes,[options])    Replaceacollectionwithanewlistofmodels. collection.reset(models,[options])   28iterationfunctionsprovidedbyUnderscore.jssuchasforEach(each), isEmpty,etc.  6.4.3.3.5 Backbone.Router Backbone.Routerprovidesmethodsforroutingclientsingle‐pagesandconnectsthem toactionsandevents.Forbrowserswhichdon’tsupportyetHistoryAPI,theRouterhandles gracefulfallbackandtransparenttranslationtothefragmentversionoftheURL.TheHistory APIprovidespermalinkstousestandardURLspage. Duringpageload,aftertheapplicationhasalreadyfinishedcreatingallitsrouters, shouldbecalledBackbone.history.start(),orBackbone.history.start({pushState:true})toroute theinitialURL.  Createacustomrouterclass.ActionswhichtriggerswhencertainURL fragmentsarematchedmustbedefined,aswellasarouteshashthatpairs routes.Hereisanexample:   c) Onc e self. u class def  iata_ e defs A end Co d Inth i d) Final l  2) Req u retri e Back b      e ,alltheins e u pfunction a InsertAirli n self.up Airline.c r code:"AB",i c nd elf.down irline.delet e d esnippet31: M i ssnippetis s l ythemigra t u estmodels. e vingtheinf o b onemodel s Search :c o getalist day,and contains Traveler : options. M Customer : forbooki Thismo d So,next t automat i CreditCar asthere q Order :co n models. C an Order m informat i Image6: e rtionlines w a ndthesam e n es<Active R r eate(airlin e c ao_code:"BE R e _all(:airli n M igrationfile e s hownhow t t ionwereex Thesekind s o rmationth a s .Thesemo d o ntainsthe a ofconnecti o incaseofa r travelermo d hasinforma M orethan o containsth e ngtickets,s u elisstored w t ime,ifthe u cally. d :creditcar d q uestforbu y n tainsa Cust o C ustomer,Tr a m odel.Obvi o i onisnotst o Hierarchyof o [80] w ereprinted e forthedel e R ecord::Migr a e _id:214, n R ",callsign: n e_id=>214 ) e xamplewhic h t oinsertan d x ecutedby r a s ofmodels a a ttheuser h d elscontain a ttributesfo r o nsfromon e returntripi s d els.It’ssto r tionforasi n o netraveler c e personalin u chasnam e w hentheus u serislogge d d informatio y ingtickets i o mer ,a Credi t a velers and L o usly, Credit C o red. o bjectmodels w inafilewer e e tionlines w a tion n ame:"AirBe "AIRBERLIN" )  h introducesor d deleteasi n a kedb:migra t a reactually c h asintroduc e thefollowin r makingar e e citytoano t s selected,f o r edforcreat n gletraveler , c anbeasso c formation w e ,address,p a e rislogged i d in,thefor m n.Obviousl y i ssent,this m t Card andon e egs arestor e C ard informa w hichcompos e e copiedinsi w ithinthesel rlin",alias ,country:"G e removesanai r n gleairlineb e  c reatedand p e donthecli e ginformati o e questtoth e t herforasp e o rthisdaya s ingusersea r , suchasag e c iatedtoas e w henauser f a ymentmet h i nandfillst h m willbepo p y isnotstore d m odelisdes t e ormore Tr e dinthedat a t ionwithall e anOrder i detheemp t f.downfunc :"", e rmany") rline b yamigratio populated e nt‐side,as o n: e APIsinord e cifictraveli s well.Itals o rchesstatist e andtrainc a e arch f illsinthefo r hod,etc. h ebookingf o p ulated d,henceas s t royed. r aveler and L e a basecomp o theconfide n t y tion. n. erto ng o  ics. a rd r m o rm. s oon e g o sing n tial    3) Resu  P a a  S d  S f o  M o t h a  S c  L s m s t  T o t h     ltconnectio riceContaine r respecialp r ndtype. chedulePoint : d ateandtim e chedule :this o rtraveling f o deOfTranspo r h ecarrierc o ndnumber ( ubLeg :forre p ontaininga S eg :represen amemean o m eaningofc o t opoverint h o ur :compos h eoriginan d Image 7 ns r :containsa r icesinclude d : containing e whenthe u modelisco m f romoneto r t :insideth o deandfligh t ( fortrainsa n p resentingt h S chedule ,a M o t stheinfor m o ftransport a o ntainingm o h istravel. e dbyoneo r d destinatio n 7 :Hierarchyof [81] llthepossib d. Price mo d itsname,ty p u sershould r m posedbyt w another. ismodelca n tnumber(f o n dpublictra h einformati o deOfTranspo r m ationtotr a a ndcancon t o rethanon e r more Leg o b n specifiedb objectmodels le Prices for d elcontains t p eofstatio n r eachthisp o w o Schedule P n befoundt h o rflights),th nsportsupp o ontotravel r t anda Pric e a velfromap t ainmoreth e  SubLeg isbe b jects,repre ytheuser. whichcompo s asingleLeg, t hepriceswi orairport, c o intalongth e P oint objects h emeanoft esub‐mode o rted). fromonep o e Container m o ointtoanot h a nonesingl e causethere sentingthe w s eaTour , duesometi i thitscurre n c oordinates ejourney. andthedu r t ransportati o oftranspor t o inttoanot h o dels. herwithth e e SubLeg .Th e existsatlea w holejourn e mes n cy a nd ation o n, t ation h er,  e  sta e yfor  [82]  4) Usermodels.  User,whichcontainstheusername,allthenecessaryattributestoencrypt thepassword,therole(normaloradminuser). ItalsoincludesreferencestoaCustomermodel,containingallthe informationforfillingautomaticallythebookingform,withoutthe CreditCardinformationandforeachtimehehaspurchasedatravelin Waymate,anOrdermodel.  UserSession,modelwhichcorrespondstoaccessrestrictionfunctionality. Thesetwomodelsarecreatedforstoringsafelytheconfidential informationforuseridentification,astheuserpassword.                     [83]  7.2Workflowalongtheentireprocess Theworkflowdefines:  Thedataflowbetweenclient‐serverandserver‐API.  Communicationbetweendifferentviewsinthesameordifferentpageviaevent triggering.  PagenavigationinsteadofpagingreloadsduetoAJAXusagebyBackbone.  Itwasconsideredappropriatetoincludethefollowinginformationunderthissectionaswell:  Client‐sideBackboneModelobjectsandViews.  Googletechnologiesemployed,givingthedetails,upsidesanddownsidesofusing them.  Howvalidationworksinthebookingform               toso isat e platf o   This p 1 2 Beforela meusersin e mporaryp a o rm. Thiswill b p ageinclud e 1 ) Usersw h subscrib e Image9: E 2 ) Testingu whichdo abletog o unchingWa y ordertoget a getoinfor m b ethelandi n e stwofuncti h owanttob e e toreceive e E mailsubscrip t sersandtea esn’tobtain o furtherth a 7.2.1. y mateasa p somefeed b m usersabou n gpagewhe Im a o nalities: e informed a e mailswith t  t ion mcompone ausernam e a nthelandi n [84] Landin g p ublicapplic a b ackandim p u twhatWay m nusersacc e a ge8:Landing p a boutthest a t hisinforma t ntscanlogi e andpassw o n gpage,bec a g page a tion,apriv a p rovesome a m atewillpr e e sstowww. w p age  a teandupd a t ion. nforaccess i o rdprovide d a usetherei s a teversion, w a spects,will b e sentastra v w aymate.de. a tesabout W ngtheappli c bythecom p s nopossibili w hichisres t belaunched v elsolution .  W aymateca n cation.Aus e panywon’t b tyyettosig n ricted .This   e r b e n up.  ascri alrea still m   byo n Oncethe ticalorimp o dyawareth a m issingorn e Hence,t h n e,arenota c teamhasg o o rtantwillb e a tdesigniss e edtobeim p h efollowing c cessibleye t Image10:Lo g o tfeedback f e implemen t ues,interfa c p roved. pages,whic h t tothepubl [85] g inwindowin f romthetes t edbydevel o c einteractio n h belongto t ic.          landingpage. tingusers,t h o pers.Neve r n andadditi o t heapplicati h eimprove m r theless,the o nalfunctio n o nandwill b m entsconsi d entiretea m n alityfeatur e b eexplaine d  d ered m is e sare one   com p   1 corr e com p  resp o com p sugg e dele t mea n  37Go o Onthes e p osedbytw o Mapview , preserve d reloadal o connecti o Searchv fromaci t Therear e  1 ) Searchf Inorder t e spondingin p p letename h  Itcanbe o nseandac c p letionpow e Itisalibr e stionslist, w t ingcharact e n sthatanas  o glePlacesa u e archpagei s o differentB , wherethe o d alongthe e o ngtheapp l o nsinadvan iew,where t t ytoanothe e 3different i ororigina n t ofacilitate t p utfields,a h eissearchi n Imag e saidthatis t c uracydispla e rinGoogle arywhichh a w hichchang e e rs.Eachtim ynchronous   u to‐complete: 7.2.2 . s wherethe t ackbonevie w o riginandd e e ntireproce s icationproc cedstages. t heuserset rforspecifi c i atedsteps w n ddestinat i t hisprocess, listofsugge s n g. e 11:Searchpa Google hebesttec h yingsugges t mapswebsi t a ndlesasync e seachtim e e thesugge s requesthas  https://deve [86] .Searc h t ravelerwill w swhichu p e stination m s sundestro y ess.Thema p alltheattri b c daysanda w ithintheS e ioncitieso whentheu s stionsshow s a ge.GooglePla Placesa u h nologyfou n t ionsforciti e t eembedde d c hronousre q e theinputfi s tionslistch a beensent, r lopers.googl e h page startplanni n p dateeacho t m arkersared y ed.Thisisp p willshow m b utesrequir e determined e archview: raddress. s ertypesso m s up,preven t cesauto‐com p u to‐compl n dsofarfor t e sandaddr e d inthisapp q ueststoGo o eldcontent c a nges,duet h r eceived,pa r e .com/places / n ghisjourn e t herviaeve n isplayed.Th i ossibledue t m oreaccura t e dforsearch numberof t m ethingwit h t ingtheuse r letion. ete 37  t hispurpose e ss.It’sactu a lication. o glePlaces A c hanges,eit h h einputfiel d r sedanddis p / documentati o e y.Thispage n ttriggering isviewwill b t hereisno p t einformati o h ingconnect i t ravelers. h inthe r totypethe e ,givenitsfa a llytheauto ‐ A PIanddispl hertypingo d haschang e p layed. o n/autocom p is . b e p age o nfor i ons   st ‐ aysa r  e d, p lete [87]  Oncetheuserselectsanoptioninthesuggestions’list,anotherrequestissentto GooglePlacesAPI.Thistimetheresponseisanobjectcontainingallthedetailsabouttheplace selectedinJSONformat,suchascoordinates,name,place’stype,etc. Intheend,themostimportantattributesarethecoordinates,whichareusedtoget theclosestairportsandtrainsstationswhichwillbemadetherequestinordertoget connections. Geocoder38 Whentheuserpressesthesearchbuttonandhasn’tselectedanoptioninthelist,but hasintroducedthenameofacity,eitherfororiginordestination,whatdoesithappen?  ArequesttotheGeocoderserviceisdoneinordertoobtainthecoordinatesandmore detailsassociatedtothatplace.ThisserviceisalsosupportedbyGoogleanditalsoprovides theGeocoderreversefunctionality,whichpassingthecoordinatesintherequest,itreturnsin theresponsetheplacedetails,suchasname,address,etc. Thisserviceguaranteesalwaystoobtainthecoordinatesfromthenameoftheplace introducedintheinputfield. Comparingauto‐completionalternatives Thefirsttechnologyemployedforauto‐completionwasGeocoderauto‐complete, whichisnotthesameservicethanGeocoder.ThesetechnologiesarepoweredbyGoogle, nevertheless,thelatterpresentedsomeimportantlackswhicharesolvedusingGooglePlaces auto‐complete:  Thepriorityofshowingaddresssuggestionsprevailsovercities.Travelerswill searchmainlyforcitiesinsteadofaddress,thereforethiswasaproblemfor Waymate.  Whenafewcharacterswereintroduced,thesuggestionlisthardlydisplaysa fewresultsandwithoutanyaccuracy.Aslesscharacterstheuserhasto introduce,thebestexperiencewillenjoy,duetothefastandeasyprocess.  Whenacityissearchedusestoappearinthesuggestions’listalmostafter typingtheentirename. TheonlyadvantagewhichGeocoderauto‐completepresentedwasitsbetter performanceandaccuracy,afterhavingintroducedmorethan5characters,fordisplaying addressinthesuggestions’list.     38Geocoder:https://developers.google.com/maps/documentation/javascript/geocoding [88]  Googlemaps39 Themapplaysanimportantrolealongtheprocessintheapplication.Thereasonis becausewhentravelingthereexisttwomaindimensions,spaceandtime.  Includingthemap,andshowingtheoriginanddestinationafterbeingselected,gives totheuseravisualfeedback,representingthespacedimension.  Atthisstage,theusercanplayaroundwiththemap,selectinghisoriginordestination byclickingoverthemapormodifyingitbydraggingthemarkersaftertheyhaveshownup.For bothactions,themarkerobtainsthecoordinateswherethemarkerisplacedinthemap. Hence,havingthecoordinates,arequesttoreverseGeocoderisdone,gettingthedetailsof theplaceandupdatingitscorrespondinginputfield,eitherfororiginordestination,withthe nameoraddressoftheplace.  HowtouseGoogleservices Forusingtheservicesexplainedpreviously,itwillberequiredtoaddbetweenthe <head></head>htmltagsthefollowingline: <scripttype="text/javascript" src="//maps.google.com/maps/api/js?libraries=places,geometry&rankby=prominence"></script>  ThesourcewithoutanyparametersgivesaccesstoGeocoderandGooglemaps services.Moreservicesareavailable,butnotusedinthisapplication. TheparameterlibrarieswiththevalueplacesincludesGooglePlacesauto‐completeand GooglePlacesservices.Inaddition,withthevaluegeometryaddsalibrarytocalculatethe distancebetweentwopoints,havingintoaccountthattheEarthisasphere. Theparameterrankby=prominencemeanstogetsuggestionsbyimportancewhenusingGoogle Placesauto‐complete.  Googleservicesdownsides WaymatefunctionalitydependsonGoogleservices.Functionalitieswhicharecrucial alongtheprocessintheapplication,asgettingcoordinates,relyontheseservices.Ifoneday, Googleservicesarenotavailable,theapplicationwon’twork.  Additionally,forbusinessapplicationsit’srequiredtogetabusinessaccount.Before gettingthisaccount,thepriceofeachrequestandtheserviceswhichwillbeaccessiblemust benegotiatedandspecifiedinacontract.  Theretwoimportantdownsides,butinthemarket,servicesaspowerfulastheones whichGoogleprovidesdon’texist.Anexceptioncouldbedoneregardingmapsservices, mentioningalternativessuchasNokiamaps,OpenStreetMaps,etc.ButGoogleprovides additionalfeaturestothemapswhicheventuallycouldbeinterestingtoadd.    39GoogleMapsAPI:https://developers.google.com/maps/documentation/javascript/reference  2 T outb o he’ll h inbo u I n acal e date / whic h bea d   40Da t 2 ) Selecto u T heseconds t o unddate, a h avetosele c u nddateis n n steadofha e ndarwitha / s.Thecale n  It’sn  Inbo u  Onc e selec case, the n  Whe n outb o cale n  Asin box b Thecale n h offersalo t d dedwithin < <%=javas c  t epickerAPI: h u tbounda n t ep,afterh a a ndifthetra c ttheinbou n otselected vingtwose p customized n dar’sfuncti otallowedt o u nddatesel e e theoutbou ted,unless t theoutbou n n extclickifd n theboxco o undorinb o n dar. bounddate b elowtheca n darcompo n t ofoptions t < head></head > c ript_includ e   h ttp://jquery u n dinbound a vingbeens e velerwants n ddate.Int i twillbeao Image1 2 p aratedcale n functionalit o nalityisas o pickaday e ctionisopt ndisselect e t hedaysele c n dwillbere e sired. ntainingthe o undwillbe isoptional, c lendar. n entisactua t obecusto m > inthetem p e _tag'jque r  u i.com/demo s [89] date. e lectedorigi tocomeba c hiscasethe newaytrip. 2 :Searchpage. n darsforou t t ywhichma k follows: inthepast. t ional. e d,withthe n c tedisbefor e selectedan d dateforma t chosenafte r c ouldbere m llyafamous m ized.Toint e p latewhere r y.tools.min. s /datepicker/ nanddestin c kfromthe s travelwillh a Calendar. t boundand k eseasyand n extclickth e e thecurren d theinbou n t tedbelowt r thenextcli m ovedbycli c jQueryplug e grateitint h it’sused: js'%>  ation,istos s amedestin a a veareturn inbound,W a fastthewa y e inboundd a t outbound c dwillhave t hecalendar ckoversom c kingtheclo s in,namedD h eapplicati o s electthe a tionandori tripaswell. a ymatepres y topickspe a tewillbe chosen.Int h t obeselect e willindicat e edayinthe s eiconwith i D atePicker40, o nthislines gin, If  ents cify h is e din e if i nits h ould   allth can b 1 2 Afterthe edetailsres b edifferenti a 1 ) Map .  H Inthisst a TheCon n whichisl andallt h map,sol v  T clicksov e 1) N 2) A 3) D 4) S 5) C n Allthese Fororigi n Fortheo 2 ) Navigat i  userclicks o pectingthe c a ted: H ere’sthep o a ge,mapsol n ectionsvi e istenedbyt h estopovers v ingthespa c hetimerep r e ramarker, N ameofthe A rrivaltime a D epartureti m S topovernu m C arrierinfor m n umberfort r information n marker’sin newhichco r i onbar whi c 7.2.4 . o veraconne c onnections Ima g o intalongth e v estimean d e wtriggersa n h eMapview , associated t c erepresent r esentationi displaying: trainstatio n a nddate. m eanddate . m ber. m ation,airli n r ains. willbeatta c fo‐window w r respondst o c hisalready [96] . Detail s ction,then e selected.In g e24:Details p e processw h d space,alli n neventwit h , wherethe d t otheselect ation. i ssolveddis p n orairport. . n eandflight c hedtoeac h w illbedispl a o thedestin a explained. s page e xtstepint h thedetails t p age. h erethema p n one. h theconnec t d etailsared edconnecti o p layinganin numberfor h markerwh i a yed1),3)a n a tiononly1) , h eprocessw t hereareaf e p acquiresm t ionselecte d isplayed.Or i o nwillbedi s fo‐window w flightsandt y i chrepresen n d5). 2)and4). w illbetodis p e wsections m oreimport a d informatio igin,destina t s playedove r w hentheus e ypeoftrain tsastopov e p lay w hich  nce. n t ion r the e r and e r.  3 4 3 )  Gener a  B stopover s  4 ) Details .  I t sub‐view   Con n rega r over v  Price one w Image2 7 Therele v  a lrepresen t B ardisplaye d s . Image25 : t ’smade‐up s: n ectiondeta i r dingtime,c a v iewofthe e Ima g switching.I w hichprefer 7 :Detailspage . v antinforma Ima g t ationofa c asinthere s : Detailspage. G byDetailsvi e i lsexpande d a rrierandst e ntireconne c g e26:Details p f thereexist s s. Priceswitchin t ionforthe g e28:Details p [97] c onnection s ultsframe, Generalrepre s ewandaC o d .Whenthe ationsorair c tionwithit s p age.Connecti o smorethan  n g priceisexpl a p age.Conditio n . butexpand e s entationofa c nnectionm o buttoni s portsaredi s s sub‐conne c o ndetailsexp a onekindof a inedinthis n sforatypeof e d,date,du r c onnection o del.Itinclu d s clicked,all t s playedgivin c tions. a nded price,theu s section: price r ationand d esthefoll o t hedetails n ganother  s ercansele c   wing c tthe  T whic h 4 5    Whenth i thesam e pricecha Itinvolv e 1 2 3 4 T heconnecti o h willbere‐ u  4 ) Travele r  T wrong.It detailsp a I m  5 ) Goton e   Sele c theo I n c u c   Got o i spageislo a e thefirstti m ngessincet h e sthesestep 1 ) Areques t oftheco n 2 ) Oncethi BahnAPI 3 ) Thecorr e thenew p 4 ) Fromthe displaye d o ndetailse x u sedinadva r s’informa t heusersho u iscompose d a ge. m age29:Detai e xtstep .Th e c tinboundc o utboundtra n thiscase, t c ompatiblec u serselects o c ombination , o thebookin a dedaprice v m ethatthet y h euserhas e s: t fromthecl n nectionan d s informatio . e spondingA P p riceincase server‐side d . x pansionan d n cedsteps. t ion . u ldbeawar e d bytheTra v l spage.Travel e e rearetwo o o nnectionif velbypress i heuserwill o nnections r o newillber e , hewillpre s gformforb  [98] validationi s y peofprice e nteredthe ienttothes d thepricet o nisonthec P Isendsbac ithaschan g thisinform a d priceswitc e oftraveler s v elers’colle c e rsprofileset. o ptions: returntrip e i ngthisbutt o  bearesults r egardingth e e directedto s sthebutto n b uyingtheti c s triggeredf o isswitched. firsttimeto erver‐side w o validate. lient‐side,it ‘ k totheser v g ed. a tionissent t hingcompo s s settingate c tionwitha s  e xistsandth o n. pageforth e e onechose n thedetails p n forgoingt o c ketsbyclic k o rtheprice p It’sperform theresults p w iththerele v ‘ ssenttoYp s v er‐sidethe v t otheclient ‐ s esConnect i achstagein s pecifictem p e connectio n e inboundtri n foroutbou p age.Ifheis o thebookin g k ingthisoth e p reselected a edincaset h p age. v antinform a silonorDeu v alidationw i ‐ sideand ionInfovie w casethey’r e p lateforth e n selected w pwith u nd.Onceth interestedi g form. e rbutton. a nd h e a tion stche i th w , e   w asfor e  nthe  ticke t        Atthisst a t sboughta n 1) M  2) N  3) D i n t h c p   t h  Image a getheuser n dbesidest h M ap . N avigation t D etailsfor c The d n theDetails , It’si m h ewholepr o heckagaint h rice,ifitexi s Trav e h emunless a 30:Bookingfo 7.2.5. willfillthe f h epayment m t ab. c onnection s d etailsforea , namedCo n m portantto k o cess.Reach h edetailso f s ts,heisgoi n e lerssetting a a newsearc h rm.Traveler p [99] Bookin g f ormwithit s m ethod.Dif s selected. chconnecti o n nectionIn f k eepinform e h edthispoin t f theconnec t n gtopayfo r a redisplaye d h isdoneor t p rofilesetand d g form s personald a f erentsecti o o ncorrespo n f oview. e dthetrave t ,thetravel e t ionschose n r . d aswell,b u t heyaremo d d etailsviewfo r a taforassoc i o nscouldbe n dstothes u l erabouthi s e rprobably w orevench a tthereisno d ifiedfromt r selectedcon n iatinghimt h distinguish e u b‐viewemp s choicesalo w ouldliket o a ngethetyp e o choicetor e t heresultsp a n ections h e e d. loyed ng o  e of e set a ge.    4) S  R  s a a 5) C  i n r  t b W  e f o i n S eatreserva t Itco m R eservatio n This s elected.Th e a ndthesele c a reincluded Ima g C ustomerp e Inth i n troducehi s It’sc o epresentth e Cust o ickets.Ticke t b elongs.Inc a W aymateca n Thisi e nterstheb o o llowingti m n formation a t ion. m posedbyB o n associated s ectionwill o e travelerwil c thisseat.A inthisarea, g e31:Booking Image32:B o e rsonalda t i ssectionbe personald a o mposedby e dataassoc i o merperson a t swillbeas s a sethatso m n obtainhis p n formation w o okingform t es,theuser a ndnotfillt h [100] o okingRese totheview. o nlyappear w lhavetoac t lltheterms aswellast h g form.Seatre s ookingform. S t aandadd r e ginsthebo o a ta. BookingCu s i ated. aldatawilli d s ociatedtot m eerrorocc u p ersonalda t w illremaini t obuyanot h mustbelog h issectiona g rvationvie w hentraini s t ivatereserv andconditi o h eadditional s ervationcond i S eatselection r ess. o kingform w s tomerview d entifythe u heperson w u rswhenth e t a,contacth ntheinput f h erticket.O b gedinifhe w g ain. wanditsm o s includedin a tionbyen a o nsregardin g pricewhich tions w heretheus e andthemo d u serwhowil w hoseperso n paymentis i mandsolv e f ieldsnextti m b viously,th e w antstosto r o del theconnec t a blingtheb u g seatreser v h willbecha r e rhasto d elCustome lpurchaset h n alinformati performed, e theproble m m etheuser e firstandth re/keepthis t ions u tton v ation r ged.   rto h e on m . e   6) C T T O b u 7) T T t r Image3 3 C reditcard i T hissectioni T hepurchas e  V  M  A  D  J C I m O nlineidenti f b ecauseDeu s u serwhowil l  C  D  I d  M I T ravelers’p hisinformat r avelisfrom 3 :Bookingfor m i nformatio n s integrated e willbefulfi V isa M asterCard A mericanEx p D inersClub C B m age34:Booki n f icationsect s tcheBahn r l purchaset h C reditcard. D eustcheBa h d number. M aestrocar d mage35:Boo k ersonalinf o ionwillonly Germanyt o [101] m .Customerp e n andonli n byBooking lledbycredi p ress n gform.Credi t ionwillsho w r equiresit.T h etickets.Id h ncard. d . k ingform.Onli n o rmation. y berequire d o anotherco e rsonaldataa n n eidentific a CreditCar d tcardpaym t cardinforma t w uponlyw h hisidentific a entification n eidentificati o d alwaysfor f untry. daddress a tion. d viewandC r e nt.Thetyp e ion h entraintic k a tionmustb canbefulfill o n f lightsandf o r editCard m essupporte d k etsareinv o ewithdata o l edby: o rtrainswh e  m odel d are:  lved, o fthe  e nthe  After user w  possi possi pass e asin g whic h erro r valid a insta n E m 8) T T D r fillingallth e w illpressth i Thereis s bletoguara bletomake Therefor e e dthevalid a g leinputfiel h notpasses r .Validation a tionit’sdo n n taneousfe e achtraveler m odel. Image T ermsand c T helinesspe D eustcheBa h I m e inputfield s i sbutton s tillanimpo r nteethatth surethatal l e ,whenthe a tion,aswell ddoesn’tp a thevalidati o isdoneinlin n eforthats i e dback. isaBookin g 36:Bookingf o c onditions. cifiedforthi h n,hasprov i m age37:Book i V s andselect t  t r tantproces s e userhasfi l l theinputfi e userclickst h ascheckbo x a ssthevalid a o n,apopu p easwell,w h i ngleinputfi [102] g Traveler v o rm.Travelers’ ssectionwi l i dedtheco n ingform.Ter m  V alidatio t hecorresp o t opurchase s toexplain, lledallthei n e ldsarefille h ebuttonfo x eswhichm a tion,thefo r p windowwi l h ichmeans w i eldinthat m v iewandits c personalinfo r l lvarydepe n n nectionsel e m sandconditio n o ndingoptio thetickets. butnotvisi b n putfieldsp r dinthepro p rbuyingtic k ustbechec k r mwon’tbe lappearab o w hentheus e m oment,pro c orrespondi n mation n dingonwhi e cted. ns n sinthedr o b letotheus e r operly.Ho w p erformat. k ets,allthei n k edbeforet h sent.Forea o vetheminf o e rleavesan v idingtoth e n gTravele r chAPI,Ypsil o pdownlist s e r.It’snot w ever,it’s n putfields m h eformiss e chinputfiel f ormingabo u inputfield, e user r   onor  s ,the m ust e nt.If d  u tthe         Cust o com p from   Validatio n Inputfiel valuewi t statically  Creditca ownreg u whichis a  Individu a thedate introduc e  Expiratio  Birthday introduc e Oncevali omer,Cre d p oseaconta Further m thebookin g  Storedi n havedo n beassoc referenc  Afterwa r Bahnor b server‐si  I f aboutw h willredi r I n types: dswithincu t hapredefin .Thesame v rdnumberi n u larexpressi o a checksum f a linputfield s includesad a e d.i.e.30/0 2 ndateinput datesfora d e dmustbei n dationsucc e d itCard,coll iningobject m ore,whent h g form,isse n n thedataba s n e.Whenth e iatedanda c etotheuse r r dsrequesti b othAPIs.T h de,parseda f anerroroc c h athappen e r ecttotheti c mage38:Pop‐ stomerdata edregulare v alidationis d n putfieldi m o ntomatch f ormulatov s whichcom p a yinputfiel d 2 /2013woul fieldsarev a d eterminea g n therange o Tickets p e ssforallth e ectionofTr namedasO r h eOrderob j n ttotheser v s einordert o e ticketisb o cessibletot r . nXMLform a h eresponse ndsenttot h c urs,thepa y e d.Otherwis e c ketspage. [103] uperrorswhe n ‐addressse c e xpression.T d onefortra v m pliesmore c andfurther v alidateiden t poseadate d ,thedaym dn’tbevali d a lidateddyn a g earealsov a o fspecified a p urchas e e inputfield s avelersan d r der. b jectiscomp v er‐sideand : okeeptrac k o ught,ifthe heuser.Ot h a tisbuiltto followsthe h eclient‐sid e y mentwillb e e ,iftheboo n validationfa i c tionareval i hus,canbe s v elers’nam e c omplexity. E m ore,itmu s t ificationnu m arevalidate d ustbevalid d . a micallycon a lidateddyn a getopass t e reques t s theformc a d Connecti o letedwitht h :  k aboutallth userwaslo g h erwise,itw i senditeith e sameflowa e . e cancelled a kingandpa y ls datedbym a s aidthatar e e andsurna m E achtypeof s tpasstheL u m bers. d withareg u d epending o sideringthe amically.H e t hevalidatio t  a nbesent.R o nsobjectm h einformati o epurchases gedin,this O i llbestore w e rtotheYps i salways,re c a ndtheuser y mentsucce s a tchingthei r e validated m e. creditcard h u hnalgorith u larexpressi o nthemont h currentdat e e nce,theag e n. R eservatio n m odelswill o nthatcom thattheus e O rderobjec t w ithoutany i lon,Deustc h c eivedonth e willbenoti f s s,theappli c  r  h asits m, on.If h  e . e  n , es e rs t will h e e  f ied c ation  t h t r M T a e i c Iftheus e heconnecti o rainsandfli g M ap,Naviga t T heonlydist i a lreadyboug Image Allticket s e xception.D e c on a  e rhasreach e o nsselected g htticketsi n t ionTaband i nctionwill b httheticke t 39:Tickets.Tr a s willbesen t e ustcheBah n a ndbeingre Image 7. 2 e dthispoint havebeen b volved.Allt i Detailsvi e b ethattheu t s. a velersprefer e t totheema n ticketswill directedto a 40:Tickets.Ti c [104] 2 .6.Tic k alongthea p b ought.No m icketsareb o e wswillrem serwon’tb e e ncessetandd iladdresss p beavailabl e a nURLwhe r c ketspurchase k ets p plication,it m atterhow m o ughtinasi n ainonthet o e abletoswi t etailsviewfor p ecifiedinth e aswellfro m r easingleti c linksandinfo r meansthat m anywere o n gleprocess . o p,asinthe t chpricesb e  purchasecon n e bookingf o m thispage b c ketisinPD F r mation alltheticke t o riftherew e .  bookingfor m e causeheh a n ections o rmwithout b yclickingi n F format. t sfor e re m . a s n this   T Boo k proc e up. I n provi Book carry       T heuserwill k ing.com.H e e ss.Iftheus e n Waymate, dedbyBoo k k ing.comwill ingoutaho t beabletob e willhavet h e rdoesn’ts e thehotels p k ing.com.It h knowthati t t elbookingi 7.2.7. H ookahotel d efreedomt e lectthecor p ageit’sane h asanidass t ’sbeendon sincludedi n Imag e [105]  H otels b d uringhisst obookitin t responding t mbeddedif r s ociatedto W n ethrought h n theiframe . e 41:Hotelsb o  b ooking ayinthecit y t hemomen t t abforhote l r amedefine d W aymate,so h isapplicati o .  o oking. y whichspec whichhed e s,thispage w d intheBoo k ifauserwill o n.Allthefu c ifiesin e cidesalong willnevers h k ingviewa n l bookahot e nctionalityf o the h ow n d e l, o r 