8 Apr 2007 Daniel Casner   » (Journeyer)

One hears the term "Generic Programming" every once in a while in computer science or programming circles as a good practice for code reusability or sometimes just as a buzz word. It is often described as "programming with concepts"[1] or software patterns. I tend to think of the process as writing algorithms without applications. That is, when you write the algorithm, you don't include anything which is specific to one application, hence making it generic.

I am not an expert on the topic and this is not a tutorial, though I have collected a few good links below. What I want to do is advocate everyone who does any programming trying it at least once. Recently I created a library implementing generic Markov chains. I did have an application in mind but decided as an exercise to make in as generic as possible because I anticipate having many future uses for this library. It turned out to be a fun challenge and rewarding to have completed something I'll be able to use for other projects. My implementation was in Python which made it slightly easier due to its weak typing, however, even in Python, one needs to be careful not to assume anything about the type being used (numeric, iterable, etc.) anywhere or to assume too much about the application.

  1. C++ STL
  2. Boost.org library generic programming concepts
  3. Generic-Programming.org
  4. The obligatory Wikipedia link
  5. My generic Markov chainer library

Latest blog entries     Older blog entries

X
Share this page