Page 1 of 1

Programming Style Guide

Posted: 22 January 2006, 13:11 PM
by victorf
Is there a programming style guide for ZBasic programs. Being somewhat new to this flavor of BASIC and wanting to be sure that I husband the processor's resources, I would like to have a discussion of "proper" programming style.

I also like to have things neat in the code. I have tons of experience with Pascal especially Borland's and have used their products from TP3 to Delphi. I have sort of developed my style. Such things a never capitalizing the words function and procedure (function and subroutine here). I try to capitalize variable names like MyVariable (which I have seen refered to as Camel Caps) and I always (almost) capitalize constants completely (MYCONST). I do not identify variables - strMyVariable. I would like to see the editor do like the help files and enforce capitalzation like this ( MakeString) so I don't have too. Tabbing is an issue with me. :) I have always indented with two spaces per level and dkinzer was kind enough to explain how to set my tab levels gobally for this.

Anyway I think style is important and makes for easier reading of programs. I would like to hear how others approach this issue.

Any enlightenment will be appreciated.

Vic

Posted: 22 January 2006, 15:21 PM
by spamiam
Well, you can capitalize it anyway you like. It will not change your resource utilization on the ZX. What ever makes it more legible to you.

But stuff like goto's and while's, and the like that affect program flow DO affect resource utilization, but the actual outcome in bytes used and processing speed are sometimes surprising.


I recently saw somebody's sig than siad something like:

If you just wrote a super-slick section of code, re-write it because you will not understand what you did in a month.

In the end, clarity is the beginning and the end.

-Tony