Software Complexity comes from reification of complex domains

Has this ever happened to you: You come across some piece of software and want to take a look at its source code. You open its codebase and it is sprawling - many layers of abstraction and much more complicated than what you expected. You think you can implement the concept in much fewer lines of code and in a much simpler fashion. If you attempt to do so, you may get the core concept (the “kernel”) implemented pretty quickly.

Read more...

Rust lifetimes: Separate your immutable parts from your mutable parts using RefCell

I recently ran into a Rust lifetimes issue when working on a toy project of mine. The simplified problem is as such: I have a struct Foo which owns a String and has a counter. struct Foo { owned_string: String, prefix_index: usize } What I want to do is to implement the Iterator trait for this struct. I want to iterate over all prefixes of this owned string. We might do something like this:

Read more...

Are Ubuntu APT repositories wasting space?

Sometime back, I went into a deep rabbit hole. This is a documentation of what I found. Consider the Ubuntu APT repository. I’m using the bionic-backports one. Each APT registry contains a ‘Release’ file which is an index of all the files in the repository. There are files listed with their associated archive files (a ‘.gz’ and a ‘.xz’ archive). Somehow I wondered what gzip options are used to create the archives.

Read more...

Why did dlclose not unload the library?

Recently, at work, we were debugging an issue where dlclose was not unloading the library . You might wonder why that even matters - if your library contains any global symbols, then their state will persist across a dlopen, dlclose sequence. In other words, your library isn’t starting from a clean state every time. In the case we were debugging, this issue manifested in the following fashion: We had two libraries libA and libB and libA dynamically depends on libB.

Read more...

Writing a simple JSON Parser from scratch in C++

JSON is one of the most common data interchange formats there is. Thankfully, it is also a pretty simple one. I had written a JSON parser in C++ sometime back, and whilst making it I came across a few decisions that were more involved than I thought they would be. So I have decided to write an article around that JSON Parser. While JSON Parsing is simple, writing one would definitely be useful to build more complex parsers, since the general principles are still present.

Read more...

Taking away control: The dumb programmer and the smart compiler

Good compilers prevent you from shooting yourself in the foot. Today, you have a wide assortment of programming languages to choose from, you can have your pick of paradigm. As a brief detour, the perspective of programmers comes full circle as they move from beginner to slightly experienced to intermediate. The beginner is deathly afraid of the differences between programming languages. In the beginning, they stick to one language out of the fear of learning something new.

Read more...

Bootup

A long, long time back, in a galaxy far far away, I was doing the same thing I’m doing right now. Booting up a blog. Genesis. Creation. My older blogs are many years behind me, and now a new journey begins. I have witnessed a stark change in how I view blogging, or how I view writing in general over my 4 years of college. More on that in a later post, but I’m excited to embark on this new journey, incorporating the many insights hidden away in some deep dark corner of my Google Keep.

Read more...