This page provides a brief overview of the coding conventions used for PowerBuilder code on this site. Remember that there are many perspectives on coding standards. One important rule is that you pick a standard and stick to it.
Code within loops, If statements, Case statements, etc. is indented one tab (which is 3 spaces in width).
Major PowerBuilder keywords (IF, ELSE, CASE, END) are capitalized. Calls to PowerBuilder functions (e.g. GetItem, GetSelectedRow, etc.) are mixed case with the first letter of each word capitalized.
Standard PowerBuilder Hungarian notiation is used, as follows:
where "a" denotes the scope (i.e. local, instance, global) and "b" denotes the variable type (e.g. s for string, l for long, i for integer, etc.)
example: ls_CustName is a local string denoting Customer Name
User events (i.e. events that are not directly defined by PowerBuilder or PFC) are prefixed with a "ue_". This makes it easy to quickly identify events that you created in your application or extension layer. Since event names are sorted alphabetically, it also "groups" all your events at the bottom of the event list where they are easy to find.
Functions are given a prefix, depending on their access and location:
This function convention convention makes it easy to scan an object's functions and locate its callable functions (i.e. those with a "f_" prefix). The added side bonus is that when you read application code and see "f_" or "of_", you know which functions are extension/application functions (f_) and which are direct PFC functions (i.e. of_). Of course, native PowerBuilder functions(e.g. MessageBox) have no prefix at all.
This is by no means a comprehensive set of coding standards. A complete PowerBuilder coding standards document will run at least 20 pages and can be very much longer, depending on the content that is included.