STOCK SYSTEM Major System Error Item 0763612 Deep

  • Slides: 17
Download presentation
STOCK SYSTEM Major System Error Item: 0763612 Deep Within event-driven interfaces • • •

STOCK SYSTEM Major System Error Item: 0763612 Deep Within event-driven interfaces • • • application aborted invalid data key access deleted in stock: #37683 53 in ac_ssdb on order: confirm edit 500 delete cancel programming styles under the bonnet … the bits leak out modal and non-modal interfaces maintaining state between events other events: networks, timers, devices

programming styles • on demand • event loop • event-driven

programming styles • on demand • event loop • event-driven

on demand print “what is your name” name = read() print “hello ”+name+“ how

on demand print “what is your name” name = read() print “hello ”+name+“ how old are you” age = read. Int(); print “you will be ”+(age+1)+“ next year” • fascist programs! • program in control (internal control) • users do what they’re told

event loop while (not the end) { event = get. Next. Event(); if (event.

event loop while (not the end) { event = get. Next. Event(); if (event. type == mouse. Click) { … } else if ( … … } • program requests events • user controls what events it gets

event-driven on mouse. Click(pos) … … end on key. Press(key) … … end handle.

event-driven on mouse. Click(pos) … … end on key. Press(key) … … end handle. Event(event) { if (event. type … … } • external control: • when an event (often from the user) happens • program function/method is called from the outside • many (e. g. VB) or single entry point

under the bonnet what windows does! • when an event happens - added to

under the bonnet what windows does! • when an event happens - added to a queue • when your program is ‘active’ • Windows takes event from queue • then calls appropriate bit of your program • when it returns, if there is enough time - repeat – N. B. slightly different for different event types e. g. TCP/IP

the bits leak out how it affects the interface STOCK SYSTEM ref no: edit

the bits leak out how it affects the interface STOCK SYSTEM ref no: edit 0763612 delete

the bits leak out how it affects the interface STOCK SYSTEM Item: 0763612 ref

the bits leak out how it affects the interface STOCK SYSTEM Item: 0763612 ref no: in stock: 0763612 53 on order: 350 confirm cancel edit delete

the bits leak out how it affects the interface STOCK SYSTEM Item: 0763612 ref

the bits leak out how it affects the interface STOCK SYSTEM Item: 0763612 ref no: in stock: deleted 53 on order: 350 confirm cancel edit delete

the bits leak out how it affects the interface STOCK SYSTEM Item: 0763612 ref

the bits leak out how it affects the interface STOCK SYSTEM Item: 0763612 ref no: in stock: deleted 53 on order: 500 confirm cancel edit delete

the bits leak out how it affects the interface STOCK SYSTEM Major System Error

the bits leak out how it affects the interface STOCK SYSTEM Major System Error Item: 0763612 ref no: deleted application aborted in stock: invalid 53 data key access #37683 in ac_ssdb on order: 500 confirm cancel edit delete

the bits leak out how it affects the interface • what goes wrong? –

the bits leak out how it affects the interface • what goes wrong? – user does anything – unexpected events STOCK SYSTEM Major System Error application Item: 0763612 deleted ref aborted invalid data key access in stock: #37683 53 in ac_ssdb delete on order: 500 no: edit confirm • no sequence control • so if not careful. . . inconsistency!! cancel

modal and non-modal interfaces • modal dialogue box – can’t do anything else until

modal and non-modal interfaces • modal dialogue box – can’t do anything else until it is complete • non-modal dialogue box – can do other things while it is there a design decision … but. . .

modal and non-modal interfaces • modal dialogue box • easy with internal control •

modal and non-modal interfaces • modal dialogue box • easy with internal control • hard with external control - event-driven • non-modal dialogue box • hard with internal control • easy with external control - event-driven beware! implementation should not drive design

maintaining state between events print “what is your name” name = read() print “hello

maintaining state between events print “what is your name” name = read() print “hello ”+name+“ how old are you” age = read. Int(); print “you will be ”+(age+1)+“ next year” • internal control easy! • external control – data in different modules – data in interface – … and no ‘program counter’

other events not just user events: • timers • when 2 minutes since last

other events not just user events: • timers • when 2 minutes since last action, save data • network • when web page arrives show it on screen • devices • when IR sensor shows activity contact police

who it was Alan Dix alan@hcibook. com http: //www. hcibook. com/ http: //www. hiraeth.

who it was Alan Dix alan@hcibook. com http: //www. hcibook. com/ http: //www. hiraeth. com/alan/teaching/bigui/ http: //www. aqtive. com/ and crackers at: http: //www. websharer. com/crackers/