Thread: Bank System
View Single Post
  #23  
Old 09-29-2006, 10:04 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Quote:
Originally Posted by JkWhoSaysNi View Post
I use return on almost every function. I'm used to programming in OO languages and I learned OO in Eiffel where "deign by contract" is a major philosopy. Basically means making sure the function can go ahead with the data it's been given (preconditions) and then making sure it's completed successfully (postconditions) the only real way to implement this in GS is return codes on functions. (Check my associative array class for example)

In GS it's best to use numbers imho for the following reasons:

1) You can use if (function()) {} for functions that return 1 or 0.
2) You can use if (function() > 3) {} and make error checks in a sensible order. E.g. in this case the first 3 errors are acceptable.
3) Comparing strings is more CPU intensive than comparing integers.
Everyone to their own. I prefer Skyld's methods!
__________________
Reply With Quote