Posts

PART I – ZIO AND SLICK

All of us are eager to start writing real-world applications using ZIO (Scala library). But ZIO is still quite new, and its ecosystem is still incomplete.

So while we wait for ZIO-HTTP and ZIO-JDBC (or whatever else comes in the future) to happen, we will have to end up integrating ZIO with other frameworks that can communicate with the outside world.

In this article, I want to explore what this kind of integration might look like for two of the most popular libraries – Slick and Akka HTTP.

Read more

Many people think that GraphQL is ‘something’ related to Graph Databases, in my opinion they’re wrong. GraphQL is to Graph DB like Javascript to Java. Are based on similar concepts, but are used for completely different things.

In short: GraphQL is a query language for APIs, optimized for performance, designed and open-sourced by Facebook. In GraphQL you can ask server for connected data and you’ll get in response only what you’ve asked for. Not more. Great! Isn’t it?

Scala is all about type-safety and making the compiler work for you. But what if we need to use SQL which is not a part of Scala? The compiler is not able to validate and type check raw queries. The solution for that problem is Domain Specific Language (DSL). We already have Slick that provides DSL for SQL and allows to work with a database just like with Scala collections.

However, Quill is going even further and supports compile-time query generation and validation. In this post I take a closer look at Quill and show an example application. Read more

We can all agree that it’s useful to be able to express a number. Or a character. It could be argued that most code is built upon some set of primitives. And naturally simple types work well in a limited number of use cases: algorithms, tutorials, small/focused applications etc.

The moment the domain outgrows the natural usage of a given primitive it becomes troublesome to keep in mind what the meaning behind a particular Int is. We all know this, it’s been the driving force behind OOP since day one.

Recently I’ve been working on an application based on play framework 2.4.x and slick 3.0. Unsurprisingly, as the app grew the need to track and control domain specific data became more and more pressing. Read more

At ScalaC we’ve recently started adopting Slick 3.0. If you haven’t tried it yet, hopefully these notes will make the process go smoother. Read more

What is STM?

Wikipedia defines it as follows: software transactional memory (STM) is a concurrency control mechanism analogous to database transactions for controlling access to shared memory in concurrent computing. It is an alternative to lock-based synchronization. Hmmm… but what does it mean in practice? Read more

Adventure begins

Recently me and a few of my colleagues from ScalaC worked on an integration project which aim was to provide an interface between a machine learning engine and its clients via a Spray-based HTTP server and (internally) a persistence layer. As our work meant to be just a part of a larger system we did not have much say in how the data should be persisted or where – MySQL in this case. It was however up to us to decide how we would access the data.

Having had a lot of positive experience with Typesafe’s technologies we immediately turned to Slick. It’s also worth mentioning that one of the expectations was to achieve a reasonable request rate with minimal scaling as our client was a startup with limited funds. Read more