These days, I hear almost everywhere about 'event driven' programming.
Wikipedia says:
In computer programming, event-driven programming is a programming paradigm in which the flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs/threads. Event-driven programming is the dominant paradigm used in graphical user interfaces and other applications (e.g. Javascript web applications) that are centered around performing certain actions in response to user input.
Isn't this exactly our old friend OOP? And if this is not OOP what is the difference?
Object Oriented Programming (OOP) and Event-Driven Programming (EDP) are orthogonal, which means that they can be used together.
In OOP with EDP all OOP principles (encapsulation, inheritance and polymorphism) stay intact.
In OOP with EDP objects acquire some mechanism of publishing event notifications and subscribing to event notifications from other objects.
The difference between OOP with / without EDP is control flow between objects.
In OOP without EDP control moves from one object to another object on a method call. Object mainly invokes methods of other objects.
In OOP with EDP control moves from one object to another object on event notification. Object subscribes on notifications from other objects, then waits for notifications from the objects it is subscribed on, does some work based on notification and publishes it's own notifications.
Conclusion: OOP+EDP is "exactly our old friend OOP" with control flow inverted thanks to Event-Driven Design.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With