---
title: "Discussion on \"Self Type in Scala\" | Hashnode"
description: "Discussion on \"Self Type in Scala\". Different usages of self types in Scala"
url: "https://hashnode.com/posts/self-type-in-scala/62a36a80165482d2b3ee9b9d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Self Type in Scala](https://yadukrishnan.live/self-type-in-scala?utm_source=hashnode&utm_medium=feed)

Different usages of self types in Scala

Jun 10, 2022 · 3 min read · yadukrishnan.live  
Updated Oct 1, 2023  
Read the article

-   [#scala](https://hashnode.com/tag/scala)
-   [#functional-programming](https://hashnode.com/tag/functional-programming)
-   [#cake-pattern](https://hashnode.com/tag/cake-pattern)
-   [#scala-basics](https://hashnode.com/tag/scala-basics)

## Written by

[Yadukrishnan](https://hashnode.com/@yadukrishnan)

@yadukrishnan · Hamburg, Germany

  
[View profile](https://hashnode.com/@yadukrishnan)

Software Developer - Scala

Travel | Movies | History | Nature I am a software developer. Started my career as a Java developer, but later switched to Scala. I wish to write Scala articles which are easier for newbies to follow. I love to travel, prefer to be alone or in very small group. Love to watch movies/series.

## Responses 1

Markdown supported · ⌘↵ to post

[Nick F](https://hashnode.com/@sevengraff)

[Sep 9, 2022](https://hashnode.com/posts/self-type-in-scala/62a36a80165482d2b3ee9b9d/comment/631b74a0f73f4734bc051f95)

> Self Type as Dependency

Have you used this in the wild? It seems interesting, but not sure when I would use it. Perhaps if I don't control the `Vehicle` trait, but I want to extend it? But Scala has Extension Methods to do this as well. When should I use one or the other? I haven't had to use Extension Methods either. Perhaps this is more for building Libraries and not Applications?

> Self Type as Tagging

This remind me a lot of `var that = this;` in JavaScript haha, brings me back. :-)

[Yadukrishnan](https://hashnode.com/@yadukrishnan)

[Sep 16, 2022](https://hashnode.com/posts/self-type-in-scala/62a36a80165482d2b3ee9b9d/comment/631b74a0f73f4734bc051f95#reply-632483f2bc15ea8efdf5db4d)

Hey [Nick F](https://hashnode.com/@sevengraff), Self Type as a dependency is widely used in Scala libraries. Overusing it can make it a pain. This is how "cake pattern" is implemented.
