Talks by Adam Rosien

2023

Async/Await for the Monadic Programmer

I was recently was on a project-not in Scala!-which used async/await for asynchronous computations. Async/await is "syntactic feature of many programming languages that allows an asynchronous, non-blocking function to be structured in a way similar to an ordinary synchronous function." (Wikipedia) Using it was very confusing to me as I had first learned async programming with Futures. I have to use some magic keywords when dealing with async code? Why would anyone want to do this, instead of using a monad like Future? (Monad just means you can flatMap() it or use it in a for-comprehension.)

It took me a couple of weeks to become comfortable, but I started to understand the rationale of async/await and would like to share it with you, so you don't have to be as confused as I was-or at least for as long. You'll learn:

Many modern languages use async/await, such as Rust and Javascript. Even though Scala doesn't natively support async/await yet-it's being discussed, and there are compiler plugins and libraries that offer support for it-learning the technique will improve your understanding of asynchronous programming and allow you to better understand other codebases… as you are porting that code to Scala!.

ScalaDays, June 2023 in Seattle WA USA. (video)

2021

Concurrent State Machines with Cats Effect

Concurrent coordination is a notoriously difficult problem: how do we make the behavior of a computation depend on another, concurrently running one? Or more than one? We'll show one technique: the concurrent state machine, and build many examples using the powerful Cats Effect library.

For example, how can we share state between effects when that state might be concurrently updated? Or how can we ensure one effect only proceeds once work is complete in another? We'll discuss the first issue by using the Ref data type for sharing mutable state. We'll then show how the Deferred data type can provide concurrent effect serialization without blocking any actual threads. Finally we'll model even more complex behavior by composing these two concurrency primitives together to form a concurrent state machine.

Some concurrent coordination behaviors we can construct using this method are:

ScalaCon, November 2021, online. (video)
No Need for NIH: Leveraging the Typelevel Stack in the Enterprise

There's a joke that a framework is a product with the business logic removed, but all the assumptions left in. In this talk we'll explore an alternative: solving the most common enterprise issues with the composable ecosystem of Typelevel libraries, avoiding not-invented-here (NIH) and lock-in.

We've been involved in many enterprise projects, and have seen many recurring patterns implemented in an ad-hoc, fragile way. At the same time, and more often than not, any custom libraries rapidly develop "bit-rot", creating a maintenance burden. Instead we can be brave! We can avoid the sunk-cost fallacy by refactoring and retooling using powerful and composable abstractions. We can also trust we are reducing our risk because of the high quality of these open source projects.

We'll dive deep into how to use the Typelevel stack to handle common tasks like data validation, integration with data sources and sinks, the modeling of actions associated with state machines, and more. We'll be using libraries like cats, cats-effect, refined, and more, to fix and extend existing systems to be more powerful, safer, and ultimately more maintainable.

ScalaCon, May 2021, online. (video)
Essential Effects

Cats Effect is a library that makes it easy to write code that effectively uses multiple cores and doesn't leak resources. This makes building complex applications, such as highly concurrent services, much more productive.

This talk will introduce the meaning and role of side-effects and effects, how to encapsulate side-effects in a safer form, and show off the features of the Cats Effect library that provide parallelism, concurrency, resource-safety, and more!

22 April 2021: Skills Matter: Thursday's Matter, online. (video)
24 March 2021: PHASE: Philly Area Scala Enthusiasts, online. (video)
3 February 2021: Singapore Scala Programmers, online. (video)
13 January 2021: SF Scala, online. (video)

2020

You Didn't Know It, but You Really Want to Learn Sequent Calculus
For some reason, I decided I wanted to understand how the Curry-Howard isomorphism could be applied to actual software, and discovered that if I then understood sequent calculus(!), I could generate programs from their type. In this talk I'll share this mathematical and programming journey with you.
Typelevel Summit 2020, part of Northeast Scala Symposium 2020, online. (video)
Free Monoids: Monoids for Anything!
"Can you make a Monoid[A] for any A?" It seems impossible, but you can do it if you cheat. This talk will quickly go over why we'd want to do this, the "trick" we can use, and show how this trick can be generalized and used in many contexts.
Northeast Scala Symposium 2020, online.

2019

