Hopefully some dear readers can help me out with my current quandary.
I have several components that I use on nearly every site that I develop. By using them, I save untold hours of programming and therefore provide cheaper results for my clients. At the same time, I am using solutions that have been tried and proven rather than developing from scratch every time.
There is, of course, a catch to all of this.
I store these components below the CustomTags folder and most of my sites are now on the same set of servers. Consequently, any time I change any of these components, I change code used by nearly every site I develop.
The problem here is that whenever I update any component, I risk introducing a bug on any site even though I am not working on that site. I try to be careful and it is very rare that a change results in a bug. Even so, it does happen.
Recently, in fact, I caused errors in the administrative area of one site one two different occasions within the same month. Although I was notified of the bug in each case and fixed it the same day, their experience is that the site breaks inexplicably and it makes the site seem, to them, unstable. This causes frustration for the end client (the site owner), embarrassment and frustration for my client (the design firm), and embarrassment for me.
In this case, both errors happened on this site because of some structural differences between it and most other sites as a consequence of it being an upgrade from old code that I didn't write (so I am kind of stuck with the data structure). It isn't that my code couldn't easily be fixed to work on that structure just that I failed to account for it in my change.
I am trying to figure out a way to avoid this.
I have considered moving copies of the components into each site. This, however, presents other problems.
A while back, I did have copies of the components in some sites. I had a few instances of very old bugs showing up in sites. These would be things that I had long ago fixed in the current versions of my components. I would like to think I have since squashed all bugs, but that is probably hubris.
Beyond that, of course, is the time to update the components on the sites when and if I have a new version that includes bug fixes (perish the thought).
Additionally, if I am adding features to a site I may assume it to have the newest version. This is easily remedied by upgrading all of the components in order to add a new feature. This is easy to do, but does add one more thing to remember. Errors could still happen at this point, but at least it would be when work is known to be performed on the site.
I have thought about applying unit tests to my components. The problem here may be my own ignorance of unit testing. I can write unit tests to test business rules, but I have a harder time testing against the myriad of possibilities that can be accounted for in some of my more flexible components. Those with XML APIs, of example, seem difficult to write unit tests for.
I would really like to come up with a process that dramatically reduces the odds of errors on all of my sites, without causing a massive increase in my development and maintenance cost. I am hoping some dear readers will have some thoughts.
Thanks in advance!