Before you see my rant, what are the worst design decisions you ever made?
***here is one of mine: rant ahead***
I don't think any of my math colleagues would understand my pain, so here it is. As studied in high school, a polynomial is a letter expression using the *, +, - operations, something like:
After 4 years of programming, I realized that one of the worst design decisions I made was to include a number of variables member of class (multivariate) Polynomial:
template <class CoefficientType>
class Polynomial : MonomialCollection<MonomialP, CoefficientType>
Besides array-out-of-bound error, non-coinciding number of variables was by far the most frequent cause of crash of my program. At the same time, the number of variables can be deduced: just take the maximum of the variable number of each monomial of a polynomial.
Today, I had the last drop: in the middle of doing actual work, I had a mysterious bug that would not manifest itself on any of my test cases. The bug was due to a polynomial containing a monomial with a number of variables not equal to NumVars. I've had enough. I will not do any work or touch my code before I remove the damned variable NumVars from my code!
I am in the process of doing this and will update this post with the number of lines I have to touch. Let us see how much will this be...