Coupling between objects (CBO)
Title short form | CBO |
Categories | Maintainability, reusability |
Definition | Number of additional function blocks that are instantiated and used in a function block |
Further information | CBO = Coupling Between Objects A function block with a high level of coupling between objects is likely to be involved in many different tasks and therefore violates the principle of clear responsibility. |
Standard upper limit for the associated rule SA0179: Coupling between objects | 30 |
Sample:
FUNCTION_BLOCK FB_Base
VAR
fb3 : FB3; // +1 instantiated here
END_VARFUNCTION_BLOCK FB_Sub EXTENDS FB_Base // +0 for EXTENDS
VAR
fb1 : FB1; // +1: instantiated here
fb2 : FB2; // +1: instantiated here
END_VARfb3(); // +0: instantiated in FB_Base, no increment for call- The extension of a function block does not increase the coupling between objects.
- fb3 is instantiated in the implementation of
FB_Baseand inherited byFB_Sub. The call inFB_Subdoes not increase the coupling between the objects. - The metric Coupling Between Objects for
FB_Subis therefore : 2