ヘキサゴナルアーキテクチャとは?
ヘキサゴナルアーキテクチャは、ポートとアダプターとも呼ばれ、ビジネスロジックを中心に置き、ポートと呼ばれる定義されたインターフェースを通じてのみ外部の世界とやり取りさせます。アダプターは、データベース、キュー、HTTP API といった特定の技術に対してこれらのポートを実装します。中核はどの具体的なアダプターが接続されているかを意識しません。
なぜ重要か
中核をインフラから疎結合にすることで、単独でテスト可能になり、技術をまたいで差し替えできるようになります。ビジネスルールに触れることなく、新しいアダプターを書くだけで database や transport を置き換えられます。
関連ガイド
What Are Ports and Adapters?Ports and adapters is the pattern where an application defines interface ports for its needs and adapters imp…
What Is Clean Architecture?Clean architecture organizes code into concentric layers where dependencies point inward, keeping business ru…
What Is Dependency Inversion?Dependency inversion is the principle that high-level modules and low-level details should both depend on abs…