Skip to content

Instantly share code, notes, and snippets.

@mattfield
Last active December 23, 2015 20:29
Show Gist options
  • Save mattfield/6689456 to your computer and use it in GitHub Desktop.
Save mattfield/6689456 to your computer and use it in GitHub Desktop.
"Real-world" Functional Javascript

As software becomes more and more complex, it is more and more important to structure it well. Well-structured software is easy to write, easy to debug, and provides a collection of modules that can be re-used to reduce future programming costs. Functional programming is a paradigm shift away from how we normally think about constructing our programs and writing our abstractions. In this talk, I'd like to introduce the style of functional programming, discuss what it has to offer versus other programming metholodies (and how functional programming can complement paradigms such as OOP) and provide "real-world" examples of functional techniques such as:

  • Programming with functions as the primary construct
  • Moving from thinking imperatively to thinking declaritively in terms of the way data flows through our applications
  • Higher-order functions and applicative programming and how they remove complexity from imperative-style programming e.g. for-loops
  • Functions as building blocks and how to compose functions together to create more powerful abstractions

As a very high-level outline, I'd like to do the following:

  • Set a brief context around what makes good software vs bad software (5 mins max - we know these things already)
  • Place functional programming into that context at a high-level and compare and contrast with other methods
  • Present varied examples of how programming in a functional style using some of the above-mentioned methods (higher-order functions, function composition etc) can greatly reduce some of the difficulties incurred when programming in a language like JavaScript
@hughfdjackson
Copy link

Did you mean 'applicative functors', rather than applicative functions? I can't find anything on the googles for applicative functions.

@hughfdjackson
Copy link

The contents look fine (noble, even!). I suspect, though, that the scope is too large. You'll either be preaching to the choir in the first part, or losing people quickly.

@mattfield
Copy link
Author

I think you're right - there's a lot to fit in. This was all very much a brain-dump last night. I think I probably meant applicative programming rather than applicative functors. Ap Functors might be just a tad too much! Regarding the first part, I was thinking about a very brief overview just to set the context of the discussion. No more than 5 minutes max. Perhaps restricting the scope to a brief conceptual overflow and just a couple of techniques would be a better way to go.

@mattfield
Copy link
Author

Ok, thinned out a bit! Functions as primary means of solving subproblems; higher-order + applicative programming is something a lot of people should have a familiarity with already, even if they don't realise it - people will have used, or at least heard of, map/filter/reduce; function composition as a means of abstraction. That sounds a bit more doable!

@gyzerok
Copy link

gyzerok commented Sep 25, 2015

It would be awesome if you can provide a good real world example of functional style isomorphic web app. With some async client-server requests, good error handling and functional server implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment