Table of Contents

1 An Affair with C++

1.1 Falling in love

It was in college, when I was studying computer science that I first learnt C++ as part of the curriculum. Prior to C++, I had studied how to program using C. C++ was (or still is) considered to be an improvement to the C language. I remember reading Stephen Prata as the textbook and Lippman as the reference for learning C++. The course was called "Object Oriented Programming using C++". This meant a paradigm shift from the erstwhile imperative programming (using a language like C). We were taught, as part of the course, to think in terms of objects. Real world objects to be precise. It could be abstract too. Jargon such as inheritance, polymorphism and encapsulation became a parlance. A parlance associated with object orientation. I was wondering back then, "Why C++? when C could do it" The programming constructs such as a class in C++ seemed alien. I started off with rewriting C programs in C++. It was an easier way to learn the syntax and features of a new programming language. Rewrite. I remember writing simple programs for calculating simple interest, bank account (just deposit, withdraw and interest calculation) and so on. Gradually, the object oriented features were introduced and programs for the same were implemented. I found C++ to be a little simpler to understand.

1.2 The trauma

C was a horror when it came to pointers, function pointers, multi-dimensional arrays, and implementing higher level data structures like trees, dictionaries etc. I had real trouble writing programs for implementing data structures. Huffman's algorithm in particular was a real challenge. Till date, I have not been able to implement it in either C or C++. Joel Spolsky, a software developer from New York, who created StackOverflow.com, states: 'programming is an aptitude' in one of his blogs. The real mettle of a programmer lies in the ability to think through abstractions. Two things that matter the most according to his blog are: Pointers and Recursion. He fails to understand why most people cannot think through these abstractions. It is probably an innate ability of a person and not something that one can practice and acquire. I would even go to an extent of calling it a talent. One can acquire skills through practice but to become a successful programmer, say someone like Linus Torvalds, one has to have this in-born ability. Back to C++, I did manage to get good grades in that course, the only challenge with C++ was friend functions. Why befriend someone when you can acquaint? Bjarne Stroustrup, the creator of C++, may have a strong reasoning behind that. Bjarne's talk on Big Think channel of YouTube was inspiring. I found his way of working noteworthy. He would use a small laptop, eleven or thirteen inches, not more than that, to write programs during his travels, and use a headphone to listen to a wide collection of music while programming. I would call Torvalds, Stroustrup and their likes as 'Celebrity Artists'. Artists who hone and master the art of computer programming and wield influence on a lot of fellow programmers. I remember a college professor of mine, who used C++ as a language of choice for understanding abstractions. From machine level to the application level: C++ did it all. Things such as 'name mangling' comes to my mind. He had worked at Yahoo, prior to joining our college. I remember him saying - "The purpose of inheritance is to avoid if-else conditions in the program". I couldn't counter that argument till date. On the contrary, it was reaffirmed by one of my senior colleagues at work, years later. Standard template library (STL) was a life saviour as it provided all the data structures that a C++ programmer would ever need. This was the case, at least back in 2009. After that, I learnt Java and never touched C++ for at least a decade to come.

1.3 Aftermath

During 2018-19, I was part of Thirty Meter Telescope project's Observatory software quality assurance team, wherein I felt the urge to write some C++ code. I took up the task of porting objects written in Scala/Java to C++. Some interfaces were needed for the Event services, as part of the observatory software. After that, when I moved to another organisation and started working on Cisco WebEx teams software, I had tried to use C++ for a certain feature called 'Buttons and Cards'. I had to meddle with C++ code for that. I gave up after a week or so. The cognitive load of going through files of C++ code was overwhelming me. It wasn't the C++ that I had learnt in college; C++ 11, 17 were in vogue now. It had asynchronous functions and weird callbacks. Tad harder to understand using a debugger. I resorted to Java and JavaScript, the languages which almost anyone can program using, without many hassles. I am an avid gamer and most of AAA titles released are written using C++. The language for building modern day console games is C++. I remember tutoring fundamentals of Python programming to Prince, a thirteen year old kid from USA, a year ago, who said - "Minecraft in C++ is faster than Minecraft in Java". He wanted to learn C++ so that he could tweak Minecraft code. I was shocked and perplexed. I initiated C++, starting with the usual 'Hello world' program. The verbosity of C++ as compared to say Python, made it hard for Prince to write programs. Prince and I were used to the Python's bonhomie. Both of us struggled at the beginning, later we decided to learn something else.

Author: Girish

Created: 2022-01-27 Thu 11:37