Search the courses, subjects, tracks, games and features, or jump straight to a page.
Learn it your way
A short class with Sarah and her students. The other ways are under More.
Sign up free to listen. Transcripts are free to read.
Today we're discussing the Polling Model, which is an event-handling technique. Can anyone tell me what they think polling means in this context?
I think it means checking for events continuously?
Exactly, Student_1! Polling involves continuously checking for an event to occur. It's a bit like waiting for a bus by looking out the window every few seconds.
So, does that mean polling uses a lot of resources?
Yes, Student_2! Polling can be quite inefficient because it keeps the system busy checking for events without actually doing any useful work in between. It's one reason why more sophisticated models have developed.
But are there situations where polling might be useful?
Great question, Student_3! Polling can still be useful in very simple applications or in cases where events occur very predictively. However, in modern programming, we generally prefer better methods.
To recap, the Polling Model checks continuously for events but is usually inefficient and not recommended for most applications.
Now, let's discuss the limitations of the Polling Model. What do you think some of these might be?
It sounds like it could slow things down.
Exactly, Student_4! It can lead to performance issues because the system is busy polling instead of handling meaningful tasks. Can anyone think of how this might affect a user experience in an application?
Users might notice lag or delays, right?
Great observation, Student_1! If an application is busy polling for events, users may experience delays or unresponsiveness. This is why most applications now leverage the more efficient Callback Model.
So, should we consider polling obsolete?
In many scenarios, yes, however, it’s valuable to understand its foundation. It reminds us of how far we've come in programming efficiency. Just remember, polling is often outdated in modern development!
Polling, polling, what a drain! Always checking, feeling vain!
Imagine a dog waiting at a door, constantly barking to see if its owner has come home. This dog uses polling, always checking, rather than waiting patiently.
Remember 'P.A.C.E.' for Polling: Persistent, Active Checking Event.
P.E.C. - Polling Equals Continuous checks.
Term
What is the Polling Model?
Click to flip
Term
What is a disadvantage of the Polling Model?
Click to flip
Term
What is a more modern alternative to polling?
Click to flip
A technique of continuously checking for events to occur, commonly seen as inefficient in modern programming.
An action or occurrence that is recognized and handled by a program.
A function or method invoked in response to an event.
A method in which functions are triggered asynchronously in response to events, improving efficiency and responsiveness.
The Polling Model involves checking for events continuously, but is considered inefficient and outdated in modern applications.
The Polling Model is a method of event handling in programming where the system continuously checks for events to occur. Although this model was prevalent in the past, its inefficiency has led to more advanced models, such as Callback/Interrupt Models, being favored in modern applications.
In the context of Event-Driven Programming (EDP), the Polling Model refers to a technique where the application continuously checks whether an event has occurred, such as mouse clicks or sensor inputs. While simple to implement, this approach is deemed inefficient because it can consume unnecessary CPU cycles, leading to performance issues.
The Polling Model is often contrasted with more advanced techniques like the Interrupt/Callback Model, which allows the system to respond to events as they arise rather than checking for them at regular intervals. This makes modern applications using asynchronous callbacks far more efficient and responsive.
Overall, while the Polling Model introduced the concept of event handling, it is largely outdated and is not utilized in most contemporary software development.