I was recently tasked with setting up a local database for integration testing. This code was in F#, and we chose Dapper, a lightweight ORM, for our database needs. After doing some research and consulting with my teammates, we came up with an overview of what’s needed for data related integration tests: Set up a […]
What’s a way of combining Maps of Iterables without losing information? In Scala, it’s common to combine or concatenate Iterables, usually something like this: val a = Vector(1, 2, 3) val b = Vector(4, 5, 6) val c = a ++ b This takes Vector a and concatenates it with Vector b. The resulting Vector […]
On a recent project, I took a list of items and grouped them into categories using a recursive partition function. Today I’ll explain that concept and show you how to implement it in Scala. As my example, I’ll be categorizing fun, delicious M&M’s by color. (Because, as everyone knows, blues are best and should be […]
Functional programming seems to be making its way into everything these days, and you can take advantage of it even if you’re not using a strictly functional language or toolset. The key is to think declaratively rather than imperatively.
Functional programming is a broad discipline, and this series has only scratched the surface. Like most skills, it is learned through practice. To help you practice, I’ve found a few ideas that are rooted in functional programming and may find a place in your next project. I’ve also collected a few functional languages that offer […]
Much of the power of functional programming is self-evident, but I wanted to spend some time exploring the reasons for and against using a functional style.
In functional programming, there are a lot of ideas and patterns that can make writing code a lot easier — most importantly pure functions, immutable state, and higher-order functions. I want to spend some time discussing these concepts and why they’re helpful in the context of functional programming.
Functional programming is a universally-applicable programming paradigm that yields clear code with evident effects, that is easier to debug and maintain. This functional approach has become popular in the software world, and I wanted to do my best to provide a thorough introduction. Here’s what you can expect: Fundamental functional programming concepts and basic examples […]
About a year ago, I was learning how to properly unit test Phoenix applications using the Mox library. The strategy I adopted for my side projects involves adding “module dependencies” to any module I want to unit test, and then using Mox to configure those dependencies during the tests. While that approach is great for […]
I’ve been working in F# lately, and one of its smaller features has had a big impact on my programming style: Variables are immutable by default. If you want to change something, you have to declare it mutable. Sometimes, this is what I naturally reach for, and the language rubs my nose in it. Here’s […]