Coding Standards

If that was the case then I have you beat by a few years. :stuck_out_tongue:

bah yer both wrong anyway :stuck_out_tongue:

They demand that ‘A’ standard be utilized, but don’t specify which one. Because I come from Visual Basic from so many years ago, I will likely pick one of those because I still code in that manner and wouldn’t have to change much. it took me a little research to find one that ‘matches’ what I already do, but I found one at http://www.pbdr.com/vbstd/VB%20Coding%20Standards(1).htm that’s pretty close.

This is my first Department of Defense project. I don’t know if anybody else has every gone through this, but holy crap!

No wonder they pay $500 for a roll of toilet paper. It has to conform to the Specifications of the Toilet Paper Advisory Committee, meet NSA standards on Toilet Paper Security, follow the OSHA guidelines on the Safe Implementation of Toilet Paper, and be certified by the National Toilet Paper Aerodynamics Board in order to be used. By the time you do all of that, you have to charge $500 a roll to still make ten cents!

Theres some interesting stuff in here. I have to say, I always prefix with 2 or 3 characters; when you have a large number of items in the navigator it helps a lot.

lbl - Label
lbx - Listbox
tf - Textfield
ta - Textarea
bb - Bevelbutton
cb - Checkbox
gb - Groupbox
tp - Tabpanel
iw - Imagewell

etc, etc.

I take it one step further too. If I have multiple textfields in say 2 groupboxes named ‘Foo’ and ‘Bar’, they then become tfFooFieldname and tfBarFieldname. That way everything stays neatly organised within their own little sub groups.

It might be viewed as a bit OCD by some, but it works very well for me.

:slight_smile:

After reading all entries, it happens that I use prefix and suffix…

Prefis are used for stuff that ends in the Navigation pane (Windows, Modules, Controls, etc.)
Suffix are used to flag the variables (Properties) types: FI, Bool, Idx (for loop), etc.

Labels / TextArea / TextFields / PushButtons, etc.: I use uppercase prefix to say what Control it is, followed bu underscore(s) as separator for meaningfull names as someone stated above.

As an example, if I have a text editor and place some buttons, their name will have PB as prefix followed by Style (for example and ends with Bold, Italic, etc.
PB_Style_Standard, PB_Style_Bold, PB_Style_Italic, etc.

Easy to do with Copy / Paste, then easy to understand days-month-years after ;-:slight_smile:

And… after all, we use GroupBox for our interface ? So I use prefix to “group” controls.

Of course, this is theory… sometimes I do mistakes too !

I use a prefix, but with less granularity and only on controls to group them by function in the IDE. I avoid using implementation details in variable and control names. What happens when you change some minor detail such as integer to double, or textfield to popupmenu? Names should be descriptive but concise. I use camel case because the IDE will autocomplete and auto correct the case, but I’m not slavish about it and often just type the whole variable in lower case.

Prefixes? Suffixes? I use both, but in a consistent manner.

Objects and properties are prefixed in a manner very similar to what Thomas listed. Local variables are suffixed. That way when I come back to debug the function a month later I can immediately tell the scope of strTotal vs TotalStr.