Day 1 of C++....too much friction to begin with.

a rough start of my c++ journey

The why.

I started my day today, pondering about the energy efficiency of python, and how mere leetcoding on python impacts the environment. Thus, I began looking for energy efficient languages for my daily coding practice.

upon careful research online, I narrowed down my choice of languages to three:-

  • C++.

  • Rust.

  • C.

Choosing one of these has proven to be a more difficult task than I anticipated initially.

Rust has been making headlines from the past couple of years and seemed like a good choice, but its kinda hard to find good solutions in rust language, as it is not being used by the competitive coding community. It might become a choice in the future, but as of now competitive coding with rust is basically non-existent.

As for C, it seemed like a good choice. Being one of the oldest languages, it has a large community, so much so that basically every software engineer/student can understand C to an extent. However, C being a procedural language I didn't feel that it would be ideal for solving advanced problems.

C++ had little complaints from my side, it seemed ideal with its speed and community support. Compared to my current go-to language, python, C++ is blazingly fast and its STL appealed to me.

The strategy.

Before battling the bosses, I first need to learn how to play the game. So, I decied to solve a hundred problems on C++ before proceeding further. I opened up the problemset of Codeforces and began solving them one after the other.

The roadblock.

Yup, that is how many attempts I made before getting an acceptance to the easiest problem(possibly) on codeforces. At that point, I realised the need of having C++ in my system locally, so that i can use an offline judge before submitting.

This is the single most frustating thing I have done in the past few months, getting to install g++ on my windows laptop seemed too tedious for a language thats so widely used, I mean come on how easy it is to start running python scripts locally.

After pushing my way through this with the help of my friend Sahasra Sagiraju( you can call him a C++ guru), trying GNU mirror webiste, an attempt to use homebrew from Windows Subsystem for Linux(WSL), I just proceeded to install CLION text editor. Gosh, once my system got rebooted post-installation, I could run C++ locally. If not for him, I might as well have given up on doing C++ LOL ๐Ÿ˜‚.

The learning curve.

Coding from the past few years made it quite easy for me to catch on to C++, the syntax was quite familiar to Java, and I could solve implementation level problems quite easily whilst referring to W3schools and Windows copilot for syntax help and debugging.

My takeaway.

I tried to find a shortcut easy way to start using C++ locally and in that process my whole focus was on getting it done ASAP, rather than trying to get it working. This led to me a panic mode making me wonder "why am I even doing this", but after recieving my friend's help, it was clear that this journey through an ambigous situation is what that made him so knowledged about C++. It is thus important to focus on the journey rather than the destination, else we lose sight of what is most important for long-term yields.

ย