Is the composition bad for verification?

Are composition and aggregation usually treated the same? But they are different, and the choice to be used varies a lot? For example, for example:

I believe that aggregation would be ideal for testing. But there is no composition.

Maintaining addictions is pain when using aggregation, but less use of composition.

Are there any similar views on the same? which to choose if it is based only on "partial" and "has-a."

+3
source share
3 answers

Aggregation, i.e. point-to, has-a-handle, has more degrees of freedom than composition, i.e. contains.

, : , , , , .

(, ++), , .

, .

: , , . , , .

, , . . , , , .

, , , 1000 , , .

+2

, , .

, :

:

:

: , .

.

, , , . , , , . / . , . .

0

unit test , , , , .

That is, if you check from the bottom up, there may be no problems with testability. When testing composition elements, you drown out the compiled block (with a test harness), and not vice versa. Testing the assembled units then uses specific units, not stubs.

0
source

Source: https://habr.com/ru/post/1763399/


All Articles