ADTs in Scala (Part 2: ADTs vs OO-Classes)

In my latest post I presented ADTs in Scala 3. I also created a Youtube video about it (check it out here). Since the content was longer, I split it in three parts. This is the second part.

We look at the differences between classes and ADTs. We discuss:

  • Immutability
  • Inheritance
  • Public and private fields
  • Methods
  • Pattern matching

This video is an introduction to ADTs in Scala for object-oriented developers. We look at the differences and show examples of how to change values in ADTs, how methods work and pattern matching.

Continue Reading

Exploring Scala 3 Macros: A Toy Quoted Domain Specific Language

I’ve been wanting to learn Scala 3 macros for a while. They seem well supported and documented. However, I could not find a nice learning path. Most guides only provide toy examples of API architecture, but I haven’t found a guide that shows how to build a real macro with the full API.

In this blog post, I present a small project that uses Scala 3 macros. I assume you know about macros and want to see how to use them in actual code that does something other than compute the power function or asserts some assertion. The project is trivial enough that I include all the code in this blog post.

Continue Reading

Encoding Base58: Understanding and implementing in Scala

I recently needed to convert to and from Base58. An existing crypto library was not an option, because I just needed one function exact function. However, I could not find a suitable Scala implementation, and the algorithm in the specification was unclear.

Understanding the algorithm

An encoding algorithm is just a base transformation, it is the same as transforming between base 2 (binary), 16 (hexadecimal), 10 (decimal) or any other base. The trick here is that the target base has a mapping we can nicely represent to ASCII symbols and as a string of characters. For Base58, the alphabet is:

Continue Reading

My thoughts after 6 months working with DAML: A Smart Contract Language

A smart contract is a fancy term for a “program that runs on the blockchain”. They were first introduced in the Ethereum blockchain and the idea is simple: The blockchain acts as an ubiquitous computer to run the programs (or “smart contracts”) and stores its results and current state. We can all agree on the results and current state of the program, because of the independent consesus provided by the blockchain.

Continue Reading

Will AI Replace Developers?

Since the release of Github Copilot and Chat-GPT, I see many posts and tweets about how AI will or are replacing humans in different tasks. Many have also said that this disruption will come to the developer, which touches me in particular. I have been thinking a lot about this. Will AI replace my job? How?

Personally, I am a user of Chat-GPT and of GH Copilot. Currently, it does not feel like it could replace me, but feels like having a very capable and fast junior developer helping me with menial tasks:

Continue Reading