Tales of caution

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Tales of caution

Post by CoderGoblin »

At the moment I am having to update some legacy code where we were getting some prices going wrong. Not a big deal once I had finally tracked the problem down but time consuming never the less.

The problem.. Some time ago the German government changed the tax on goods (mwst, VAT in england) from 16% to 19%. In some places in the legacy code this was a variable, in others it was actually base price*1.16 and yet others got the information from a database (OK admit I added this previously as we had lots of files and I wanted a single place to need to change things). The problem we were having is that a couple of places the change wasn't implemented. I have just spent time going through the code tracking down any place where this mwst is calculated and standardising it to always use the value from the database.

My tale of caution is therefore... Always allow for changes in tax and make it easily changable in just one place. Also always process it using the same method.

Does anyone else have any tales which may be of benefit to people when designing code to avoid updates to legacy code ?

Other obvious ones include ...
.. Upgrade to php5 when creating new projects rather than use php4.
.. Make sure that register_globals is off, even for php4 legacy code
.. Don't rely on short tags as another server may not recognise them
Post Reply