We recently decided to expand our horizons beyond the quite successful React meetup we host every month. The result was the functional programming for the web meetup – with the inaugural first meetup held last month.
As an introduction to functional programming in general, Joe gives us an overview of object orientation – or more specifically the problems that concepts like state everywhere and mutability bring, along with how functional programming solves these issues and makes writing safe, predictable, multi-threaded code much simpler.
UI = f(data) - to the fundamentals of functional programming
Coincidentally – this was also a great intro for our next talk.
Many of us are aware of the benefits of immutable data – but there are a lot of questions left unanswered – most prominently how can copying a whole tree of data be efficient compared to changing a simple value?
Viktor’s explanation was a very easy to digest approach to explaining the inner workings of immutable data structures. We are shown the origins of structural sharing and tries and how these concepts merged together to form what we consider a very performant data store.
He outlines Joe’s explanation of purity and predictability – noting how immutable data makes for predictable functions and more predictable functions means code which is easier to debug, read and reason about.
Tomas introduces us to the the basic concepts of F# as a functional language and as a web platform. We were introduced to the type system in F#, the Suave web framework (think express for F#), DotLiquid – a templating system for .NET, dependency management through Paket, and type providers.
Providers allowed us to connect and fetching external resource feeds (json, xml, etc.) into your application. A very cool feature is using these external data sources at compile time and inferring types from them, so you can know if you’ve made a type error even if you’re loading the content dynamically. Through editor plugins, F# can also do this inferring as you type – providing you with autocomplete for things that aren’t even defined locally! Powerful stuff.
A live demo followed Tomas’ explanation of these concepts from fetching a news feed, a weather feed and injecting the data into a template which is rendered and served to the client. We also get a sneak peek at deploying to both Heroku and Microsoft Azure. Definitely worth a watch!
Full recording of meetup is available on YouTube.
Next month’s meetup will be on the 30th September, make sure you don’t miss it!