# Design

**URL:** https://users.scala-lang.org/c/design/11.md

[Latest](https://users.scala-lang.org/latest.md) · [Categories](https://users.scala-lang.org/categories.md)

---

## [About the Design category](https://users.scala-lang.org/t/about-the-design-category/577)

<div class="topic-metadata">

**Author:** [@heather.miller](https://users.scala-lang.org/u/heather.miller)\
**Replies:** 0

</div>

Questions about how to model systems using Scala. For discussing the Scala language itself, use contributors.scala-lang.org instead.

---

## [Fast and Durable: how Redis and Postgres split the work in a game backend](https://users.scala-lang.org/t/fast-and-durable-how-redis-and-postgres-split-the-work-in-a-game-backend/12313)

<div class="topic-metadata">

**Author:** [@andy327](https://users.scala-lang.org/u/andy327)\
**Replies:** 1\
**Last updated:** [July 26, 2026, 10:35am UTC](https://users.scala-lang.org/t/fast-and-durable-how-redis-and-postgres-split-the-work-in-a-game-backend/12313 "2026-07-26T10:35:13Z")

</div>

I wrote up the persistence layer of a multiplayer, turn-based game backend I’ve been building in Scala (Pekko, Cats Effect, Doobie, redis4cats), evolving the design one problem at a time: everything-in-memory → Postgres …

---

## [RFC: sbt 2.0 on JDK 17](https://users.scala-lang.org/t/rfc-sbt-2-0-on-jdk-17/12169)

<div class="topic-metadata">

**Author:** [@eed3si9n](https://users.scala-lang.org/u/eed3si9n)\
**Replies:** 25\
**Last updated:** [January 18, 2026, 8:13am UTC](https://users.scala-lang.org/t/rfc-sbt-2-0-on-jdk-17/12169 "2026-01-18T08:13:17Z")

</div>

Hello, On behalf of the sbt project, I would like to solicit your feedback on the minimum JDK version required for sbt 2.0. sbt 1.x has existed for nine years, which continues to support JDK 8, 11, 17, and 25. For sbt …

---

## [Scala shortcomings for modeling ASTs](https://users.scala-lang.org/t/scala-shortcomings-for-modeling-asts/12179)

<div class="topic-metadata">

**Author:** [@rcano](https://users.scala-lang.org/u/rcano)\
**Replies:** 7\
**Last updated:** [January 14, 2026, 11:59am UTC](https://users.scala-lang.org/t/scala-shortcomings-for-modeling-asts/12179 "2026-01-14T11:59:52Z")

</div>

When modeling ASTs, typically most nodes will have their shape defined as case class with arguments, but in many asts, you typically have secondary properties that you don’t want to have them be a part of the deconstruct…

---

## [Supporting cross-compilation and repository organization pros and cons](https://users.scala-lang.org/t/supporting-cross-compilation-and-repository-organization-pros-and-cons/12137)

<div class="topic-metadata">

**Author:** [@Turin](https://users.scala-lang.org/u/Turin)\
**Replies:** 1\
**Last updated:** [November 30, 2025, 11:30am UTC](https://users.scala-lang.org/t/supporting-cross-compilation-and-repository-organization-pros-and-cons/12137 "2025-11-30T11:30:49Z")

</div>

The most typical way of managing many release lines for projects I worked on was to keep seperate branches in the same project. This means that backports and forward-ports are relatively easy. The downside is that, in or…

---

## [Children of Scala](https://users.scala-lang.org/t/children-of-scala/12093)

<div class="topic-metadata">

**Author:** [@kolotyluk](https://users.scala-lang.org/u/kolotyluk)\
**Replies:** 4\
**Last updated:** [October 30, 2025, 6:22pm UTC](https://users.scala-lang.org/t/children-of-scala/12093 "2025-10-30T18:22:31Z")

</div>

I have been programming since 1970, using Java since 1995, and Scala since 2005. I have had a love-hate relationship with Scala, and learned to love Kotlin. More recently, I have learned to love Rust. But I want more……

---

## [Design advice on a merge abstraction](https://users.scala-lang.org/t/design-advice-on-a-merge-abstraction/12038)

<div class="topic-metadata">

**Author:** [@sageserpent-open](https://users.scala-lang.org/u/sageserpent-open)\
**Replies:** 4\
**Last updated:** [September 23, 2025, 8:09am UTC](https://users.scala-lang.org/t/design-advice-on-a-merge-abstraction/12038 "2025-09-23T08:09:15Z")

</div>

Hi all, A request for some design advice. Get yourself a brew, it’s a long one… Background: I have an abstraction to represent merges (in the sense of merging file content, eg. Git merge) that looks like this… trait M…

---

## [What's new (in reliability)?](https://users.scala-lang.org/t/whats-new-in-reliability/12037)

<div class="topic-metadata">

**Author:** [@som-snytt](https://users.scala-lang.org/u/som-snytt)\
**Replies:** 2\
**Last updated:** [September 14, 2025, 7:00pm UTC](https://users.scala-lang.org/t/whats-new-in-reliability/12037 "2025-09-14T19:00:53Z")

</div>

Someone posted the idea that a gradual rollout of a feature dilutes the signal of catastrophic failure so that it’s harder to identify a cause. An illustrative example was a Kafka outage that resulted in a service disru…

---

## [What does "type-safe" mean in Scala?](https://users.scala-lang.org/t/what-does-type-safe-mean-in-scala/10330)

<div class="topic-metadata">

**Author:** [@eggo](https://users.scala-lang.org/u/eggo)\
**Replies:** 10\
**Last updated:** [October 30, 2024, 10:33pm UTC](https://users.scala-lang.org/t/what-does-type-safe-mean-in-scala/10330 "2024-10-30T22:33:00Z")

</div>

I’m new here and I’m not sure if I understand “type-safe” in Scala 3 correctly. To me, “type-safe” means, simply put, that I am prevented from using apples when I would need pears. This should be detected by the compiler…

---

## [Parameterized enums in scala 3 accessed from Java](https://users.scala-lang.org/t/parameterized-enums-in-scala-3-accessed-from-java/10197)

<div class="topic-metadata">

**Author:** [@mcallisto](https://users.scala-lang.org/u/mcallisto)\
**Replies:** 14\
**Last updated:** [September 10, 2024, 8:35am UTC](https://users.scala-lang.org/t/parameterized-enums-in-scala-3-accessed-from-java/10197 "2024-09-10T08:35:46Z")

</div>

Hi all, I am writing a Scala 3 library, with the requirement that has to be used within Java projects as well. I was liberally using Enum in my code… until I discovered that Scala 3 enumerations, if parameterized, seem…

---

## [Representation of numeric type with dynamic constraint](https://users.scala-lang.org/t/representation-of-numeric-type-with-dynamic-constraint/9786)

<div class="topic-metadata">

**Author:** [@sangamon](https://users.scala-lang.org/u/sangamon)\
**Replies:** 3\
**Last updated:** [February 11, 2024, 1:13pm UTC](https://users.scala-lang.org/t/representation-of-numeric-type-with-dynamic-constraint/9786 "2024-02-11T13:13:39Z")

</div>

I am looking for a nice way to represent a numeric type that is constrained via runtime configuration. Example: Pagination of search results. The maximum page size, psMax (\> 0), is given in the service configuration, the…

---

## [Structured logging context with cats-effect](https://users.scala-lang.org/t/structured-logging-context-with-cats-effect/9740)

<div class="topic-metadata">

**Author:** [@sangamon](https://users.scala-lang.org/u/sangamon)\
**Replies:** 7\
**Last updated:** [January 26, 2024, 3:02pm UTC](https://users.scala-lang.org/t/structured-logging-context-with-cats-effect/9740 "2024-01-26T15:02:36Z")

</div>

Any suggestions for structured logging with a cats-effect stack (http4s, fs2, doobie, circe and more)? Currently I’m using log4cats and the logstash logback encoder for JSON formatted log lines. Now I’d like to add cust…

---

## [Domain-Driven Design and Scala](https://users.scala-lang.org/t/domain-driven-design-and-scala/9736)

<div class="topic-metadata">

**Author:** [@yyqwerty](https://users.scala-lang.org/u/yyqwerty)\
**Replies:** 4\
**Last updated:** [January 22, 2024, 3:28am UTC](https://users.scala-lang.org/t/domain-driven-design-and-scala/9736 "2024-01-22T03:28:33Z")

</div>

Hey. Scala is known for its ability to model complex domains and DDD (Domain-Driven Design) is known for the same thing. Are there anything like that (How to Implement Domain-Driven Design (DDD) in Golang | by Percy Bo…

---

## [How do you choose when to return Option.None vs. an empty sequence?](https://users.scala-lang.org/t/how-do-you-choose-when-to-return-option-none-vs-an-empty-sequence/9372)

<div class="topic-metadata">

**Author:** [@tsegarra](https://users.scala-lang.org/u/tsegarra)\
**Replies:** 8\
**Last updated:** [June 30, 2023, 9:42pm UTC](https://users.scala-lang.org/t/how-do-you-choose-when-to-return-option-none-vs-an-empty-sequence/9372 "2023-06-30T21:42:14Z")

</div>

I’m writing a virus-scanning class. It has a public method that takes a file path (string) and returns a Seq\[String\], where each string is a description of a virus found. For some inputs, no viruses will be found. I’m d…

---

## [Is Scala Too Complex?](https://users.scala-lang.org/t/is-scala-too-complex/9279)

<div class="topic-metadata">

**Author:** [@kolotyluk](https://users.scala-lang.org/u/kolotyluk)\
**Replies:** 9\
**Last updated:** [May 6, 2023, 4:42pm UTC](https://users.scala-lang.org/t/is-scala-too-complex/9279 "2023-05-06T16:42:39Z")

</div>

Years ago, I raised this topic elsewhere, and it became a big stink for many reasons… Not long after that, I left that forum because I was getting trolled too much, and shortly after that, they established long-overdue g…

---

## [Ending the confusion of private case class constructor in Scala 2.13 or 2.14](https://users.scala-lang.org/t/ending-the-confusion-of-private-case-class-constructor-in-scala-2-13-or-2-14/2915)

<div class="topic-metadata">

**Author:** [@akauppi](https://users.scala-lang.org/u/akauppi)\
**Replies:** 11\
**Last updated:** [April 22, 2023, 4:59am UTC](https://users.scala-lang.org/t/ending-the-confusion-of-private-case-class-constructor-in-scala-2-13-or-2-14/2915 "2023-04-22T04:59:06Z")

</div>

There is a bug open about this (only mentioning .copy, but .apply should likely be treated alike). The bug comments mention “… the principled thing is to give the synthetic copy method the same access modifiers as the p…

---

## [Performance impact of union type](https://users.scala-lang.org/t/performance-impact-of-union-type/8776)

<div class="topic-metadata">

**Author:** [@polarker](https://users.scala-lang.org/u/polarker)\
**Replies:** 3\
**Last updated:** [February 3, 2023, 9:46am UTC](https://users.scala-lang.org/t/performance-impact-of-union-type/8776 "2023-02-03T09:46:41Z")

</div>

While union type is very convenient in some cases, I am wondering what is the performance impact of this feature. Does it introduce extra boxing/unboxing operations? Is it more efficient than a class hierarchy? Is ther…

---

## [A box for typeclasses](https://users.scala-lang.org/t/a-box-for-typeclasses/8926)

<div class="topic-metadata">

**Author:** [@adampauls](https://users.scala-lang.org/u/adampauls)\
**Replies:** 7\
**Last updated:** [November 7, 2022, 3:20am UTC](https://users.scala-lang.org/t/a-box-for-typeclasses/8926 "2022-11-07T03:20:46Z")

</div>

My team has been trying to develop a subset of Scala that only uses typeclasses and no inheritance. Along the way, we have identified some relatively small changes to Scala (like wildcard context bounds) that e.g. Rust h…

---

## [I want to know your thoughts about hijacking \`def ==\` for other purposes](https://users.scala-lang.org/t/i-want-to-know-your-thoughts-about-hijacking-def-for-other-purposes/8910)

<div class="topic-metadata">

**Author:** [@Turin](https://users.scala-lang.org/u/Turin)\
**Replies:** 4\
**Last updated:** [October 28, 2022, 7:56am UTC](https://users.scala-lang.org/t/i-want-to-know-your-thoughts-about-hijacking-def-for-other-purposes/8910 "2022-10-28T07:56:28Z")

</div>

When desiging any kind of expression DSL, there is a need to create an expression for equality. Please consider: trait Expr\[T\] { def same(other :Expr\[T\]) :Expr\[T\] = Eq(this, other) } case class Literal\[T\](value :T)…

---

## [Containers Redux](https://users.scala-lang.org/t/containers-redux/8763)

<div class="topic-metadata">

**Author:** [@markehammons](https://users.scala-lang.org/u/markehammons)\
**Replies:** 0\
**Last updated:** [August 26, 2022, 9:15pm UTC](https://users.scala-lang.org/t/containers-redux/8763 "2022-08-26T21:15:10Z")

</div>

http://mark.hammons.fr/blog/containers-redux-2022-08-26.gmi I’ve written up an expansion of the Container concept I described in an earlier post. In this one I also explain a non-academic usage of this pattern that I’ve…

---

## [Metadata types with Scala 3](https://users.scala-lang.org/t/metadata-types-with-scala-3/8635)

<div class="topic-metadata">

**Author:** [@markehammons](https://users.scala-lang.org/u/markehammons)\
**Replies:** 0\
**Last updated:** [July 8, 2022, 12:41pm UTC](https://users.scala-lang.org/t/metadata-types-with-scala-3/8635 "2022-07-08T12:41:27Z")

</div>

This is a blog post I’ve written about what I’m calling metadata types. These are types that provide additional data about a type.

---

## [Simple, Naïve, and Wrong: More than you wanted to know about Case Classes](https://users.scala-lang.org/t/simple-naive-and-wrong-more-than-you-wanted-to-know-about-case-classes/8300)

<div class="topic-metadata">

**Author:** [@chaotic3quilibrium](https://users.scala-lang.org/u/chaotic3quilibrium)\
**Replies:** 24\
**Last updated:** [May 23, 2022, 6:19pm UTC](https://users.scala-lang.org/t/simple-naive-and-wrong-more-than-you-wanted-to-know-about-case-classes/8300 "2022-05-23T18:19:22Z")

</div>

This is the “Effective Scala Case Class Patterns” guide I wished I had read years ago when starting my Scala journey.

---

## [Could Type Macros be a thing?](https://users.scala-lang.org/t/could-type-macros-be-a-thing/8005)

<div class="topic-metadata">

**Author:** [@markehammons](https://users.scala-lang.org/u/markehammons)\
**Replies:** 0\
**Last updated:** [December 10, 2021, 2:25am UTC](https://users.scala-lang.org/t/could-type-macros-be-a-thing/8005 "2021-12-10T02:25:35Z")

</div>

In scala 3 we have inline methods, which allow some of the power of macros, and then macros themselves. While using macros, I have found myself wishing for a similar thing to exist for match types: type macros. In a libr…

---

## [Will Java Project Loom affect Scala and Akka?](https://users.scala-lang.org/t/will-java-project-loom-affect-scala-and-akka/7871)

<div class="topic-metadata">

**Author:** [@kolotyluk](https://users.scala-lang.org/u/kolotyluk)\
**Replies:** 1\
**Last updated:** [October 19, 2021, 1:35pm UTC](https://users.scala-lang.org/t/will-java-project-loom-affect-scala-and-akka/7871 "2021-10-19T13:35:58Z")

</div>

I have been following Project Loom for some time now, but more recently Project Loom: Next Level Java - Daniel Hinojosa and Modern, Scalable Concurrency for the Java Platform. Project Loom remedies many of the shortcomi…

---

## [Refactoring and output data](https://users.scala-lang.org/t/refactoring-and-output-data/7771)

<div class="topic-metadata">

**Author:** [@Maia](https://users.scala-lang.org/u/Maia)\
**Replies:** 22\
**Last updated:** [September 17, 2021, 11:37am UTC](https://users.scala-lang.org/t/refactoring-and-output-data/7771 "2021-09-17T11:37:29Z")

</div>

Hello, I’d like to know if the method readData() which may have Null output could be refactored ? Also, is it better to a separate readData outside of readSetOfData ? Thank you very much def readData( originalDi: Str…

---

## [Questons regarding type projection in Dotty/Scala3](https://users.scala-lang.org/t/questons-regarding-type-projection-in-dotty-scala3/7510)

<div class="topic-metadata">

**Author:** [@hmf](https://users.scala-lang.org/u/hmf)\
**Replies:** 0\
**Last updated:** [June 1, 2021, 9:20am UTC](https://users.scala-lang.org/t/questons-regarding-type-projection-in-dotty-scala3/7510 "2021-06-01T09:20:38Z")

</div>

I had already asked something about type projections here, but I have some additional questions. Consider the this example: case class TypeT\[T\](m:T): def doA: String = m.toString trait Abstract: type I type T = …

---

## [Scala3 extension drops colon's right-associativity](https://users.scala-lang.org/t/scala3-extension-drops-colons-right-associativity/7478)

<div class="topic-metadata">

**Author:** [@jwvh](https://users.scala-lang.org/u/jwvh)\
**Replies:** 1\
**Last updated:** [May 24, 2021, 3:53pm UTC](https://users.scala-lang.org/t/scala3-extension-drops-colons-right-associativity/7478 "2021-05-24T15:53:24Z")

</div>

The following produces different results depending on which line is un-commented. // implicit class C(i: Int): //extension the old way // extension (i: Int) //extension the new way def @:(arg: Int):Unit…

---

## [Is \`lazy\` thread-safe?](https://users.scala-lang.org/t/is-lazy-thread-safe/7279)

<div class="topic-metadata">

**Author:** [@dubaut](https://users.scala-lang.org/u/dubaut)\
**Replies:** 6\
**Last updated:** [April 3, 2021, 12:38am UTC](https://users.scala-lang.org/t/is-lazy-thread-safe/7279 "2021-04-03T00:38:31Z")

</div>

Continuing the discussion from \[SOLVED\] Using \`Future\` combined with \`synchronized\`: Is lazy thread-safe? Can anyone clarify this?

---

## [\[SOLVED\] Using \`Future\` combined with \`synchronized\`](https://users.scala-lang.org/t/solved-using-future-combined-with-synchronized/7269)

<div class="topic-metadata">

**Author:** [@dubaut](https://users.scala-lang.org/u/dubaut)\
**Replies:** 16\
**Last updated:** [March 31, 2021, 8:51am UTC](https://users.scala-lang.org/t/solved-using-future-combined-with-synchronized/7269 "2021-03-31T08:51:18Z")

</div>

In my application, I need to access a ZIP file, extract it to a temporary folder and provide the path of this folder. The respective ZIP files can get quite large, the ArchiveManager should implement the following featur…

---

## [\[SOLVED\] Chained if-statements vs. for comprehension](https://users.scala-lang.org/t/solved-chained-if-statements-vs-for-comprehension/7236)

<div class="topic-metadata">

**Author:** [@dubaut](https://users.scala-lang.org/u/dubaut)\
**Replies:** 8\
**Last updated:** [March 24, 2021, 1:55pm UTC](https://users.scala-lang.org/t/solved-chained-if-statements-vs-for-comprehension/7236 "2021-03-24T13:55:27Z")

</div>

Let’s say I want to check, whether a path exists, is a directory, and can be written. Until now I’d have solved this task this way: def checkPath(path: Path): Either\[ErrorMessage, Unit\] = if (Files.exists(path) == fa…

[Next page](https://users.scala-lang.org/c/design/11.md?page=1)
