This is the second chapter of Head First Design Patterns book. Though the book has code snippets in Java, my attempt here is to implement the problem discussed in Go. Without further ado, let’s understand the use-case.
We are told to design a weather monitoring application. It consists of 3 sections
Usually I find technical books very dry, but Head First Design Patterns was awash with funny anecdotes and eye-grabbing illustrations. It felt a good place to start learning design patterns though it may miss out on more intricate details. The code examples are in Java. I recently started learning Go and chose it to implement the strategy pattern.
According to the book,
The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Okay, that did not make much sense to me at first too…
Back when I learnt merge sort, I always saw this diagram of dividing the array till the end and merging them in a sorted manner. A passing thought came to my mind, what if we could run the two halves in parallel like the diagram showed. Found out later like any other inventions, I am too late to the game. But felt content that my hunch was right and it has been attempted.
Let’s take a look into the pseudo-code and understand.
A[p...r] : array p : start of array r : end of array MERGE_SORT(A, p, r) if p…
This will be a basic tutorial to familiarize the concept of state hook.
The mini-application will display videos of four rock bands and ask you to like or dislike the bands accordingly. A list of all your liked bands will be displayed below.
I always like to make a small snippet of code on codesandbox to try out things as a proof of concept.
In most of the cases, the data is obtained through an API request. …
In JS, an object is an unordered collection of associated key/value pairs (properties). Each property can reference a primitive type (string, number, boolean, null, undefined) or another object (array, functions, etc).
There are two types of two forms of objects,
const developer = {
name: 'Srinjoy Santra',
age: 21,
"isGraduate": false
};
const developer = new Object();
developer.name = 'Srinjoy Santra';
developer.age = 21;
developer['isGraduate'] = false;
Let’s break these down and see what’s going:
developer
.developer
object.
In the month of December last year, an email from Udacity India appeared in my inbox. Given the brand name of Google and Udacity in the technology and education fields respectively, it was a big opportunity ahead. I proceeded to fill up my application without thinking twice, only to be encountered with thought-provoking questions such as why I should I be considered for the scholarship, my interests and my involvement in my other personal goals.
On 28th October 2017, few of my classmates and me formed a team to participate at our first-ever hackathon. Named #OpenGovDataHack, it was one of the most prestigious hackathons of India. The event was concerned with building a mobile application or an infographic based on the data-sets provided by the government of India.
Being second year students we didn’t know enough to compete in the hackathon. We believed that the 24 hour long event would be one hell of an experience, and sure it was. …
Inspired by ‘Automate the Boring Stuff with Python’ by Al Sweigart , I thought of putting it to some good use for my college based course.