The event-driven programming paradigm lets you create full-featured applications with clearly defined logic. An event-driven application can respond to any runtime occurrence generated by the end-user or by the developer internally as part of the business logic. This makes the task clearer, more understandable, and easier for other developers to maintain.
Greater Flexibility — Event-driven architecture lets you better handle runtime occurrences generated by the end-user or by third-party components, such as the database in use or ActiveX controls. Reusability — The event-driven architecture lets you define your business logic as global logic that you define once and reuse throughout your application.
Having such sharable logic segments saves you time in writing and maintaining repeated logic segments. There are definitely valid use cases for this as well but the majority of popular applications on the market right now function through user input all the social media platforms, games, productivity tools, etc. Needless to say, GUI graphical user interface applications can experience the biggest benefits of using this approach.
Because event-driven programming is an approach rather than a type of programming language, it can be practiced with any programming language. Since it offers the most value for GUI applications, some other use cases might not benefit from it. Some critics are also saying that event-driven programming is complex to master and not worth the trouble when your application is very simple and small.
See the original article here. Programmers used to working with procedural programming languages sometimes find that the transition to an event-driven environment requires a considerable mental adjustment. The change in emphasis from procedural to event-driven programming has been accelerated by the introduction of the Graphical User Interface GUI which has been widely adopted for use in operating systems and end-user applications. It really began, however, with the introduction of object-oriented OO programming languages and development methodologies in the late s.
By the 's, object-oriented technologies had largely supplanted the procedural programming languages and structured development methods that were popular during the 70s and 80s. One of the drivers behind the object oriented approach to programming that emerged during this era was the speed with which database technology developed and was adopted for commercial use. Information system designers increasingly saw the database itself, rather than the software that was used to access it, as the central component of a computerised information system.
The software simply provided a user interface to the database, and a set of event handling procedures to deal with database queries and updates. One of the fundamental ideas behind object-oriented programming is that of representing programmable entities as objects. An entity in this context could be literally anything with which the application is concerned. A program dealing with tracking the progress of customer orders for a manufacturing company, for example, might involve objects such as "customer", "order", and "order item".
The basic structure of an object, and its relationship to the application to which it belongs, is illustrated in the diagram below. Before going any further, it is worth drawing the distinction between objects and classes. A class , in very general terms, is an object template that defines the attributes, methods and events that will be implemented in any object created with it. An object is an instance of a class. An analogy would be to say that "Dog" is a class, of which "Fido" is a specific instance.
The link between object-oriented programming and event-driven programming is fairly obvious. For example, objects on a Visual Basic form usually referred to as controls can be categorised into classes e.
Each class will have attributes usually referred to as properties that will be common to all objects of that type e. But it is an Event drive programming, easy to develop applications. Login to your account using email and password provided during registration. Don't have an account? Sign up. Already have an account?
Sign in. Advantages of Event-Driven Programming 1. Flexibility Programmers that use event-driven can be altered easily if the programmer wants something to be changed. Suitability for Graphical Interfaces Event-driven allows the user to select different tools from the toolbar to directly create what they need such as buttons, radio buttons, etc.
Simplicity of Programming Event-driven can make programming easier for some by being able to directly edit the object you want the code for. Easy to Find Natural Dividing Lines it is easy to find natural dividing lines for unit testing infrastructure. Highly Compostable It is highly compostable.
0コメント