Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 7 Interaction. Topics Implementing data flows An internet solution Transactions in MySQL 4-tier systems – business rule/presentation separation.

Similar presentations


Presentation on theme: "Lecture 7 Interaction. Topics Implementing data flows An internet solution Transactions in MySQL 4-tier systems – business rule/presentation separation."— Presentation transcript:

1 Lecture 7 Interaction

2 Topics Implementing data flows An internet solution Transactions in MySQL 4-tier systems – business rule/presentation separation Forms and URL in PHP User modelling Long running processes

3 extract Schedule data Validate and load Consolidated schedules Service Provider Consolidator

4 Typical implementation The provider prepares the schedule file – e.g. extract process in scheduling software The file is transmitted to the consolidator –mailing a floppy disk – emailing the file – ftp’ing the file … The consolidator’s system has a scheduled task to pick up new schedule files, process them against the database and log any errors. The report of the success or the list of errors must be returned to the provider

5 Internet solution Consolidator provides form Provider selects schedule file Schedule file sent to server Server executes script to: –validate data –Update database –Return log of actions and errors

6 Summary of actions Script generates the form and returns it User selects file PUT action sends file to server Script reads (parses) file (from temporary folder) Script validates file Script creates SQL statements to update the database Script executes SQL in a TRANSACTION Script returns the log of actions and errors

7 4-tier systems Consider the task of displaying the number of minutes to the next bus on a given route. This information can be requested –Via a web form –Via a Wap phone –Via SMS –From a partner system Need to separate: –Logic to process the request and get the minutes to go – Business logic –Logic to respond to input and present data appropriate to interface - Presentation

8 4-tier system Browser HTML Get view of data and format as Web Page (source(source) Get view and return SMS message routettg?rn=70 minutes Compute next bus timeCompute next bus time (source)(source) Nextbus?routeno= 70 Sms request SMS messag e SMS caller

9 Sequence diagram userbrowserServer1Server2db

10 PHP and forms Fields on form are named –e.g. route When form submitted with GET, name/value pairs are attached to URL –e.g. prog.php?route=70 In script, values are accessed with variables of the same name –e.g. If ($route == ’70’)…

11 PHP and URLs PHP can open URL just like a file –e.g. $fn= fopen(“http://www.google.com/search?q=SMS”); Parameters can be included in URL Web services provide more powerful interface

12 User models ImplementationUser modelProblem Provide a form to allow the user to select the routes of interest. the list of fields in the URLModel lost as soon as script is run The form is ‘sticky’ - the buttons are pre-selected when the information is returned User model is the same as before but persists in the URL If the site involves multiple pages and hence multiple URLS, the same preferences cannot be just held in a URL Script sends data as a COOKIE to be stored on the user’s machine User model stored in COOKIE associated with a site, and sent to the server with an URL to the same site Users can reject cookies or the user uses multiple machines (such as Internet Café’s Provide table on server database for user model – with login and password Normalised user model requires multiple table to resolve the many-many relationship Many normalized tables, no requirement for access from route to user. User has to remember yet another login/pw Scripts need update rights in database, potential security issue if password in script Hold list of routes in a SET or other NFNF field User model in a single table

13 Long Running Processes Users are concerned with units of work which are bigger than a single interaction –Issuing a new schedule (with all the attendant changes that have to take place) –On-line shopping order and delivery –Exam preparation and monitoring Much interest in support for ‘Business Processes’ Languages and notations to define business processes –ebXML, RAD, Activity Diagrams

14 Tutorial To discuss the issues in the Exercises Design, no implementation (unless you want to) Questions appropriate to the exam


Download ppt "Lecture 7 Interaction. Topics Implementing data flows An internet solution Transactions in MySQL 4-tier systems – business rule/presentation separation."

Similar presentations


Ads by Google