Connecting Tech Pros Worldwide Help | Site Map

Proper Script/Code Documentation

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 25th, 2008, 04:55 PM
Patient Guy
Guest
 
Posts: n/a
Default Proper Script/Code Documentation


I am looking for standards or advice or guidelines, either written in a
posted reply here or given by a link in your reply, that gives CONVENTIONAL
or TRADITIONAL or ACCEPTED-STANDARD formatting for how to document
script/code. My guess is also that this is used by automatic
documentation-gathering software tools.

I have a fair idea that classes/functions should be described at a minimum
as to purpose, parameters passed, and return value(s). But there is a lot
of other symbols/characters used, including how "to version" the code.

With descriptions (with multiple paragraphs similar to UNIX documentation),
I tend to put them at the bottom of a *.js file between /* */ delimiters,
with a line at the top directing the reader to the bottom of the script
file.

What are everyone's (best?) practices here?

How do you avoid the problem of coming back to YOUR OWN code months later
and trying to figure out what you were doing, let alone having another
developer come to your code and instantly picking up the ball and running
with it?


  #2  
Old August 25th, 2008, 06:55 PM
John G Harris
Guest
 
Posts: n/a
Default Re: Proper Script/Code Documentation

On Mon, 25 Aug 2008 at 11:46:32, in comp.lang.javascript, Patient Guy
wrote:
Quote:
>
>I am looking for standards or advice or guidelines, either written in a
>posted reply here or given by a link in your reply, that gives CONVENTIONAL
>or TRADITIONAL or ACCEPTED-STANDARD formatting for how to document
>script/code. My guess is also that this is used by automatic
>documentation-gathering software tools.
If you're using software tools you won't have much choice. You'll just
have to learn to live with whichever format rules you don't like.

Quote:
>I have a fair idea that classes/functions should be described at a minimum
>as to purpose, parameters passed, and return value(s). But there is a lot
>of other symbols/characters used, including how "to version" the code.
Keep it simple, keep it clear, don't neglect it, and, above all, keep it
up to date. That last one is easier if you've kept it simple and clear.

Quote:
>With descriptions (with multiple paragraphs similar to UNIX documentation),
>I tend to put them at the bottom of a *.js file between /* */ delimiters,
>with a line at the top directing the reader to the bottom of the script
>file.
Surely the best two choices are to put a function's specification inside
the function or in a separate document. Anywhere else will be more
trouble to read, write, and update.

Quote:
>What are everyone's (best?) practices here?
>
>How do you avoid the problem of coming back to YOUR OWN code months later
>and trying to figure out what you were doing, let alone having another
>developer come to your code and instantly picking up the ball and running
>with it?
This works for me :

function Vet(form)
// Vet the form and return true iff values are ok
{ ... }

And so does this :

function DayName(dow)
// Return name for day of week dow (English)
// In and Pre
// dow : Integer
// Out and Post
// DayName : String
// DayName is name of day dow if 0 <= dow <= 6
// DayName is "<unknown>" otherwise
{ ... }


John
--
John Harris
  #3  
Old August 25th, 2008, 07:15 PM
purcaholic
Guest
 
Posts: n/a
Default Re: Proper Script/Code Documentation

On 25 Aug., 18:46, Patient Guy <sevisen.adam@gmailDOTHEREcomwrote:
Quote:
I am looking for standards or advice or guidelines, either written in a
posted reply here or given by a link in your reply, that gives CONVENTIONAL
or TRADITIONAL or ACCEPTED-STANDARD formatting for how to document
script/code. *My guess is also that this is used by automatic
documentation-gathering software tools.
Check out JsDoc Toolkit (http://jsdoctoolkit.org/). You can comment
your sources using the JsDoc syntax (it's like Javadoc) and than
generate documentation running JsDoc Toolkit from commandline.

Regards,
purcaholic
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.