News for hackers. Stuff that matters.
Re:Making invisible glue code first-class by codeismath on Saturday June 12, 2021 @07:42PM (#27488408)
I recently watched a video [0] that contrasted all of the OO Design Patterns with Functional Programming equivalents. After reading about how this author wants to make "glue" code "first class" and how the Unix pipe operator is an example of single-character-glue-code, my thoughts immediately went to the aforementioned video presentation. Perhaps my "glue code" is simply gold-old "function composition"?

[0] Scott Wlaschin "Functional programming design patterns" https://vimeo.com/113588389

[Edit] Spoiler alert: each of the design patterns reviewed and contrasted in the video I mentioned seemed to "disappear" in FP since the equivalent is simply to use functions and/or function composition. Recently transitioning from C# to F# for my .NET Core projects, I felt the "glue code" the author mentions disappear in a similar manner with greatly-reduced code bloat.

Re:Making invisible glue code first-class by mpweiher on Sunday June 13, 2021 @02:43AM (#27490349)
Yes, function composition is one kind of glue, and it's good that we have it. But it's only one kind of glue, and often not particularly useful (see the part of the post about algorithm DSLs).

As John Hughes put it in Why Functional Programming Matters, we need more kinds of glue.

See https://blog.metaobject.com/2019/02/why-architecture-oriente...

As to Design Patterns: the Smalltalk version of the Design Patterns book is a small booklet, most of the patterns just go away. As to the video: tried to watch, got to the "it's functions, functions functions and again functions" slide. For OO, it would be "it's objects, objects, objects and again, objects". Sadly, most FP-centered critiques of OO are at this level, or even worse. :-/

Overall, you're going to have more patterns in FP because its model of computation is less powerful. (See Concepts, Techniques, and Models of Computer Programming https://www.info.ucl.ac.be/~pvr/book.html for a definition of relative power ).

Re:Making invisible glue code first-class by shadytrees on Saturday June 12, 2021 @10:47PM (#27489345)
I think function composition is powerful glue, indeed. Attach some side effect to the arrow, and all of a sudden you can implement a state machine, a reader environment, promises, or even continuations.
Re:Making invisible glue code first-class by bern4444 on Monday June 14, 2021 @02:51AM (#27499990)
Scott is a great speaker and does an incredible job at talking about and explaining a ton of cool ideas in functional programming and makes his slides in F# easy to understand and apply those ideas.

Absolutely a great video and he has many others in addition to his site fsharpforfunandprofit.com

Re:Making invisible glue code first-class by BoiledCabbage on Saturday June 12, 2021 @08:08PM (#27488548)
He's also got some other great videos on software design.