Dynamically defined tags for annotation at the
                     description level.


                         G. C. Joly

              Department of Computer Science,
                 University College London,
                       Gower Street,
                   LONDON WC1E 6BT, U.K.
                 Email: G.Joly@cs.ucl.ac.uk


                          ABSTRACT

          This paper shows how the user can  manipulate
     the  process of searching for known (method) func-
     tions and at the same time provide their own  tag-
     ging mechanism through a single interface.



1.  Introduction.

     One  of the fundamental concepts that is debated in the
field of Object Oriented programming (and now OO design)  is
that  of reuse.  The Cognitive Browser (CogBrow) project [1]
has been developing a set of browsing tools  that  extend  a
class  browser,  such as the Smalltalk Class Browser, to aid
the programmer in their search for objects to reuse.  Exper-
imental  work  has shown that the user changes their view of
the code very rapidly, that is to say from one  day  to  the
next.  The  use  of tags, applied to spreadsheet designs, is
reported in [2], and this paper reports a direct application
to  OO systems.  Programmers and designers will often sketch
a flow chart then turn to writing pseudo-code,  and  CogBrow
will  support  this flexibility as much as possible.  If the
Cognitive Browser is left standing idle and the  user  turns
to pencil and paper then the Browser is of little value.

     A  prototype system has been built using the EMACS edi-
tor and a short PERL script; we  call  this  system  "stags"
(for  "super-tags"  or "SOLVE tags": for further information
on the SOLVE language, see for example [1]).

2.  Arbitrary placing of tags and browsing using EMACS.

     Stallman [3] developed the EMACS "editor" for  extensi-
bility. The EMACS Lisp language in which EMACS is now mostly
written can be used to modify the behaviour of the  "editor"
in  different  "modes".  New  "modes"  are created, which be
viewed in text windows, either by the  user  or  as  library
packages.  Currently EMACS can act (among other things) as a
folding editor, an interface to a mail system and  a  source
level debugger. Each mode is dynamically self documenting.

     Source  code,  in  multiple  files  which may be spread
across many directories, can be browsed using the EMACS tags
facility  "etags".   In  a sense, "etags" allows the dynamic
generation of an index over all the code.   Since  tags  are
language dependent, (the context of) the mode (corresponding
to a distinct "language"), is used to create  and  scan  the
tags  tables. For example, in C any function, in FORTRAN any
function or subroutine and in  (EMACS)  Lisp,  any  function
defined  with  defun and any variable defined with defvar or
defconst (see Schoonover et al [4]).

     Further extensions to "etags" (EMACS  tags)  have  been
