Facets of Immutability

Immutability, the cornerstone of functional programming, has many facets.

Not every (mainstream) language supports all the facets; at least not per what each facet stands for. That’s what I will talk about today. The various facets of immutability from a theoretical perspective, and briefly show how some of the mainstream languages have adopted and support these facets in their own way.

Continue reading Facets of Immutability

Advertisements

A Paradox of Braces

A great deal of thought goes into language design. Eric Lippert’s posts is a living testament, at least for C#. Syntax and idioms are also part of the language design. When designing a language, the designers have to also consider its future. For instance, when designing C#, Anders and others should have thought of and planned for what’s coming in then upcoming version(s) of C#. Such level of forethought might be seem daunting for an outsider. But the language designers are good at what they do, and most importantly, they know what they are doing. Well, in most cases!

Continue reading A Paradox of Braces

My Take on Picking a Log Level

Logging? What’s there to talk about logging? It’s straightforward. Use the one of the log levels and log it.

The ubiquitous log4j‘s website says …

ERROR level designates error events that might still allow the application to continue running
FATAL level designates very severe error events that will presumably lead the application to abort
INFO level designates informational messages that highlight the progress of the application at coarse-grained level
WARN level designates potentially harmful situations

That is the theory of it. Let me tell you my opinion on a more practical matter.

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 are created on the fly1 using the object literal syntax:

let obj = {
   name: "Will",
   age: 26
};

There are scenarios when creating objects on the fly is indeed a flexibility.

Continue reading JS Programming in C# – Objects on the fly

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 …

waitingWaiting …

The crux of the trick is the protocol part of the URL – http:, becomes a goto label and the rest of the URL starting with // becomes a comment. Sweet 🤗

My turn My turn …

Continue reading Writing sonnets in C++

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 us talk about it in a different post. But for now, I was consuming xUnit’s backend library.

XunitFrontController is the gateway to xUnit’s world; AFAIK. You create an instance of the controller specifying the target assembly.

var xfc = new XunitFrontController(
  AppDomainSupport.IfAvailable,
  "{full path of the assembly where the test cases reside}"
);

Continue reading Compiler aided overloading

C++/CLI Primer – An Apress Book

Earlier this year, I wrote about publishing C++/CLI Primer on LeanPub.com. I wondered if there is anybody else besides myself and Microsoft using C++/CLI but readers surprised and humbled me with their support. Seems C++/CLI is here to stay. Know why?

A couple of months back Apress Publications took notice of the book and offered to publish/print. So here it is: C++/CLI Primer for .NET Development, my first book; who would’ve thought 😎

I don’t see this publication as a great achievement or something for there are “miles to go … miles to go”. But it is a little thing to celebrate; cute moments of life.

In penning down the book I was just the vehicle. Friends and family are the wheels and fuel of the vehicle.

Thanks to Apress – Steve, Mark, Amrita and the team.

Thanks to my wife and my brother who always supported and encouraged me to write.

Thanks to Sanjeev and Sammy for not letting my fire within die.

Finally, also taking liberty on behalf of Sanjeev: Special thanks to Tom Craig. Yeah, we would still have been in software development, made names and everything. But without his guidance and inspiration we wouldn’t have known what makes programming a joy.