B4J Question B4J style guide

Coldrestart

Member
Licensed User
Longtime User
Hello everyone,

Is there a style guide for B4J / B4X?
(Someting like PEP 8 for Python)

Are there tips and tricks for giving useful names to:
-Public variables
-Private variables
-Temporary local variable within a function
-Constants
-Classes
-Modules
-Types
-Maps
-Lists
-Arrays
....
Sometimes I see, PascalCasing or camelCasing, UPPER_CASING etc... but i don't know if there is a standard in this language?
Do you add the datatype in you variable name? Or is it useless?
For example:
B4X:
Private intTimeOffset as Int
Timer declaration:
Private tmrReadFile As Timer
 

AHilton

Active Member
Licensed User
Longtime User
No standards. Do as you like. I wouldn't say that coming up with your own standards would be "useless" but there's no language-specific requirements. Well, there are *are* some, in some very specific circumstances, for naming Subs or html "id=" when working with B4J WebApps (use all lowercase in the HTML but in your B4J code it doesn't matter), for example.

If you're programming in a group, that group should come up with their own best practices.

You're really not restricted. It just comes down to a matter of readability.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…