Samir Parikh / Blog

Originally published on 01 October 2019


I've always had an interest in programming for as long as I can remember, starting with manually copying lines of Basic code from the back of computer magazines into various early Apple computers. Since then, I have dabbled in a number of programming languages including:

To be clear, I am not a professional programmer or software engineer, but as hopefully this blog has shown, I like to dip my toes in the technical pool every now and then. Programming is relatively easy to get started in, has an initially shallow learning curve, but can take years to master. For the past several years, I had focused on learning Python (first Python2 and then Python3) as this is most often recommended as a good choice for novice programmers like me. But just because it's good for beginners doesn't mean that it is limited in its feature set or functionality. Python's "batteries included" philosophy means that it's standard library is filled with a wide variety of easily importable modules to get you up and running quickly or to solve complex programs with just a few lines of code. Python also has a large number of valuable packages (similar to Perl's CPAN, R's CRAN or Rust's Crates) that are just a pip install away. Armed with a number of online tutorials, I set out to learn as much about it as I could.

I've often heard advice that the best way to learn a language is to apply it to a real world problem. Since I didn't really have one, I went in search of one and stumbled across the Project Euler site, which contains, at the time of this writing, over 600 math puzzles for you to solve. The beauty of the site is that while a program should be able to solve the problem in under a minute, it can take you hours or days (or in my case weeks) to come up with an algorithm or solution. Once you do solve the problem, the site unlocks a discussion forum where you can share your solution or approach with others who have similarly solved it. This is another good way to learn about programming and more importantly, algorithms (as many of the initial problems can be solved with just pen and paper!). Over the course of a few years working on Project Euler, I was able to solve 62 problems -- not great, but not horrible as this is just a hobby for me in my limited spare time.

Because I cannot stick with one thing for very long though, I began to hunt for another language to try. While I had only scratched the surface of Python, I wasn't completely enamored with all of the indentation and white space requirements and I started longing for something that would provide me with static typing. Python's dynamic typing is great for small projects or quick prototyping but I often found myself running into issues where static typing would provide more safety. At the time, Go and Rust were two of the relatively popular newcomers which seemed like good contenders to explore. Go is a simple (or perhaps small is a better adjective) yet powerful language from Google geared toward solving enterprise scale problems and comes with strong support of concurrency via goroutines and channels. Go is often portrayed as a worthy successor to C. Rust is another option I briefly experimented with in my quest to find another language to "master". Rust hails from the folks at Mozilla and is billed as providing safer memory guarantees through its ownership, lifetimes and borrowing models (concepts which, like garbage collection, are way over my head). It is often seen as a replacement for C++.

Unfortunately, neither Go nor Rust really stuck with me. There is nothing inherently wrong with either language (both are used extensively by big companies in production) but none of them was really fun for me. I found Rust in particular, to be really difficult to pick up despite the great documentation and very helpful community. The learning curve was just too steep for me. I then began picking up snippets of D amongst various comments on Hacker News. I can't remember precisely which one tipped me over the edge but I eventually found myself looking through the D language home page and tutorials which really perked up my interest.

Why I like D

D, like Rust, can be seen as a replacement of successor of C++. I am not a historian on the origin of programming languages so please don't hold me to these pronouncements. While D has been around for a number of years, it is not relatively popular compared to Go or Rust. But none of that really matters to me as I don't program for a living. Given that I have some background and experience with C and C++, I found D relatively easy to take up. I don't mind the brackets ({, }) or the semicolons (;) and in fact miss them when I occasionally go back to Python. Besides the clean aesthetics though, here are some of the other reasons why I have been spending more time with D:

Most, if not all, of these reasons are also applicable to a large number of other languages but how they come together for D really resonates with me.

What's Next

In addition to using D to go back and redo some of the Project Euler problems, I've also started to dip my toes into the problem sets offered by exercism and Rosalind. Thanks to the many questions that the community has answered for me over the past few months, I've managed to solve 27 problems on Rosalind already! My plan is to continue working through the problem sets offered up on the online coding sites (I also want to resume Advent of Code) and going through the resources listed above to start exploring some more advance concepts such as classes, structs and unit testing.

D is not a perfect language by any stretch of the imagination but it works well enough for me. In an effort to reboot this moribund blog, I hope to document some of what I learn here, more to help me remember, but hopefully to help others as well. Let's see how far I get before I inevitably get distracted by the next new shiny thing that comes along.