Polymorphism in Golang

In Object-Oriented Programming, an object can behave like another object. This property is called polymorphism. This post will cover how we achieve polymorphism in Golang. What is polymorphism? Polymorphism is a property that is available to many OO-languages. Go despite not being an OO-language achieves polymorphism through interfaces. Polymorphism using interfaces In Golang, polymorphism is […]

Polymorphism in Golang Read More »

Inheritance in Golang

Object-oriented programming is a paradigm that works with objects and has 3 properties – Inheritance, Encapsulation, and Polymorphism. Go also supports OOP, but it’s not like other object-oriented languages. It doesn’t support classes. This post will show how go achieves inheritance without classes. What is inheritance? In OO-languages inheritance refers to the property that a

Inheritance in Golang Read More »

Concurrency in Golang

Concurrency is when a large task is split into smaller sub-tasks and run at the same time. This post provides an outline of how Go handles concurrency. Goroutines Goroutines are an integral part of Go. They are the units of execution inside a Go program. The main function is also another goroutine. They all have

Concurrency in Golang Read More »

Mutex in Golang

Mutexes are an important topic in concurrency. They appear in almost every programming language when they talk about concurrency. In this post, we are going to look at what problems mutexes solve and how. The race condition The race condition appears when multiple goroutines try to access and update the shared data. They instead fail

Mutex in Golang Read More »

Waitgroups in Golang

When doing concurrent programming in Go, it can be seen that the goroutine may not execute and the main thread stops before it finishes executing. This is a problem that frequently appears when doing concurrent programming. Waitgroups solves the problem in an easy way. How Golang waitgroups work? Waitgroup is a blocking mechanism that blocks

Waitgroups in Golang Read More »

Select statement in Golang

Golang select statement is like the switch statement, which is used for multiple channels operation. This statement blocks until any of the cases provided are ready. This post will explore the select statement in the Go programming language. Golang Select Statement Syntax The syntax of the select statement is like the switch statements. It is

Select statement in Golang Read More »

Multiple goroutines in Golang

In this post, we will see how to work with multiple goroutines. If you are looking for the basics, please go through Goroutines in Golang and Channels in Golang. Multiple Goroutines Simple Example This code shows how two goroutines will interact when running concurrently. The output order will not be maintained and each time this

Multiple goroutines in Golang Read More »

Channels in Golang

Channels are a medium that the goroutines use in order to communicate effectively. It is the most important concept to grasp after understanding how goroutines work. This post aims to provide a detailed explanation of the working of the channels and their use cases in Go. Golang Channels syntax In order to use channels, we

Channels in Golang Read More »

Goroutines in Golang

Goroutines are one of the most important aspects of the Go programming language. It is the smallest unit of execution. This post explores the different aspects of a goroutine and how to work with it. What is a goroutine? A goroutine is a lightweight thread in Golang. It can continue its work alongside the main

Goroutines in Golang Read More »