While modeling the domain I often use sealed trait hierarchies, value classes, and case classes. They are essential for idiomatic Scala code. However, the encoding and decoding them to JSON can be problematic. Even though Circe provides boilerplate-free generic derivation, the JSON encoded using the default configuration may be confusing. In this post, I describe how to make it more friendly.
Asynchronous applications are much harder to debug. You do not get the whole stack trace so easily. So it is important to react to all the exceptions that might unexpectedly occur. I found a case when following a simple pattern to run futures in parallel leads to loss of exceptions. In this post I describe a solution for that.
This month I switched to emacs for scala programming. I was tired of the IntelliJ IDEA slowness and the fact that it consumes lots of CPU and memory. It works great for java, but with scala it’s unpleasant. Then I discovered spacemacs and ensime. I felt a relief. I find it much more ergonomic and faster IDE for scala. However, the beginnings are hard. I wrote this post to help you with the firsts steps in emacs.
The code should be easy to read. One of the programming principles to make the code more readable is to avoid nested operations. The so-called pyramid of doom does not only refers to callback hell in javascript but ofter appear in scala as well. Here, I describe how to make the for-comprehensions more elegant when using monad transformers in scala.
This month I started working remotely. It turns out that it is harder to stay focused and productive that way. However, I managed to gather and integrate apps that help me to increase productivity and avoid distractions. In this post, I describe what I am using and why.
Following the recent trend of “10 Things You Need To…” articles I decided to write my own list of things that you need to do. Nah. I have just built the list based on my experience and mistakes that I do not want to repeat. This is my checklist for future production deployments.
Http4s and scalaz-stream are good alternatives for akka-http and akka-stream. In this post, I show how easy it is to stream data over HTTP using them. Streaming allows to operate on heavy data without the necessity to store it in the memory. With http4s, it is just a few lines of code.
Sometimes it is necessary to use the same library in two different versions in one application. This is when dependency hell arises. This post describes how to quickly resolve it in maven.
In my master thesis I evaluated performance of blocking and non-blocking web frameworks in the context of distributed RESTful micro services. Non-blocking frameworks tend to have higher scalability as the processor is not wasted on context switching between threads. This post summarizes my findings.
Recently I was working on yet another startup project (mobile app with backend). The goal was to make the backend stateless and highly scalable. I did not want to maintain sessions. So I was looking for authentication and authorization mechanism for RESTful APIs which is scalable, secure and appropriate for mobile. The solution was HMAC. This post describes how to handle it using spray.io.