Writing Programs That Write Tests: Better Testing With Scala
Writing tests is so... boring. And repetitive. And often, in hindsight, rather ad hoc, and therefore ineffective. We'll learn about property-based testing using ScalaCheck: How it compares to unit testing, when is it better (or worse); learning about different families of invariants and when they are appropriate for your code; how to structure the tests using the main ScalaCheck abstractions, run them, and debug them; and how to test stateful systems. Don't write tests! Write code that will write lots of tests!
Lambda World in Cadiz, Spain.
Understanding FP Concepts via Refactoring
Y-combinator? Reader monad? Catamorphisms? Functional programming concepts can seem intimidating, but in this talk we'll see that we can view them as solutions to refactoring problems. For example, the Reader monad sounds rather intellectual, but we can derive it from the very concrete problem of passing dependencies to some computation (dependency injection). We'll deconstruct a number of FP concepts this way, to demystify them so you can feel more confident using them and teaching them to others.
LambdaSquared 2019 in Knoxville, TN USA.
Systematic Software with Scala
Scala is a very flexible language, and this flexibility can make it difficult to know how to effectively design Scala code. In the nearly ten years I've been using Scala, my approach to using the language has coalesced around a ten or so strategies, which are similar to OO design patterns but broader in scope and borrow many ideas from functional programming. Using these strategies I can create code in a systematic and repeatable way. In this talk I will present the majority of my strategies, and illustrate their use by live coding a simple graphics system where the majority of the code is systematically derived by applying strategies. The strategies allow me to work at a higher-level of abstraction, and the coding itself becomes formulaic. This means I can get more work done and my code is simpler to read and use. I hope that my strategies will also enable you to design better code in Scala.
2019 Typelevel Summit in Philadelphia, PA USA.
Scala at the Sea meetup on April 9, 2019, in Seattle, WA USA.
Free Boolean Algebras: Boolean Logic for Free!
You may have heard of Free Monads, but there are other "Free" structures. Another useful type are Free Boolean Algebras, which give us Boolean logic for a set of primitives "for free". We'll derive the Free Boolean Algebra and show how you can use it in your programs.
2019 NEScala conference in Philadelphia, PA USA. (video)
Fun(c)tional Programming Group meetup in Bellevue, WA USA

2018

Strings are Evil: Methods to hide the use of primitive types
Most primitive types we use are "too wide" for how we are using them; for example, there are an infinite number of Strings, but we are only using the String (hex!) representation of a 128-bit UUID. This is a huge source of bugs in our programs. This talk will go over the many ways we can reduce these kinds of errors in Scala, such as wrapper types, refined types, type restrictions, and more.
ScalaDays 2018 in Copenhagen, Denmark, with Noel Welsh. (video)
Why do functional programmers always talk about algebra(s)?
Learn about what an algebra is, why functional programmers talk about them constantly, and how you can use them in your projects. Algebras *are* structure, and we'll talk about their various forms: algebraic data types, F-algebras, object algebras, and more!
Fun(c) meetup in Bellevue, WA USA.

2017

Domain Algebras For A Busy Busy World
Domains are the "business" stuff of our applications, quite often fuzzy, ill-defined, or inconsistent in known (or unknown!) ways. But we can find and apply more structure to them through the ideas of an algebra: something with symbols, operations and laws. Once we have this better structure, we can then use some common techniques to analyze it and make assertions about it. This talk will teach you how to construct domain algebras from scratch, or from your existing code, and we'll show off the induced benefits of better abstractions, along with greater modularity and testability.
Scala Up North in Vancouver, CA. (video)
Macros versus Shapeless versus Code Generation: What Works, When, and How Much?
In this talk we will compare three techniques for meta-programming in Scala: macros, shapeless, and code generation. Through a sequence of simple examples we will attempt to characterise the relative pros and cons of each technique, where they are most appropriate, and where they might turn around and bite you.
ScalaDays 2017 in Chicago, IL USA.

2016

Why do functional programmers always talk about algebra(s)?
Learn about what an algebra is, why functional programmers talk about them constantly, and how you can use them in your projects. Algebras *are* structure, and we'll talk about their various forms: algebraic data types, F-algebras, object algebras, and more!
Scala.IO 2016 in Lyon, France

2015

Scala, OODA, and Entropy: Thoughts on Continuous Learning
In this talk, Adam will discuss Compellon's approach to so-called prescriptive analytics, which basically means "Ok, but what the *&^% should I do now!?". He'll talk about the barriers blocking domain experts from using analytic systems, how data scientists bias their models, and the evolution of Compellon's engine, written in Scala with Apache Spark.
Nike Tech Talk in Portland, OR USA.

Source, license and issues can be found at https://github.com/arosien/talks .