TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
Subject:Re: HELP! I need a solid definition From:"Steven J. Owens" <puff -at- netcom -dot- com> To:johnny_brown -at- hotbot -dot- com Date:Fri, 24 Sep 1999 10:53:07 -0700 (PDT)
Johnny Brown writes:
> I understand that an "event" is an action that a user or internal
> activity can trigger.
> However, I don't understand what an "event handler" is and I don't
> know what mapping is.
The definition it gives of "event" is too terse, but there's also a link
to the term "event-driven":
----------------------------------------------------------------------
A kind of program, such as a graphical user interface, with a main
loop which just waits for events to occur. Each event has an
associated handler which is passed the details of the event, e.g mouse
button 3 pressed at position (355,990).
For example, X window system application programs are event-driven.
----------------------------------------------------------------------
This may give you a bit more insight into the idea; nowadays, the
"event-driven"-ness of the program is usually handled automatically by
support in the environment (e.g. windows) or in the programming
language (for example, Java), but originally, the way you built an
event-driven program was, the first thing your program did when it
started up was start a loop that kept looping until something happened
- whereupon, depending on what happened, it did something, then came
back to the loop and resumed.
In a little more detail, a simple event-driven program's main body
might look sort of like this:
------------------------------------------------------------------------------
set up anything that needs setting up set up a variable named "exit"
start loop (keep looping until something sets "exit" to true)
Check to see if the user pressed a key,
(or did something with the mouse).
If the user did something it's an event.
This is the mapping part:
If the user clicked "exit",
set the exit variable to true.
else if the user clicked "print",
go run the print method/function/subroutine/module.
else if the user clicked "load",
go run the load method/function/subroutine/module.
else if the user clicked "save",
go run the save method/function/subroutine/module.
etc
.
.
.
else the user didn't click an appropriate event
go run the "DisplayHelp" method/function/subroutine/module.
end of the event mapping
end of the "if an event", there's no else because if the user
didn't do anything, there's nothing we can do but loop again
end of the loop, go back to start
if we get this far,
the program is exiting,
so clean up anything that needs cleaning up
End of the program
----------------------------------------------------------------------
The 'mapping' is the part up there with the "if this, do this" lines.
It comes from math-specific use of the word "map" in set theory, but
you can relate to the general word "map" - it's a description of how
you get from here to there, or specifically a set of descriptions of
how you get from the various possible heres to the various possible
theres.
Here's the FOLDOC definition
----------------------------------------------------------------------
mapping -->
function
1. <mathematics> (Or "map", "mapping") If D and C are sets (the domain
and codomain) then a function f from D to C, normally written "f : D -> C"
is a subset of D x C such that:
1. For each d in D there exists some c in C such that (d,c) is an
element of f. I.e. the function is defined for every element of D.
2. For each d in D, c1 and c2 in C, if both (d,c1) and (d,c2) are
elements of f then c1 = c2. I.e. the function is uniquely defined
for every element of D.
See also image, inverse, partial function.
2. <programming> Computing usage derives from the mathematical term
but is much less strict. In programming (except in functional
programming), a function may return different values each time it is
called with the same argument values and may have side effects.
A procedure is a function which returns no value but has only
side-effects. The C language, for example, has no procedures, only
functions. ANSI C even defines a type, void, for the result of a
function that has no result.
----------------------------------------------------------------------