Granularity can be understood as the division level at which objects are built. To address in terms of classification high and low:
Granularity low is the division into many details of objects, commonly with many compositions and few attributes per object; granularity high is the grossest level, objects are left with many attributes and few relations.
I make a parallel with the representation of fiscal notes in some corporate systems, maintained with two objects: NotaFiscalNaoEmitida
and NotaFiscalEmitida
. It seems to me a good example because it deals with two extremes of the same data and is consistent with this brief reference:
Building objects at the lowest granularity level provides optimal flexibility, but can be unacceptable in terms of performance and memory usage. (free translation)
The first has only a few fields of the invoice and refers to dozens of other entities as Cliente
, Produto
, Empresa
, Endereco
, Imposto
, etc. Has granularity low.
Once issued and no longer modified, and for performance purposes, historical consistency and storage simplicity, the NotaFiscalEmitida
has a copy of all relationship information stored on a single row of the database. The object has an absurd configuration with more than a hundred fields and no relation, but is totally independent of any other entity and self-contained in its data. Has granularity high.
As it was not I who wrote the text , I leave here the link with a good example. https://www.componentsource.com/pt-br/help-support/about-us/components
– brielga
The link says that granularity has to do with componentization, but I think they’re different things.
– Ivan Ferrer