The request for its API val request = Request[IO](Method.POST, uri"/jobs")val api = new AsyncJobApi // this will not compile since AsyncJobApi is not defined yet Minimal implementation to make it green: class AsyncJobApi Red test: The API should return a 202 Accepted response: "POST /jobs returns Accepted" in { val request = Request[IO](Method.POST, uri"/jobs") val api = new AsyncJobApi api.routes.orNotFound.run(request).asserting : response => response.status shouldBe Status.Accepted} Make it green: class AsyncJobApi { val routes: HttpRoutes[IO] = HttpRoutes.of[IO] : case req @ POST -> Root / "jobs" => Accepted()} 5.2 Add headers (Trivial Implementation) Red test: add X-Total-Count and Location headers with job ID (only the assertion is shown)
The project behind this post is intentionally a bit over-engineered - in the "let's see what breaks when things grow" sense. That's by design. While a simple recipe example could easily be modelled with plain strings and numbers, cookbook explores more advanced, real-world concerns: extensibility, customisation, validation, and precise handling of numeric values, including floating-point quantities. The recipe domain is just a familiar, low-stakes vehicle for discussing these deeper ideas.
PF4J expects that your plugin code has a class that extends org.pf4j.Plugin interface. And for running and stopping the plugin, methods start() and stop() of this interface will be called. But our service is expected to have completely pure logic - without any side effects - we need to bring these two worlds together - Java impure plugins start/stop and Scala pure logic.
After some investigation, I found that Home Assistant has an integration with Node-RED - a graphical tool for manipulating data and event streams. It could probably satisfy most of my needs. But from time to time I remember that I'm a professional software developer, working with event streams for many years, and for this kind of problem there's nothing better than math (and Scala's type system, which supports it very well).
His first solo single was a cover of Elmer Bernstein's theme from The Man with the Golden Arm, and his debut solo album, Moss Side Story, was a soundtrack to a nonexistent film noir. He's gone on to compose scores for actual soundtracks, like new documentary SCALA!!!, which is about London's infamous arthouse cinema from the '70s and '80s where Adamson spent a lot of time.
Imagine you're working with a third-party library that provides a User class. You need to add JSON serialization to it, but you can't modify the source code. Of course you can create a wrapper class or extend it, but that feels clunky and breaks existing code that expects the original type. This is where type classes shine. They're one of Scala's most powerful patterns, and they're the secret ingredient in popular libraries like Cats, Scalaz, and Circe.
When it comes to Scala interviews, the trick isn't just solving problems - it's solving them the Scala way.Interviewers are often less interested in whether you can code something and more curious about how you think, use language features, and write clean functional code. In this article, I'll walk through three interview-style Scala questions. Each question is designed to test a different dimension of your Scala skill set - from string manipulation to functional collections and stack-based problem solving.
Slick (short for Scala Language Integrated Connection Kit) is one of the most widely used libraries in the Scala ecosystem for functional, type-safe, and composable database access. It provides a clean DSL for querying SQL databases while staying true to Scala's functional style. In this article, we'll explore: What Slick is and why it matters How to set up a Slick environment in a Scala project Basic CRUD operations with examples Slick in Play Framework vs. standalone Scala apps Common pitfalls and best practices
Workflows4s is a Scala library for modeling and running workflows in a type-safe, composable, and functional way. It allows developers to represent long-running business processes or system orchestrations as pure code.
Scala's unique integration of object-oriented programming and functional programming paradigms empowers developers to write concise, expressive, and highly concurrent code, making it an ideal choice for modern software development.