---
title: "Discussion on \"Random Scala Tip #697: Avoid Anonymous Functions as Dependencies\" | Hashnode"
description: "Discussion on \"Random Scala Tip #697: Avoid Anonymous Functions as Dependencies\". The Problem\nImagine that you're building an app and somewhere in your code you write something like this:\nclass DoFinanceStuff(cc: CreditCardService):\n\n  def grabClientMoney(card: CardData) =\n    val amount = // ...\n\n    // ...\n\n    cc.processPayment..."
url: "https://hashnode.com/posts/2025-01-07-random-scala-tip-697-avoid-anon-func-deps/677da38bbcf783f0f69af3e9"
---

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

Discussion

# [Random Scala Tip #697: Avoid Anonymous Functions as Dependencies](https://ncreep.hashnode.dev/2025-01-07-random-scala-tip-697-avoid-anon-func-deps?utm_source=hashnode&utm_medium=feed)

The Problem Imagine that you're building an app and somewhere in your code you write something like this: class DoFinanceStuff(cc: CreditCardService): def grabClientMoney(card: CardData) = val amount = // ... // ... cc.processPayment...

Jan 7, 2025 · 7 min read · ncreep.hashnode.dev  
Updated Feb 8  
Read the article

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

## Written by

[Daniel Beskin](https://hashnode.com/@ncreep)

@ncreep

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

This mind intentionally left blank

I enjoy using Scala and Functional Programming to craft code that is beautiful, maintainable, and fun to write. Reach out for software development projects, consulting, and training. https://linksta.cc/@ncreep https://traverse.consulting Buy me a coffee

## Responses

Markdown supported · ⌘↵ to post

[Edmund Leif](https://hashnode.com/@eddy557)

[Apr 16, 2025](https://hashnode.com/posts/2025-01-07-random-scala-tip-697-avoid-anon-func-deps/677da38bbcf783f0f69af3e9/comment/67ff0b2f870f209c7ea4c870)

It is impossible for me to adequately thank Supreme Peregrine Recovery for their amazing support. Upon learning that my close friend had stolen my phone to gain access to private work data, I felt utterly deceived and devastated. Nevertheless, the staff at Supreme Peregrine Recovery took over and gave me the knowledge I had lost. They showed professionalism and understanding as soon as I contacted them. They helped me locate my stolen phone by using sophisticated recovery methods that I never would have imagined were possible. Their commitment to assisting me in recovering my device and safeguarding my data was absolutely astounding. I was able to retrieve my phone and protect my private information because of their prompt action and careful investigation. In addition to giving me my peace of mind back, Supreme Peregrine Recovery assisted me in handling a very trying circumstance with quickness and kindness. I heartily endorse their services to anyone dealing with such problems. +1,8,7,0,2,2,6,0,6,5,9 supremeperegrinerecovery567(@)zohomail(.)com supremeperegrinerecovery(@)proton(.)me info(@)supremeperegrinerecovery(.)com
