Fields should not have public accessibility


    This rule states that fields in PowerBuilder code should not be made publicly accessible. This means that they should not be declared as public variables, and should instead be declared as private or protected variables. This is important because making fields publicly accessible could open up the code to potential security risks, as it would allow external code to access and modify the fields without any restrictions. It is also important to ensure that fields are only accessible by code that is within the same class, as this will help to ensure that the code is secure and that it is only modified in the intended way.

Key Benefits

  • Improved Security: By limiting access to certain fields, the security of your data is improved.
  • Enhanced Data Integrity: By preventing unauthorized users from accessing sensitive information, the integrity of your data is maintained.
  • Reduced Risk of Data Breaches: By limiting access to certain fields, the risk of data breaches is reduced.
  • Improved Performance: By limiting access to certain fields, the performance of your system is improved.


Non-compliant Code Example

type variables
private double id_seconds
public string id // 'Public' is not compliance
public int cnt // 'Public' is not compliance
end variables
Visual Expert 2024