Re: Basic Question



But wouldn't you agree that if there are 10-15 lines of comments per single
line of code that's obvious in what it does that its probably to many as in...

'Create an object variable pointing back to the current workspace of the
engine,
'we'll use this later to work with the various tables to insert and edit
records as
'we 'loop through them via the recordSet object, while we'll be using DAO to
directly
'add and edit records using the recordSet object and .Edit, .Update, the
..Execute
'method of the database object will be used to insert the new records, this
will
'allow us to encapsulate the insert in an explicit transaction
'using .BeginTrans, .CommitTrans and .Rollback so that if one part of the
insert
'fails we can trap the errors and allow or disallow the change

Set db = DBEngine(0)(0)

Most of the comments above could be edited down as the remaining lines of
code would infer what we're doing. Imagine though a new programmer leaving
that amount of comments for nearly every single line of code - that's the
direction that I was going in. If its an educational setting, I could see
extensive comments, but in a real-world application, I can only see a handful
of comments (one or two lines) per line of code to briefly elaborate on why
we're doing what we're doing, unless its something utterly commplicated that
needs to be explained, and then most likely at the top of the SUB/FUNCTION.
As one of my old instructors used to say - why use 5 words, when 5,000 will
do.

"Douglas J. Steele" wrote:

Why? You should have as many comments as it takes to explain what you're
doing.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"dch3" <dch3@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3DEC8C79-7BBA-424F-9E39-737AA97DF5D4@xxxxxxxxxxxxxxxx
Never seen that myself, but just how many comments do you have? Tip: If
you
have more lines of comments than actual lines of code, you should edit
them.




.



Relevant Pages

  • Re: Basic Question
    ... in many situations the developer won't necessarily be the one ... Doug Steele, Microsoft Access MVP ... 'we'll use this later to work with the various tables to insert and edit ... 'we 'loop through them via the recordSet object, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Back-end
    ... It is advisable to change the Record Locks ... Then if another user attempts to edit that same ... Doug Steele, Microsoft Access MVP ...
    (microsoft.public.access.security)
  • Re: Simple DDX_Text with edit box and spin button falls over
    ... used spin buttons many times in the past. ... -Add two edit boxes and two spin buttons, one for each box (in the ... This fails on both Visa Basic and XP. ... afx_msg void OnPaint; ...
    (microsoft.public.vc.mfc)
  • Re: Basic Question
    ... Doug Steele, Microsoft Access MVP ... (no private e-mails, please) ... 'we'll use this later to work with the various tables to insert and edit ... 'we 'loop through them via the recordSet object, ...
    (microsoft.public.access.modulesdaovba)
  • Re: : Are there any macros/scripts to:
    ... You must edit the file called init.txt that resides in the folder ... Tell the Nav System to go over a trap if it has to... ... Would also be nice to have it ignore stairs, armor/weapons I cant use, ...
    (rec.games.roguelike.misc)