Speaking directly to Cassandra over its native protocol using ZIO & Scodec

Most developers will sooner or later need to interact with some database from within the application. We then reach for an established Object Relational mapping or Functional Relational Mapping library of our choice.

Those are frameworks and libraries that help us interact with the database — handle mapping between objects and database’s tables (or graphs, depending on your database), help us with query constructions and so much more.

One such example is (one that many object-oriented programmers are familiar with) a Hibernate. Functional programmers might reach for Slick or Quill.

These usually depend on another layer — some driver —…

Combining Scala functional libraries for fun and productivity

Scala often gets a reputation for how complicated it is to write and setup and how much boilerplate there is. The same goes for functional programming. My goal is to show you the opposite — how even with limited knowledge of the following topics you can productively use competing libraries in the same field, and how well they fit together. How you can easily treat Kafka topics as streams of data, how simply you can compose SQL statements into a bigger transaction, and overall how productive you can be in today's Scala’s ecosystem.

This article relies on some very limited…

Fields and columns that could save you lots of time

The other kind of favorite columns

I’ll share my two tips for database structure based on “what I wish I had” when working with — and maintaining legacy applications. I’ve experienced the pain of not following the recommendations below — fixing it required lots of time and a deliberate approach. As it usually is with tips like these, one should think about where and when to use them and even more importantly, when to not use them.

They apply for both relational and nonrelational databases, but I’ll use simple Postgres as a reference. Examples are written in Scala3 but should be applicable in other typed languages.

Use Enumerations instead of Booleans

Exploring Completion & Context Suggester

In this article, we’ll explore implementing typeahead (or in other words, autocomplete) for a real dataset using Completion Suggester. We’ll then create phrases that map to our completion and ask for some suggestions based on the movie’s title. After that, we’ll use contexts to limit our suggestions to only some genres while applying specific boosts per genre.

The goal is an exploration of this feature, its API, and possible usage.

We will not look at the performance (although the chosen one is supposedly the fastest), go through all the options suggesters give us, or take a look at other alternatives…

We will be looking into ways of accessing your Gmail via Google API, following it up further with a low-level approach — programmatically via SMTP & XOAuth2. This is a rather uncommon way, as the provided client APIs are sufficient in most cases. Next, we’ll approach cases that are not achievable with Gmail library clients.

This blog has educational purposes and is supplemented by code that demonstrates the principles outlined here. All of the code can be found in this repository.

Before proceeding, we need to get our app’s credentials (one that will perform the authorized actions on your…

Marek Kadek

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store