Thread: TattsDownloads
View Single Post
  #41  
Old 10th January 2014, 09:11 PM
blackdog1 blackdog1 is offline
Member
 
Join Date: Aug 2013
Posts: 177
Default

Quote:
Originally Posted by Martinw
Curious about not copying code - why reinvent the wheel?
lets say you have a pageful of code (a function) that will also do a job in an other part of your app. but you have to change a few variable names it will call on.
It's tempting of course and you ask what could go wrong?

well for starters some of those vars will be global not private, so if you miss changing just one of of them the function will still work because it doesn't 'know' which global vars are you referencing the old ones or the new ones.

there is more to it than that, it need not be a function it could be a directory address or whatever or worse case a pointer address that happens to be valid, but believe me it can drive you nuts trying to find a bug like that because everything seems to work ok but gives you the wrong results.

It probably won't matter as much in a small project.
Reply With Quote