[{"content":"A year ago, I started writing my first professional project in Go. Until then, I had never written a single line of that programming language. Most of my prior work has always been in Python and Java. This article summarises my experience with the language, peppered with some opinions here and there. However, this is not an opinion and judgement on the language. This is also not a guide on how to learn Go.\nSo here we go.\nSyntax and Go\u0026rsquo;s simplicity Go prides itself on being simple. You can pick up the language syntax, idioms and gotchas within a few days at best and a week at worst. If you are coming from a dynamically typed PL background (like Python in my case), it might take you slightly longer, but if you are coming from a statically typed PL background, like Java, skilling up in Go would be a breeze.\nThis brings me to my second point. It\u0026rsquo;s very easy to mistake Go\u0026rsquo;s simplicity for a weakness. Coming from a Python background, I was missing the three ways to set up your environment, the multiple coding standards and packages that did a lot. (Where are my sync and async methods?) At some level, I felt that the language\u0026rsquo;s simplicity would be the bottleneck in solving the problem(s) at hand.\nIn hindsight, I was so wrong. Go\u0026rsquo;s extraordinary power is its simplicity and ease of use. I would highly recommend this talk by Rob Pike, who covers why and how Go is simple.\nThe fact that Go is simple doesn\u0026rsquo;t stop you from solving complex problems. The correct way of writing Go code is to think simply and break complex chunks into simpler chunks.\nSome of the nastiest tech debt that I introduced in my Go project in the earlier days was because I brought my Python way of thinking into the project.\nConsistency There\u0026rsquo;s one way of formatting Go code; the specification comes from the language itself (go fmt). No matter what codebase we are talking about, they look the same—no debates about camel-case vs snake-case, tabs vs spaces, whitespaces, etc.\nThere\u0026rsquo;s also only one way to manage Go packages and projects. Project dependencies are specified in go.mod. Packages are added to a project via go install, and that\u0026rsquo;s it.\nI usually work on both Go and Python projects, and every time I use Pip or Conda, I miss Go\u0026rsquo;s package management.\nAlso, in a corporate setup, you are more often than not using proprietary packages. In Python, you have two options to accomplish this: you either vendor in the package or host your internal registry. In Go, you can install it straight from your internal Git repository. It makes life so much more enjoyable!\nErrors should always be returned as values This was the first time in my life that I came across the concept of returning errors as values. I love this concept so much that I have a hot take.\nHot take: Try Catches should be illegal.\nReturning errors as values tell the programmer exactly which function can error and which cannot. This explicitly forces you to handle errors but also gives you the freedom to decide how to handle the error.\nDue to a constraint violation, the DB layer failed to insert a row into the table. Check the error value and return an HTTP status code to the user. Did the CLI get an invalid option? Log the error and return a non-zero exit code.\nYou can neatly design your package to return from a list of possible errors that the caller can check.\nThe package bar defines a list of possible errors that any public function can return.\npackage bar var ( ErrBadRequest = errors.New(\u0026#34;bad_request\u0026#34;) ErrInternal = errors.New(\u0026#34;internal_error\u0026#34;) ) func DoSomething() (string, err) { return \u0026#34;\u0026#34;, errInternal } On the other hand, the caller package foo can check the error type and handle it appropriately.\npackage foo func main() { s, err := bar.DoSomething() if errors.Is(err, bar.ErrBadRequest) { // Do something }else if errors.Is(err, bar.ErrInternal) { // Do something else } else { // Do a third thing, maybe panic? } } Compare this to the Python equivalent.\ndef main(): try: s = bar.do_something() except Exception as e: if isinstance(e, bar.ErrBadRequest): # do something. This is so much cleaner than the Python equivalent. More importantly, it is easier for a new co-worker to understand. In the Python world, the only way to know whether or not a function can error is by relying on the documentation, which, if we are honest, can be a hit or miss.\nI also understand that this is a matter of taste. But my taste in this is strong.\nInterfaces and lack of inheritance Another shocker was the lack of inheritance. As someone whose education, undergrad and otherwise, revolved around OOPs and inheritance, I struggled to grasp the why behind interfaces and why one should accept interfaces and returns structs.\nBut it is the better way to program. Consumer functions define the interfaces they use, and producers return concrete types.\nFor example, let\u0026rsquo;s say we have a function, WriteData, in our service layer that attempts to create a new record in your data storage layer. Note that this layer can change from time to time - today, it is Postgres; tomorrow, it can be Mongo; the day after, it can be MySQL.\nWriteData accepts an interface StoreWriter that defines the relevant methods. The function internally doesn\u0026rsquo;t care who or what type implemented that method as long as the type has defined methods that satisfy the interface.\ntype StoreWriter interface { InsertNewData(b []byte) error } func WriteData(s StoreWriter) error { // some other stuff return s.InsertNewData(b) } Another great example is the Marshaller / Unmarshaller interface. Go\u0026rsquo;s standard library has the encoding/JSON package, the primary way Go projects convert structs to JSON and vice versa. The reliance on a pre-defined interface makes introducing custom marshalling and unmarshalling behaviour super easy. Simply add an Unmarshal and a Marshal method onto your struct that defines the custom behaviour. Another remarkable aspect is that nested structs can have their own custom marshalling and unmarshalling logic!\nWriting unit tests with mocking becomes easy when your functions and methods accept interfaces.\nI recommend going through the Go Tour\u0026rsquo;s slides on interfaces.\nConcurrency: Goroutines and channels Ah, concurrency! This is the highlight of articles and videos praising Go. While Go excels at concurrency—especially compared to Python—the key takeaway is the contrasting synchronisation approach.\nGo recommends sharing memory and synchronising concurrent processes by passing messages via channels. Note that the standard library also implements a locking mechanism exposed via the sync package, should a use-case demand it.\nA lot has been said over the internet about Go\u0026rsquo;s concurrency, and it\u0026rsquo;s not productive to rehash all that again. From my experience, the whole message-passing construct is fantastic, simple and easy to reason about and maintain.\nSome closing thoughts Philosophically, programming languages represent the worldview of their creators and long-term maintainers. They are the culmination of a million decisions made by people in the project, each driven by some implicit and explicit factors, often not apparent to a casual user.\nGo, above all, is a professional tool. It is designed and expected to make building software more efficient. It is a dead simple language with an extensive standard library and good enough DX.\nLike all good and reliable tools, it stops being the concern and fades into the background. There is no bickering about ten different formatting styles (like JS and Python) or a steep learning curve with an almost academic rigour (like Rust).\nAs a language, Go often doesn\u0026rsquo;t inspire a lot of hot debate, and that\u0026rsquo;s a good thing. It\u0026rsquo;s a good, reliable tool that gets the job done. It also helps by making coding really enjoyable.\n","permalink":"https://pranjaldatta.com/post/one-year-of-writing-go/","summary":"\u003cp\u003eA year ago, I started writing my first professional project in Go. Until then, I had never written a single line of that programming language. Most of my prior work has always been in Python and Java. This article summarises my experience with the language, peppered with some opinions here and there. However, this is not an \u003cem\u003eopinion and judgement on the language.\u003c/em\u003e This is also not a guide on how to learn Go.\u003c/p\u003e","title":"One year of writing software in Go"},{"content":" Why am I here? Source: https://www.bankrate.com/\nI recently completed my undergrad in CS Engineering and graduated. Like most of my peers around the world \u0026mdash; past or present \u0026mdash; during the course, I firmly believed in the irrelevance of college education (apart from being yet another checkbox in a status-driven society).\nNow that I am on the other side, and with the benefit of hindsight, context, and more importantly, distance from temporal and localized pain, I\u0026rsquo;ve come around 180 degrees \u0026mdash; I think college and your degree are relevant, probably more than ever. This is a long read. I have provided a table of contents so that you can jump around. There\u0026rsquo;s also a summary in the end for the folks interested in a quick read.\nSections Disclaimers and Assumptions\nExposure\nPeer Relationships\nAlumni Network\nBrand and Mean Can-Do Index\nGo where your curiosity takes you\nReality and the eternal cycle of suffering\nBias and Incentives Online.\nSummary\nConclusion\nDisclaimers and Assumptions The topic at hand is a pretty complicated and opinion-rich one. But more importantly, this is fundamentally a contextual topic. For example, the problems and issues of the higher education system in, say, the US doesn\u0026rsquo;t translate in its entirety to the issues of the Indian Higher education system. Within the Indian context, too, sub-contexts are very important. Engineering disciplines have their own set of issues that have little overlap with, say, medical and liberal art disciplines.\nIt suffices to say that context and nuance are fundamentally crucial for topics like these.\nHence below is the set of assumptions and disclaimers I hope you keep in mind while reading this article \u0026mdash; so here goes,\nI am 22 years old at the time of writing and graduated a couple of weeks ago. Take everything mentioned here with a two-pinches of salt. With time and experience, my opinions on this would most definitely change.\nThis article is primarily meant for B.Tech folks in India. It would probably make little sense to people outside this limited context. If you are one of them, thanks for stopping by, and I hope you enjoy reading just for fun!\nI am aware and actively trying to counter my survivorship bias. I have been through the intense workload pressures and other stuff that make people mad about the system.\nMost of the things mentioned here are personal lived experiences and observed experiences of peers.\nThere are a lot of nuances involved. I will try to be explicit about the more obvious ones but it must be noted that it is not possible to account for each and every nuance and subtlety.\nExposure Before we go ahead, let\u0026rsquo;s define what I mean by a background in the context of an 18-year-old fresher.\nBackground for an 18-year-old is the number of family members and people in close familial proximity in engineering. Not just the degree, but their career tracks too are in engineering.\nNow that the definition is established, let us carry on.\nVery few people come from a family of engineers. Most people come from very non-technical / traditional backgrounds. Along with pretty much all of my friends, I belong to this category.\nWhat is the issue here? Well, frankly, we don\u0026rsquo;t know much about the larger industry and, more importantly, the trends before college. Most of our decisions/plans before joining are driven by folklore, some of them being,\nThe whole B.Tech -\u0026gt; MBA -\u0026gt; Investment Bank career track. CS \u0026raquo; everything else. Engineering \u0026raquo; everything else. Working in software companies is painful, a source of unhappiness, full of regimentation, and everyone is just sad. (Thanks, Bollywood!) College is like a buffet of exposure and experiences. A couple of weeks in, you realize that careers can be in all shades of the color palette, beyond the black and white you thought it to be.\nBatchmate who is programming for the first time is roommate with batchmate who has been programming since age 10? Check. Peers who want to stay in engineering roles vs. peers who found their calling in other non-tech domains? Check. An electrical engineer who transitioned into Software? Check. The friend who wants to join the military/IAS after graduation? Check. Batchmate joining the film industry after graduation? Check.\nYour batch probably has people coming from all sorts of backgrounds. And everyone is trying to figure out what they want to do. Some would find their calling in the process, while the rest would carry on the search. But the fact that you spend four years of your life with fellow travelers on this journey exposes you to ways, means, and ideas you never knew could exist. And that\u0026rsquo;s important.\nI know you are asking, \u0026ldquo;But hey, what about Twitter and online communities?\u0026rdquo;. Please read on to The Bias and Incentives Online section.\nPeer Relationships Colleges in India, especially those that admit students from all over the nation, are probably the best socio-economic and cultural mixers. For most people, it\u0026rsquo;s perhaps the first time they are transplanted into a new environment outside their immediate familial environment - an unknown city, unfamiliar languages, and new cultures \u0026mdash; and as a bonus, you are sharing rooms with strangers.\nThe only coping mechanism is to make new friends. Some make a large number of them, some very few. The bottom line is that you build new relationships.\nMore importantly, you have fun along the way!\nOn a more serious note, all these relationships and experiences act as a transformation function for everyone involved.\nNoone that I know of is the same person on their graduation day as they were on their commencement day.\nLike it or not, none of this can be replicated on online forums. Most people you meet online are \u0026ldquo;connections,\u0026rdquo; \u0026ldquo;followers,\u0026rdquo; and, at best, \u0026ldquo;acquaintances\u0026rdquo; - Not friends.\nAlumni Networks Probably one of the most significant upsides of college. But more importantly, this upside is directly proportional to the quality of your college and hence contributes significantly to the famous (or infamous) \u0026ldquo;tiers.\u0026rdquo;\nBeing from a higher tier (read: the IITs and BITS of the world) college with a strong, active, and high-quality alumni network across industries and research institutes makes your life relatively much easier. Referrals, information, and help come much more smoothly. Thanks to a pass-out senior, a friend of mine from one of these top institutes found it much easier to get in touch with a very sought-after professor at his dream lab in Canada.\nPlease note, at no point am I insinuating that kids from these colleges are somehow less deserving or somehow life is easy for them. It\u0026rsquo;s not. These colleges are supremely competitive and demanding.\nAlso, I am not insinuating that colleges that are not IIT/BITS/NITs do not have such networks. My college does. So do other non-tier one colleges. I have benefited a lot from my college\u0026rsquo;s alumni network. It\u0026rsquo;s all a question of how expansive and active the network is.\nBrand and Mean Can-Do Index Just a while ago, we mentioned the very emotive and dramatic (even controversial) word: \u0026ldquo;tiers.\u0026rdquo;\nWe can go on and on about tiers and why they exist (or don\u0026rsquo;t exist) or why they matter (or don\u0026rsquo;t matter), but that\u0026rsquo;s not why we are here.\nThe TLDR is as follows,\nYour college\u0026rsquo;s brand is directly proportional to the number, variety, and quality of companies and roles coming on-campus.\nThe most significant value a higher tier college provides is that the average kid suffers from a relatively lesser amount of inferiority complex and believes they can achieve or do much more. It\u0026rsquo;s a herd mindset game. This, in turn, has a substantial impact on on-campus activities (technical or otherwise), which indirectly impacts the average student skillset.\nGo where your curiosity takes you College is an exciting place to be in. At any given point in time, multiple things are happening on campus.\nChances are there is a club for everything. Mars Rover? Yes. Race Car? Yes. Space Satellite team? Yes. Electric Race Car? Yes. Dirt Racing? Yes. MUNs and Public Speaking? Yes. Organizational committees for fests? Yes. Dance and Drama Clubs? Yes. Competitive Coding Clubs? Yes. \u0026mdash; this list could go on. Even if there isn\u0026rsquo;t one for your niche interest, very little stops you from starting one for your own niche needs!\nThe point is that college gives you a unique opportunity to work on multiple streams of interest \u0026mdash; at the same time. You could spend the first half of the week working on fine-tuning the suspension of the racing vehicle that goes into testing next week while spending the last few days running around collecting sponsorships for the upcoming cultural fest! All the while squeezing in the time in-between for friends and other activities.\nCollege is probably one of the few periods in life wherein you can take up or drop projects/work/interests on an ad-hoc, non-committal basis and try different things to find out what sticks. After all, engineering is more than grades and the degree in the end.\nReality and the eternal cycle of suffering This section is the no-brainer one.\nThe reality of the world we live in (as of date) is that degrees are essential. 99% of open tech roles require an undergrad STEM degree. Life becomes easier when applying for work visas if you have an undergrad degree. The bottom line - life is much more challenging without a degree. Of course, there would be exceptions, but edge-cases cannot guide our decision/opinion-making.\nAnother critical point against college is the suffering during the degree, namely, endless assignments, tests, limitations, administrative barriers, attendance requirements, etc.\nI have been through the rigor and felt the same frustrations. But now that I am through, I have a slightly more evolved way of looking at this. If you are someone who isn\u0026rsquo;t in your final semester (semester \u0026lt; 8th), please skip this as it would read like utter bullshit.\nMy perspective on this has essentially evolved into this \u0026mdash; all engineering batches, past, present, and future, have felt and will feel the same frustrations, so it\u0026rsquo;s okay. You are not a particular case and consider this to be part and parcel of life. It sounds a lot like stoical resignation \u0026mdash; but it\u0026rsquo;s much more simple.\nBias and Incentives Online Aha, the most controversial section of all!\nIf a martian were to judge the progress of human technology from #TechTwitter, it would seem that 95% of tech is javascript, crypto, and leetcode. This is, of course, is sampling bias. When dealing with social media of any kind, especially tech/ed/career twitter, the theory of sampling bias becomes fundamental.\nSo what is Sampling bias?\nYou can check out the Wikipedia article here, but the essence is as follows,\nWhen a sampling technique is flawed such that the sampled set is biased towards certain members of the population which results in the mischaracterization of the underlying population \u0026mdash; this bias is called Sampling bias.\nBut again, why are we talking about Sampling bias?\nMy theory is that people (including myself) forget about this bias during their feed-scrolling sessions. As a result, you start misjudging the underlying population thanks to the bias in the reference sample. For example, a career in tech doesn\u0026rsquo;t start and end with javascript \u0026mdash; there are other things that people do as well.\nNone of the above are wrong in themselves. All the three disciplines mentioned above are essential in their own right. The problem arises when people don\u0026rsquo;t account for their own sampling bias and forget the unsaid ToC about social media \u0026mdash; the world doesn\u0026rsquo;t start and end with what you see on your feeds.\nAnother critical point to keep in mind is a conflict of interest, especially in the context of accounts with more significant followings. If an account A is telling you that X is bad/sucks but also stands to gain financially by selling you Y, wherein Y is an antidote/competition/alternative to X, it\u0026rsquo;s safe to assume that there is a bias and it is a potential case of a principal-agent problem. An important thing to note here is that I have essentially described capitalism, i.e., there is absolutely nothing wrong with identifying a problem and profiteering by selling its solution. All our modern economies are based on this simple concept. It\u0026rsquo;s also important to note that content creators play a critical role in pushing new products and services that often are better than the existing solutions. At the same time, while forming your opinions about an industry or anything in general from people on the internet, it helps to be mindful of potentially misaligned incentives.\nSummary The TLDR is as follows,\nPlease read the Disclaimers and assumptions before proceeding.\nA college experience (for most kids coming from ordinary and modest backgrounds) introduces the 18-year-old fresher to a wide array of career trajectories and opportunities to switch between them.\nFour years of undergrad is probably the best time to meet peers from all around the country, build relationships (not just professional, but of all kinds), and have fun :)\nAccess to an active and high-quality alumni network is an advantage in life. For a more lengthy explanation, please check out the Alumni Network section.\nA high-quality undergrad environment and peer groups generally lead to much better outcomes for the average student. On top of this, colleges with a better brand, more often than not, are a significant advantage, at least in the early days of your career. Again, for more verbosity, check out the Brand and Mean Can-Do Index section.\nThe four years of your undergrad is an exciting opportunity to work on multiple interests - technical, creatives, people management, or whatever else might interest you. Hopefully, you will be able to figure out what your thing is.\nIn reality, life is a lot harder without a degree. Exceptions exist, but exceptions and edge cases cannot be the primary north star.\nAccount for sampling biases and principle-agent problems while basing your opinions/approaches on social media commentary.\nConclusion Finally.\nFinally, we are at the end of this one! Pretty much all of this piece is essentially opinion based upon personal and observed experiences. I could have added another section regarding job hunting as a fresher, but that would be stretching this article too far. More importantly, I feel that the topic is saturated with content.\nIt\u0026rsquo;s important to emphasize again that there are a lot of nuances that have been left unsaid in the paragraphs above.\nI enjoyed writing this article a lot more than I expected. That could be because it helped me solidify most of my thoughts and ideas around this topic.\nAll in all, it was an excellent mental exercise! I really hope you enjoyed reading this as much as I enjoyed writing this. More importantly, I hope this gave you some ideas to think about!\nFeel free to write to me at pranjaldatta99@gmail.com with any feedback and counters!\n","permalink":"https://pranjaldatta.com/post/why-college-isnt-irrelevant/","summary":"\u003cfigure\u003e\n    \u003cimg loading=\"lazy\" src=\"college-1.jpg\"\n         alt=\"College\"/\u003e \u003cfigcaption\u003e\n            \u003cp\u003eWhy am I here? Source: \u003ca href=\"https://www.bankrate.com/\"\u003ehttps://www.bankrate.com/\u003c/a\u003e\u003c/p\u003e\n        \u003c/figcaption\u003e\n\u003c/figure\u003e\n\n\u003cp\u003eI recently completed my undergrad in CS Engineering and graduated. Like most of my peers around the world \u0026mdash; past or present \u0026mdash; during the course, I firmly believed in the irrelevance of college education (apart from being yet another checkbox in a status-driven society).\u003c/p\u003e\n\u003cp\u003eNow that I am on the other side, and with the benefit of hindsight, context, and more importantly, distance from temporal and localized pain, I\u0026rsquo;ve come around 180 degrees \u0026mdash; I think college and your degree are relevant, probably more than ever.\nThis is a long read. I have provided a table of contents so that you can jump around. There\u0026rsquo;s also a summary in the end for the folks interested in a quick read.\u003c/p\u003e","title":"Why college isn't irrelevant"},{"content":"So after months of procrastination and delay, I finally got around to working on this personal site! The idea is pretty simple: a concise, simple website to serve as my blog. Most of the stuff would be around software and tech (with some minor digressions here and there).\nHopefully, you would enjoy reading some of these articles!\nThanks!\n","permalink":"https://pranjaldatta.com/post/hello-world/","summary":"\u003cp\u003eSo after months of procrastination and delay, I finally got around to working on this personal site! The idea is pretty simple: a concise, simple website to serve as my blog. Most of the stuff would be around software and tech (with some minor digressions here and there).\u003c/p\u003e\n\u003cp\u003eHopefully, you would enjoy reading some of these articles!\u003c/p\u003e\n\u003cp\u003eThanks!\u003c/p\u003e","title":"Hello, World!"},{"content":"Hi! Good to see you here I am Pranjal, and thank you for visiting my page! Here\u0026rsquo;s a 60 second blitz about me,\nI primarily work in Machine Learning, Backend and Distributed Systems.\nSpecifically, I work at on inference orchestrationn platforms and model tooling.\nI did my undergraduate in Computer Science and Engineering in 2018.\nCurrently, I am working as a Machine Learning Engineer at Pixxel Space. Earlier I was with Mad Street Den, Synopsys and OurEye.ai.\nI live in Bengaluru, India. So in-case you are in town, would love to meet in person!\nIf you want to learn more about my work experience, you can visit here .\n","permalink":"https://pranjaldatta.com/about/","summary":"\u003ch2 id=\"hi-good-to-see-you-here\"\u003eHi! Good to see you here\u003c/h2\u003e\n\u003cp\u003eI am Pranjal, and thank you for visiting my page! Here\u0026rsquo;s a 60 second blitz about me,\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eI primarily work in Machine Learning, Backend and Distributed Systems.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eSpecifically, I work at on inference orchestrationn platforms and model tooling.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eI did my undergraduate in Computer Science and Engineering in 2018.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eCurrently, I am working as a Machine Learning Engineer at \u003ca href=\"https://www.pixxel.space/\"\u003ePixxel Space\u003c/a\u003e. Earlier I was with \u003ca href=\"https://www.madstreetden.com/\"\u003eMad Street Den\u003c/a\u003e, \u003ca href=\"https://www.synopsys.com\"\u003eSynopsys\u003c/a\u003e and \u003ca href=\"https://www.oureye.ai/\"\u003eOurEye.ai\u003c/a\u003e.\u003c/p\u003e","title":"About"},{"content":" Github: here\nLinkedIn: here\nMedium: here\nEmail: Address\n","permalink":"https://pranjaldatta.com/contact/","summary":"\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eGithub: \u003ca href=\"https://github.com/pranjaldatta\"\u003ehere\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eLinkedIn: \u003ca href=\"https://www.linkedin.com/in/pranjal-datta/\"\u003ehere\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eMedium: \u003ca href=\"https://medium.com/@pranjaldatta99\"\u003ehere\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003cp\u003eEmail: \u003ca href=\"mailto:pranjaldatta99@gmail.com\"\u003eAddress\u003c/a\u003e\u003c/p\u003e\n\u003c/li\u003e\n\u003c/ul\u003e","title":"Contact"}]