什么是联络人?

我试图学习一些编程相关的术语,我经常过来的单词“处理程序”。有人能解释一下这是什么意思,什么时候用吗?

69491 次浏览

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 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.