views:

196

answers:

2

I work in a department where people create (or select) algorithms that they implement in small-sized software to optimize some field-related objectives. Most of my colleagues know more about mathematical modelling and solvers than about programming.

I personally have a few years of experience developping C++ class templates. I pretty much know how to design class templates that represent algorithms but i can't design every piece of software that my colleagues write (not enough time, not enough interest).

My goal is therefore to try and teach my colleagues how to turn the functionalities and algorithms they think about into class templates. Template arguments would either be structure types or policy classes. I feel that i need to come up with a set of "do/don't" rules but i can't seem to be able to invent them.

To me, the objective of a good class template design is to maximize readability.

Do you personally have rules to design good class templates ? Is there a right process from functionality description to class template design ?

EDIT

Yes, it is difficult to get people to program using templates. I am working on it and developping a framework to make template instantiation as graphical as possible, and guidelines (and providing daily help) to make template programming as easy as possible. But the question here is only about designing, which i consider to be a completely different issue.

+2  A: 

In your case I would develop kind of framework to allow to your colleagues think only about formulas, maths and solvers.

I think all of the "good at math" Guys if their work is not only implementing math functions should be aware of the "Design Patterns: Elements of Reusable Object-Oriented Software".

You also can pay your colleagues attention to the boost algorithms. There is a graph library you can adopt for your project needs.

Mykola Golubyev
I may not have been clear. Modelling and solvers is what they know the best. What they need to do is to develop algorithms !
Benoît
They can develop algorithms if it is their main work using bricks you will develop for them.
Mykola Golubyev
+2  A: 

I don't want to rain on your parade, but in my experience trying to get non-programmers (or folks for whom programming is not their primary 'thing') interested in something as relatively arcane as writing good template code in C++ is a Sysiphean task.

Heck, I work in a department with a large number of very good C++ programmers, and even so, getting the organization to commit to adopt new technology is not always easy. If your folks are good mathematicians and know enough programming to get by, trying to impose a mandate on them that they need to write generic C++ instead is going to be a very tough sell.

I'd try hard to follow Mykola's advice and try to come up with some sort of generic algorithmic framework that minimizes the raw template coding they need to do; that might be the best way to overcome the resistance to the inevitable perception that you are simply shoveling more work at them.

mwigdahl
I agree with you. See the edited section of my question.
Benoît