How to Proceed at Generic Programming

I am currently reading From Mathematics to Generic Programming by Stepanov and Rose. It is a very good book that has me thinking hard about how to render my agent system more generic.

In mathematics, there was a process of generalization that moved through things such as:
  • Common measures
  • Natural numbers
  • Integers
  • Rational numbers
  • Polynomials
  • Real numbers
  • Complex numbers
  • Groups
  • Rings
  • Fields
I think it important to note how this happened: no one sat down and devised an abstract algebra of rings and fields, and then said, "So farmers: I think you can derive something from this to measure your fields." No, people started out measuring fields and buildings and so on, and gradually, over a period of thousands of years, abstracted higher-level constructs from these concrete applications.

Similarly in programming, it seems to me that it is rarely a successful strategy to try to start by defining some grand abstraction, and then building one's system around it. Rather, successful generic programming comes from building concrete applications, and then painstakingly seeking out commonalities found in different applications and abstracting them.

6 comments:

  1. A book that interests me. I used the STL extensively when I did C++. I'm curious to see how you find it.

    ReplyDelete
    Replies
    1. Good, but like a mathematician's book: post to come.

      Delete
  2. Gene, do you study abstract mathematics? Specifically, abstract algebra? I don't really have any reason for asking other than pure curiosity. Some programmers, at least here at Texas Tech, absolutely hate pure mathematics.

    ReplyDelete
    Replies
    1. Yes, I'm doing so at present.

      Delete
  3. A thin book you want, trust me on this, is The Skeleton Key to Mathematics. It's in a Dover edition. It provides some of the intuitive motivation for why algebra is the way it is you won't get from a standard text.

    ReplyDelete