Spring is a very popular framework in the world of Java, and one of the reasons behind its popularity and high usage rate is its dependency injection mechanism.
Kotlin, on the other hand, is a JVM language created by the team at JetBrains that is considered to be the modern version of Java alongside Scala, for example.
How good would it be to use a modern language with the solid, robust, and time-tested Spring framework?
Fortunately, in January 2017, it was announced that Spring version 5.0 will provide support for Kotlin. So, starting from Spring Boot version 2.x, Kotlin will have their first-class support. …
Recently, I wrote a comprehensive tutorial on how to build an event-driven application with Kafka and DynamoDB. The tutorial covers the end-to-end of building a working application which exposes 2 x endpoints:
POSTendpoint to receive a request to create a new user
GETendpoint to return a user information
POST endpoint publishes a message containing a user creation request from the client to a Kafka topic. There’s a Kafka listener pipeline that subscribes to this topic, consumes the messages, and, finally, persists the new user information in a DynamoDB table. …
As developers, most of us spend a fair amount of time on Git to manage our version control. We also use Git to collaborate with other developers to track bug fixes, build new features, refactor codes, and many more things.
In this tutorial, I am going to share with you three common scenarios that you will face or have encountered previously and how to deal with them.
I don’t know about you, but where I work, I do my development based on Jira tickets. What this means is all my pull requests will have their corresponding branches named as per the respective ticket number. This is also true for the first commit of the pull request (i.e. it starts with the ticket number followed by the commit message). …
If you have been using the AWS Java SDK for DynamoDB since its version 1, you will have implemented or come across the
DynamoDBMapper class. This class allows us to define the relationship or mapping between the actual items in the DynamoDB table and the Java POJO classes in our application.
In other words, the AWS Java SDK takes care of or abstracts out the low-level operations, i.e., constructing the relevant DynamoDB expression for the corresponding CRUD operations. This is very convenient for us when we write our application code.
To cut the story short, here comes the AWS Java SDK version 2. It is a major rewrite of version 1. The initial releases did not have the DynamoDB abstraction as provided by the
DynamoDBMapper class from version 1. What this means is that we need to handle the low-level operations, i.e., constructing attribute values and the Java POJO class objects. …
Empty meeting room at the office? Well, that is most likely how meeting rooms all over the world look like during this unprecedented time of COVID-19. Almost all organisations, if not all, are working remotely and meetings are conducted via online conferencing software, such as Zoom, Google Hangouts and Microsoft Teams.
This is also the case for my company and my Church’s bible study organisation. In the case of my bible study activities, we usually would take attendance. When it was done in person, it was easy as we were broken up to a few classes. …
In this tutorial, we will learn how to handle exceptions in Python by using the try except clause.
But first, what is an exception? 🤔
An exception is an error that is thrown by our code when the execution of the code results in an unexpected outcome. Normally, an exception will have an error type and an error message. Some examples are as follows.
ZeroDivisionError: division by zero
TypeError: must be str, not int
TypeError are the error type and the text that comes after the colon is the error message. …
String is one of the basic type in any programming languages, including Kotlin. I have never seen any application or program that does not deal with
String. Have you ever? 🤔
That’s why I thought we should spend some time looking at the fundamentals of
String. In this tutorial, we will learn the basics of
String in the Kotlin programming language.
Let’s start by learning how to initialise a
String object. To initialise a String object, simply wraps your expression with double quotes
val myString = "This is my first String object"
myString::classprintln(myString)// val myString: String
// class kotlin.String …
In Python, one of the most used data structures is
list in Python is basically an ordered collection that can hold a number of items or objects. Just think about a to-do list, which basically just contains the list of things for us to do.
There are 2 ways to initialise a
demo_one = list([1, 2, 3, 4, 5])
print(demo_one) # [1, 2, 3, 4, 5]demo_two = [1, 2, 3, 4, 5]
print(demo_two) # [1, 2, 3, 4, 5]
Alternatively, if you don’t already know what are the items the list will store, you can also initialise an empty
list like so. …
Pattern matching is one of the most powerful tools that the Scala language has to offer. It is similar to
when statement in Kotlin and
switch statement in Java.
Essentially, it compares an input with all the possible cases we want to match it with. In my opinion, it’s an elegant alternative to using multiple lines of
if-else statements and it’s more readable when there are many cases to compare against.
In this tutorial, we are going to learn how to use pattern matching in Scala by looking at a few different scenarios.
For those who are interested in Kotlin’s
when statement, you can go to this tutorial. …
In this tutorial, we are going to learn how to download a specific Sheet by name from a Google Spreadsheet into a csv file. A use case for this: you need to generate a report, which data are stored in a Google Spreadsheet that has many Sheets, but you only need one or two of them. …