What the heck are Scala's ExecutionContext's?
Dec 27, 2016 · 3 min readAn ExecutionContext or otherwise called a thread pool is vital when running asynchronous code. In Scala, there is a global ExecutionContext that you can supply to your asynchronous code blocks. An ExecutionContext is just an Executor of a Task. It executes a Task in such a way that it is free to execute the Task in a …
Read MorePartial Functions in Scala
Sep 23, 2016 · 4 min readBefore taking a look at what partial functions in Scala is, let's look at some examples that map an assorted List of elements: 1 val assorted = List(1,2,"joe","san") 2 assorted map { case i: Int => i + 1 } The code above when tried results in a match error. The reason being that we have an anonymous …
Read MoreMaking a Case for Scala's case classes
Aug 25, 2016 · 3 min readIf you are like me that is fed-up with writing or generating those getters / setters in your domain objects or Data Transfer Objects or Value Objects, deferring the process of writing at compile time is definitely a boon. Scala's case classes does exactly that. Some noteworthy things to know about Scala case classes. …
Read MoreScala's for expression
Jun 14, 2016 · 3 min readThis blog article takes a deeper look into Scala's for comprehensions. The for comprehension / expression in Scala has the following syntax: 1 for ( seq ) yield expr In deed a very simple syntax underneath which lies a very strong fundamental concept. The seq in the syntax above could be a sequence of generators, …
Read MoreAccessing Tuples in Scala
May 13, 2016 · 1 min readScala seems to be like a gold mine, the more you dig into, the more you get. While you deal with tuples, when you want to access the elements of a tuple, you have to use the default numbering given to you by the Scala compiler. Say for example., you have a tuple as defined below: 1val myTuple = (31, "Joesan", …
Read MoreSealed Traits in Scala
Apr 6, 2016 · 2 min readYou probably know the idea behind using case classes and pattern matching them. Sometimes you might want the help of the compiler to tell you if you have pattern matched correctly by covering all possible cases. You can now get this sort of compiler support by creating a superclass for the case classes and marking them …
Read MoreLiner Interpolation
Jan 13, 2016 · 3 min readIn mathematics, linear interpolation is understood as a method of curve fitting using linear polynomials. A polynomial is just an expression that consists of variables along with their co-efficients. An example of a polynomial would be: 1x+2y² In the above equation, the variable x has 1 as its coefficient, the …
Read MoreBuilder, Strategy Patterns Still relevant?
Oct 22, 2015 · 5 min readIf you agree with me that writing less code equals lesser bugs, you are going to appreciate how Scala simplifies Strategy and Builder design patterns by making you write less code! Let's look at them one by one. Let us see how the Builder design pattern is implemented in Java. Builder Pattern Builder design pattern …
Read MoreFacts & Knowledge Nuggets
1 min readThis page exists for one single fact that upon a glance on the topic, you get your aha moment! Scala Co-Variant & Contra-Variant Spark SQL Joins
Read MorePrivacy Policy
1 min readUpdated on: 19.12.2021 This website does not collect any personally identifiable information that can be used to personally identify you. There are no cookies installed that could be used to individually track you. To learn more about cookies, please visit this website here. Links to third party websites This website …
Read More