473,387 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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?

Aug 25 '08 #1
2 1365
On Mon, 25 Aug 2008 at 11:46:32, in comp.lang.javascript, Patient Guy
wrote:
>
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.

>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.

>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.

>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
Aug 25 '08 #2
On 25 Aug., 18:46, Patient Guy <sevisen.adam@gmailDOTHEREcomwrote:
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
Aug 25 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Ksenia Marasanova | last post by:
Hi, I have a little problem with encoding. Was hoping maybe anyone can help me to solve it. There is some amount of data in a database (PG) that must be inserted into Excel sheet and emailed....
4
by: TK | last post by:
I'm sure this is probably the wrong place to ask, but is there a way to execute an SSI script in javascript? I'm using an SSI script to read a memory address, and I'd like to be able to update...
10
by: Tim B. | last post by:
Hello, I am looking for the proper way to shut down db2 completely so that I can do a cold back up on all the databases. Thanks! ----== Posted via Newsfeed.Com -...
9
by: Harry Smith | last post by:
While reading the documentation on IsStartupScriptRegistered, there is a reference to "client startup script" as "Determines if the client startup script is registered with the Page object." What...
5
by: YaoBao | last post by:
Is any ColdFusion script I can put on my webpage that will create a search bar so people can type keywords to match it on the current page in my website? It will be exactly like the finder search bar...
14
by: asdf | last post by:
I have a python script whose output i want to dynamically display on a webpage which will be hosted using Apache. How do I do that? thanks
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.