added  to  the TeX and LaTeX document preparation languages,
where commands `chapter', `section', `subsection',  `subsub-
section',  `eqno',  `label',  `ref',  `cite',  `bibitem' and
`typeout' are all tags. In this case,  instances  of  (equa-
tion)  labels  and chapter (headings) will both be found (if
the text strings correspond); in fact the user may have this
notion in mind.

     The  extension  of  "etags" (for the C language) to C++
was carried out by Yacko [5].  Here, the system could search
for  classes  and  includes the notion of a class hierarchy,
which is displayed in a textual form, using  indentation  to
denote  subclassing.  Note  that  a similar program in EMACS
Lisp  is  currently  maintained  by   Sam   Kendall   (email
kendall@centerline.com), which allows the user to search for
classes using command line completion.

3.  An extension of EMACS style tags for browsing

     Payne and Green [6] describe a TAG  (task-action  gram-
mar) as "a formal device... a description of a task as a set
of semantic components".  In contrast, the system of "stags"
proposed  in  this  paper  takes the view that user is fully
aware of the semantics and it is the system  which  provides
the  mechanical browsing (on text files).  Therefore "stags"
are completely free, without any notion of formal grammar or
structure.

     A   small   script  by  David  Megginson  (email  dmeg-
gins@acadvm1.uottawa.ca) called PETAGS and  written  in  the
Perl  language, as described in [7] allowed the extension of
tags to an arbitrary computer language, which Pascal,  COBOL
or BASIC. From this starting point, it is possible to extend
the idea further.  We consider three  modifications:  super-
sets  of languages, sub-sets of languages, and the "descrip-
tion level", that is  "arbitrary  attributes  and  relation-
ships... in a browsable form", see [1]

     In  the  first case, a user could take the standard set
of tag words by the tags program (described above)  and  add
further  tag words. One example of this sort of procedure is
where some PostScript (tm) interpreters  will  process  code
inside a comment.

     The  second category allows faster browsing of a subset
of the language. Consider the standard etags definitions  of
EMACS  Lisp.  It would be possible to interactively restrict
tagging to ``defun'' and not to ``defvar'' and ``defconst''.

     The  final  case could be any hybrid, "stags", in which
the user chooses dynamically over the (fixed) source  files.
It would be possible to tag comments dynamically to existing
code so that the user could browse comments  only,  if  they
wished.  Note  that the users themselves may or may not have
added the comments to the code.  If they for  example  added
their  own initials when making changes, then these could be
tagged.

     In this case, since the "stags"  are  processed  simply
(by  a  search  operation), the user would have to produce a
meaningful set of tag words. If the user chose to  find  all
entries  with  their  own  initials in a comment field, they
should be able to search for any words after the tag word up
to the "end of comment". For example, if comments begin with
``//'', then the following lines
   // xxyz changed size of windows
   // and filled in background
would allow a search for all occurrences of  ``changed''  or
``window'',  for  user  (that  is to say tag word) ``xxyz''.
Note that the support for tags searches in EMACS allows this
operation  to  be carried out over more than one (UNIX (tm))
directory.

4.  Conclusions

     The proposal is to perform some experiments  with  this
system  of "stags" with a small set of users, to see if this
arbitrary scanning of code is fruitful for code  reuse.  The
base language of choice for would be a fully Object Oriented
language, such as SOLVE, but C++ or another  language  could
be  considered,  or  even  software  written in several lan-
guages. The current browsing method  is  through  the  EMACS
editor,  but an extension to form part of the graphical user
interface of the Cognitive Browser is planned. The  proposed
system  is far from complete in any sense, but may provide a
new dimension for browsing source code.

References


1.   Green, T. R. G., Gilmore, D. J., Blumenthal, B, Davies,
     S.,  and  Winder,  R., "Towards a cognitive browser for
     OOPS," International Journal on Human-Computer Interac-
     tion, vol. 4, no. 1, pp. 1-34, 1991.

2.   Hendry,  D.,  Green, T. R. G., Gilmore, D., and Davies,
     S.,  "Improving  the  communicability   of   speadsheet
     designs: Annotating with descriptive tags," in Psychol-
     ogy in  Programming  Interest  Group  -  5th  Workshop,
     Paris, (unpublished), 1992.

3.   Stallman,  R. M., "EMACS: The Extensible, Customizable,
     Self-Documenting Display Editor," in  Interactive  Pro-
     gramming  Environments, ed. David R. Barstow, Howard E.
     Shrobe and Erik Sandwell., McGraw-Hill, New York, 1986.

4.   Schoonover,  Micheal  A.,  Bowie,  John S., and Arnold,
     William R., GNU Emacs: Unix Text Editing  and  Program-
     ming, Addison Wesley, Reading, Mass, 1992.

5.   Yacko,  Nancy  Jane,  "A GNU Emacs Browser for C++ Code
     Development," M.Sc. Thesis, University of  Illinois  at
     Urbana-Champaign, Urbana, Illinois, 1987.

6.   Payne,  Stephen  J.  and  Green, T. R. G., "Task-Action
     Grammar: the model and its developments," in Task anal-
     ysis for human-computer interaction, ed. D. Diaper, pp.
     75-107, Ellis Horwood Publishers, Chichester, 1989.

7.   Wall, Larry and Schwartz, Randall L., Programming Perl,
     O'Rielly & Associates Inc., Sebastopol, CA, 1990.


                -------------------------------

Recursion home page