Applying the Gestalt Principles to Code
The example below shows three versions of the same class, that has 3 fields and a constructor. It’s a little bit of a stretch to tie it into this law, but in the version above our eye doesn’t close the newlines to form a whole, so removing these newlines helps us to see a single class at first glance, then allowing us to read the properties if needed. The second version doesn’t suffer from this problem, and we have good form achieved at the same time, where the characters get ignored by the eye, rather than impede our reading of the code as in first version.
Source: yetanotherchris.dev