Sw4   >   Namingconventions   >   Naming Conventions (All Contents)
StudioWorks uses the naming conventions which are documented under the
This section covers addition naming conventions specific to StudioWorks. group.The following are StudioWorks reserved class names:
The StudioWorks framework has some default class names which you can use to your advantage. By following these default class names you can reduce the amount of code you write.
The StudioWorks framework automatically generates two window instance IDs (WinInstID) for every server table based schema class in each library.
Each auto generated WinInstID is mapped to a SQL class. The SQL class can either be a query class or a schema class. The StudioWorks framework looks for and maps to either a query class or schema class as follows:
The WinInstID is mapped to the first SQL class which it finds in the order of the above list. If you decide to add a query class later on, you simply need to
, and StudioWorks will automatically map the applicable WinInstID to the new query class.For simple tables, you might never need to create a query class, letting StudioWorks map to the schema class.
For more complex tables you will want to create a List query class to reduce the number or columns, control the order of columns, and/or join to other tables.
For more complex tables you will want to create an Edit query class to control the order of columns, and/or join to other tables.
Each auto generated WinInstID is mapped to a window class. The StudioWorks framework looks for a window class that is the name of the WinInstID prefixed by the letter w. If not found, StudioWorks defaults to using an wList_autoconfig or wEdit_autoconfig as applicable.
The StudioWorks framework does not require you to use the default class naming conventions. You can name your WinInstIDs and classes whatever names you like, but following the default class naming conventions saves you declaring and maintaining the basic class names.Composite class names combine several class names.
As you develop query classes which join several schema classes or window classes which contain subwindow window instances you will face the dilemma of deciding on a naming convention for composite class names.
The following StudioWorks naming convention has been developed for composite class names.
For this section we will use the StudioWorks community contacts module (swcContacts4) which has a number of composite classes.
We will limit our discussion to the following tables in the contacts module:
The contacts module maps the following schema classes to the tables:
The contacts module has the following
query classes which map to WinInstIDs.The following basic window classes map to the WinInstIDs:
Things get a bit more complicated when we combine basic window classes inside container window classes.
The naming convention for a composite WinInstID and its container window class is to list each contained WinInstID in the intended order of use. We we easily see from the WinInstID, OrgEditOrgpersonList, that it contains the WinInstID, OrgEdit, and the WinInstID, OrgpersonList.
The composite class names naming convention is only a guideline. If you get into a composite class that has many subwindow the above naming convention gets very messy and you will need to come up with a name that as clearly as possible states what the window class accomplishes.
For example, in the swcTasks module, there is a composite window that has 5 subwindows. The window allows use to view and select any projects, categories, and project member. It lists the tasks for the selection and allows the user to edit, add, delete tasks. This composite window has been named, wTaskViewer.
You may have a situation where you have a shell window which contains numerous subwindows. The swBase4 is a good example of a shell window. It uses a tab pane object with each tab instantiating a different subwindow. I had tried several different names for the shell window. (wDBAdminShell, wDBAdminContainer, wDBAdminTabs). Eventually, I found it was cleanest to simply name the shell window, wDBAdmin. In the the wDBAdmin window class nicely sorts above all the subwindows.
Meaningful class names are important for making it easier for yourself and other developers to read your code. Deciding what to name a composite window class can be difficult. Hopefully the naming conventions and recommendations in this section will help you to that end. Remembers, these are guidelines, not rules. window inThere may be situations where you use a substitute string table for a certain table.
An example of this is in the StudioWorks community contacts module. In this module the Org table is used for storing organizations and households.
In the sOrg schema meta-data the OrgName column label is Organization Name.
For presenting household records a substitute string table sHousehold_stb is used. In the sHousehold_stb schema class the OrgName column label is Household Name.
Special query classes are created which have their Household. (See )
meta-data value set toThe naming convention for the substitute classes is to replace the base table name with the substitute base name. So for the household related classes, Org is replaced with Household as follows:
If you want to create a series of classes which list and edit both the base and substitute records you would concatenate the base name and the substitute name. To include organization and household records in the same list we would create classes and declare window instances as follows: