I have a problem understanding the meaning of dependence in the hexagonal (port adapter) architecture.
They are good pictures, what I do not see is that difference (implementation) from the n-layer structure.
The internal layers in the onion / hex architecture should be separated from the external , but how it has been implemented (please refer to my Java / Spring Background Note Do)
In N-layered you have the auto wire of N + 1 layer components. I look at the direction of dependence, but how can you get it back: - /
If I'm going to call then I'll use the interface. So the interface is in the interior layer and in the implementation. Now I'm free on the outset this thing? Where is it just about the API?
Nevertheless the hex / onion should be independent of the dependency proposal, this means that I should not use @tevoyeware, @ injection etc ??
Thank you very much for clarification in advance.
Wow, this is a lot of questions, / P>
The outer layers in the onion / hex architecture should be independent of the internal ones, but how it has been implemented (please note my java / spring background)
With the pattern of architecture you see very different interpretations, but this one hit me as weird Receiving the inner part of an onion pattern your domain logic, while the outer parts are adapted to other domains or technologies (database, Vebsrvisej ...). You do not want your domain to depend on those technical details, so the outer part may depend on the internal part, but not in other ways.
N-layered You see the direction of dependence of the N + 1 layer layer components in the auto-wire, but how can you return it: - /
It is called the reverse of control. Your domain (internal part) is often required to call the adapter (like your database access logic), hence there should be dependency on run-time, but when compiling time, Do not want to depend on, to be used to know To replace specific technology You do this by using the interface and dependency injection. Example: Your domain may need access to a list of all brands For this purpose, you create an interface like this:
Public Interface Brandripority {Public Set [Brand] All () }
This interface is your domain. You certainly implement that interface, perhaps based on Jdbc (or in-memory-list, or web service). These implementations remain in the outer layers of onions. Since the interface is implemented, it is up to the internal part, as requested.
If I'm going to call an external layer, then I'll use the interface. So the interface is in the interior layer and in the implementation. Now I'm free on the outset this thing?
Yes
Is this just about where the API is kept?
Difficult to answer: What is your API? The API adapter for your domain model adapter is the API of your system or other parts of other systems.
Still the hex / onion dependency should be independent of the offer, does it mean that I should not use @tevoyeware @ inject etc.?
Now that there can be a debate for ages, speaking those annotations strictly depends on your de-framework. But since they become standardized, they become more of dependence for your language (which you can participate without any infinite reconstruction and can not survive without collecting many experiences in language design). Dependency on interpretations, which can not include any implementation in the definition, is not more of a problem, and I am personally fine with keeping them in my code.
What I'm not seeing is the difference (implementation) from the n-layer structure.
An onion structure is a distinct variation of the general term rather than a n-layer architecture.
No comments:
Post a Comment