-
-
Save morisono/e146830f74fc093091b4196db708602f to your computer and use it in GitHub Desktop.
Revisions
-
corlaez revised this gist
Oct 18, 2021 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -65,12 +65,13 @@ https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 * [Ports and Adapters on c2 wiki](http://wiki.c2.com/?PortsAndAdaptersArchitecture) * [Hexagonal Architecture on Alistair's webpage](https://alistair.cockburn.us/hexagonal-architecture/) * Talks by Jakub Nabrdalik: * ["Hexagonal Architecture in practice"](https://www.youtube.com/watch?v=sOaS83Ir8Ck) * ["Improving your Test Driven Development in 45 minutes"](https://www.youtube.com/watch?v=2vEoL3Irgiw) * [Excalidraw Library](https://libraries.excalidraw.com/?target=_excalidraw&referrer=https%3A%2F%2Fexcalidraw.com%2F&useHash=true&token=ggP8dbrNZlW57BKaDFrd5&theme=light&sort=default#corlaez-hexagonal-architecture) used to create the diagrams shown here. * Implementation examples: * [Github Java Example](https://github.com/jakubnabrdalik/hentai) by Jakub Nabrdalik (Spring, HTTP API, Repository) * [Replit Java Example](https://replit.com/@lrn2prgrm/HexagonalArchitectureExample) by me (0 libraries, Console, System Time, Random) -
corlaez revised this gist
Oct 14, 2021 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,16 +40,18 @@ Based on talks by Jakub Nabrdalik. There are multiple ways to implement the ideas of this architecture this is by no means the only one. This implementation is modular and as such it can scale to implement a modular monolith (modulith). * Each module is an Hexagonal Architecture "Hexagon" (It has ports, adapters and use cases). * There is a heavy use of package-private and a minimal, thoughtful use of public. * Subjects Under Test in your unit tests are Primary adapters (mocking the Primary Port), the DTOs (if needed) and the Primary Port (using fakes and mocking other modules) * Each module has a Configuration file that assembles the classes together for production and testing use. #### Additional notes on implementation * In the following example I decided to move `customerconsole` package outside of the customer module because it required it's own module configuration. However, there is nothing stopping the package to remain as a folder inside of `com.abc.project.customer` * Depending on the library choice or code implementation, your primary adapters may need to be public. Jakub's package-private controllers are possible because he uses the Spring framework. * Primary adapters expose an API to an external agent so you may want to treat them as a public API regardless of the access modifier used for the class  -
corlaez revised this gist
Oct 14, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ## Hexagonal Architecture Conceptualized by Alistair Cockburn. Also known as "Ports and Adapters". In a nutshell: -
corlaez revised this gist
Oct 14, 2021 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -59,14 +59,16 @@ https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 ## Useful Links: * Articles by Alistair Cockburn: * [Hexagonal Architecture on c2 wiki](http://wiki.c2.com/?HexagonalArchitecture) * [Ports and Adapters on c2 wiki](http://wiki.c2.com/?PortsAndAdaptersArchitecture) * [Hexagonal Architecture on Alistair's webpage](https://alistair.cockburn.us/hexagonal-architecture/) * ["Hexagonal Architecture in practice"](https://www.youtube.com/watch?v=sOaS83Ir8Ck) and ["Improving your Test Driven Development in 45 minutes"](https://www.youtube.com/watch?v=2vEoL3Irgiw) by Jakyb Nabrdalik * [Excalidraw Library](https://libraries.excalidraw.com/?target=_excalidraw&referrer=https%3A%2F%2Fexcalidraw.com%2F&useHash=true&token=ggP8dbrNZlW57BKaDFrd5&theme=light&sort=default#corlaez-hexagonal-architecture) used to create the diagrams shown here. * Implementation examples: * [Github Java and Spring](https://github.com/jakubnabrdalik/hentai) by Jakub Nabrdalik (Spring, HTTP API, Repository) * [Replit Java](https://replit.com/@lrn2prgrm/HexagonalArchitectureExample) by me (0 libraries, Console, System Time, Random) -
corlaez revised this gist
Oct 14, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,7 +32,7 @@ They deal with with side effects such as: communication outside of the system, r ## Hexagonal Architecture - Modular Implementation Based on talks by Jakub Nabrdalik.  @@ -63,7 +63,7 @@ https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 * * [Ports and Adapters on c2 wiki](http://wiki.c2.com/?PortsAndAdaptersArchitecture) * * [Hexagonal Architecture on Alistair's webpage](https://alistair.cockburn.us/hexagonal-architecture/) * ["Hexagonal Architecture in practice"](https://www.youtube.com/watch?v=sOaS83Ir8Ck) and ["Improving your Test Driven Development in 45 minutes"](https://www.youtube.com/watch?v=2vEoL3Irgiw) by Jakyb Nabrdalik * [Github Java Example Implementation](https://github.com/jakubnabrdalik/hentai) by Jakub Nabrdalik (Spring, HTTP API, Repository) -
corlaez revised this gist
Oct 14, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -67,6 +67,6 @@ https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 * [Github Java Example Implementation](https://github.com/jakubnabrdalik/hentai) by Jakub Nabrdalik (Spring, HTTP API, Repository) * [Replit Runnable Java Example with Tests](https://replit.com/@lrn2prgrm/HexagonalArchitectureExample) by me (0 libraries, Console, System Time, Random) * [Excalidraw Library](https://libraries.excalidraw.com/?target=_excalidraw&referrer=https%3A%2F%2Fexcalidraw.com%2F&useHash=true&token=ggP8dbrNZlW57BKaDFrd5&theme=light&sort=default#corlaez-hexagonal-architecture) Excalidraw library used to create the diagrams shown here. -
corlaez revised this gist
Oct 13, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -63,7 +63,7 @@ https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 * * [Ports and Adapters on c2 wiki](http://wiki.c2.com/?PortsAndAdaptersArchitecture) * * [Hexagonal Architecture on Alistair's webpage](https://alistair.cockburn.us/hexagonal-architecture/) * [Youtube Talk "Hexagonal Architecture in practice"](https://www.youtube.com/watch?v=sOaS83Ir8Ck) by Jakyb Nabrdalik * [Github Java Example Implementation](https://github.com/jakubnabrdalik/hentai) by Jakub Nabrdalik (Spring, HTTP API, Repository) -
corlaez revised this gist
Oct 13, 2021 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,7 +58,10 @@ https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 ## Useful Links: * Articles by Alistair Cockburn: * * [Hexagonal Architecture on c2 wiki](http://wiki.c2.com/?HexagonalArchitecture) * * [Ports and Adapters on c2 wiki](http://wiki.c2.com/?PortsAndAdaptersArchitecture) * * [Hexagonal Architecture on Alistair's webpage](https://alistair.cockburn.us/hexagonal-architecture/) * [Youtube Talk](https://www.youtube.com/watch?v=sOaS83Ir8Ck) by Jakyb Nabrdalik -
corlaez revised this gist
Oct 13, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,7 +58,7 @@ https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 ## Useful Links: * Articles by Alistair Cockburn: [Hexagonal Architecture on c2 wiki](http://wiki.c2.com/?HexagonalArchitecture), [Ports and Adapters on c2 wiki](http://wiki.c2.com/?PortsAndAdaptersArchitecture), [Hexagonal Architecture on Alistair's webpage](https://alistair.cockburn.us/hexagonal-architecture/) * [Youtube Talk](https://www.youtube.com/watch?v=sOaS83Ir8Ck) by Jakyb Nabrdalik -
corlaez revised this gist
Oct 13, 2021 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,7 +38,14 @@ Based on talks by Jakub Nabrdalik such as https://www.youtube.com/watch?v=2vEoL3 ### Modules Project Structure There are multiple ways to implement the ideas of this architecture this is by no means the only one. This implementation is modular and as such it can scale to implement a modular monolith (modulith). * Each module is in itself following the Hexagonal Architecture. * There is a heavy use of package-private and a minimal, thoughtful use of public. * Subjects Under Test in your unit tests are Primary adapters (mocking the Primary Port), the DTOs (if needed) and the Primary Port (using fakes and mocking other modules) * Each module has a Configuration file that assembles the classes together for production and testing use. #### Additional notes on implementation * In the following example I decided to move customerconsole package outside of the customer module because it required it's own module configuration. However there is nothing stopping that package to remain as a folder inside of `com.abc.project.customer` -
corlaez revised this gist
Oct 13, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,7 +42,7 @@ There are multiple ways to implement the ideas of this architecture this is by n * In the following example I decided to move customerconsole package outside of the customer module because it required it's own module configuration. However there is nothing stopping that package to remain as a folder inside of `com.abc.project.customer` * Depending on the library choice or code implementation, your primary adapters may be required to be public. Jakub's package-private controllers are possible because he uses the Spring framework. Furthermore, primary adapters expose an API to an external agent so you may want to think about it as a public API regardless of the access modifier used for the class.  -
corlaez revised this gist
Oct 13, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -40,9 +40,9 @@ Based on talks by Jakub Nabrdalik such as https://www.youtube.com/watch?v=2vEoL3 There are multiple ways to implement the ideas of this architecture this is by no means the only one. This implementation is modular an can scale to implement a modular monolith (modulith). * In the following example I decided to move customerconsole package outside of the customer module because it required it's own module configuration. However there is nothing stopping that package to remain as a folder inside of `com.abc.project.customer` * Depending on the library choice or code implementation, your primary adapters may be required to be public. Jakub's package-private controllers are possible because he uses the Spring framework. Furthermore, primary adapters apen up an API to an external actor so you may want to think about it as a public API regardless of the access modifier used for the class.  -
corlaez revised this gist
Oct 13, 2021 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,21 +16,20 @@ They define the business rules and they should not depend on code related on how ### Ports They expose the ways in which the use cases can be reached (primary) or reach to (secondary) to the outside world. They are technology agnostic.  ### Adapters They deal with with side effects such as: communication outside of the system, random generation, current time, etc.  ### Port and Adapter Implementation  ## Hexagonal Architecture - Modular Implementation Based on talks by Jakub Nabrdalik such as https://www.youtube.com/watch?v=2vEoL3Irgiw @@ -39,9 +38,11 @@ Based on talks by Jakub Nabrdalik such as https://www.youtube.com/watch?v=2vEoL3 ### Modules Project Structure There are multiple ways to implement the ideas of this architecture this is by no means the only one. This implementation is modular an can scale to implement a modular monolith (modulith). (*) In the following example I decided to move customerconsole package outside of the customer module because it required it's own module configuration. However there is nothing stopping that package to remain as a folder inside of `com.abc.project.customer` (*) Depending on the library choice or code implementation, your primary adapters may be required to be public. Jakub's package-private controllers are possible because he uses the Spring framework. Furthermore, primary adapters apen up an API to an external actor so you may want to think about it as a public API regardless of the access modifier used for the class.  -
corlaez revised this gist
Sep 29, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -54,8 +54,8 @@ https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 * [Youtube Talk](https://www.youtube.com/watch?v=sOaS83Ir8Ck) by Jakyb Nabrdalik * [Github Java Example Implementation](https://github.com/jakubnabrdalik/hentai) by Jakub Nabrdalik (Spring, HTTP API, Repository) * [Replit Runnable Java Example with Tests](https://replit.com/@lrn2prgrm/HexagonalArchitectureExample) by me (0 libraries, CLI, System Time, Random) * [Excalidraw Library](https://libraries.excalidraw.com/?target=_excalidraw&referrer=https%3A%2F%2Fexcalidraw.com%2F&useHash=true&token=ggP8dbrNZlW57BKaDFrd5&theme=light&sort=default#corlaez-hexagonal-architecture) Excalidraw library used to create the diagrams shown here. -
corlaez revised this gist
Sep 29, 2021 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,10 +50,12 @@ https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 ## Useful Links: * Articles by Alistair Cockburn: [1](http://wiki.c2.com/?HexagonalArchitecture), [2](http://wiki.c2.com/?PortsAndAdaptersArchitecture), [3](https://alistair.cockburn.us/hexagonal-architecture/) * [Youtube Talk](https://www.youtube.com/watch?v=sOaS83Ir8Ck) by Jakyb Nabrdalik * [Github Java Example Implementation](https://github.com/jakubnabrdalik/hentai) by Jakub Nabrdalik (Spring) * [Replit Runnable Java Example with Tests](https://replit.com/@lrn2prgrm/HexagonalArchitectureExample) by me (0 libraries) * [Excalidraw Library](https://libraries.excalidraw.com/?target=_excalidraw&referrer=https%3A%2F%2Fexcalidraw.com%2F&useHash=true&token=ggP8dbrNZlW57BKaDFrd5&theme=light&sort=default#corlaez-hexagonal-architecture) Excalidraw library used to create the diagrams shown here. -
corlaez revised this gist
Sep 29, 2021 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,24 +31,24 @@ They deal with the code that communicates outside of the system.  ## Hexagonal Architecture - Modular Implementation Based on talks by Jakub Nabrdalik such as https://www.youtube.com/watch?v=2vEoL3Irgiw  ### Modules Project Structure Based on Jakub Nabrdalik's talks About Hexagonal Architecture and TDD. (*) In the following example I decided to move customerconsole package outside of the customer module because it required it's own module configuration. However there is nothing stopping that package to remain as a folder inside of `com.abc.project.customer`  ### Module configuration and it's relationship with mock testing: https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 ## Useful Links: * https://alistair.cockburn.us/hexagonal-architecture/ by Alistair Cockburn -
corlaez revised this gist
Sep 29, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -56,4 +56,4 @@ https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 * https://github.com/jakubnabrdalik/hentai example repo by Jakub Nabrdalik (Spring) * https://replit.com/@lrn2prgrm/HexagonalArchitectureExample by me (0 libraries) -
corlaez revised this gist
Sep 28, 2021 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -47,3 +47,13 @@ Based on Jakub Nabrdalik's talks About Hexagonal Architecture and TDD. #### Module configuration and it's relationship with mock testing: https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051 #### Useful Links: * https://alistair.cockburn.us/hexagonal-architecture/ by Alistair Cockburn * https://www.youtube.com/watch?v=sOaS83Ir8Ck talk by Jakyb Nabrdalik * https://github.com/jakubnabrdalik/hentai example repo by Jakub Nabrdalik (Spring) * https://replit.com/@lrn2prgrm/ForthrightUniformCustomization#race/Race.java by me (0 libraries) -
corlaez revised this gist
Sep 23, 2021 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,6 +26,11 @@ They deal with the code that communicates outside of the system.  ### Port and Adapter Implementation  ### Modules Based on talks by Jakub Nabrdalik such as https://www.youtube.com/watch?v=2vEoL3Irgiw -
corlaez revised this gist
Sep 23, 2021 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,10 @@ Conceptualized by Alistair Cockburn initially under the name "Ports and Adapters". In a nutshell: ``` Application Driver -> Primary Adapter -> Primary Port -> Use Case -> Secondary Port -> Secondary Adapter -> External System/Side Effect ```  @@ -30,8 +33,11 @@ Based on talks by Jakub Nabrdalik such as https://www.youtube.com/watch?v=2vEoL3  #### Modules Project Structure Based on Jakub Nabrdalik's talks About Hexagonal Architecture and TDD. (*) In the following example I decided to move customerconsole package outside of the customer module because it required it's own module configuration. However there is nothing stopping that package to remain as a folder inside of `com.abc.project.customer`  #### Module configuration and it's relationship with mock testing: -
corlaez created this gist
Sep 23, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ ## Hexagonal Architecture Conceptualized by Alistair Cockburn initially under the name "Ports and Adapters". In a nutshell: Application Driver -> Primary Adapter -> Primary Port -> Use Case -> Secondary Port -> Secondary Adapter -> External System/Side Effect  ### Use Cases They define the business rules and they should not depend on code related on how the system communicates with the outside world. Throught the use of Ports and Adapters the Use Cases can be reliably tested and change mainly if the business rules change ### Ports They expose the ways in which the use cases can be reached (primary) or reach to (secundary) to the outside world. They are technology agnostic.  ### Adapters They deal with the code that communicates outside of the system.  ### Modules Based on talks by Jakub Nabrdalik such as https://www.youtube.com/watch?v=2vEoL3Irgiw  #### Modules Project Structure Based on Jakub Nabrdalik's talks About Hexagonal Architecture and TDD.  #### Module configuration and it's relationship with mock testing: https://gist.github.com/corlaez/aa2c1a657438f5c998af9340a3339051