There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Well, yes, it could well be faulty. But that's a separate concern from trying to speed it up. You should first get the program working correctly. Then, if you are trying to speed it up, you should not consider changes that make the program work differently. That was my main point -- in making the change from II to I you might make the program work differently.Originally posted by Sylvester James:
If the method does not take parameters, and if the programmer isn't making sure in Case II. above that the doJobAndReturnResult() is returning the same value everytime it is called within the if condition, isn't the program faulty.
Originally posted by Sylvester James:
If the method does not take parameters, and if the programmer isn't making sure in Case II. above that the doJobAndReturnResult() is returning the same value everytime it is called within the if condition, isn't the program faulty. How can the programmer rely on what value is returned each time. ( unless he has a counter in there and returns a value based on how many times its called).
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |