For faster navigation, this Iframe is preloading the Wikiwand page for برنامه‌نویسی رویدادمحور.

برنامه‌نویسی رویدادمحور

برنامه‌نویسی رویداد گرا یک الگوی برنامه‌نویسی است که در آن، روند اجرای برنامه توسط رویدادها - برای مثال، خروجی یک سنسور یا دستورهای کاربر (کلیک‌های موس، دکمه‌های کیبورد) یا پیام‌های دریافتی از سایر برنامه‌ها یا رشته‌ها - تعیین می‌گردد.

برنامه‌نویسی رویداد گرا را می‌توان به عنوان یک تکنیک معماری نرم‌افزار تعریف کرد که در آن نرم‌افزار یک حلقه اصلی دارد که به روشنی به دو بخش زیر تقسیم می‌شود:

  • نخست، انتخاب رویداد (یا شناسایی رویداد)
  • و دوم، اداره کردن رویدادها

برنامه‌های رویداد گرا را می‌توان در هر زبانی نوشت، اگرچه این کار در زبان‌هایی که سطح بالایی از انتزاع را فراهم می‌کنند، آسان‌تر است.

یک نگهدارنده بدیهی رویداد

چون کد چک رویدادها و حلقه اصلی در میان برنامه‌ها مشترک هستند، بسیاری از فریم ورک‌های برنامه‌نویسی مسوولیت پیاده‌سازی را بر عهده دارند و از کاربر انتظار دارند که تنها کد نگهدارنده رویداد را فراهم کنند. در این مثال ساده ممکن است یک نگهدارنده رویداد فراخوانده شود که OnKeyEnter() نامیده می‌شود و شامل ارگومانی با یک رشته از کاراکترهاست که متناظر است با آنچه که کاربر قبل از فشردن دکمه ENTER تایپ کرده ست. برای اضافه کردن دو عدد، ذخیره‌سازی خارج از نگهدارنده رویداد باید مورد استفاده قرار گیرد. پیاده‌سازی ممکن است مشابه آنچه در زیر می آید باشد.

منابع

[ویرایش]

http://simple.wikipedia.org/wiki/Event-driven_programming

{{bottomLinkPreText}} {{bottomLinkText}}
برنامه‌نویسی رویدادمحور
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?