visit
This post discusses the Event Driven Programming Paradigm.
Photo by on
Event-driven programming is a programming paradigm in which the flow of the program is determined by events.
Below, is the code for ReaderBot: A EDP based chatbot that interacts with you and opens articles that you’d like to read based on your responses.
Feel free to check the GH repository. Below, is the explanation of the key functions.
def register_callback(self, message, callback):"""Registers a callback to a message."""if message not in self.accepted_messages:self.accepted_messages[message] = []self.accepted_messages[message].append(callback)
Here, We’re creating a local dictionary of accepted messages for standard responses.
def respond_to_sdc(self):webbrowser.open_new("//gzht888.com/a-self-driving-new-year-33284e592f35")
This would open in a new tab, a post on Self Driving Cars. Next up, is extending EDP to the Flying Car World and programming Flight Plan for an Autonomous Drone. Checkout the Video for My First Project of the Flying Car Nanodegree, completely based on EDP here:
If you found this article interesting and would like to stay in touch, you can find me on Twitter .