Benjamin Tinker Team : Web Development

Updating Code: Remember to scroll down

Benjamin Tinker Team : Web Development

All code gets a revision from time to time. The client will ask for a feature to be revised, removed, updated or just changed into something completely different. As a developer it is imperative to be able to keep a train of thought that can move around multiple files simultaneously to track down code changes and implement new ones that can have far reaching effects. You'll probably have multiple tabs open at the same time along with multiple development applications for code, deployments and database management. It is easy to get lost in all of that.

With all the documents open I too was making some code changes to a clients checkout system. Normally products were discounted if they matched certain criteria or if the customer had attached a voucher or promo code to their order. These cart calculations were complex in some parts. The client also had some requirements that if the customer had certain products in their cart that no discounts of any kind could be applied to those products. As the checkout system was done prior to this a change had to be made to existing code. I made all the necessary changes to the classes and methods and was sure it would return the right results. To my dismay it was not. I checked and checked the code again. I even ran it through debugger to watch the code. Everything seemed to line up except it was returning a old value.

Turns out that with all those 1000s of lines of code I did not scroll down far enough on the page to see where the real value was being returned. So for all my changes to the code the new value was never being sent back to the browser. So a one line change after this great realisation was all that was required and everything worked as required.

As a developer you have to check and check and check again that your changes follow through all the branches in the tree of code. As the code gets more complex it is too easy to get trapped. Be thorough and remember to scroll down.