Re: Basic Question
- From: dch3 <dch3@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 2 Jul 2008 12:32:02 -0700
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.
- Follow-Ups:
- Re: Basic Question
- From: Douglas J. Steele
- Re: Basic Question
- References:
- Basic Question
- From: Sash
- RE: Basic Question
- From: dch3
- Re: Basic Question
- From: Douglas J. Steele
- Basic Question
- Prev by Date: Access Application Version
- Next by Date: MS-Access 2007 Hide items in Office Button
- Previous by thread: Re: Basic Question
- Next by thread: Re: Basic Question
- Index(es):
Relevant Pages
|