在某些情况下,您定义一些 API 以使这些处理程序大部分可以互换,因此调用者可以从表中选择一个并使用相同的代码来调用其中任何一个。 OOP 在这里有很大帮助。
I think it's a very general term, without a 'hard' definition. The meaning is highly contextual, varies depending on the general code design.
For me, it usually means some code that is called from an inner core and is supposed to do some things and return. That 'inner' part can have several 'handlers' available, and chooses which one to call.
In some cases, you define some API to make those handlers mostly interchangeable, so the caller can pick one from a table and use the same code to call any of them. OOP helps a lot here.
Code that's associated with and triggered by the occurrence of a specific event, like an incoming message, a thrown exception, a signal sent to a process, a network I/O request completing, or a mouse click on a user interface element. It's a very generic term.
发布评论
评论(3)
我认为这是一个非常笼统的术语,没有“硬”定义。 其含义与上下文高度相关,根据一般代码设计而有所不同。
对我来说,它通常意味着从内核调用一些代码,并且应该执行一些操作并返回。 该“内部”部分可以有多个可用的“处理程序”,并选择调用哪一个。
在某些情况下,您定义一些 API 以使这些处理程序大部分可以互换,因此调用者可以从表中选择一个并使用相同的代码来调用其中任何一个。 OOP 在这里有很大帮助。
I think it's a very general term, without a 'hard' definition. The meaning is highly contextual, varies depending on the general code design.
For me, it usually means some code that is called from an inner core and is supposed to do some things and return. That 'inner' part can have several 'handlers' available, and chooses which one to call.
In some cases, you define some API to make those handlers mostly interchangeable, so the caller can pick one from a table and use the same code to call any of them. OOP helps a lot here.
处理程序是专门处理某种类型的数据或专注于某些特殊任务的例程/函数/方法。
示例:
事件处理程序 - 接收并消化来自
周围系统(例如操作系统或 GUI)。
内存处理程序 - 在内存上执行某些特殊任务。
文件输入处理程序 - 接收文件输入并执行的函数
数据上的特殊任务,当然都取决于上下文。
A handler is a routine/function/method which is specialized in a certain type of data or focused on certain special tasks.
Examples:
Event handler - Receives and digests events and signals from the
surrounding system (e.g. OS or GUI).
Memory handler - Performs certain special tasks on memory.
File input handler - A function receiving file input and performing
special tasks on the data, all depending on context of course.
与特定事件的发生相关联并由其触发的代码,例如传入消息、引发的异常、发送到进程的信号、网络 I/O 请求完成或用户界面元素上的鼠标单击。 这是一个非常通用的术语。
Code that's associated with and triggered by the occurrence of a specific event, like an incoming message, a thrown exception, a signal sent to a process, a network I/O request completing, or a mouse click on a user interface element. It's a very generic term.