Image for post
Image for post
Photo by Ben Hershey on Unsplash

In general, while doing code reviews, I have developed a strong notion of why the use of null (or nil, NULL, nullptr etc depending on your programming language) generally causes more problems than it solves.

The fundamental problem of null is that it is trying to represent the fact that it is not a value while being assigned as a value. This fundamental flaw then snowballs and manifests into problems that we see in everyday production code.

Here, I have made an attempt to document the various types of issues I commonly find with using null.

Poor language Decisions

Certain languages have not handled edge-cases of null type variables in a consistent manner. For example, in Java, you have primitive and reference types of variables. …

Image for post
Image for post
Photo by Djim Loic on Unsplash

Golang’s native libraries provide an immense amount of functionality that can be leveraged to deal with time in its various formats, extract detailed information from it and manage it effectively in your codebase. Let us take a look at them.

Time Initialization

All common use cases related to formatting and using time values are available natively in the time package. For example, we can use the Now() function available in this package to get the current time.

func main() {   t := time.Now()

giving us the current time in the output:

2020-06-17 16:35:55.374219 +0530 IST m=+0.000097244

The Now function returns an instance of the struct time.Timeavailable in the time package. …

Image for post
Image for post
Photo by Pietro Jeng on Unsplash

Recommender Systems are extremely powerful tools in personalizing the experience of your digital product. Personalization is a proven tool that makes your product more sticky, improves retention and conversion rates. Be it Spotify recommending you the best music for your taste, Amazon recommending you the next thing to buy, or Medium recommending you the next article to read, recommender systems are incredibly powerful in making users derive more value from your product.

As PMs, having a fundamental understanding of how recommendation systems work can go a long way in driving product decisions and having meaningful discussions with engineers and data scientists to ensure everyone is trying to achieve the same goal. …

Image for post
Image for post
Photo by Sandrachile . on Unsplash

Regular expressions are a widely used way of defining and using search patterns for strings and building find/replace functionality into software. However, dealing with them can sometimes lead to frustration from the confusion created by hundreds of libraries and frameworks, each using slightly different approaches to regex handling.

With Golang however, the builtin regexp package contains all use-cases of regexes and is very robust and extremely intuitive to use.

Let us take a look at the various functionalities of the regexp package.

Check for a pattern match in a string

Use the MatchString method to find a pattern in a string. The first parameter is the regular expression to search for, and the second is the input string. …

Learn to use in-built Go features to handle Unix commands

Image for post
Image for post
Photo by Harshal Desai on Unsplash

Accepting and processing signals from the operating system is important for various use cases in applications.

While many server-side languages have complicated or tedious approaches to processing signals from the OS, with Golang applications it’s extremely intuitive. Golang’s in-built OS package provides an easy way to integrate and react to Unix signals from your Go application. Let’s see how.

The Premise

Let’s say we want to build a Golang application that when requested to shutdown prints a message saying, “Thank you for using Golang.” …

Image for post
Image for post
Photo by Joshua Aragon on Unsplash

Java 12 is here. And it has brought a lot of new features and improvements that I’m personally very excited about. From a language and syntax perspective, the most impressive upgrade is the new optimized way of writing switch cases. Let’s take a look at it!

For our sample scenario, we will just write a function which takes the number of the month as input(numbers ranging from 0 to 11), and return the number of days in that month. For simplicity, we will assume February has 28 days in this scenario.

Before Java 12, we would write a function like…

Image for post
Image for post
Photo by Blake Connally on Unsplash

Unit testing is a mandatory component of writing good code. Every developer should know how to write good unit tests. With more and more organisations using Golang, it is imperative that as developers, we learn about writing beautiful unit tests for our Golang functions.

This guide is the most basic introduction to Golang unit testing. It does not cover advanced topics such as mocking, benchmarking, and idempotency. I will try to cover these topics in the future.

So let’s get started.

The Code

The functionality we test today is quite simple. We have an interface Operator which has two methods.

Generate takes two integers and creates a key based on some template, and Degenerate takes a key and decodes out the the integers from which the key was created. …

Image for post
Image for post
Photo by Fatos Bytyqi on Unsplash

Profiling functions is important. Knowing execution time can reveal hidden bottlenecks in your code, provide clear latency estimates before releasing features in production environments, and provide impetus for looking for inefficient algorithm choices in your code.

However, the important thing is that measuring time is not a critical part of the core logic of the function, and thus the code for time measurement should be as non-intrusive as possible.

A Naive Implementation

Let’s say we have a function that does something expensive. For a sample case, we will print the numbers 1 to 5, with intervals of 100 milliseconds between them.

func expensivePrint() {
for i := 1; i <= 5; i++ {
fmt.Printf("Current number is %d \n", i)
time.Sleep(100 * time.Millisecond) …

Learning to use sets and dictionaries in Python

Image for post
Image for post
Photo by Hitesh Choudhary on Unsplash

In the previous installments of the Zero to Hero Python series, we covered:

  1. Dealing with primitive data types like integers, strings, and boolean values.
  2. Interacting with the console and learning about lists and tuples.

In this piece, we will be looking at Python’s in-built collections for supporting mathematical concepts like sets and key-value pairs.

Let’s get started!

Working With Sets

A set is used to store a sequence of unique values.


A set can be declared by making use of curly braces {}.

>>> numSet = {1, 2, 3, 4, 5}
>>> print(numSet)
{1, 2, 3, 4, 5}

If you put duplicate elements in the initialization of a set, only one instance of the elements will be retained. …


Arindam Roy

Product @hyperverge. I write about a lot of things, mostly tech.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store