Day 2 -

June 6th

Track 1 (Olympic Room)

11:00 - 11:45

Writing a Database in Scala.js

This year I’ve been writing a browser-based database application named “TinyDB” that is meant to be an entrypoint into basic, spreadsheet-like tasks for manipulating tabular data. As part of the development, I’ve had to implement a lot of the fundamentals of databases from scratch, and reconcile their implementation details with how I would normally design programs including compilers, parsers, interpreters, and so on. Scala is uniquely well-suited to modelling all kinds of programs using very concise and purposeful code, such as function composition, Scala 3’s new features such as enumerations and union types, type classes, and ways to opt-in to laziness when it benefits the developer. For designing a database, I would like to detail just how these features come into play, and how these lessons also apply to everyday programs. For example, defining column types as enumerations, or implementing a high-level language for the user to construct queries or transformation functions. This will not be a step-by-step, live demo of creating a database, but it will be an exercise of practical lessons learned while implementing a database’s core feature-set, as database design consists of following several common best-practices for efficiency, user-friendliness, and future extensibility.

There will be live demos of the application running in a browser to illustrate the power of Scala.js, and time will be dedicated to some of the necessary constraints and limitations that Scala.js requires.

Ryan Peters

Xebia Functional

I am a Scala developer at Xebia Functional with a particular passion for DSLs. When I’m not writing functional databases in your web browser, I’m often playing with my dogs or working on my annoyingly large video game backlog.


Join our conference

Subscribe and follow @ScalaDays on Twitter for the latest conference updates.