Friday, November 9, 2012

"Low Level" Programming

Given the type of work that many programmers do, it is hard to find value in studying such "low level" concepts as operating systems, garbage collection, digital signal processing, etc. These are solved problems. There are libraries for them, and they most certainly are not relevant to designing web applications.

This is like the age old "why do I have to study calculus since I'll never use it?" conundrum. I believe it just requires the right perspective to see the value in studying low level programming concepts.

Consider two problems. First, imagine you are working at an e-mail archiving company. Since many of your customers are businesses (not necessarily individuals), you are storing some e-mails that are sent from someone inside the business to others inside the business. In this case you decide to de-duplicate the e-mails in your archive, and only store a single copy of such e-mails.

However, you want to be able to delete the e-mail when all of the associated users have deleted it, so you need to keep track of which users are connected to each e-mail, and when they have cut their association with it.

Does this problem sound familiar? It should. It is very similar to automatic memory management. You have an object and many pointers to it, and you want to know when you can delete the object. Maybe automatic memory management doesn't match this problem at every point, but there is probably much to gain from studying garbage collection algorithms.

Now consider a second problem (and more tenuous connection :)). Imagine that at this e-mail archiving company you want to synchronize a directory tree (like an LDAP directory) of users and groups. You will take snapshots of a customer's directory and store them, and then, for purposes of searching, use the information to determine whether a user was part of a particular group at some point in time.

You could certainly find the snapshot closest to the time in question, and see whether the user was part of a particular group. This is one way of interpolating between data points. Perhaps this problem is similar to reconstructing an analog audio signal from digital samples, or regression analysis. I admit this connection is more tenuous, but it may be there are techniques to be gleaned from work in these other areas.

The algorithms and data structures that we create in Computer Science are abstract, and I think with the right perspective they can be applied in many different situations. The next time you are sorting a deck of playing cards, use quicksort!

No comments: