Method Calling vs Observer pattern

Method Calling:
scenario: script A is calling script B to ask him if they arrive at the destination every frame.
script A: are we there yet, I can’t complete my update till you answer me.
script B: no
script A: ok just checking, let me pay the phone bill then.

script A: are we there yet, I can’t complete my update till you answer me.
script B: yes, after xxxx calls we are here!.
script A: cool let me complete my update, oh I need to pay the phone bill …

Observer pattern.
scenario: script B on the megaphone making an announcement in the town.
script B: all right! I’ll use this pigeon to send the latest news until then make sure to subscribe to this new service to receive the latest news from me.



script B: ok releases the pigeons!

script B: what you mean there is one script that has passed away! Nullreference! Nullreference!

Privacy & Terms