Smartgambler
Pro-Punter

Go Back   OZmium Sports Betting and Horse Racing Forums > Public Forums > General Topics
User Name
Password
Register FAQ Search Today's Posts Mark all topics as read

To advertise on these
forums, e-mail us.

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #42  
Old 10th January 2014, 09:20 PM
blackdog1 blackdog1 is offline
Member
 
Join Date: Aug 2013
Posts: 177
Default

forgot to add, you might not even know you are getting the wrong results.
Reply With Quote
  #43  
Old 10th January 2014, 09:52 PM
Martinw Martinw is offline
Member
 
Join Date: May 2012
Posts: 40
Default

Thanks for that.

It goes along way in answering an issue I have at times - get the wrong result.
The code runs automatically through the day. As I am not placing bets at this time I just let the computer run through and then go through and tidy up any code at the end of the day and update the records.
Sometimes the code will say to place a bet when it should say no bet and other times the opposite.
I put it down to the excel not being on the screen or something like that.
Now from what you are saying then maybe it is because I have a lot of global variables.
Oh well...more work to do.
Thanks for the heads up.

Ta,
Martin
Reply With Quote
  #44  
Old 11th January 2014, 12:36 AM
walkermac walkermac is offline
Member
 
Join Date: Nov 2013
Posts: 603
Default

Another convention! All global variables should be named ala: gMyVariable

...although globals were thought an indicator of poor design back in my day... Hasn't stopped me lately; I don't even bother defining variables half the time. And memory? How big a deal did that used to be?! And how great is Google?! I don't know VisualBasic, but I know what it *should* be able to do, I google it, and there's a code example! No more manuals. No more learning. We're in a golden age now!!!

If you're looking for another related project to spend time on, you could start collecting xml race files and cobble together an 'automated test harness'. Essentially, have your project cycle through a series of these files (that would ideally represent everything you would encounter in a real-time environment and base decisions on within your program) and verify that the program behaves as it's meant to. That is, instead of making a bet it outputs to a text file noting the action it would've performed. Once all the xml files are processed you compare the text file produced to one that contains the correct results.

A pain to set up, but it quickly and easily highlights logic bugs and allows you to verify you haven't made any unintended changes when you edit.

Oh! Use revision/version control too. It's all coming back to me now. ...make it stop! Make it stop!
Reply With Quote
  #45  
Old 11th January 2014, 11:05 AM
aussielongboat aussielongboat is offline
Member
 
Join Date: Nov 2010
Posts: 259
Default

youre right about google and VBA.
i use it all the time for vba code.
Just type up a coding problem and there is someone, somewhere, who has a solution for it.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump



All times are GMT +10. The time now is 08:18 AM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
©2008 OZmium Pty. Ltd. All rights reserved . ACN 091184655