3 ms·
A port IS just a service facade/interface. An adaptor IS just a specific implementation of a service. Think of P&A as terminology to help you disambiguate thes
by macca321 9y ago
A port IS just a service facade/interface. An adaptor IS just a specific implementation of a service.
Think of P&A as terminology to help you disambiguate these use cases from the extremely overloaded words. If your team know these terms, it makes a lot of discussions a lot clearer.
The hexagon thing is a bit of a red herring IMO. I think of it as dependency inversion at the module level, rather than the class level.
- derriz 9y agoIn what way is the term "service facade/interface" overloaded? I've never encountered confusion (or been confused) by its usage in the context of discussing software development. On the other hand, "port" is already completely overloaded: serial interface, TCP socket endpoint, etc. Further overloading it - particularly when there is a widely used term for the same thing - makes no sense. Reinventing terms for existing concepts does nothing - in my mind - to advance the state of art.
- macca321 9y agoOK, an example: a LOT of .NET/Java codebases have these (IMO smelly) constructs: class FooService : IFooService{} interface IFooService {} where there is an interface with a single implementation. In this case, the "service interface" isn't a port, because it's not actually decoupled from the domain. It has the potential to be one, but only if the FooService is extracted, dereferenced from the domain, and the application composes the FooService. Saying "we need to make this into a port and adapter" gets the point across very quickly.
- Spearchucker 9y agoThanks for that explanation, I think I get that. The part that still worries me though, is how absolutely everything in the app is decoupled, even where tighter coupling makes sense, like where the coupling doesn't pass through a security boundary. Also not sure how the terms facade and interface are overloaded?