polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kent Sølvsten <kent.soelvs...@gmail.com>
Subject What is the meaning of @Structure anyway?
Date Thu, 30 Nov 2017 07:08:05 GMT
In another thread was written:

> > I think there is no need for a "LoggerFactory" (I could be wrong), but
> > that
> > > we simply introduce a few types to be injectable in @Structure scope,
> > each
> > > dedicated for the purpose, instead of the generic "log" that is
> prevalent
> > > in logging systems deriving from Log4j.
> >
> >
> > Very much agree that we should avoid another Factory. But I actually
> would
> > prefer the types to @Service instead of @Structure - more like eg.
> > EntityStores.
> >
> The reason I wanted @Structure is to capture the caller's module, rather
> than the service's. And that the implementation ends up being a @Service,
> just like UnitOfWork ends up delegating to services.
> But, when thinking about it, UnitOfWorkFactory is now optionally a Service.
> So, I should check how the @Structure semantics are handle or if there is a
> design flaw, and if it is done correctly, perhaps use the same mechanism.

It dawned on me, that I may not have understood the exact meaning of the
What is the meaning of using @Structure as opposed to @Service.

When should a "singleton" be a service, when should it be a structure?

So far I have more or less thought of the Structure-stuff as
Some of them (application/layer/module) ARE the application-structure

Others are service-like constructs, which are part of the modules (and
actually implemented by the module itself).

But should I just focus on "part-of-the-calling-module" instead?

Maybe a "thing" injected with @Structure should simply be considered as
"belongs-to-the-module-using-it" regardless of how it is declared ....

Meaning that if we had an application structure like:

Module1: Service1, Service3a
Module2: Service2, Service3b
Module3: Structure

with Service1 and Service2 depending on the Structure, and the Structure
depending on "Service3" (with instances in both modules) then the
dependency graph would actually be:

Service1 -> Structure -> Service 3a
Service2 -> Structure -> Service3b

I have been missing a feature such as
Maybe this interpretation of the meaning of @Structure is it?

So maybe we are actually just missing a feature likke adding a "Structure"
to a ModuleAssembly.

With that focus, we could think of all the existing "default" structures
(ValueBuilderFactory, UOWFactory ....) as the application automatically
having a "secret" module with these structure-things - and that *could*
hint at a way of customizing these things?

Am i making sense or just babblling here?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message