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,
1. High-level modules should not depend on low-level modules. Both should depend on abstractions.
2. Abstractions should not depend on details. Details should depend on abstractions.
For the sake of this discussion, let's ignore the latter and look deeper into the former with an…
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.
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 :=…
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.
If you are from any other programming language, each one of these is going to be different from what you know. Let’s see them in detail and try to comprehend these features.
Unlike most of the languages, Go has various flavors of declaring variables. …
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,
In this blog, we are going to discuss another linear data structure called LinkedList which help to overcome a few limitations.
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. …
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.
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.
Now that we have our roadmap, let’s start diving in by answering the question, what is Go?
Go is an open-source programming language that makes it easy to build simple, reliable, and efficient software. …
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.
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
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. …
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.
About