Hi
I use mixed case using the same capitalization as for Delphi and VB (rather
than camelCase for C# and Java).
OpenSeq
NumberOfFields = DCount(SomeVariable, @FM)
However I use upper case to distinguish things that are 'special' e.g.
equate literals, file and select variables, common variables and compiler
directives. That way they stand out.
I also use upper case for STOP and the main RETURN from an external
subroutine, which helps to distinguish it from the Return from a local
GoSub.
I don't worry about searching since the editors I use are capable of
searching case-independently, and you can always write an IDescriptor to do
an UPCASE(@RECORD) if you want to search in a source file. In fact,
generally I find doing a SELECT with a LIKE clause on that is faster than
using the SEARCH command.
There should be no need to do anything special to format your comments since
any editor worth using will distinguish these (as a bare minimum). I have a
simple 'autodoc' markup in the comments that makes it easy to generate
technical docs.
So, putting it all together:
PROGRAM ShowStuff
*---------------------------------------------------------------------
* @@Name : ShowStuff
* @@Project : Demo
* (other autodoc header info here)
*---------------------------------------------------------------------
* @@Info{
* Shows some stuff.
* <b>And some other comments in here with HTML markups</b>
* }
*---------------------------------------------------------------------
* (other autodoc comments here: modifications, keywords, todo etc.
*---------------------------------------------------------------------
* version stamp goes in here - assigned to a variable so it compiles into
* the object and I can then rip it from the string table.
VERDATA = "Version=001002003;"
VERDATA:= "VerDate=12345;"
VERDATA:= "VerDesc=Short Description here;"
(etc)
*---------------------------------------------------------------------
$INCLUDE BOOK_TITLES.h
Open "BOOK_TITLES" To TITLES Else
Crt "Cannot open the TITLES File"
RETURN
End
Execute "SSELECT BOOK_TITLES", SELECT. > SLIST
Fin = @False
Loop
ReadNext TitleId From SLIST Else
Fin = @True
End
Until Fin Do
GoSub ShowISBN
Repeat
RETURN
*----------------------------------------------------------------------
* ShowISBN: show the title id, ISBN and price
*----------------------------------------------------------------------
ShowISBN:
Read TitleRec From TITLES,TitleId Then
Crt TitleId, TitleRec<BOOK_TITLES.ISBN>,
OConv(TitleRec<BOOK_TITLES.PRICE>,"MD2")
End
Return
I find it much more legible, since I spent at least half of my life in
client languages. But I understand the point of view of those raised on
upper case only who don't use modern (grin) languages, and may initially
find it confusing. It's just a question of what you're used to.
Incidentally, this has evolved over the years. I started off upper case (no
other choice back then), went to lower case in the 'C/UNIX' age, and then
camelCase before settling on this style. When I go back to older code I can
see that this one works best.
But the main thing is to be consistent with your style and use a good
editor.
Brian
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users