scala

Decorator Design Pattern

Hi everyone! In this blog, we are going to discuss decorator design patterns with Scala. Let’s say I own a pizza outlet and we know that everyone has a very different taste and so there can be various combination of toppings. If I have n number of toppings, so i will have to create p(n) = 2 * p(n-1) + 1 Subclasses.

Back2Basics: Scala Extractors in Detail

While working with the Case Classes closely, we have a very concise way to decompose an entity using pattern matching. The potent example is pattern matching on the Some(x) and None, as most of us know they are case class and case object respectively. The potential question that we have is do we have a provision to use similar patterns without having an associated case Continue Reading

ScalaFP: Firsthand With Scala-Cats Monads – #1

In the previous post, we had a look at the reasons behind the monads and how monads can help us design the programs in a functional style. Now we are going to explore some of the monads which are frequently used in the applications but not available within the Scala predefined libraries. We will be exploring the monads which are provided by the scala-cats functional Continue Reading

ScalaFP: Let’s Find The Reasons Behind Monads.

Monads in Functional Programming play an important role but they mostly confuse the beginners. One of the reasons for the confusion is that they mostly have a knowledge of imperative style programming, where they have no idea about function composition and its importance. In the terms of functional programming, the composition is the root where we have a set(Z) and we compose the elements of Continue Reading

Code Combat II : The Code Battle For The Vanguard Continues…

“If you can dream it, you can do it. ”  -Walt Disney For some coding is a job. For some, it is an exercise. But for us folks here at Knoldus, it’s a Passion. So in order to bring a twist in the daily work schedule, Knoldus held an overnight Hackathon competition within the organization on 18th May 2018 which presented an opportunity for every Knolder(employees Continue Reading

map(), flatMap() on Futures & Options in scala

In this blog, we would be looking at how map() and flatMap() operations work with Option and Future of scala, literally speaking both Futures and Options are very effective features of scala, A Future lets us have a value from some task on a differnt thread and Option provides us a hand from null of java as using null in scala is seen a very bad approach in Continue Reading

Do you think your code is Perfect? Well, Think again.

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” – Martin Fowler “I can code.” I always say to myself. But do others think the same? Is my code good enough for people to understand? Do other people think “Damn I wish I could write such code.?” –  that’s the main question I always had in Continue Reading

Back2Basics: Exception Handling – #3

In our previous blog Exception Handling – #2, we talked about how we can handle exception using Either. In this blog, we will explore further about Either, how we can elegantly handle exceptions using Either while working with Collections. We use collections when we want to perform some operations on elements. But what if something goes wrong while performing the transformation, do you have any Continue Reading

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

Clean Code – Robert C. Martin’s Way

Writing good code in accordance with all the best practices is often overrated. But is it really? Writing good and clean code is just like good habits which will come with time and practice. We always give excuses to continue with our patent non-efficient bad code. Reasons like no time for best practices, meeting the deadlines, angry boss, tired of the project etc. Most of Continue Reading

CodeSquad: An insight into code quality

http://getcodesquad.com/ Software development has reached beyond the mere question of, “Does it work?”’ However, the question of “how to improve the code quality and its efficiency?” becomes the primary concern. The code quality improvement is one of the things that requires well-developed strategy and adhering to it throughout the project’s lifecycle. It’s only a matter of time when it catches you up and causes problems Continue Reading

Back2Basics: Exception Handling – #1

While building an application, it is common that something might go wrong. What if there is an attempt to divide a number by 0 or fetching the data from the database which does not exist, or reading a file which can’t be located? We need to handle such situations to make sure our application does not go down. Every language provides ways to handle such Continue Reading

Back2Basics: Catalogue #2

Knoldus Inc is pleased to announce the launch of “Back2Basics: Tutorials”. We at Knoldus firmly believe that quality of coding plays an important role in the success of any IT organization and here we are adding a few more steps to heighten out coding benchmarks. At Knoldus we are laying the foundation for adopting healthier scala coding environment through getting and setting our Basics right. In our Continue Reading

%d bloggers like this: