JargonFile/original/html/H/hook.html
2014-03-27 18:54:56 +00:00

19 lines
2.8 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>hook</title><link rel="stylesheet" href="../../jargon.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.61.0"/><link rel="home" href="../index.html" title="The Jargon File"/><link rel="up" href="../H.html" title="H"/><link rel="previous" href="honey-pot.html" title="honey pot"/><link rel="next" href="hop.html" title="hop"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">hook</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="honey-pot.html">Prev</a> </td><th width="60%" align="center">H</th><td width="20%" align="right"> <a accesskey="n" href="hop.html">Next</a></td></tr></table><hr/></div><dt><a id="hook"/><dt xmlns="" id="hook"><b>hook</b>: <span xmlns="http://www.w3.org/1999/xhtml" class="grammar">n.</span></dt></dt><dd><p> A software or hardware feature included in order to simplify later
additions or changes by a user. For example, a simple program that prints
numbers might always print them in base 10, but a more flexible version
would let a variable determine what base to use; setting the variable to 5
would make the program print numbers in base 5. The variable is a simple
hook. An even more flexible program might examine the variable and treat a
value of 16 or less as the base to use, but treat any other number as the
address of a user-supplied routine for printing a number. This is a
<a href="hairy.html"><i class="glossterm">hairy</i></a> but powerful hook; one can then write a
routine to print numbers as Roman numerals, say, or as Hebrew characters,
and plug it into the program through the hook. Often the difference
between a good program and a superb one is that the latter has useful hooks
in judiciously chosen places. Both may do the original job about equally
well, but the one with the hooks is much more flexible for future expansion
of capabilities (<a href="../E/EMACS.html"><i class="glossterm">EMACS</i></a>, for example, is
<span class="emphasis"><em>all</em></span> hooks). The term <span class="firstterm">user
exit</span> is synonymous but much more formal and less hackish.</p></dd><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="honey-pot.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="../H.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="hop.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">honey pot </td><td width="20%" align="center"><a accesskey="h" href="../index.html">Home</a></td><td width="40%" align="right" valign="top"> hop</td></tr></table></div></body></html>