<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How-To Guides on Advanced Beginner</title><link>https://advanced-beginner.github.io/en/docs/scala/howto/</link><description>Recent content in How-To Guides on Advanced Beginner</description><generator>Hugo</generator><language>en-US</language><managingEditor>d8lzz1gpw@mozmail.com (kimbenji)</managingEditor><webMaster>d8lzz1gpw@mozmail.com (kimbenji)</webMaster><lastBuildDate>Mon, 23 Mar 2026 19:08:15 +0900</lastBuildDate><atom:link href="https://advanced-beginner.github.io/en/docs/scala/howto/index.xml" rel="self" type="application/rss+xml"/><item><title>Implicit/Given Debugging</title><link>https://advanced-beginner.github.io/en/docs/scala/howto/implicit-debugging/</link><pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate><author>d8lzz1gpw@mozmail.com (kimbenji)</author><guid>https://advanced-beginner.github.io/en/docs/scala/howto/implicit-debugging/</guid><description>&lt;p&gt;Learn how to diagnose and resolve issues when the compiler cannot find implicit values.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Estimated time&lt;/strong&gt;: 10-15 minutes&lt;/p&gt;
&lt;blockquote class="book-hint info"&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;br&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Scala 2&lt;/strong&gt;: Use &lt;code&gt;-Xlog-implicits&lt;/code&gt; flag to trace the search process&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scala 3&lt;/strong&gt;: Compiler messages are clearer and provide &lt;code&gt;import&lt;/code&gt; suggestions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Common&lt;/strong&gt;: Check if implicit values are in scope and types match exactly&lt;/li&gt;
&lt;/ul&gt;

&lt;/blockquote&gt;

&lt;hr&gt;
&lt;h2 id="what-this-guide-solves"&gt;What This Guide Solves&lt;a class="anchor" href="#what-this-guide-solves"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Use this guide when you encounter these compile errors:&lt;/p&gt;
&lt;div class="book-tabs"&gt;
&lt;input type="radio" class="toggle" name="tabs-1" id="tabs-1-0" checked="checked" /&gt;&lt;label for="tabs-1-0"&gt;Scala 2&lt;/label&gt;&lt;div class="book-tabs-content markdown-inner"&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;could not find implicit value for parameter ord: Ordering[MyClass]&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;or&lt;/p&gt;</description></item><item><title>Future Error Handling</title><link>https://advanced-beginner.github.io/en/docs/scala/howto/future-error-handling/</link><pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate><author>d8lzz1gpw@mozmail.com (kimbenji)</author><guid>https://advanced-beginner.github.io/en/docs/scala/howto/future-error-handling/</guid><description>&lt;p&gt;Learn how to safely handle and debug exceptions in asynchronous code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Estimated time&lt;/strong&gt;: 15-20 minutes&lt;/p&gt;
&lt;blockquote class="book-hint info"&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;br&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;recover&lt;/code&gt;/&lt;code&gt;recoverWith&lt;/code&gt;: Handle specific exceptions and return fallback values&lt;/li&gt;
&lt;li&gt;&lt;code&gt;transform&lt;/code&gt;: Transform both success and failure cases&lt;/li&gt;
&lt;li&gt;&lt;code&gt;onComplete&lt;/code&gt;: Use only for side effects (logging, etc.)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Never do this&lt;/strong&gt;: Use &lt;code&gt;Await.result&lt;/code&gt; to throw exceptions synchronously&lt;/li&gt;
&lt;/ul&gt;

&lt;/blockquote&gt;

