Tejas Mandre | Blog

Strongly switching to strongly typed compiled languages

By in software

Back in college, we were taught C as an introductory language to programming. Then we moved to C++. I learnt the basics of both the languages. To give an idea, I did do structs in C and classes in C++. As someone very new to programming I had a hard time grabbing the concepts of classes, structs, access modifiers, data types and so on. I sticked to it though and made a simple console based baking program using the things I learnt. It was good start. Then in my next semester we were taught Python. I quickly realized the ease and speed at which applications in Python could be developed. I started with writing GUI apps in Tkinter, scraping, browser automation scripts and made my way into Python's web frameworks like Django, Flask. I had so much adrenaline rush when a the web app that I wrote loaded into the browser. I started picking up HTML, CSS and JavaScript as well. I learnt the UI library React.js with the same dedication I had for Django and Flask. I started diving deep into Web-sockets, background task processing, threading and so on. I further learnt a lot about infrastructure when I deployed the apps I wrote to public clouds like Amazon. I did freelancing projects in the same and joined a start up in my pre-final year that worked using the same tech. Life was good. But everything started becoming repetitive and the apps that I wrote took a lot of time to debug in case of errors. I was also an amateur programmer back then who didn't know how to structure and maintain a clean codebase. Probably that's another reason for not having confidence in my own code. I used to worry whether the code I am shipping will deliver exactly what it is supposed to deliver or not. I eventually improved my coding style and shipped decent code.

If everything is so good, why the switch?

If you notice the main languages I gained experience were Python and JavaScript both dynamically typed and interpreted. It did teach me a lot about building projects, distributed systems like RabbitMQ, Jenkins, MapReduce, K8s, AWS and so on. But the main focus then was on utilizing these tools. Around this time I joined VMware as an intern. I was amazed by looking at the products VMware had and core technologies that were used to make them. I was actually able to see Hypervisors, Virtualization in action out of college textbooks. I mean I has used VMware Workstation in the past (a type-2 desktop-level hypervisor) but never imagined that it could create poweful clouds when installed at the kernel level (type-1 hypervisor as a OS). I started reading more about ESXi (VMware's hypervisor OS) and the systems built using it as a fundamental unit. VCenter could orchestrate multiple hosts having ESXis installed. All this was really cool and seemed like an engineering miracle.

And then I started thinking how these products are built? how are OSes built? What are kernels? All the core level stuff I had only done on paper and textbooks while in college. This is when it hit me: Yes, Python and JavaScript gave me a good start in my career and taught me a lot of stuff about computers. Python is good for scripting. It offers development speed. But in order to make core technologies that I had been using be it RabbitMQ, Jenkins, K8s, Docker, Redis, SQL DBs and others I need to switch back to languages that are more closer to the hardware. Yes, you can technically write an OS in Python but under the hood Python interpreter and many commonly used libraries are written in C.  Same for JavaScript. So why not learn C/C++ directly. Plus the concurrency in Python sucks because of the global interpreter lock. It cannot effectively consume the CPU cycles to get work done. And also when it comes to shipping with confidence typed languages are certainly a better choice. The output, code design is more predictable. Yes I'd end up writing more code but that's what makes it fun. Plus if you look at the most of famously used databases, key value stores, queues, kernels are all written in strongly typed compiled languages.

As someone who aspires to build / contribute to core product, I am going to stick to languages like C++, Java, maybe Rust someday. I am going to implement all my algorithms, data structures on Leetcode, build my hobby projects in these languages. Luckily my professional work also supports my choices and aligns with it. At work, I got a chance to contribute to a project that did operations at CPU, Memory, Disk level on multiple machines. This was entirely written in C++ and the underlying tech was engineered in house. VMware has a very good engineering culture and smart engineers. I just feel that strong engineering cultures were built on theses strongly typed compiled languages and I very well wish to be a part it and hence the choice. As of today, I am learning concurrency using C++ and trying to understand how it happens at the processor level. I am learning how things happen at the memory level and how the data is structured, loaded into the memory. For networking, I wrote a small console based tic tac toe game that has it's own TCP server binary, custom protocol and a client binary. I also started looking into lexers, compilers but realized that's not my cup of tea and I'd rather focus on learning how to build software.

undefined

Taking the above image extremely seriously: For now, I wish to contribute to Clickhouse DB which is an open source OLAP database written in C++. Gathering all the knowledge required for it! :)