Using Java 8's Function interface for extension

In this article I will show how existing interfaces can be extended to provide additional features by using the Function interface, introduced in Java 8, without breaking existing code. I will show, through practical examples, the usages of the apply, compose and andThen methods from the Function interface. [Read More]

Practical Guide to Java 8’s Date Time API

I will be covering the features of the Java 8’s Date Time API from a practical standpoint, which means those features that a developer uses on a daily basis. This API was introduced as part of the JSR-310. In addition to improvements over existing Date and Calendar in representing date... [Read More]

How functional programming helps me write clean code

I have been writing code for several years now. One thing that I have realized is that I have spent much more time in reading code than writing code. Hence, as a part of continuous improvement, I invest a lot of time in learning new techniques to write clean code.... [Read More]

Using asynchrony to reduce response times in Java 8

Java 8, among other changes, had introduced CompletableFuture which has made writing asynchronous programs in Java easy. In this article I will be using CompletableFuture to explain how asynchronous programs are written and what value asynchronous programs bring in the context of backend services’ response times. I will also be... [Read More]

Java 8 Optional as a Monad

Lately there has been lot of discussions around functional programming and object oriented programming and their differences. A few functional programming constructs had also been introduced in Java 8 release a couple of years back. Since then I have been exploring functional programming and I have realized that using a... [Read More]

REST Error Responses in Spring Boot

The format of error responses from REST web services has always been a topic of grey area for me. According to me, whatever format you choose, it should give enough information to the clients, consuming the REST web services, so that the clients can handle the error situations gracefully. Spring... [Read More]

Writing Comparators - The Java 8 Way

Java 8 introduced a few default methods and static factory methods on the Comparator interface using which developers can write Comparators in a declarative way. The Comparator interface combines the principles from Builder Pattern, Factory Method Pattern, Decorator Pattern and Functional Programming to come up with a very expressive API.... [Read More]