&lt;hr&gt;
&lt;h2 id="what-this-guide-solves"&gt;What This Guide Solves&lt;a class="anchor" href="#what-this-guide-solves"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Use this guide when:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Exceptions in Future silently disappear&lt;/li&gt;
&lt;li&gt;You don&amp;rsquo;t know how to handle errors in asynchronous code&lt;/li&gt;
&lt;li&gt;You need to decide between &lt;code&gt;recover&lt;/code&gt;, &lt;code&gt;recoverWith&lt;/code&gt;, and &lt;code&gt;transform&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="symptoms"&gt;Symptoms&lt;a class="anchor" href="#symptoms"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-scala" data-lang="scala"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;scala.concurrent.Future&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;scala.concurrent.ExecutionContext.Implicits.global&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;val&lt;/span&gt; &lt;span class="n"&gt;future&lt;/span&gt; &lt;span class="k"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Future&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;RuntimeException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;Something went wrong&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nc"&gt;Program&lt;/span&gt; &lt;span class="n"&gt;exits&lt;/span&gt; &lt;span class="n"&gt;normally&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;but&lt;/span&gt; &lt;span class="n"&gt;where&lt;/span&gt; &lt;span class="n"&gt;did&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;exception&lt;/span&gt; &lt;span class="n"&gt;go&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="what-this-guide-does-not-cover"&gt;What This Guide Does NOT Cover&lt;a class="anchor" href="#what-this-guide-does-not-cover"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Basic Future concepts&lt;/strong&gt;: See &lt;a href="https://advanced-beginner.github.io/en/docs/scala/concepts/concurrency/"&gt;Concurrency Concepts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cats Effect IO / ZIO error handling&lt;/strong&gt;: Refer to respective library documentation&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Akka actor system error handling&lt;/strong&gt;: Refer to Akka documentation&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="before-you-begin"&gt;Before You Begin&lt;a class="anchor" href="#before-you-begin"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Ensure you have the following environment ready:&lt;/p&gt;</description></item><item><title>Type Error Debugging</title><link>https://advanced-beginner.github.io/en/docs/scala/howto/type-error-debugging/</link><pubDate>Mon, 23 Mar 2026 00:00:00 +0000</pubDate><author>d8lzz1gpw@mozmail.com (kimbenji)</author><guid>https://advanced-beginner.github.io/en/docs/scala/howto/type-error-debugging/</guid><description>&lt;p&gt;This guide walks you through decoding and resolving complex type error messages.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Estimated time&lt;/strong&gt;: About 15-20 minutes&lt;/p&gt;
&lt;blockquote class="book-hint info"&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;br&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Type Mismatch&lt;/strong&gt;: Compare expected and actual types to find where the mismatch occurs&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bounds violation&lt;/strong&gt;: Check upper/lower bound constraints on type parameters&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Variance issues&lt;/strong&gt;: Verify that the correct types appear in covariant/contravariant positions&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;splain plugin&lt;/strong&gt;: Transforms complex type errors into a more readable format&lt;/li&gt;
&lt;/ul&gt;

&lt;/blockquote&gt;

&lt;hr&gt;
&lt;h2 id="problems-this-guide-solves"&gt;Problems This Guide Solves&lt;a class="anchor" href="#problems-this-guide-solves"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Use this guide when you encounter the following compilation errors:&lt;/p&gt;</description></item><item><title>Resolving sbt Dependency Conflicts</title><link>https://advanced-beginner.github.io/en/docs/scala/howto/sbt-dependency-conflicts/</link><pubDate>Mon, 23 Mar 2026 00:00:00 +0000</pubDate><author>d8lzz1gpw@mozmail.com (kimbenji)</author><guid>https://advanced-beginner.github.io/en/docs/scala/howto/sbt-dependency-conflicts/</guid><description>&lt;p&gt;This guide walks you through diagnosing and resolving library version conflicts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Estimated time&lt;/strong&gt;: About 15-20 minutes&lt;/p&gt;
&lt;blockquote class="book-hint info"&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;br&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Symptom&lt;/strong&gt;: Compilation succeeds but &lt;code&gt;NoSuchMethodError&lt;/code&gt; or &lt;code&gt;ClassNotFoundException&lt;/code&gt; occurs at runtime&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Diagnosis&lt;/strong&gt;: Use &lt;code&gt;sbt dependencyTree&lt;/code&gt; to identify conflicting libraries&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resolution&lt;/strong&gt;: Use &lt;code&gt;exclude&lt;/code&gt;, &lt;code&gt;dependencyOverrides&lt;/code&gt;, or &lt;code&gt;force()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Prevention&lt;/strong&gt;: Do not ignore eviction warnings&lt;/li&gt;
&lt;/ul&gt;

