Image for post
Image for post
courtesy: google.com

Before we delve into the Dependency Injection(DI) in ‘.Net core’, it is important to understand why do we need the sorcery DI at all.

Let's start by exploring what is Dependency Inversion Principle(DIP) is. DIP allows you to decouple two classes that otherwise are very tightly coupled which help improving reusability and more maintainability.

DIP states,

For the sake of this discussion, let's ignore the latter and look deeper into the former with an…


Image for post
Image for post
image courtesy: google.com

We have already seen how to create and work with variables, pointers, and Constants. In this article, we are going to see the four important collection types built into the language.

We start with humble Arrays, from there we move on to Slice, an evolved version of Array. From Slice, we talk about the map a key-value pair collection. Let’s start with Arrays here.

Array

Just like in any other programming language, an array in Go is a fixed-sized collection of similar data types.

Array declaration is very straightforward like any other language but with an interesting twist,

   other language syntax          |            Go syntax
int[] arr = new int[10] | arr :=…


Go data types
Go data types

Now its time for us to start digging into the Go language by talking in short about the primitive data types that are used. We are going to keep this discussion into three parts.

  1. Variable declaration and available primitive data types in Go
  2. Pointer and the features of pointers in Go
  3. Constants and how they are different from the other languages.

Variable declaration:

Unlike most of the languages, Go has various flavors of declaring variables. …


Image for post
Image for post

In the previous blog, we discussed arrays one of the most commonly known linear data structure in the programming world. Despite its simplicity and popularity Array by nature got few limitations,

  • Arrays are static by nature which makes it less flexible to fit when the amount of data grows or shrinks
  • Arrays are quite costly for common operations like insertion and deletion

LinkedList:

LinkedList is a linear data structure where each element is an object. Unlike Array, LinkedList is doesn't have a contiguous memory structure. …


Quicksort is one of the efficient and most commonly used algorithms. Most of the languages used quicksort in their inbuild “sort” method implementations. The name comes from the fact that it sorts data faster than any commonly available sorting algorithm and like Merge sort, it also follows the divide and conquer principle.

Quicksort, in particular, is an interesting one nevertheless it takes enough time to get your head around it. Quicksort breaks down the problem of sorting the complete array into smaller problems by breaking down the array into smaller subarray. …


Image for post
Image for post

The array is one of the most common primitive data type in programming languages.

An array is a collection of homogeneous data items stored in contiguous memory locations. That is one chunk of memory that can be either on the stack or the heap. The allocated memory is divided into equally spaced memory locations and each of these locations are indexed by contiguous integers.


Image for post
Image for post

Go was created as an effort to give a single language that mixed efficient compilation, efficient execution, and ease of programming. In the last few years, Go’s rise in fame has demonstrated that it has filled a need in the software development society. Here, we’re going to take a look at Go from a high level, and we’ll answer the following questions.

  1. What is “Go”?
  2. Why you might have to choose “Go”?
  3. What is it like to program in “Go”?

What is Go:


Practical conventions

Image for post
Image for post
Photo by Nick Morrison on Unsplash

Picturing writing code as being like writing a story is a helpful and easy metaphor. It’s also a wonderful perception of the way we see and write code.

I have seen in my daily life how these good practices have helped me and my team to be faster and more productive.

How readable code is structured varies with the computer language with which the programmer is transcribing their mental model into code. Nevertheless, there are a number of guidelines that can be followed in most high-level languages to help ensure code is easily readable.


Image for post
Image for post
Photo by Timothy Dykes on Unsplash

Conditional statements, like if-else and switch, are core to any programming language. We use them day in and day out, but it is surprising that it is viewed as a code smell in an object-oriented programming language (OOP). If you ever wondered why this is like I did, then this article is for us.

Before we go any deeper, let's understand two very important concepts of SOLID principles in OOP

  1. Single Responsibility Principle
  2. Open-Closed principle

Single Responsibility Principle

Robert C. Martin describes the Single responsibility principle as:

“A class should have only one reason to change.”

Martin defines a responsibility as a reason to change and concludes that a class or module should have one, and only one, reason to be changed (i.e. …


Image for post
Image for post
Photo by Clément H on unsplash

If you are someone who always resorts to the for loop and forEach loop to iterate over items in an array, then this is for you. We will explore a few array methods that you can employ as an alternative to simple “for” loops.

There are a lot of advantages of using specific methods over generic for or forEach version.

  • It’s easy to write and others can interpret it easily
  • It’s easy to maintain, extend, and test
  • You can write pure functions without any side effects
  • Helps you thinking in terms of functional programming
  • If you ever plan to use libraries like RxJS, it will surely…

About

Madhavan Nagarajan

Reader | Writer | Developer @ ThoughtWorks|

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