Skip to content

Instantly share code, notes, and snippets.

@kbilsted
Last active November 13, 2022 00:38
Show Gist options
  • Save kbilsted/abdc017858cad68c3e7926b03646554e to your computer and use it in GitHub Desktop.
Save kbilsted/abdc017858cad68c3e7926b03646554e to your computer and use it in GitHub Desktop.

Revisions

  1. kbilsted revised this gist Sep 24, 2020. 1 changed file with 1 addition and 109 deletions.
    110 changes: 1 addition & 109 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -1,109 +1 @@

    # 1. Separation of immutable and mutable logic
    Quite a lot of different people have been on the same trail of thought. Gary Bernhardt's formulation of a *"functional core, imperative shell"* seems to be the most voiced.



    ### "Boundaries" - Gary Bernhardt
    *"Imperative shell" that wraps and uses your "functional core".. The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately. Functional core — Many fast unit tests. Imperative shell — Few integration tests*

    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell

    ### There are only two roles of code - John Sonmez
    *All code can be classified into two distinct roles; code that does work (algorithms) and code that coordinates work (coordinators).*
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/

    ### Object layer, valuelayer - Andy Matuschak
    *Great talk, but specifically on the separation of side-effects at the at the 27 minutes 53 seconds mark.*
    https://realm.io/news/andy-matuschak-controlling-complexity/


    ### A Modern Architecture for FP - John A De Goes
    *Interpreters of the functional core*
    http://degoes.net/articles/modern-fp
    http://degoes.net/articles/modern-fp-part-2


    ### Hexagonal architecture - Alistair Cockburn
    *Hexagonal Architecture is an architecture defined by establishing a perimeter around the domain of your application and establishing adapters for input/output interactions. By establishing this isolation layer, the application becomes unaware of the nature of the things it's interacting with.*

    *Create your application to work without either a UI or a database so you can run automated regression-tests against the application, work when the database becomes unavailable, and link applications together without any user involvement.*

    http://alistair.cockburn.us/Hexagonal+architecture
    https://github.com/jschairb/sandbox/wiki/HexagonalArchitecture



    # 2. Test isolation - nomock
    Growing Object-Oriented Software, Guided by Tests Without Mocks - Vladimir Khorikov
    http://enterprisecraftsmanship.com/2016/07/05/growing-object-oriented-software-guided-by-tests-without-mocks/

    Test Isolation Is About Avoiding Mocks - Gary Bernhardt
    https://www.destroyallsoftware.com/blog/2014/test-isolation-is-about-avoiding-mocks

    To Kill a Mockingtest - Ken Scambler
    http://rea.tech/to-kill-a-mockingtest/

    Mocking is Tautological - Mark Sands
    http://marksands.github.io/2014/05/14/mocking-is-tautological.html



    # 3. Blogs on Functional core, Imperative shell
    "Functional core & Imperative shell" : OO design, and isolated tests without mocks
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-oo-design-and-isolated-tests-without-mocks.html
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-explanation-with-code.html


    Business-Friendly Functional Programming, Part 2: Testability - Yang Bo
    http://rea.tech/business-friendly-functional-programming-part-2-testability/

    mokacoding - unit and acceptance testing, automation, productivity
    http://www.mokacoding.com/blog/functional-core-reactive-shell/

    Functional Core, Imperative Shell - Sean Hammond
    http://www.seanh.cc/posts/functional-core-imperative-shell

    BoochTek, LLC
    http://blog.boochtek.com/category/programming/architecture


    # 4. Reality...
    Conceptually, these are nice ideas. But how well do they ride in reality? Here are some of my experiences from C#.

    ## Frameworks
    To my knowledge, there are no frameworks readily available in which one can program. Also I would be hard pressed to figure out what such framework offer, given that the notion of purity (especially in the light of inheritance and polymorphism and partial compilation) make the problem a deeply rooted in the language, the type checker and the compiler as a whole.

    ## Separation
    Separating the core from the shell by means of namespaces is too brittle, especially with modern IDE's make it too easy for you to cross the boundaries. A better approach, perhaps, is to separate the core and the shell into different projects under the same solution. That way the code is more segregated.

    ## Purity
    Not much native support is offered from the language in term of keeping the core pure - free from side effects. Perhaps a simple method at startup could via reflection ensure that no usage of file I/O, Console I/O etc is used. The tricky part, though, is realizing just how much code we take for granted that is impure. For example `DateTime.Now` or `Guid.NewGuid()`.

    Resharper has introduced a `[pure]` attribute (https://www.jetbrains.com/help/resharper/Reference__Code_Annotation_Attributes.html#PureAttribute) but I have too little experience with it to jot anything down.

    # 5. Slides/books
    Functional Programming in Ruby - Vitor Capela
    https://speakerdeck.com/dodecaphonic/functional-programming-in-ruby

    Enemy of the State by Justin Spahr-Summers
    https://speakerdeck.com/jspahrsummers/enemy-of-the-state

    Functional Programming in Swift - slide 55+
    http://www.slideshare.net/SaugatGautam2/functional-programming-in-swift

    Test-Driven Development with Python - Harry Percival
    https://books.google.dk/books?id=fTLJAwAAQBAJ&pg=PA403&lpg=PA403&dq=%22functional+core%22+%22imperative+shell%22&source=bl&ots=A4g25w7wWY&sig=x0bu4NZWiXrpzWPziAH7Y78AKgM&hl=en&sa=X&ved=0ahUKEwi0jq3em-zPAhUqG5oKHYNJBIE4ChDoAQhRMAk#v=onepage&q=%22functional%20core%22%20%22imperative%20shell%22&f=false


    # Quotes...

    > programming, when stripped of all its circumstantial irrelevancies,
    > boils down to no more and no less than very effective thinking so as to avoid unmastered complexity,
    > to very vigorous separation of your many different concerns.
    > -- Dijkstra EDW512
    > https://www.cs.utexas.edu/users/EWD/transcriptions/EWD05xx/EWD512.html

    Moved to https://github.com/kbilsted/Functional-core-imperative-shell/blob/master/README.md
  2. kbilsted revised this gist Sep 22, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -71,7 +71,7 @@ http://blog.boochtek.com/category/programming/architecture


    # 4. Reality...
    Conceptually, there are nice ideas. How well do they ride in reality? Here are some of my experiences from C#.
    Conceptually, these are nice ideas. But how well do they ride in reality? Here are some of my experiences from C#.

    ## Frameworks
    To my knowledge, there are no frameworks readily available in which one can program. Also I would be hard pressed to figure out what such framework offer, given that the notion of purity (especially in the light of inheritance and polymorphism and partial compilation) make the problem a deeply rooted in the language, the type checker and the compiler as a whole.
  3. kbilsted revised this gist Sep 22, 2020. 1 changed file with 15 additions and 1 deletion.
    16 changes: 15 additions & 1 deletion functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -70,7 +70,21 @@ BoochTek, LLC
    http://blog.boochtek.com/category/programming/architecture


    ## Slides/books
    # 4. Reality...
    Conceptually, there are nice ideas. How well do they ride in reality? Here are some of my experiences from C#.

    ## Frameworks
    To my knowledge, there are no frameworks readily available in which one can program. Also I would be hard pressed to figure out what such framework offer, given that the notion of purity (especially in the light of inheritance and polymorphism and partial compilation) make the problem a deeply rooted in the language, the type checker and the compiler as a whole.

    ## Separation
    Separating the core from the shell by means of namespaces is too brittle, especially with modern IDE's make it too easy for you to cross the boundaries. A better approach, perhaps, is to separate the core and the shell into different projects under the same solution. That way the code is more segregated.

    ## Purity
    Not much native support is offered from the language in term of keeping the core pure - free from side effects. Perhaps a simple method at startup could via reflection ensure that no usage of file I/O, Console I/O etc is used. The tricky part, though, is realizing just how much code we take for granted that is impure. For example `DateTime.Now` or `Guid.NewGuid()`.

    Resharper has introduced a `[pure]` attribute (https://www.jetbrains.com/help/resharper/Reference__Code_Annotation_Attributes.html#PureAttribute) but I have too little experience with it to jot anything down.

    # 5. Slides/books
    Functional Programming in Ruby - Vitor Capela
    https://speakerdeck.com/dodecaphonic/functional-programming-in-ruby

  4. kbilsted revised this gist Oct 25, 2016. 1 changed file with 19 additions and 19 deletions.
    38 changes: 19 additions & 19 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -35,7 +35,23 @@ http://alistair.cockburn.us/Hexagonal+architecture
    https://github.com/jschairb/sandbox/wiki/HexagonalArchitecture


    # 2. Blogs on Functional core, Imperative shell

    # 2. Test isolation - nomock
    Growing Object-Oriented Software, Guided by Tests Without Mocks - Vladimir Khorikov
    http://enterprisecraftsmanship.com/2016/07/05/growing-object-oriented-software-guided-by-tests-without-mocks/

    Test Isolation Is About Avoiding Mocks - Gary Bernhardt
    https://www.destroyallsoftware.com/blog/2014/test-isolation-is-about-avoiding-mocks

    To Kill a Mockingtest - Ken Scambler
    http://rea.tech/to-kill-a-mockingtest/

    Mocking is Tautological - Mark Sands
    http://marksands.github.io/2014/05/14/mocking-is-tautological.html



    # 3. Blogs on Functional core, Imperative shell
    "Functional core & Imperative shell" : OO design, and isolated tests without mocks
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-oo-design-and-isolated-tests-without-mocks.html
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-explanation-with-code.html
    @@ -54,8 +70,7 @@ BoochTek, LLC
    http://blog.boochtek.com/category/programming/architecture



    # 3. Slides/books mentioning Functional core, Imperative shell
    ## Slides/books
    Functional Programming in Ruby - Vitor Capela
    https://speakerdeck.com/dodecaphonic/functional-programming-in-ruby

    @@ -69,22 +84,7 @@ Test-Driven Development with Python - Harry Percival
    https://books.google.dk/books?id=fTLJAwAAQBAJ&pg=PA403&lpg=PA403&dq=%22functional+core%22+%22imperative+shell%22&source=bl&ots=A4g25w7wWY&sig=x0bu4NZWiXrpzWPziAH7Y78AKgM&hl=en&sa=X&ved=0ahUKEwi0jq3em-zPAhUqG5oKHYNJBIE4ChDoAQhRMAk#v=onepage&q=%22functional%20core%22%20%22imperative%20shell%22&f=false




    # 4. Test isolation - nomock
    Growing Object-Oriented Software, Guided by Tests Without Mocks - Vladimir Khorikov
    http://enterprisecraftsmanship.com/2016/07/05/growing-object-oriented-software-guided-by-tests-without-mocks/

    Test Isolation Is About Avoiding Mocks - Gary Bernhardt
    https://www.destroyallsoftware.com/blog/2014/test-isolation-is-about-avoiding-mocks

    To Kill a Mockingtest - Ken Scambler
    http://rea.tech/to-kill-a-mockingtest/

    Mocking is Tautological - Mark Sands
    http://marksands.github.io/2014/05/14/mocking-is-tautological.html


    # Quotes...

    > programming, when stripped of all its circumstantial irrelevancies,
    > boils down to no more and no less than very effective thinking so as to avoid unmastered complexity,
  5. kbilsted revised this gist Oct 25, 2016. 1 changed file with 4 additions and 9 deletions.
    13 changes: 4 additions & 9 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -5,10 +5,7 @@ Quite a lot of different people have been on the same trail of thought. Gary Ber


    ### "Boundaries" - Gary Bernhardt
    *"Imperative shell" that wraps and uses your "functional core"*
    *Functional core — Many fast unit tests. Imperative shell — Few integration tests*

    *The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately.*
    *"Imperative shell" that wraps and uses your "functional core".. The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately. Functional core — Many fast unit tests. Imperative shell — Few integration tests*

    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    @@ -19,11 +16,12 @@ https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperativ
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/

    ### Object layer, valuelayer - Andy Matuschak
    *Great talk, but specifically at the at the 27 minutes 53 seconds mark on the separation of side-effects.*
    *Great talk, but specifically on the separation of side-effects at the at the 27 minutes 53 seconds mark.*
    https://realm.io/news/andy-matuschak-controlling-complexity/


    ### A Modern Architecture for FP - John A De Goes
    *Interpreters of the functional core*
    http://degoes.net/articles/modern-fp
    http://degoes.net/articles/modern-fp-part-2

    @@ -57,8 +55,7 @@ http://blog.boochtek.com/category/programming/architecture



    # 3. Slides/books mentioning "functional core, imperative shell"

    # 3. Slides/books mentioning Functional core, Imperative shell
    Functional Programming in Ruby - Vitor Capela
    https://speakerdeck.com/dodecaphonic/functional-programming-in-ruby

    @@ -74,8 +71,6 @@ https://books.google.dk/books?id=fTLJAwAAQBAJ&pg=PA403&lpg=PA403&dq=%22functiona





    # 4. Test isolation - nomock
    Growing Object-Oriented Software, Guided by Tests Without Mocks - Vladimir Khorikov
    http://enterprisecraftsmanship.com/2016/07/05/growing-object-oriented-software-guided-by-tests-without-mocks/
  6. kbilsted revised this gist Oct 25, 2016. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@

    # Separation of immutable and mutable logic
    # 1. Separation of immutable and mutable logic
    Quite a lot of different people have been on the same trail of thought. Gary Bernhardt's formulation of a *"functional core, imperative shell"* seems to be the most voiced.


    @@ -37,7 +37,7 @@ http://alistair.cockburn.us/Hexagonal+architecture
    https://github.com/jschairb/sandbox/wiki/HexagonalArchitecture


    ## Blogs on Functional core, Imperative shell
    # 2. Blogs on Functional core, Imperative shell
    "Functional core & Imperative shell" : OO design, and isolated tests without mocks
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-oo-design-and-isolated-tests-without-mocks.html
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-explanation-with-code.html
    @@ -57,7 +57,7 @@ http://blog.boochtek.com/category/programming/architecture



    # Slides/books mentioning "functional core, imperative shell"
    # 3. Slides/books mentioning "functional core, imperative shell"

    Functional Programming in Ruby - Vitor Capela
    https://speakerdeck.com/dodecaphonic/functional-programming-in-ruby
    @@ -76,7 +76,7 @@ https://books.google.dk/books?id=fTLJAwAAQBAJ&pg=PA403&lpg=PA403&dq=%22functiona



    # Test isolation - nomock
    # 4. Test isolation - nomock
    Growing Object-Oriented Software, Guided by Tests Without Mocks - Vladimir Khorikov
    http://enterprisecraftsmanship.com/2016/07/05/growing-object-oriented-software-guided-by-tests-without-mocks/

  7. kbilsted revised this gist Oct 24, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,7 @@ https://www.destroyallsoftware.com/talks/boundaries
    https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell

    ### There are only two roles of code - John Sonmez
    *All code can be classified into two distinct roles; code that does work (algorithms) and code that coordinates work (coordinators).*
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/

    ### Object layer, valuelayer - Andy Matuschak
  8. kbilsted revised this gist Oct 24, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell

    ### there are only two roles of code - John Sonmez
    ### There are only two roles of code - John Sonmez
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/

    ### Object layer, valuelayer - Andy Matuschak
    @@ -56,7 +56,7 @@ http://blog.boochtek.com/category/programming/architecture



    ## Slides/books mentioning "functional core, imperative shell"
    # Slides/books mentioning "functional core, imperative shell"

    Functional Programming in Ruby - Vitor Capela
    https://speakerdeck.com/dodecaphonic/functional-programming-in-ruby
  9. kbilsted revised this gist Oct 24, 2016. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -2,14 +2,14 @@
    # Separation of immutable and mutable logic
    Quite a lot of different people have been on the same trail of thought. Gary Bernhardt's formulation of a *"functional core, imperative shell"* seems to be the most voiced.

    ## functional core, imperative shell


    ### "Boundaries" - Gary Bernhardt
    *"Imperative shell" that wraps and uses your "functional core"*
    *Functional core — Many fast unit tests*
    *Imperative shell — Few integration tests*
    *Functional core — Many fast unit tests. Imperative shell — Few integration tests*

    *The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately.*

    ### "Boundaries" - Gary Bernhardt
    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell
  10. kbilsted revised this gist Oct 24, 2016. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,8 @@ https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperativ
    ### there are only two roles of code - John Sonmez
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/

    ### Object layer, valuelayer (starting at 27 minutes 53 seconds) - Andy Matuschak
    ### Object layer, valuelayer - Andy Matuschak
    *Great talk, but specifically at the at the 27 minutes 53 seconds mark on the separation of side-effects.*
    https://realm.io/news/andy-matuschak-controlling-complexity/


  11. kbilsted revised this gist Oct 24, 2016. 1 changed file with 12 additions and 9 deletions.
    21 changes: 12 additions & 9 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -9,26 +9,24 @@ Quite a lot of different people have been on the same trail of thought. Gary Ber

    *The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately.*

    "Boundaries" - Gary Bernhardt
    ### "Boundaries" - Gary Bernhardt
    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell

    there are only two roles of code - John Sonmez
    ### there are only two roles of code - John Sonmez
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/

    Object layer, valuelayer (starting at 27 minutes 53 seconds) - Andy Matuschak
    ### Object layer, valuelayer (starting at 27 minutes 53 seconds) - Andy Matuschak
    https://realm.io/news/andy-matuschak-controlling-complexity/

    "Functional core & Imperative shell" : OO design, and isolated tests without mocks
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-oo-design-and-isolated-tests-without-mocks.html
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-explanation-with-code.html

    A Modern Architecture for FP - John A De Goes
    ### A Modern Architecture for FP - John A De Goes
    http://degoes.net/articles/modern-fp
    http://degoes.net/articles/modern-fp-part-2

    Hexagonal architecture - Alistair Cockburn

    ### Hexagonal architecture - Alistair Cockburn
    *Hexagonal Architecture is an architecture defined by establishing a perimeter around the domain of your application and establishing adapters for input/output interactions. By establishing this isolation layer, the application becomes unaware of the nature of the things it's interacting with.*

    *Create your application to work without either a UI or a database so you can run automated regression-tests against the application, work when the database becomes unavailable, and link applications together without any user involvement.*
    @@ -37,7 +35,12 @@ http://alistair.cockburn.us/Hexagonal+architecture
    https://github.com/jschairb/sandbox/wiki/HexagonalArchitecture


    ## Functional core, Imperative shell
    ## Blogs on Functional core, Imperative shell
    "Functional core & Imperative shell" : OO design, and isolated tests without mocks
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-oo-design-and-isolated-tests-without-mocks.html
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-explanation-with-code.html


    Business-Friendly Functional Programming, Part 2: Testability - Yang Bo
    http://rea.tech/business-friendly-functional-programming-part-2-testability/

  12. kbilsted revised this gist Oct 24, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -2,12 +2,14 @@
    # Separation of immutable and mutable logic
    Quite a lot of different people have been on the same trail of thought. Gary Bernhardt's formulation of a *"functional core, imperative shell"* seems to be the most voiced.

    "Boundaries" - Gary Bernhardt
    ## functional core, imperative shell
    *"Imperative shell" that wraps and uses your "functional core"*
    *Functional core — Many fast unit tests*
    *Imperative shell — Few integration tests*

    *The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately.*

    "Boundaries" - Gary Bernhardt
    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell
  13. kbilsted revised this gist Oct 24, 2016. 1 changed file with 5 additions and 9 deletions.
    14 changes: 5 additions & 9 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,13 @@
    “Imperative shell”
    that wraps and uses your
    “functional core”
    Functional core — Many fast unit tests
    Imperative shell — Few integration tests

    The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately.

    I also found that the tests for the functional core are extremely short - many only 3 lines.

    # Separation of immutable and mutable logic
    Quite a lot of different people have been on the same trail of thought. Gary Bernhardt's formulation of a *"functional core, imperative shell"* seems to be the most voiced.

    "Boundaries" - Gary Bernhardt
    *"Imperative shell" that wraps and uses your "functional core"*
    *Functional core — Many fast unit tests*
    *Imperative shell — Few integration tests*

    *The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately.*
    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell
  14. kbilsted revised this gist Oct 24, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -31,13 +31,13 @@ http://degoes.net/articles/modern-fp
    http://degoes.net/articles/modern-fp-part-2

    Hexagonal architecture - Alistair Cockburn
    http://alistair.cockburn.us/Hexagonal+architecture
    https://github.com/jschairb/sandbox/wiki/HexagonalArchitecture

    *Hexagonal Architecture is an architecture defined by establishing a perimeter around the domain of your application and establishing adapters for input/output interactions. By establishing this isolation layer, the application becomes unaware of the nature of the things it's interacting with.*

    *Create your application to work without either a UI or a database so you can run automated regression-tests against the application, work when the database becomes unavailable, and link applications together without any user involvement.*

    http://alistair.cockburn.us/Hexagonal+architecture
    https://github.com/jschairb/sandbox/wiki/HexagonalArchitecture


    ## Functional core, Imperative shell
    Business-Friendly Functional Programming, Part 2: Testability - Yang Bo
  15. kbilsted revised this gist Oct 24, 2016. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,8 @@ The result of this is that the shell has fewer paths, but more dependencies. The
    I also found that the tests for the functional core are extremely short - many only 3 lines.

    # Separation of immutable and mutable logic
    Quite a lot of different people have been on the same trail of thought. Gary Bernhardt's formulation of a *"functional core, imperative shell"* seems to be the most voiced.

    "Boundaries" - Gary Bernhardt
    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    @@ -28,6 +30,14 @@ A Modern Architecture for FP - John A De Goes
    http://degoes.net/articles/modern-fp
    http://degoes.net/articles/modern-fp-part-2

    Hexagonal architecture - Alistair Cockburn
    http://alistair.cockburn.us/Hexagonal+architecture
    https://github.com/jschairb/sandbox/wiki/HexagonalArchitecture

    *Hexagonal Architecture is an architecture defined by establishing a perimeter around the domain of your application and establishing adapters for input/output interactions. By establishing this isolation layer, the application becomes unaware of the nature of the things it's interacting with.*

    *Create your application to work without either a UI or a database so you can run automated regression-tests against the application, work when the database becomes unavailable, and link applications together without any user involvement.*


    ## Functional core, Imperative shell
    Business-Friendly Functional Programming, Part 2: Testability - Yang Bo
  16. kbilsted revised this gist Oct 24, 2016. 1 changed file with 18 additions and 5 deletions.
    23 changes: 18 additions & 5 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,12 @@
    > programming, when stripped of all its circumstantial irrelevancies,
    > boils down to no more and no less than very effective thinking so as to avoid unmastered complexity,
    > to very vigorous separation of your many different concerns.
    > -- Dijkstra EDW512
    > https://www.cs.utexas.edu/users/EWD/transcriptions/EWD05xx/EWD512.html
    “Imperative shell”
    that wraps and uses your
    “functional core”
    Functional core — Many fast unit tests
    Imperative shell — Few integration tests

    The result of this is that the shell has fewer paths, but more dependencies. The core contains no dependencies, but encapsulates the different logic paths. So we’re encapsulating dependencies on one side, and business logic on the other side. Or put another way, the way to figure out the separation is by doing as much as you can without mutation, and then encapsulating the mutation separately.

    I also found that the tests for the functional core are extremely short - many only 3 lines.

    # Separation of immutable and mutable logic
    "Boundaries" - Gary Bernhardt
    @@ -72,3 +76,12 @@ http://rea.tech/to-kill-a-mockingtest/
    Mocking is Tautological - Mark Sands
    http://marksands.github.io/2014/05/14/mocking-is-tautological.html



    > programming, when stripped of all its circumstantial irrelevancies,
    > boils down to no more and no less than very effective thinking so as to avoid unmastered complexity,
    > to very vigorous separation of your many different concerns.
    > -- Dijkstra EDW512
    > https://www.cs.utexas.edu/users/EWD/transcriptions/EWD05xx/EWD512.html

  17. kbilsted revised this gist Oct 24, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    > -- Dijkstra EDW512
    > https://www.cs.utexas.edu/users/EWD/transcriptions/EWD05xx/EWD512.html
    # Separation of immutable and imperative logic
    # Separation of immutable and mutable logic
    "Boundaries" - Gary Bernhardt
    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
  18. kbilsted revised this gist Oct 24, 2016. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -4,8 +4,7 @@
    > -- Dijkstra EDW512
    > https://www.cs.utexas.edu/users/EWD/transcriptions/EWD05xx/EWD512.html
    # Functional core, Imperative shell

    # Separation of immutable and imperative logic
    "Boundaries" - Gary Bernhardt
    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    @@ -25,6 +24,8 @@ A Modern Architecture for FP - John A De Goes
    http://degoes.net/articles/modern-fp
    http://degoes.net/articles/modern-fp-part-2


    ## Functional core, Imperative shell
    Business-Friendly Functional Programming, Part 2: Testability - Yang Bo
    http://rea.tech/business-friendly-functional-programming-part-2-testability/

  19. kbilsted revised this gist Oct 24, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -62,6 +62,7 @@ https://books.google.dk/books?id=fTLJAwAAQBAJ&pg=PA403&lpg=PA403&dq=%22functiona
    Growing Object-Oriented Software, Guided by Tests Without Mocks - Vladimir Khorikov
    http://enterprisecraftsmanship.com/2016/07/05/growing-object-oriented-software-guided-by-tests-without-mocks/

    Test Isolation Is About Avoiding Mocks - Gary Bernhardt
    https://www.destroyallsoftware.com/blog/2014/test-isolation-is-about-avoiding-mocks

    To Kill a Mockingtest - Ken Scambler
  20. kbilsted revised this gist Oct 24, 2016. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -17,19 +17,20 @@ https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/
    Object layer, valuelayer (starting at 27 minutes 53 seconds) - Andy Matuschak
    https://realm.io/news/andy-matuschak-controlling-complexity/


    "Functional core & Imperative shell" : OO design, and isolated tests without mocks
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-oo-design-and-isolated-tests-without-mocks.html
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-explanation-with-code.html

    A Modern Architecture for FP - John A De Goes
    http://degoes.net/articles/modern-fp
    http://degoes.net/articles/modern-fp-part-2

    Business-Friendly Functional Programming, Part 2: Testability - Yang Bo
    http://rea.tech/business-friendly-functional-programming-part-2-testability/

    mokacoding - unit and acceptance testing, automation, productivity
    http://www.mokacoding.com/blog/functional-core-reactive-shell/


    Functional Core, Imperative Shell - Sean Hammond
    http://www.seanh.cc/posts/functional-core-imperative-shell

  21. kbilsted revised this gist Oct 24, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperativ
    there are only two roles of code - John Sonmez
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/

    Object layer, valuelayer (27 minutes 53 seconds) - Andy Matuschak
    Object layer, valuelayer (starting at 27 minutes 53 seconds) - Andy Matuschak
    https://realm.io/news/andy-matuschak-controlling-complexity/


  22. kbilsted revised this gist Oct 24, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,7 @@
    "Boundaries" - Gary Bernhardt
    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell

    there are only two roles of code - John Sonmez
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/
    @@ -57,6 +58,8 @@ https://books.google.dk/books?id=fTLJAwAAQBAJ&pg=PA403&lpg=PA403&dq=%22functiona


    # Test isolation - nomock
    Growing Object-Oriented Software, Guided by Tests Without Mocks - Vladimir Khorikov
    http://enterprisecraftsmanship.com/2016/07/05/growing-object-oriented-software-guided-by-tests-without-mocks/

    https://www.destroyallsoftware.com/blog/2014/test-isolation-is-about-avoiding-mocks

  23. kbilsted revised this gist Oct 23, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ https://www.destroyallsoftware.com/talks/boundaries
    there are only two roles of code - John Sonmez
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/

    Object layer, valuelayer (27:53-) - Andy Matuschak
    Object layer, valuelayer (27 minutes 53 seconds) - Andy Matuschak
    https://realm.io/news/andy-matuschak-controlling-complexity/


  24. kbilsted revised this gist Oct 23, 2016. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -62,3 +62,7 @@ https://www.destroyallsoftware.com/blog/2014/test-isolation-is-about-avoiding-mo

    To Kill a Mockingtest - Ken Scambler
    http://rea.tech/to-kill-a-mockingtest/

    Mocking is Tautological - Mark Sands
    http://marksands.github.io/2014/05/14/mocking-is-tautological.html

  25. kbilsted revised this gist Oct 23, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,8 @@
    # Functional core, Imperative shell

    "Boundaries" - Gary Bernhardt
    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries
    https://www.youtube.com/watch?v=yTkzNHF6rMs
    https://www.destroyallsoftware.com/talks/boundaries

    there are only two roles of code - John Sonmez
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/
  26. kbilsted revised this gist Oct 23, 2016. 1 changed file with 19 additions and 19 deletions.
    38 changes: 19 additions & 19 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -6,53 +6,53 @@
    # Functional core, Imperative shell

    Ruby Conf 12: "Boundaries" - Gary Bernhardt
    "Boundaries" - Gary Bernhardt
    https://www.youtube.com/watch?v=yTkzNHF6rMs


    "Boundaries" - Gary Bernhardt from SCNA 2012
    https://www.destroyallsoftware.com/talks/boundaries

    there are only two roles of code - John Sonmez
    https://simpleprogrammer.com/2012/10/21/there-are-only-two-roles-of-code/

    Business-Friendly Functional Programming, Part 2: Testability - Yang Bo
    http://rea.tech/business-friendly-functional-programming-part-2-testability/


    Functional Programming in Swift - slide 55+
    http://www.slideshare.net/SaugatGautam2/functional-programming-in-swift


    Enemy of the State by Justin Spahr-Summers
    https://speakerdeck.com/jspahrsummers/enemy-of-the-state
    Object layer, valuelayer (27:53-) - Andy Matuschak
    https://realm.io/news/andy-matuschak-controlling-complexity/


    "Functional core & Imperative shell" : OO design, and isolated tests without mocks
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-oo-design-and-isolated-tests-without-mocks.html
    http://blogs.perl.org/users/mascip/2014/06/functional-core-imperative-shell-explanation-with-code.html


    Business-Friendly Functional Programming, Part 2: Testability - Yang Bo
    http://rea.tech/business-friendly-functional-programming-part-2-testability/

    mokacoding - unit and acceptance testing, automation, productivity
    http://www.mokacoding.com/blog/functional-core-reactive-shell/


    Functional Core, Imperative Shell - Sean Hammond
    http://www.seanh.cc/posts/functional-core-imperative-shell

    BoochTek, LLC
    http://blog.boochtek.com/category/programming/architecture



    ## Slides/books mentioning "functional core, imperative shell"

    Functional Programming in Ruby - Vitor Capela
    https://speakerdeck.com/dodecaphonic/functional-programming-in-ruby

    Enemy of the State by Justin Spahr-Summers
    https://speakerdeck.com/jspahrsummers/enemy-of-the-state

    Functional Programming in Swift - slide 55+
    http://www.slideshare.net/SaugatGautam2/functional-programming-in-swift

    Test-Driven Development with Python - Harry Percival
    https://books.google.dk/books?id=fTLJAwAAQBAJ&pg=PA403&lpg=PA403&dq=%22functional+core%22+%22imperative+shell%22&source=bl&ots=A4g25w7wWY&sig=x0bu4NZWiXrpzWPziAH7Y78AKgM&hl=en&sa=X&ved=0ahUKEwi0jq3em-zPAhUqG5oKHYNJBIE4ChDoAQhRMAk#v=onepage&q=%22functional%20core%22%20%22imperative%20shell%22&f=false


    BoochTek, LLC
    http://blog.boochtek.com/category/programming/architecture


    Object layer, valuelayer (27:53-) - andy_matuschak
    https://realm.io/news/andy-matuschak-controlling-complexity/



  27. kbilsted revised this gist Oct 22, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -51,9 +51,11 @@ BoochTek, LLC
    http://blog.boochtek.com/category/programming/architecture


    Object layer, valuelayer - andy_matuschak
    Object layer, valuelayer (27:53-) - andy_matuschak
    https://realm.io/news/andy-matuschak-controlling-complexity/



    # Test isolation - nomock

    https://www.destroyallsoftware.com/blog/2014/test-isolation-is-about-avoiding-mocks
  28. kbilsted revised this gist Oct 22, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -51,6 +51,9 @@ BoochTek, LLC
    http://blog.boochtek.com/category/programming/architecture


    Object layer, valuelayer - andy_matuschak
    https://realm.io/news/andy-matuschak-controlling-complexity/

    # Test isolation - nomock

    https://www.destroyallsoftware.com/blog/2014/test-isolation-is-about-avoiding-mocks
  29. kbilsted revised this gist Oct 22, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    > programming, when stripped of all its circumstantial irrelevancies,
    > boils down to no more and no less than very effective thinking so as to avoid unmastered complexity,
    > to very vigorous separation of your many different concerns.
    > - Dijkstra EDW512
    > -- Dijkstra EDW512
    > https://www.cs.utexas.edu/users/EWD/transcriptions/EWD05xx/EWD512.html
    # Functional core, Imperative shell
  30. kbilsted revised this gist Oct 22, 2016. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions functional core, imperative shell.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,8 @@
    > programming, when stripped of all its circumstantial irrelevancies,
    > boils down to no more and no less than very effective thinking so as to avoid unmastered complexity,
    > to very vigorous separation of your many different concerns.
    > - Dijkstra EDW512 https://www.cs.utexas.edu/users/EWD/transcriptions/EWD05xx/EWD512.html
    > programming, when stripped of all its circumstantial irrelevancies,
    > boils down to no more and no less than very effective thinking so as to avoid unmastered complexity,
    > to very vigorous separation of your many different concerns.
    > - Dijkstra EDW512
    > https://www.cs.utexas.edu/users/EWD/transcriptions/EWD05xx/EWD512.html
    # Functional core, Imperative shell