&lt;/blockquote&gt;

&lt;hr&gt;
&lt;h2 id="problems-this-guide-solves"&gt;Problems This Guide Solves&lt;a class="anchor" href="#problems-this-guide-solves"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Use this guide in the following situations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Compilation succeeds but &lt;code&gt;NoSuchMethodError&lt;/code&gt; occurs at runtime&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ClassNotFoundException&lt;/code&gt; occurs even though the library is clearly present&lt;/li&gt;
&lt;li&gt;Eviction warnings appear during the sbt build&lt;/li&gt;
&lt;li&gt;Multiple libraries require different versions of the same dependency&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="symptoms"&gt;Symptoms&lt;a class="anchor" href="#symptoms"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Compilation succeeds but error at runtime&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ sbt run
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;java.lang.NoSuchMethodError: &lt;span class="s1"&gt;&amp;#39;void com.google.common.collect.ImmutableMap.forEach()&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Or class not found&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ sbt run
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="what-this-guide-does-not-cover"&gt;What This Guide Does Not Cover&lt;a class="anchor" href="#what-this-guide-does-not-cover"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;sbt basics&lt;/strong&gt;: See the official sbt documentation&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Maven/Gradle dependency management&lt;/strong&gt;: See the respective build tool documentation&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scala binary compatibility&lt;/strong&gt;: Compatibility between Scala versions is a separate topic&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="before-you-begin"&gt;Before You Begin&lt;a class="anchor" href="#before-you-begin"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Verify the following environment is ready:&lt;/p&gt;</description></item><item><title>Performance Profiling</title><link>https://advanced-beginner.github.io/en/docs/scala/howto/performance-profiling/</link><pubDate>Mon, 23 Mar 2026 00:00:00 +0000</pubDate><author>d8lzz1gpw@mozmail.com (kimbenji)</author><guid>https://advanced-beginner.github.io/en/docs/scala/howto/performance-profiling/</guid><description>&lt;p&gt;This guide walks you through finding and optimizing performance bottlenecks in Scala applications.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Estimated time&lt;/strong&gt;: About 20-25 minutes&lt;/p&gt;
&lt;blockquote class="book-hint info"&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;br&gt;&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;CPU profiling&lt;/strong&gt;: Identify hotspots with JFR (Java Flight Recorder)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Memory analysis&lt;/strong&gt;: Analyze heap dumps with VisualVM or MAT&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Collection selection&lt;/strong&gt;: Choosing the right collection for the job can make a significant performance difference&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Optimization techniques&lt;/strong&gt;: &lt;code&gt;@specialized&lt;/code&gt;, &lt;code&gt;@tailrec&lt;/code&gt;, avoiding boxing&lt;/li&gt;
&lt;/ul&gt;

&lt;/blockquote&gt;

&lt;hr&gt;
&lt;h2 id="problems-this-guide-solves"&gt;Problems This Guide Solves&lt;a class="anchor" href="#problems-this-guide-solves"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Use this guide in the following situations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Your application&amp;rsquo;s response time has suddenly become slow&lt;/li&gt;
&lt;li&gt;Memory usage is continuously increasing (suspected memory leak)&lt;/li&gt;
&lt;li&gt;You need to decide which collection to use from a performance perspective&lt;/li&gt;
&lt;li&gt;GC pauses are occurring frequently&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="what-this-guide-does-not-cover"&gt;What This Guide Does Not Cover&lt;a class="anchor" href="#what-this-guide-does-not-cover"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;JVM tuning (GC options, etc.)&lt;/strong&gt;: See the official JVM documentation&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Distributed system performance optimization&lt;/strong&gt;: This is a separate topic&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cats Effect / ZIO performance optimization&lt;/strong&gt;: See the respective library documentation&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h2 id="before-you-begin"&gt;Before You Begin&lt;a class="anchor" href="#before-you-begin"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Verify the following environment is ready:&lt;/p&gt;</description></item></channel></rss>