View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Organizing functions

Jamie,

How can you 'criticise' anyone for using comments<g

I am sure Jim uses meaningful names as well, just as I do (see how many
times I use the variable in my code<bg), but comments can also help. To
fully explain, a meaningful name could get ridiculously long, as in your
example, I would rather not use
TotalIncomeByTaxScheduleOfLastEmployeeAddedToGrid. a name and comments works
better for me, as an example

'--------------------------------------------------------------------
' Constant: CFP_Icon
' Usage: Defines if an icon is shown in the toolbar

What annoys me is shortening (I note happily that you don't), such as
TotIncByTaxSchedOfLastEmpAddToGrid, they are the worst of all.

I would add that I find some comments useless, such as

adoConn.Close 'close the connection

If comments are not used effectively, and just sprinkled about stating the
obvious, another developer may well decide that the comments do not help,
and so ignore them. And of course, they will then miss the one comment that
is truly enlightening.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jamie Collins" wrote in message
oups.com...

Jim Thomlinson wrote:
All of my variables are
commented.


Perhaps, then, you are not using intuitive names for your variables. I
think code should be 'self documenting' where possible. I'd sooner use:

Dim TotalIncomeByTaxScheduleOfLastEmployeeAddedToGrid As Currency

than have to resort to something like:

' Keep a running total of income by Tax Schedule
' of last employee added to the grid
Dim Total8 As Currency

on the basis that it makes it harder to maintain the code if I have to
remember what distinguishes Total8 from Total1, Total2, Total3 etc.

Jamie.

--