An application presents the user with a graphical interface. The interface includes buttons
that the user clicks to perform tasks. Each time the user clicks a button, a method is called
that corresponds to that button.
Which term is used to describe this programming model?
A.
Functional
B.
Service oriented
C.
Structured
D.
Event driven
Explanation:
Events are a way for a class to notify other classes or objects when something of interest happens. the class that sends
the notificaiton is called a publisher of the the event. The class that receives the notification is called the subscriber of the event.
Events are easy to understand in the context of a graphical user interface (GUI). For example, when a user clicks on a button,
a Click event occurs. Multiple user ineterface elements can subscribe to this event and change their visual state accordingly (for
example, some controls are enabled or disabled). In this type of event communication, the event publishers do not need to know
which objects subscribe to the events that are being raised.
Events are not just limited to GUI programming. In fact, events play an important role in .NET Framework class libraries as a
way for objects to signal any change in their state. You’ll work with events in practically all programs.
When you define events, you generally need two piecies of information:
1. A delegate that connects the event with its handler method(s)
2. A class that contains the event data. This class is usually derived from teh EventArgs class
To define an event, you can use a custom delegate. However, in most cases, if your event holds no event-specific data, using the predefined delegate
Event Handler is sufficient. The Event Handler delegate is defined as follows:
public delegate void EventHandler(Object sender, EventArgs e);
Source: Software Development Fundamentals 98-361, p. 40-41, Wiley 2012
Just say D, ¬¬