Click here to Skip to main content
15,895,709 members
Articles / Programming Languages / Visual Basic
Article

Code usability

Rate me:
Please Sign up or sign in to vote.
1.13/5 (27 votes)
16 Dec 20021 min read 140.7K   330   13   16
Macro to add description to any function written by developers.

This VB procedure helps any developer to easily add comments to his/her code. The comments including some function details like function name, input parameter and return value. Also, the date when the function was written and the author name. All are retrieived automatically and it saves the developer time.

How does it work?

  • The developer marks the function she wants to remark.
  • The code parses the selected text and gets all of the relevant data from the function (i.e. name,input and return value)
  • The description should be filled by the author
  • Date is written as the current date
  • Author is taken by the Windows login name

How can you use it?

    • Open VC
    • Go to Tools->Customize->Commands->Macros
    • On the right pane click on the function AddFunctionDescription (should be the 1'st one), then drag it to the toolbar.
    • You should see this function in the toolbar
    • Go to Tools->Macors->Macro explorer
    • In the tree, open Samples->DevStudio6Editor
    • Right Click on AddFunctionDescription and choose Edit
    • Replace the current code of this procedure with the one you have in the attached zip file.
    • Save all the changes in all of the IDEs
    • Select any function you have in the code (select the whole row)
    • Click on the AddFunctionDescription button in the toolbar
    • You will see the proper remark
    • Sample: Supposed that you have the function void Foo(int bar) written by a guy
    • named Henry. This macro will add the next lines just below you selected
    • function.
    • // ********************************************************************
    • // Function name : Foo
    • // Description :
    • // Return type : void
    • // Argument : bar
    • //
    • // Date : 1:10PM 12/13/2002
    • // Author : henry
    • // ********************************************************************

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Israel Israel
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralIt doesn't work Pin
MikeTheProgrammer21-Sep-03 1:36
MikeTheProgrammer21-Sep-03 1:36 
GeneralC#.NET already has automatic comment ability... Pin
Marc Clifton17-Dec-02 1:14
mvaMarc Clifton17-Dec-02 1:14 
GeneralRe: C#.NET already has automatic comment ability... Pin
Michael P Butler19-Dec-02 0:04
Michael P Butler19-Dec-02 0:04 
GeneralRe: C#.NET already has automatic comment ability... Pin
Daniel Fisher (lennybacon)23-Dec-02 10:09
Daniel Fisher (lennybacon)23-Dec-02 10:09 
GeneralRe: C#.NET already has automatic comment ability... Pin
Hades5k20-Sep-07 7:29
Hades5k20-Sep-07 7:29 
GeneralA revision history might be useful Pin
Marc Clifton17-Dec-02 0:57
mvaMarc Clifton17-Dec-02 0:57 
QuestionWhere is a StripTabs? Pin
_Samael_16-Dec-02 1:39
_Samael_16-Dec-02 1:39 
Generalsuggestions Pin
Henry Jacobs13-Dec-02 7:41
Henry Jacobs13-Dec-02 7:41 
GeneralRe: suggestions Pin
oferudi16-Dec-02 19:42
oferudi16-Dec-02 19:42 
GeneralRe: suggestions Pin
jhwurmbach16-Dec-02 21:39
jhwurmbach16-Dec-02 21:39 
First, let me say that (after the rewrite), you did a good job for an article, and I (having myself not posted any article yet) appreciate your support of this site.
But:
oferudi wrote:
Isn't it great?

Well, it might be help if you are obliged (e.g. by company policy) to document every function that way.
But it will not help in writing a description that is not in the header, nor does it add meaningful descriptions to the parameter. (How could it? No one would have expected this.)
But this is the hard part with documenting: Getting the meaning of your code transported, the reasons for your algorithm choice, the limitations the algorithm has and the constraints on the parameter values.

So, I think that this macro will have a bad effect on the documenting style of many user (a least on me it would have): With running the macro one thinks: "Well, now I have made a documentation for it, so this one is finished."
But it is not! The real job has just started.





--
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
GeneralNot being picky Pin
NormDroid12-Dec-02 21:11
professionalNormDroid12-Dec-02 21:11 
GeneralRe: Not being picky Pin
David Stone14-Dec-02 7:56
sitebuilderDavid Stone14-Dec-02 7:56 
GeneralPlease reformat the text of your article Pin
Matthias Mann12-Dec-02 2:29
Matthias Mann12-Dec-02 2:29 
GeneralRe: Please reformat the text of your article Pin
leppie12-Dec-02 8:10
leppie12-Dec-02 8:10 
GeneralRe: Please reformat the text of your article Pin
Uwe Keim12-Dec-02 20:08
sitebuilderUwe Keim12-Dec-02 20:08 
GeneralRe: Please reformat the text of your article Pin
NormDroid12-Dec-02 21:13
professionalNormDroid12-Dec-02 21:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.