Skip to content
0:00 / 0:00

#scala#monads#johndegoes

Fun(c) 2018.7: John De Goes - FP to the Max

Fun(c)tional Programming Group

1.4K subscribers • 1 video on Hallway

YouTube
  • Recommended by 3 people: 3 in engineering communities.
  • Presented by John De Goes
  • An opinion. It argues one side of a question engineers disagree on.

Advanced. Deep dive for people who know the field.

37K views8 years ago3 recommendations

Programming languagesSoftware designScalaFunctional programmingRefactoring and legacy code

John De Goes incrementally refactors a procedural program into a purely functional Scala application, demonstrating the benefits and costs of pure FP.

What happens when you take a procedural program riddled with partial functions and effects, and incrementally refactor it to a purely functional program—and then dial it up to eleven? In this live coding session, John hopes you'll be amused and a maybe little terrified as he shows you where pure FP leads on one of the simplest programs possible, pointing out both the benefits and the costs of pure functional programming, and giving you an appreciation for how functional programming techniques scale to and deliver the most benefit in very large teams and very large applications. Code: gist.github.com/jdegoes/1b43f43e2d1e845201de853815ab3cb9 Web: tiny.cc/Func Twitter: @fun_c_ Hosted by Expedia Group, Inc. "We are the World’s Travel Platform. Bringing the world within reach" Expedia Group is hiring (see lifeatexpedia.com)

Why it's here

3 people recommend this

What people say. Highly recommended as a classic demonstration of refactoring procedural code into pure functional programming.

u/hmemcpyin r/scala • Recommends

FP to the Max with John De Goes

u/leet92in r/functionalprogramming • Recommends

Best examples of medium scale, real-world FP projects? My overall goal is to understand how to translate large-scale OOP systems to an FP paradigm. A couple useful examples I’ve encountered so far are the following: https://github.com/pauljamescleary/scala-pet-store [video My gripe is that in the first example, there are no complicated interactions among concepts - it's basically just CRUD on 4 isolated resources of different types (User, Pet, Order, ....). As for the second, it's a little too small of a program to extrapolate the techniques to bigger projects. It shows you how to abstract over context very well, but the data structures aren’t very complex, not like what you'd see…

u/mrxtravisin r/scala • Recommends

Fun(c) 2018.7: John De Goes - FP to the Max

u/quizteamaquilerain r/scala • Mentions

On “ZIO Scala”

If you’re cool with videos, I’d recommend both FP to the min and FP to the max - great practical examples within a realistic mixed code base: link to this video https://www.signifytechnology.com/blog/2020/07/fp-to-the-min-by-john-de-goes-scala-in-the-city-conference

u/vishbarin r/scala • Mentions

On “Advice on a good route to Functional Scala”

Sorry, I was busy earlier and didn't get a chance to look it up. Here it is; it's called FP To The Max. link to this video EDIT: Dammit. I saw this mentioned above just now. That's what you get for skimming.

u/Plippein r/scala • Mentions

On “Explaining monad (or functional programming, or ScalaZ, etc.) tutorials be like...”

Forgot to add a few great resources: * Functional Programming with Effects by Rob Norris - [video * John De Goes - FP to the Max - [video * Functional Structures in Scala - [video * Book: Functional Programming in Scala * Book: Functional Programming, Simplified: (Scala Edition) (haven't read it yet) * Book: Category Theory for Programmers (haven't read it yet) And a shameless plug for my intro to cats: https://medium.com/@pvinchon

u/kjetulfin r/scala • Mentions

On “Good guide other than documentation for cats/IO”

This video takes the principles from the ground up in a really easy to understand and great motivated way: [video

u/k1v1uqin r/scala • Mentions

On “Advancing Scala knowledge”

…re. Writing parsers touches on a lot of important concepts. For ex in case of parsers you will stumble over parser combinators and parser caching. Look up how the same could've been done in Clojure, OCaml or Haskell. Writing games is always fun and parsers go well with games too There are other cool ideas that can be applied to simple TicTacToe link to this video What ever it is you do, start with your own implementation first and be mentally ready to re-do that initial code multiple times as you learn more about the problem domain. Don't get emotionally attached to any of your solutions, because it'll keep you from advancing. From the get got, it's a private laboratory, ever evolving. Why not sta…

u/scalahuntin r/scala • Mentions

On “Got a quick question? Ask here - August 27, 2018”

In JDG's video FP to the Max he defines a `Random` trait, a companion object and then there is another `nextInt` inside the app, that nextInt on an implicit instance of Random. The relevant lines in this gist: https://gist.github.com/jdegoes/1b43f43e2d1e845201de853815ab3cb9#file-fpmax-scala-L65-L71 My question is: why having this external \`nextInt\` is desirable? It seems like unnecessary boilerplate. The code that needs this capability might as well changed from: `def gameLoopF[_: Program: Random: Console](name: String): FUnit =` to `def gameLoopF[_](name: String)(implicit p: ProgramF[_], r: RandomF[_], c: ConsoleF[_]): FUnit` and invoke `nextInt` directly on the `r`…

u/kjetulfin r/scala • Mentions

On “Switching over to functional programming after learning OCaml in school (trying to make pacman 100% functionally)”

This video is a great start to begin learning how to handle stuff like this in a functional way in Scala: link to this video

u/teckhooiin r/scala • Mentions

On “Beginner scala project examples?”

You can check out this number guessing program written in pure FP link to this video

u/ggrigoriin r/scala • Mentions

On “Functional Programming in Scala book suggestions”

There is a very nice talk by John De Goes, right about "moving from functions to writing software" link to this video Also if you really want to learn functional programming, you may want to try Haskell. An I also would recommend "Category theory for programmers" book