Is it only the difference between the black box and the white one that only interfaces can be specified for the first, while for the second we can display the internal structure?enter image description hereOn the diagram I showed my vision of the differences in the boxes. Is it correct?enter image description here

2

Best Answer


A black box is, as the name says, black inside. You can't see what is inside. In contrast a white box shows anything inside. It depends on the use case which one to prefer.

You often get a black box when you buy a product from a company. They hide what exactly is inside and how they made it. Open source in contrast is a white box.

Notably your white box isn't all that white. It's more grey. You don't see which part is responsible for which interface.

Please also note that the terms black/white box are not UML terms but were born a long time before anyone thought of UML or objects. See also here: https://en.wikipedia.org/wiki/Black_box

Every component can be drawn either as a black box or as a white box. If you draw a component as a black box, you don't show its internals, only its interface(s). If you draw the same component as a white box, you do show its internals.

Both diagrams are valid UML diagrams. In the first diagram, only little information is given about the internals of White Box, so you might say that it is not a pure white box, but there is no strict definition of 'white box'.