Inheritance

Go doesn’t have a concept of class or have a class-based inheritance. Go is a bit different than the regular object-oriented languages.

How we can reuse the code if Inheritance is not there?

Go has a unique feature called embedded fields in the struct(More like composition). Using those we can reuse the code, it is pretty much similar to what Inheritance provides in other languages.

The Embedded field is a special field, a field without a field name. Let’s have a look at the below example :

As mentioned in the above example: Animal is an embedded field in the parrot struct. The Animal struct is behaving like a base…


Feel free to checkout this blog to see increasing array size in action.

Firstly what is Amortized time complexity?

According to Wikipedia: In computer science, amortized analysis is a method for analyzing a given algorithm’s complexity, or how much of a resource, especially time or memory, it takes to execute. The motivation for amortized analysis is that looking at the worst-case run time per operation, rather than per algorithm, can be too pessimistic.

In simple words: Instead of calculating time complexity of an algorithm based on its worst case operation, we calculate amortized time complexity of an algorithm by calculating…


First, let’s see slice and append in action:

Output:
[10]
[20 2]
[40 2 3]
[40 2 3 4]

Output is a bit different from what we were expecting right? How come slice3[0] is 40 as we have set it to 30.

Let’s understand how slice and append function works, According to golang documentation:

func append(slice []Type, elems ...Type) []Type

“The append built-in function appends elements to the end of a slice. If it has sufficient capacity, the destination is resliced to accommodate the new elements. If it does not, a new underlying array will be allocated. Append returns…


Many people prefer command line over GUI because it is more efficient for most of the day-to-day tasks of a programmer. In short, “Command line is Love”. But in the case of resolving the conflicts “GUI is Magic”.

In this post, I will be covering How to resolve merge conflicts through GUI. You will find a very similar experience in any other famous IDE that you use.

Let’s take an example where you have testBranch and you wanted to merge updated master into your testBranch. And for doing so run:
git merge master

And consider that you have some conflicts…


The time complexity of calculating distinct count is of order O(N) which is pretty huge if you have the requirement to have real-time analysis on these metrics.
Let’s take an example, Facebook wants to know active users/per minute on the platform. Now, people can log in multiple times with different devices. When you are operating at 2.5 billion users you can’t just fire a distinct count query in the SQL and expect it to get completed in real-time. …


The image is taken from Howitworksdaily

What is Microservices Architecture?

Microservices: Small, and Focused on Doing One Thing Well.

BY Wikipedia: Microservices are a software development technique — a variant of the service-oriented architecture (SOA) architectural style that structures an application as a collection of loosely coupled services. In a microservices architecture, services are fine-grained and the protocols are lightweight.

So what? why would I break my projects into smaller pieces? What is in there for me?

We are living in a digital ERA. Every day a new app comes that reduce man efforts to 1/100th of the original. These Apps start becoming a basic necessity of our life. This lead to a huge increase in the number of customers of these Apps…


“In Actor model, Actors are the basic computation unit and they can interact with each other through messages. You can think an actor as a class containing receive and send message functions, and they can have their own private state and functions. Based on these they can take some action, send messages, or create more actors.”

Now a little bit of Azure Service Fabric:


Please first read my blog regarding embedded fields in Golang here.

What is Design Pattern?

By Wiki: In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn’t a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

Command pattern:

The image is taken from Wikimedia

The Command Pattern allows you to decouple the requester of action from the object that acts. Let’s say your team building a universal remote which can start any car that the user owns.

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