Strict Private Methods is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Strict Private Methods
API ID: CountDeclMethodStrictPrivateLanguages: Pascal
Targets: Architectures, Classes, Project
Number of local strict private methods.
Object Pascal's strict private is narrower than plain private: a plain private member is visible to any code in the same unit (file), while a strict private member is only visible within the declaring class itself.
For example:
unit sample;
interface
type
TShape = class(TPersistent)
strict private
FArea: Double;
procedure CalcArea;
strict protected
procedure Resize;
published
procedure NotifyChanged;
public
property Area: Double read FArea write FArea;
end;
implementation
procedure TShape.CalcArea;
begin
FArea := 0;
end;
procedure TShape.Resize;
begin
end;
procedure TShape.NotifyChanged;
begin
end;
end.
CalcArea is declared strict private, giving CountDeclMethodStrictPrivate = 1.
See Private Methods for the plain (non-strict) access level, Strict Protected Methods for the other strict access level, and Published Methods for Object Pascal's public-with-RTTI level.
Targets By Language:- Pascal: Project, Class, Interface
- For projects and architectures, this metric must also be enabled from "Project Configuration/Metrics/Projects and Architectures" with the "Show aggregated class metrics" option. Enabling this option can be time consuming.
- This metric can be disabled from "Project Configuration/Metrics/Object Orientated" with the "Show method and variable count metrics" option.