Never miss a beat

Join my newsletter.

Tag: scala

Pagination in Scala with Slick

Published: 9/2/2019

Pagination is the idea that a list of content can be broken into separate pages. When I first heard of pagination, the common practice was to use query params to influence which rows of content was loaded by the server. If you clicked the “next” button on the page, it would reload the page with new query params. Fundamentally, pagination hasn’t changed much, but the landscape in which it exists has changed drastically. While some monolithic apps are still built today, the pattern for modern web…

Setting Up Sentry Logging with Scala / Play

Published: 4/16/2019

Sentry is an error tracking service that helps you quickly track errors in many environments. While it’s not the only option for error reporting ( Rollbar comes to mind since they sponsor most of the podcasts I listen to), Sentry is my favorite option. Today, we’re going to setup Sentry reporting for our Scala / Play application. The Play framework is a web framework for building predictable and scalable applications. Featuring support for Java and Scala, the Play framework is a great…

Comparing Kotlin to Scala

Published: 3/5/2019

Kotlin to Scala. Scala to Kotlin. Two contenders for my heart. In the left corner, we have the new comer! Weighing in at just over 1.2MB — The Ambassador of Android: Kotlin! And in the right corner, we have the long-time favorite, weighing in at just over 5.3MB — The Archduke of Akka, The Sultan of Spark: Scala! If you’ve made it this far through my silliness, you’re likely comparing Kotlin to Scala for your next project. There’s definitely some key takeaways from the above paragraph that may…

Upper and Lower Bounds in Scala

Published: 4/9/2018

Its pretty common to find yourself working with generics in Scala, but you may find yourself where you want a generic with some constraints. Generally, these constraints can be boiled down to "Subclass" or "Superclass" and Scala offers functionality out of the box to help facilitate this.

Creating a Java Bean from a Scala Class

Published: 3/9/2018

Sometimes, you may find yourself in a situation (like using Scala with Spring) where you need to generate a Java bean but would like to do that in Scala. By default, Scala classes don’t adhere to the requirements of the Bean definition, namely autogenerating getters and setters. Thankfully, there is a BeanProperty decorator that can be used in conjunction with the constructor definition to help adhere to the Bean specification. You can start using it by importing the BeanProperty like so: Then…

Using Generics in Scala

Published: 2/15/2018

Scala has, in it's core library, several classes that are intended to contain (at some point or another) some instance of another class. A few examples of this are seen in Option and Future. These container classes allow you to act upon values that may or may not exist or even to work with values that should appear in the future (hence the name "Future"). The idea of these container classes is fundamentally simple.

Scheduling background tasks in Play with Scala

Published: 2/13/2018

A common theme with web applications is to run tasks in the background. Commonly, they're ran at set intervals. You'll find data processing servers, online-game servers, and several other types of servers using regularly scheduled background tasks and today, you'll learn how to implement these tasks in Play with Scala.