Naming Best Practices

From JRapid

Jump to: navigation, search

Make your JRapid projects easier to read and understand by following a few guidelines.

Following naming best practices makes applications more understandable by making them easier to read. By following these practices a developer can also give information about the function of an identifier which can be helpful in understanding the code.

The guidelines described in the next article take into account the different parts of the underlying generated code that each name will take, thus, making it comply with the conventions of the related technologies.

Contents

Entities

Entity names should be singular nouns, in mixed case with the first letter of each internal word capitalized. Entities must not contain spaces and should not contain underscore "_" characters. Although this last point is allowed due to backwards compatibility with legacy databases. Examples of entitiy names are: Company, InvoiceLine and SaleState.

Properties

Property names should be mixed case with a lowercase first letter and internal words should start with capital letters. Properties must not contain spaces and should not contain underscore "_" characters. Examples of property names are: name, phoneNumber and fromTime.

Transient Entities

Transient entities should follow the same guidelines as entities but with the difference that in general, verbs will suit better than nouns for their names. Examples of transient entitiy names: LoadCompanySale, DoLottery and SelectPrintingTemplate.

Listings

Listing names should be written in mixed case with a lowercase first letter and the first letter of each internal word capitalized. Examples of listing names: activePersonnelListing and approvedSalesListing.

Defaultsets

Defaultset names should be written in mixed case with a lowercase first letter and the first letter of each internal word capitalized. Another tip is to start their names with "for", meaning the instance of the entity created using this defaultset is created for some parameter. For example, a Sale entity could include the "forCompany" defaultset to create a new sale for a determined company.

Subsets

Subset names should be written in mixed case with a lowercase first letter and the first letter of each internal word capitalized. Here, again a nice tip is to start their names with "for", meaning the sub list of an entity records is being filtered for some parameter. A good example is the Employee "forCompany" subset that filters the records of the former for a particular company.

Actions

Action names should be written in mixed case with a lowercase first letter and the first letter of each internal word capitalized. Action names usually describe better their purpose by using verbs. Examples are: disable, makeQuestion and approveRequest.

Reports

Report names follow the same guidelines as entities. Examples of report names are: TaskList, SalesChart and InvoiceReport.

Panels

In the case of panels, it's a good practice to use mixed case with the first letter of each internal word capitalized for their names, just like entities. Examples are: Index, AdminDesktop and MainIndex.

Filters

Filter names should take into account the same tips described for properties.


See also

Personal tools