JS Programming in C# - Immutability

Enough! JavaScript had us in its grip for long with its foot guns. The first time I heard the term Hoisting, I had no idea about it and misheard as hosting. You declare variables using var happily, and you have to come to peace with yourself that it is okay…

JS Programming in C# - Local Functions

Functional programs treat functions and data alike. No discrimination, if you will. That means, you can declare and use functions – assign to variables, pass to other functions etc., the same way you would play with variables. A canonical example of a functional program would show how to pass functions…

JS Programming in C# - Objects on the fly

Creating objects without defining types is considered a great flexibility in JavaScript. JavaScript treats objects nothing more than key-value pairs. Yeah, you can declare functions in the object but they are still part of the key-value philosophy. Bottomline: JavaScript did not start out as an object oriented language. Typically, objects…

Writing sonnets in C++

Recently, I came across this post – Write a URL in a C++ program, one of those C’s tricks. If you have not already read the post, I will wait until you read and return … Waiting … The crux of the trick is the protocol part of the…

Compiler aided overloading

I was playing with xUnit.net for a pet project of mine. I wasn’t writing test cases with xUnit rather I was using the underlying xUnit engine to discover test cases and invoke calls that execute desired test cases. Forget the details of what I was doing, let…

Problem Reduction

Problem Reduction is what I call when a given problem can be expressed in terms of or solved using a solution to an alternate problem. Take for instance, the word distance problem: Find the shortest distance between two words in a given set of words. Following is an unanimous solution,…

Iterators vs. Generators

Yes, there is a difference. Although both produce the same end effect, an iterator is not the same as a generator. The difference is in the way it is implemented and also consumed. Iterators Iterator is a (design/implementation) pattern for iterating over different kinds of collection sources via an…

JINQ

In his talk at the CppCon 2014, Bjarne Stroustrup explained, politely and brilliantly, how to write succinct expressive yet intent-ful code. The task is especially hard when there are parties interested in trolling1 rather than contributing. Like Stroustrup explains back, it is difficult to find the real meaning out of…