Go - constant variables and const keyword

Brief Programming languages have the notion of constants which means “variables that can not be mutated once declared and initialized”. Go also has almost the same meaning, but in a different context. To initialize a variable as a constant with a value of 10, we can do something like this: const DISCOUNT = 10 In Go, constants mean “storing a literal to a variable”, this can be seen as a version of pattern matching in Erlang....

May 12, 2024 · 2 min · Aleem Isiaka

Dynamically lookup a property in deeply nested object

I was solving a challenge and got to a point where I had to implement a store that could hold arbitrarily deeply nested objects. The new me, I need to see what others have done. I found dot-prop npm package, which solves it quite well. But going through this gist, I found this answer. The author said a “functional way to solve it”… And this right here, is an example of declarative programming....

January 23, 2024 · 1 min · Aleem Isiaka

Imparative and Declarative coding?

As a software engineer, I have written a lot of lines of code, and taking hindsight back to the very first day of my career, I have written a log of bad code. I recently published a new version of my react-here-maps library which saw a sprinkle of my improved skill set. I had a coding interview where I was tasked to add functionality to support extra data points of the original response and think about adding weeks, months, and years to data that only returned days....

January 20, 2024 · 4 min · Aleem Isiaka

Ruby - if statement?

In Ruby, the if statement looks like this val = 1 if val == 1 p "Equality Checked!" end And for if else val = 2 if val == 1 p "Equality Checked!" else p "Equality Unchecked!" end And for if, else if, else val = 2 if val == 1 p "Equality Checked!" elsif val == 2 p "Equality Middle Checked!" else p "Equality Unchecked!" end Also, remember that everything in ruby returns a value, so your if statement can return a value that could be stored in another variable....

January 15, 2024 · 1 min · Aleem Isiaka