2005-09-18 11:10:08 -04:00
|
|
|
PEP: 350
|
|
|
|
Title: Codetags
|
|
|
|
Version: $Revision$
|
|
|
|
Last-Modified: $Date$
|
|
|
|
Author: Micah Elliott <mde at tracos.org>
|
2007-05-18 13:41:31 -04:00
|
|
|
Status: Rejected
|
2005-09-18 11:10:08 -04:00
|
|
|
Type: Informational
|
|
|
|
Content-Type: text/x-rst
|
|
|
|
Created: 27-Jun-2005
|
2005-09-26 19:38:14 -04:00
|
|
|
Post-History: 10-Aug-2005, 26-Sep-2005
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
|
2007-05-18 13:41:31 -04:00
|
|
|
Rejection Notice
|
|
|
|
================
|
|
|
|
|
|
|
|
This PEP has been rejected. While the community may be interested,
|
|
|
|
there is no desire to make the standard library conform to this standard.
|
|
|
|
|
|
|
|
|
2005-09-18 11:10:08 -04:00
|
|
|
Abstract
|
|
|
|
========
|
|
|
|
|
|
|
|
This informational PEP aims to provide guidelines for consistent use
|
2005-09-26 15:56:53 -04:00
|
|
|
of *codetags*, which would enable the construction of standard
|
|
|
|
utilities to take advantage of the codetag information, as well as
|
|
|
|
making Python code more uniform across projects. Codetags also
|
|
|
|
represent a very lightweight programming micro-paradigm and become
|
|
|
|
useful for project management, documentation, change tracking, and
|
|
|
|
project health monitoring. This is submitted as a PEP because its
|
2005-09-26 19:38:14 -04:00
|
|
|
ideas are thought to be Pythonic, although the concepts are not unique
|
|
|
|
to Python programming. Herein are the definition of codetags, the
|
|
|
|
philosophy behind them, a motivation for standardized conventions,
|
|
|
|
some examples, a specification, a toolset description, and possible
|
|
|
|
objections to the Codetag project/paradigm.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
This PEP is also living as a wiki_ for people to add comments.
|
|
|
|
|
|
|
|
|
|
|
|
What Are Codetags?
|
|
|
|
==================
|
|
|
|
|
|
|
|
Programmers widely use ad-hoc code comment markup conventions to serve
|
|
|
|
as reminders of sections of code that need closer inspection or
|
|
|
|
review. Examples of markup include ``FIXME``, ``TODO``, ``XXX``,
|
|
|
|
``BUG``, but there many more in wide use in existing software. Such
|
2005-09-26 15:56:53 -04:00
|
|
|
markup will henceforth be referred to as *codetags*. These codetags
|
2005-09-18 11:10:08 -04:00
|
|
|
may show up in application code, unit tests, scripts, general
|
|
|
|
documentation, or wherever suitable.
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
Codetags have been under discussion and in use (hundreds of codetags
|
|
|
|
in the Python 2.4 sources) in many places (e.g., c2_) for many years.
|
|
|
|
See References_ for further historic and current information.
|
|
|
|
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
Philosophy
|
|
|
|
==========
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
If you subscribe to most of these values, then codetags will likely be
|
2005-09-18 11:10:08 -04:00
|
|
|
useful for you.
|
|
|
|
|
|
|
|
1. As much information as possible should be contained **inside the
|
|
|
|
source code** (application code or unit tests). This along with
|
2005-09-26 15:56:53 -04:00
|
|
|
use of codetags impedes duplication. Most documentation can be
|
2005-09-18 11:10:08 -04:00
|
|
|
generated from that source code; e.g., by using help2man, man2html,
|
|
|
|
docutils, epydoc/pydoc, ctdoc, etc.
|
|
|
|
|
|
|
|
2. Information should be almost **never duplicated** -- it should be
|
|
|
|
recorded in a single original format and all other locations should
|
|
|
|
be automatically generated from the original, or simply be
|
2005-09-26 15:56:53 -04:00
|
|
|
referenced. This is famously known as the Single Point Of
|
|
|
|
Truth (SPOT) or Don't Repeat Yourself (DRY) rule.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
3. Documentation that gets into customers' hands should be
|
|
|
|
**auto-generated** from single sources into all other output
|
|
|
|
formats. People want documentation in many forms. It is thus
|
|
|
|
important to have a documentation system that can generate all of
|
|
|
|
these.
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
4. The **developers are the documentation team**. They write the code
|
|
|
|
and should know the code the best. There should not be a
|
|
|
|
dedicated, disjoint documentation team for any non-huge project.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
5. **Plain text** (with non-invasive markup) is the best format for
|
2005-09-18 11:10:08 -04:00
|
|
|
writing anything. All other formats are to be generated from the
|
|
|
|
plain text.
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
Codetag design was influenced by the following goals:
|
|
|
|
|
|
|
|
A. Comments should be short whenever possible.
|
|
|
|
|
|
|
|
B. Codetag fields should be optional and of minimal length. Default
|
|
|
|
values and custom fields can be set by individual code shops.
|
|
|
|
|
|
|
|
C. Codetags should be minimalistic. The quicker it is to jot
|
|
|
|
something down, the more likely it is to get jotted.
|
|
|
|
|
|
|
|
D. The most common use of codetags will only have zero to two fields
|
|
|
|
specified, and these should be the easiest to type and read.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
Motivation
|
|
|
|
==========
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
* **Various productivity tools can be built around codetags.**
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
See Tools_.
|
|
|
|
|
|
|
|
* **Encourages consistency.**
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
Historically, a subset of these codetags has been used informally in
|
2005-09-18 11:10:08 -04:00
|
|
|
the majority of source code in existence, whether in Python or in
|
|
|
|
other languages. Tags have been used in an inconsistent manner with
|
2005-09-26 15:56:53 -04:00
|
|
|
different spellings, semantics, format, and placement. For example,
|
2005-09-18 11:10:08 -04:00
|
|
|
some programmers might include datestamps and/or user identifiers,
|
2005-09-26 15:56:53 -04:00
|
|
|
limit to a single line or not, spell the codetag differently than
|
2005-09-18 11:10:08 -04:00
|
|
|
others, etc.
|
|
|
|
|
|
|
|
* **Encourages adherence to SPOT/DRY principle.**
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
E.g., generating a roadmap dynamically from codetags instead of
|
2005-09-18 11:10:08 -04:00
|
|
|
keeping TODOs in sync with separate roadmap document.
|
|
|
|
|
|
|
|
* **Easy to remember.**
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
All codetags must be concise, intuitive, and semantically
|
2005-09-18 11:10:08 -04:00
|
|
|
non-overlapping with others. The format must also be simple.
|
|
|
|
|
|
|
|
* **Use not required/imposed.**
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
If you don't use codetags already, there's no obligation to start,
|
2005-09-18 11:10:08 -04:00
|
|
|
and no risk of affecting code (but see Objections_). A small subset
|
2005-09-26 15:56:53 -04:00
|
|
|
can be adopted and the Tools_ will still be useful (a few codetags
|
2005-09-18 11:10:08 -04:00
|
|
|
have probably already been adopted on an ad-hoc basis anyway). Also
|
2005-09-26 15:56:53 -04:00
|
|
|
it is very easy to identify and remove (and possibly record) a
|
|
|
|
codetag that is no longer deemed useful.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
* **Gives a global view of code.**
|
|
|
|
|
|
|
|
Tools can be used to generate documentation and reports.
|
|
|
|
|
|
|
|
* **A logical location for capturing CRCs/Stories/Requirements.**
|
|
|
|
|
|
|
|
The XP community often does not electronically capture Stories, but
|
2005-09-26 15:56:53 -04:00
|
|
|
codetags seem like a good place to locate them.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
* **Extremely lightweight process.**
|
|
|
|
|
|
|
|
Creating tickets in a tracking system for every thought degrades
|
|
|
|
development velocity. Even if a ticketing system is employed,
|
2005-09-26 15:56:53 -04:00
|
|
|
codetags are useful for simply containing links to those tickets.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
Examples
|
|
|
|
========
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
This shows a simple codetag as commonly found in sources everywhere
|
2005-09-18 11:10:08 -04:00
|
|
|
(with the addition of a trailing ``<>``)::
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
# FIXME: Seems like this loop should be finite. <>
|
|
|
|
while True: ...
|
|
|
|
|
|
|
|
The following contrived example demonstrates a typical use of
|
|
|
|
codetags. It uses some of the available fields to specify the
|
|
|
|
assignees (a pair of programmers with initials *MDE* and *CLE*), the
|
|
|
|
Date of expected completion (*Week 14*), and the Priority of the item
|
|
|
|
(*2*)::
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
# FIXME: Seems like this loop should be finite. <MDE,CLE d:14w p:2>
|
|
|
|
while True: ...
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
This codetag shows a bug with fields describing author, discovery
|
|
|
|
(origination) date, due date, and priority::
|
|
|
|
|
|
|
|
# BUG: Crashes if run on Sundays.
|
|
|
|
# <MDE 2005-09-04 d:14w p:2>
|
|
|
|
if day == 'Sunday': ...
|
|
|
|
|
|
|
|
Here is a demonstration of how not to use codetags. This has many
|
|
|
|
problems: 1) Codetags cannot share a line with code; 2) Missing colon
|
|
|
|
after mnemonic; 3) A codetag referring to codetags is usually useless,
|
|
|
|
and worse, it is not completable; 4) No need to have a bunch of fields
|
|
|
|
for a trivial codetag; 5) Fields with unknown values (``t:XXX``)
|
|
|
|
should not be used::
|
|
|
|
|
|
|
|
i = i + 1 # TODO Add some more codetags.
|
|
|
|
# <JRNewbie 2005-04-03 d:2005-09-03 t:XXX d:14w p:0 s:inprogress>
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
Specification
|
|
|
|
=============
|
|
|
|
|
|
|
|
This describes the format: syntax, mnemonic names, fields, and
|
2005-09-26 15:56:53 -04:00
|
|
|
semantics, and also the separate DONE File.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
General Syntax
|
|
|
|
--------------
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
Each codetag should be inside a comment, and can be any number of
|
|
|
|
lines. It should not share a line with code. It should match the
|
|
|
|
indentation of surrounding code. The end of the codetag is marked by
|
|
|
|
a pair of angle brackets ``<>`` containing optional fields, which must
|
|
|
|
not be split onto multiple lines. It is preferred to have a codetag
|
|
|
|
in ``#`` comments instead of string comments. There can be multiple
|
|
|
|
fields per codetag, all of which are optional.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
.. NOTE: It may be reasonable to allow fields to fit on multiple
|
|
|
|
lines, but it complicates parsing and defeats minimalism if you
|
|
|
|
use this many fields.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
In short, a codetag consists of a mnemonic, a colon, commentary text,
|
2005-09-18 11:10:08 -04:00
|
|
|
an opening angle bracket, an optional list of fields, and a closing
|
2005-09-26 15:56:53 -04:00
|
|
|
angle bracket. E.g., ::
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
# MNEMONIC: Some (maybe multi-line) commentary. <field field ...>
|
|
|
|
|
|
|
|
|
|
|
|
Mnemonics
|
|
|
|
---------
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
The codetags of interest are listed below, using the following format:
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
| ``recommended mnemonic (& synonym list)``
|
|
|
|
| *canonical name*: semantics
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``TODO (MILESTONE, MLSTN, DONE, YAGNI, TBD, TOBEDONE)``
|
|
|
|
*To do*: Informal tasks/features that are pending completion.
|
|
|
|
|
|
|
|
``FIXME (XXX, DEBUG, BROKEN, REFACTOR, REFACT, RFCTR, OOPS, SMELL, NEEDSWORK, INSPECT)``
|
2005-09-18 11:10:08 -04:00
|
|
|
*Fix me*: Areas of problematic or ugly code needing refactoring or
|
2005-09-26 15:56:53 -04:00
|
|
|
cleanup.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``BUG (BUGFIX)``
|
|
|
|
*Bugs*: Reported defects tracked in bug database.
|
|
|
|
|
|
|
|
``NOBUG (NOFIX, WONTFIX, DONTFIX, NEVERFIX, UNFIXABLE, CANTFIX)``
|
2005-09-18 11:10:08 -04:00
|
|
|
*Will Not Be Fixed*: Problems that are well-known but will never be
|
|
|
|
addressed due to design problems or domain limitations.
|
|
|
|
|
|
|
|
``REQ (REQUIREMENT, STORY)``
|
|
|
|
*Requirements*: Satisfactions of specific, formal requirements.
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``RFE (FEETCH, NYI, FR, FTRQ, FTR)``
|
|
|
|
*Requests For Enhancement*: Roadmap items not yet implemented.
|
|
|
|
|
2005-09-18 11:10:08 -04:00
|
|
|
``IDEA``
|
|
|
|
*Ideas*: Possible RFE candidates, but less formal than RFE.
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``??? (QUESTION, QUEST, QSTN, WTF)``
|
|
|
|
*Questions*: Misunderstood details.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``!!! (ALERT)``
|
|
|
|
*Alerts*: In need of immediate attention.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``HACK (CLEVER, MAGIC)``
|
2005-09-18 11:10:08 -04:00
|
|
|
*Hacks*: Temporary code to force inflexible functionality, or
|
|
|
|
simply a test change, or workaround a known problem.
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``PORT (PORTABILITY, WKRD)``
|
|
|
|
*Portability*: Workarounds specific to OS, Python version, etc.
|
|
|
|
|
|
|
|
``CAVEAT (CAV, CAVT, WARNING, CAUTION)``
|
2005-09-18 11:10:08 -04:00
|
|
|
*Caveats*: Implementation details/gotchas that stand out as
|
2005-09-26 15:56:53 -04:00
|
|
|
non-intuitive.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``NOTE (HELP)``
|
|
|
|
*Notes*: Sections where a code reviewer found something that needs
|
|
|
|
discussion or further investigation.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``FAQ``
|
|
|
|
*Frequently Asked Questions*: Interesting areas that require
|
|
|
|
external explanation.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``GLOSS (GLOSSARY)``
|
|
|
|
*Glossary*: Definitions for project glossary.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``SEE (REF, REFERENCE)``
|
|
|
|
*See*: Pointers to other code, web link, etc.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 19:38:14 -04:00
|
|
|
``TODOC (DOCDO, DODOC, NEEDSDOC, EXPLAIN, DOCUMENT)``
|
2005-09-26 15:56:53 -04:00
|
|
|
*Needs Documentation*: Areas of code that still need to be
|
|
|
|
documented.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``CRED (CREDIT, THANKS)``
|
|
|
|
*Credits*: Accreditations for external provision of enlightenment.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``STAT (STATUS)``
|
|
|
|
*Status*: File-level statistical indicator of maturity of this
|
|
|
|
file.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``RVD (REVIEWED, REVIEW)``
|
|
|
|
*Reviewed*: File-level indicator that review was conducted.
|
|
|
|
|
|
|
|
File-level codetags might be better suited as properties in the
|
|
|
|
revision control system, but might still be appropriately specified in
|
|
|
|
a codetag.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
Some of these are temporary (e.g., ``FIXME``) while others are
|
2005-09-26 15:56:53 -04:00
|
|
|
persistent (e.g., ``REQ``). A mnemonic was chosen over a synonym
|
|
|
|
using three criteria: descriptiveness, length (shorter is better),
|
|
|
|
commonly used.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
Choosing between ``FIXME`` and ``XXX`` is difficult. ``XXX`` seems to
|
2005-09-18 11:10:08 -04:00
|
|
|
be more common, but much less descriptive. Furthermore, ``XXX`` is a
|
|
|
|
useful placeholder in a piece of code having a value that is unknown.
|
2005-09-26 15:56:53 -04:00
|
|
|
Thus ``FIXME`` is the preferred spelling. `Sun says`__ that ``XXX``
|
|
|
|
and ``FIXME`` are slightly different, giving ``XXX`` higher severity.
|
|
|
|
However, with decades of chaos on this topic, and too many millions of
|
|
|
|
developers who won't be influenced by Sun, it is easy to rightly call
|
|
|
|
them synonyms.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
__ http://java.sun.com/docs/codeconv/html/CodeConventions.doc9.html#395
|
|
|
|
|
|
|
|
``DONE`` is always a completed ``TODO`` item, but this should probably
|
2005-09-26 15:56:53 -04:00
|
|
|
be indicated through the revision control system and/or a completion
|
|
|
|
recording mechanism (see `DONE File`_).
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
It may be a useful metric to count ``NOTE`` tags: a high count may
|
2005-09-26 15:56:53 -04:00
|
|
|
indicate a design (or other) problem. But of course the majority of
|
|
|
|
codetags indicate areas of code needing some attention.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
An ``FAQ`` is probably more appropriately documented in a wiki where
|
|
|
|
users can more easily view and contribute.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
Fields
|
|
|
|
------
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
All fields are optional. The proposed standard fields are described
|
|
|
|
in this section. Note that upper case field characters are intended
|
|
|
|
to be replaced.
|
|
|
|
|
|
|
|
The *Originator/Assignee* and *Origination Date/Week* fields are the
|
|
|
|
most common and don't usually require a prefix.
|
|
|
|
|
|
|
|
.. NOTE: the colon after the prefix is a new addition that became
|
|
|
|
necessary when it was pointed out that a "codename" field (with no
|
|
|
|
digits) such as "cTiger" would be indistinguishable from a username.
|
|
|
|
<MDE 2005-9-24>
|
|
|
|
|
|
|
|
.. NOTE: This section started out with just assignee and due week. It
|
|
|
|
has grown into a lot of fields by request. It is still probably
|
|
|
|
best to use a tracking system for any items that deserve it, and
|
|
|
|
not duplicate everything in a codetag (field). <MDE>
|
|
|
|
|
|
|
|
This lengthy list of fields is liable to scare people (the intended
|
|
|
|
minimalists) away from adopting codetags, but keep in mind that these
|
|
|
|
only exist to support programmers who either 1) like to keep ``BUG``
|
|
|
|
or ``RFE`` codetags in a complete form, or 2) are using codetags as
|
|
|
|
their complete and only tracking system. In other words, many of
|
|
|
|
these fields will be used very rarely. They are gathered largely from
|
|
|
|
industry-wide conventions, and example sources include `GCC
|
|
|
|
Bugzilla`__ and `Python's SourceForge`__ tracking systems.
|
|
|
|
|
|
|
|
.. ???: Maybe codetags inside packages (__init__.py files) could have
|
|
|
|
special global significance. <MDE>
|
|
|
|
|
|
|
|
__ http://gcc.gnu.org/bugzilla/
|
|
|
|
__ http://sourceforge.net/tracker/?group_id=5470
|
|
|
|
|
|
|
|
``AAA[,BBB]...``
|
|
|
|
List of *Originator* or *Assignee* initials (the context
|
|
|
|
determines which unless both should exist). It is also okay to
|
|
|
|
use usernames such as ``MicahE`` instead of initials. Initials
|
|
|
|
(in upper case) are the preferred form.
|
|
|
|
|
|
|
|
``a:AAA[,BBB]...``
|
|
|
|
List of *Assignee* initials. This is necessary only in (rare)
|
|
|
|
cases where a codetag has both an assignee and an originator, and
|
|
|
|
they are different. Otherwise the ``a:`` prefix is omitted, and
|
|
|
|
context determines the intent. E.g., ``FIXME`` usually has an
|
|
|
|
*Assignee*, and ``NOTE`` usually has an *Originator*, but if a
|
|
|
|
``FIXME`` was originated (and initialed) by a reviewer, then the
|
|
|
|
assignee's initials would need a ``a:`` prefix.
|
|
|
|
|
|
|
|
``YYYY[-MM[-DD]]`` or ``WW[.D]w``
|
|
|
|
The *Origination Date* indicating when the comment was added, in
|
|
|
|
`ISO 8601`_ format (digits and hyphens only). Or *Origination
|
|
|
|
Week*, an alternative form for specifying an *Origination Date*.
|
|
|
|
A day of the week can be optionally specified. The ``w`` suffix
|
|
|
|
is necessary for distinguishing from a date.
|
|
|
|
|
|
|
|
``d:YYYY[-MM[-DD]]`` or ``d:WW[.D]w``
|
|
|
|
*Due Date (d)* target completion (estimate). Or *Due Week (d)*,
|
|
|
|
an alternative to specifying a *Due Date*.
|
|
|
|
|
|
|
|
``p:N``
|
|
|
|
*Priority (p)* level. Range (N) is from 0..3 with 3 being the
|
|
|
|
highest. 0..3 are analogous to low, medium, high, and
|
|
|
|
showstopper/critical. The *Severity* field could be factored into
|
|
|
|
this single number, and doing so is recommended since having both
|
|
|
|
is subject to varying interpretation. The range and order should
|
|
|
|
be customizable. The existence of this field is important for any
|
|
|
|
tool that itemizes codetags. Thus a (customizable) default value
|
|
|
|
should be supported.
|
|
|
|
|
|
|
|
``t:NNNN``
|
|
|
|
*Tracker (t)* number corresponding to associated Ticket ID in
|
|
|
|
separate tracking system.
|
|
|
|
|
|
|
|
The following fields are also available but expected to be less
|
|
|
|
common.
|
|
|
|
|
|
|
|
``c:AAAA``
|
|
|
|
*Category (c)* indicating some specific area affected by this
|
|
|
|
item.
|
|
|
|
|
|
|
|
``s:AAAA``
|
|
|
|
*Status (s)* indicating state of item. Examples are "unexplored",
|
|
|
|
"understood", "inprogress", "fixed", "done", "closed". Note that
|
|
|
|
when an item is completed it is probably better to remove the
|
|
|
|
codetag and record it in a `DONE File`_.
|
|
|
|
|
|
|
|
``i:N``
|
|
|
|
Development cycle *Iteration (i)*. Useful for grouping codetags into
|
|
|
|
completion target groups.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
``r:N``
|
|
|
|
Development cycle *Release (r)*. Useful for grouping codetags into
|
2005-09-18 11:10:08 -04:00
|
|
|
completion target groups.
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
.. NOTE: SourceForge does not recognize a severity and I think
|
|
|
|
that *Priority* (along with separate RFE codetags) should
|
|
|
|
encompass and obviate *Severity*. <MDE>
|
|
|
|
|
|
|
|
.. NOTE: The tools will need an ability to sort codetags in order
|
|
|
|
of targeted completion. I feel that *Priority* should be a
|
|
|
|
unique, lone indicator of that addressability order. Other
|
|
|
|
categories such as *Severity*, *Customer Importance*, etc. are
|
|
|
|
related to business logic and should not be recognized by the
|
|
|
|
codetag tools. If some groups want to have such logic, then it
|
|
|
|
is best factored (externally) into a single value (priority)
|
|
|
|
that can determine an ordering of actionable items. <MDE>
|
|
|
|
|
|
|
|
To summarize, the non-prefixed fields are initials and origination
|
|
|
|
date, and the prefixed fields are: assignee (a), due (d), priority
|
|
|
|
(p), tracker (t), category (c), status (s), iteration (i), and release
|
|
|
|
(r).
|
|
|
|
|
|
|
|
It should be possible for groups to define or add their own fields,
|
|
|
|
and these should have upper case prefixes to distinguish them from the
|
|
|
|
standard set. Examples of custom fields are *Operating System (O)*,
|
|
|
|
*Severity (S)*, *Affected Version (A)*, *Customer (C)*, etc.
|
|
|
|
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
DONE File
|
|
|
|
---------
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
Some codetags have an ability to be *completed* (e.g., ``FIXME``,
|
|
|
|
``TODO``, ``BUG``). It is often important to retain completed items
|
|
|
|
by recording them with a completion date stamp. Such completed items
|
|
|
|
are best stored in a single location, global to a project (or maybe a
|
|
|
|
package). The proposed format is most easily described by an example,
|
|
|
|
say ``~/src/fooproj/DONE``::
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
# TODO: Recurse into subdirs only on blue
|
|
|
|
# moons. <MDE 2003-09-26>
|
|
|
|
[2005-09-26 Oops, I underestimated this one a bit. Should have
|
|
|
|
used Warsaw's First Law!]
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
# FIXME: ...
|
|
|
|
...
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
You can see that the codetag is copied verbatim from the original
|
|
|
|
source file. The date stamp is then entered on the following line
|
|
|
|
with an optional post-mortem commentary. The entry is terminated by a
|
|
|
|
blank line (``\n\n``).
|
2005-09-18 11:10:08 -04:00
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
It may sound burdensome to have to delete codetag lines every time one
|
|
|
|
gets completed. But in practice it is quite easy to setup a Vim or
|
|
|
|
Emacs mapping to auto-record a codetag deletion in this format (sans
|
|
|
|
the commentary).
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
Tools
|
|
|
|
=====
|
|
|
|
|
|
|
|
Currently, programmers (and sometimes analysts) typically use *grep*
|
2005-09-26 15:56:53 -04:00
|
|
|
to generate a list of items corresponding to a single codetag.
|
2005-09-18 11:10:08 -04:00
|
|
|
However, various hypothetical productivity tools could take advantage
|
2005-09-26 15:56:53 -04:00
|
|
|
of a consistent codetag format. Some example tools follow.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
.. NOTE: Codetag tools are mostly unimplemented (but I'm getting
|
|
|
|
started!) <MDE>
|
|
|
|
|
|
|
|
Document Generator
|
|
|
|
Possible docs: glossary, roadmap, manpages
|
|
|
|
|
|
|
|
Codetag History
|
|
|
|
Track (with revision control system interface) when a ``BUG`` tag
|
|
|
|
(or any codetag) originated/resolved in a code section
|
|
|
|
|
|
|
|
Code Statistics
|
|
|
|
A project Health-O-Meter
|
|
|
|
|
|
|
|
Codetag Lint
|
2005-09-26 15:56:53 -04:00
|
|
|
Notify of invalid use of codetags, and aid in porting to codetags
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
Story Manager/Browser
|
|
|
|
An electronic means to replace XP notecards. In MVC terms, the
|
2005-09-26 15:56:53 -04:00
|
|
|
codetag is the Model, and the Story Manager could be a graphical
|
2005-09-18 11:10:08 -04:00
|
|
|
Viewer/Controller to do visual rearrangement, prioritization, and
|
|
|
|
assignment, milestone management.
|
|
|
|
|
|
|
|
Any Text Editor
|
2005-09-26 15:56:53 -04:00
|
|
|
Used for changing, removing, adding, rearranging, recording
|
|
|
|
codetags.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
There are some tools already in existence that take advantage of a
|
2005-09-26 15:56:53 -04:00
|
|
|
smaller set of pseudo-codetags (see References_). There is also an
|
|
|
|
example codetags implementation under way, known as the `Codetag
|
|
|
|
Project`__.
|
|
|
|
|
|
|
|
__ http://tracos.org/codetag
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
Objections
|
|
|
|
==========
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
:Objection: Extreme Programming argues that such codetags should not
|
2005-09-18 11:10:08 -04:00
|
|
|
ever exist in code since the code is the documentation.
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
:Defense: Maybe you should put the codetags in the unit test files
|
|
|
|
instead. Besides, it's tough to generate documentation from
|
|
|
|
uncommented source code.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: Too much existing code has not followed proposed
|
|
|
|
guidelines.
|
|
|
|
|
|
|
|
:Defense: [Simple] utilities (*ctlint*) could convert existing codes.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: Causes duplication with tracking system.
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
:Defense: Not really, unless fields are abused. If an item exists in
|
|
|
|
the tracker, a simple ticket number in the codetag tracker field
|
|
|
|
is sufficient. Maybe a duplicated title would be acceptable.
|
|
|
|
Furthermore, it's too burdensome to have a ticket filed for every
|
|
|
|
item that pops into a developer's mind on-the-go. Additionally,
|
|
|
|
the tracking system could possibly be obviated for simple or small
|
|
|
|
projects that can reasonably fit the relevant data into a codetag.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: Codetags are ugly and clutter code.
|
|
|
|
|
|
|
|
:Defense: That is a good point. But I'd still rather have such info
|
|
|
|
in a single place (the source code) than various other documents,
|
2005-09-26 15:56:53 -04:00
|
|
|
likely getting duplicated or forgotten about. The completed
|
|
|
|
codetags can be sent off to the `DONE File`_, or to the bit
|
|
|
|
bucket.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: Codetags (and all comments) get out of date.
|
|
|
|
|
|
|
|
:Defense: Not so much if other sources (externally visible
|
2005-09-26 15:56:53 -04:00
|
|
|
documentation) depend on their being accurate.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: Codetags tend to only rarely have estimated completion
|
|
|
|
dates of any sort. OK, the fields are optional, but you want to
|
|
|
|
suggest fields that actually will be widely used.
|
|
|
|
|
|
|
|
:Defense: If an item is inestimable don't bother with specifying a
|
|
|
|
date field. Using tools to display items with order and/or color
|
|
|
|
by due date and/or priority, it is easier to make estimates.
|
|
|
|
Having your roadmap be a dynamic reflection of your codetags makes
|
|
|
|
you much more likely to keep the codetags accurate.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: Named variables for the field parameters in the ``<>``
|
|
|
|
should be used instead of cryptic one-character prefixes. I.e.,
|
|
|
|
<MDE p:3> should rather be <author=MDE, priority=3>.
|
|
|
|
|
|
|
|
:Defense: It is just too much typing/verbosity to spell out fields. I
|
|
|
|
argue that ``p:3 i:2`` is as readable as ``priority=3,
|
|
|
|
iteration=2`` and is much more likely to by typed and remembered
|
|
|
|
(see bullet C in Philosophy_). In this case practicality beats
|
|
|
|
purity. There are not many fields to keep track of so one letter
|
|
|
|
prefixes are suitable.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: Synonyms should be deprecated since it is better to have a
|
|
|
|
single way to spell something.
|
|
|
|
|
|
|
|
:Defense: Many programmers prefer short mnemonic names, especially in
|
|
|
|
comments. This is why short mnemonics were chosen as the primary
|
|
|
|
names. However, others feel that an explicit spelling is less
|
|
|
|
confusing and less prone to error. There will always be two camps
|
|
|
|
on this subject. Thus synonyms (and complete, full spellings)
|
|
|
|
should remain supported.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: It is cruel to use [for mnemonics] opaque acronyms and
|
|
|
|
abbreviations which drop vowels; it's hard to figure these things
|
|
|
|
out. On that basis I hate: MLSTN RFCTR RFE FEETCH, NYI, FR, FTRQ,
|
|
|
|
FTR WKRD RVDBY
|
|
|
|
|
|
|
|
:Defense: Mnemonics are preferred since they are pretty easy to
|
|
|
|
remember and take up less space. If programmers didn't like
|
|
|
|
dropping vowels we would be able to fit very little code on a
|
|
|
|
line. The space is important for those who write comments that
|
|
|
|
often fit on a single line. But when using a canon everywhere it
|
|
|
|
is much less likely to get something to fit on a line.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: It takes too long to type the fields.
|
|
|
|
|
|
|
|
:Defense: Then don't use (most or any of) them, especially if you're
|
|
|
|
the only programmer. Terminating a codetag with ``<>`` is a small
|
|
|
|
chore, and in doing so you enable the use of the proposed tools.
|
|
|
|
Editor auto-completion of codetags is also useful: You can
|
|
|
|
program your editor to stamp a template (e.g. ``# FIXME . <MDE
|
|
|
|
{date}>``) with just a keystroke or two.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: *WorkWeek* is an obscure and uncommon time unit.
|
|
|
|
|
|
|
|
:Defense: That's true but it is a highly suitable unit of granularity
|
|
|
|
for estimation/targeting purposes, and it is very compact. The
|
|
|
|
`ISO 8601`_ is widely understood but allows you to only specify
|
|
|
|
either a specific day (restrictive) or month (broad).
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: I aesthetically dislike for the comment to be terminated
|
|
|
|
with <> in the empty field case.
|
|
|
|
|
|
|
|
:Defense: It is necessary to have a terminator since codetags may be
|
|
|
|
followed by non-codetag comments. Or codetags could be limited to
|
|
|
|
a single line, but that's prohibitive. I can't think of any
|
|
|
|
single-character terminator that is appropriate and significantly
|
|
|
|
better than <>. Maybe ``@`` could be a terminator, but then most
|
|
|
|
codetags will have an unnecessary @.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
:Objection: I can't use codetags when writing HTML, or less
|
|
|
|
specifically, XML. Maybe ``@fields@`` would be a better than
|
|
|
|
``<fields>`` as the delimiters.
|
|
|
|
|
|
|
|
:Defense: Maybe you're right, but ``<>`` looks nicer whenever
|
|
|
|
applicable. XML/SGML could use ``@`` while more common
|
|
|
|
programming languages stick to ``<>``.
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
References
|
|
|
|
==========
|
|
|
|
|
2005-09-26 15:56:53 -04:00
|
|
|
Some other tools have approached defining/exploiting codetags.
|
2005-09-18 11:10:08 -04:00
|
|
|
See http://tracos.org/codetag/wiki/Links.
|
|
|
|
|
|
|
|
.. _wiki: http://tracos.org/codetag/wiki/Pep
|
|
|
|
.. _ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
|
2005-09-26 15:56:53 -04:00
|
|
|
.. _c2: http://c2.com/cgi/wiki?FixmeComment
|
2005-09-18 11:10:08 -04:00
|
|
|
|
|
|
|
..
|
|
|
|
Local Variables:
|
|
|
|
mode: indented-text
|
|
|
|
indent-tabs-mode: nil
|
|
|
|
sentence-end-double-space: t
|
|
|
|
fill-column: 70
|
|
|
|
End:
|