Author: Mahesh Chand

monads

Back2Basics: Understanding Partially Applied Functions

In this blog, we are going to talk about Partially applied functions and its use case. Before starting, first, we will emphasize that though Partial functions and Partially applied functions sound similar they are different from each other. To understand Partial Functions refer. What is function application? Applying a function is called calling a function. When we pass all arguments of the function, we can Continue Reading

monads

Back2Basics: Understanding Partial Function – #2

In previous blog Understanding Partial Functions – #1, we have talked about what is partial function and how they are different from regular functions. In this blog, we will explore more about the partial function. We have talked about how we can define partial functions having one argument. But what to do if we have to pass more than one argument. Let’s try defining divide Continue Reading

monads

Back2Basics: Understanding Partial Functions – #1

  In this blog, we will talk about partial functions. We know about functions in Scala. Let’s talk about it first. So, what is a function? A function is a mapping or a transformation of an input to an output. For example,  we have function isEven, which takes an int value and retuns boolean value. scala> def isEven(x :Int) = x % 2 == 0 Continue Reading

Back2Basics: The Story of Trait – Part 4

In our previous blog The Story of Trait – Part 3, we have discussed the mixin, one of the charming feature of traits. Now we are going to explore chaining of traits. We have seen how can we mix more than one traits into classes. But what would happen if two traits have same method i.e same name and same signature? This is where Multiple Inheritance Continue Reading

Back2Basics: Demystifying Eta Expansion

In this blog, we will talk about eta expansion in Scala. How they behave under the hood before and after Scala version 2.12. Scala has both methods and functions in Scala. We refer them interchangeably but there are situations where the difference matters. When you see the bytecode generated by the Scala compiler for Test, scala> :javap -c Test Compiled from “” public class Test Continue Reading

Back2Basics: The Story of Trait – Part 3

In our previous blog The Story of Trait – Part 2, we have discussed that traits can have implementation too and how they behave under the hood. In this blog, we will discuss mixins one of the most charming features of traits. Mixins are the wonderful concept of object-oriented programming. Sadly, some of the mainstream object-oriented programming languages like C++, Java, C#, have not provided Continue Reading

Back2Basics: The Story of Trait – Part 2

In our previous blog The Story of Trait – Part 1, we have discussed how traits are the just regular interfaces at the very basic form. In this blog, we will explore about traits can have method implementation too. We will continue with our previous example and modify it and see how trait behaves in different scenarios.

Back2Basics: The Story of Trait – Part 1

In this blog, we will have a look at traits in Scala. We have classes in Scala. Suppose we have a class Dog which has a method speak. class Dog(val name: String){ def speak() = println(s”$name is barking”) } Now if we want another class Cat which has the same method speak. What we will do? In Java, generally, we create an interface Animal and Continue Reading

Getting Lazy With Scala

In this blog, we will talk about lazy evaluation in Scala. How we can add efficiency to our application? Efficiency is achieved not just by running things faster, but by avoiding things that shouldn’t be done in the first place. In functional programming, lazy evaluation means efficiency.  Laziness lets us separate the description of an expression from the evaluation of that expression. This gives us Continue Reading

Knolx: Demystifying Mesos

Hello everyone, Knoldus organized a session on Fri Dec 15, 2017. The topic was “Introduction to Mesos”. Many people attended and enjoyed the session. In this blog post, I am going to share the slides & video of the session. Slides: Introduction to Apache Mesos from Knoldus Inc.

Working with XML in Scala

In this blog, we will talk about how we can work with XML using Scala. Scala treats XML as the first-class citizen. So, instead of embedding XML documents into strings. , you can place them inline in your code like you place an int or double value. For example scala> val xml = Hello xml: scala.xml.Elem = Hello scala> xml.getClass res2: Class[_ <: scala.xml.Elem] = Continue Reading

How to throttle messages using Akka Fsm ?

A few days ago, I was having an issue that the rate of incoming message requests to the process was too high.  All requests were thus being processed in future. By default, every message request was getting processed in parallel. But this was too much parallelism. It was flooding the thread pool with a lot of simultaneous work. A better way to do it is Continue Reading

Exploring the Real Power of Functional Programming

We have been programming with object-oriented technology for quite a while. But now we are moving away from it. Functional Programming is getting lot of attention nowadays. Even every mainstream language is now supporting functional style i.e Java, C++, C# etc. Basically, it is one of the paradigm of writing code where we write less code and do more. Why do we really care about Continue Reading

%d bloggers like this: