When designing a program (in this case Visual Basic) you typically want to think of speed for the end user. What can and does end up happening is the programmer trys to test everything to make sure it's valid before giving it to the user.
For example, let's say you want to add a list of files to a filebox, that down the line the user will be using to open the files and use. There are a couple of things to think about here, we can load the files in the filebox and just let the user have at them, this can pose a potential problem if the file doesn't exist when you try to open it, rather then check each file as you add it to the file box, and make sure it exists first. You can do the check on each file as you attempt to open it, this way if the user only ends up using 5 files out of the entire box for this duration you only check to see that 5 files exist, rather then say the 100 other ones that they didn't use.
Another thing to do is let the user attempt to do certain actions if the action succeeds then continue on your way, but if the action fails rather then posting an error and stopping the program essentially, you just notify the user hey that action didn't work but here is what we're doing to recover from it, this thought alone can save you boatloads of time as well, rather then having to check each corner case, allow the user/program to do something that might cause an error, and simply know how to recover.
Aside from optimizing your code to reduce the number of checks how are you speeding things up for the end user?
Post a Comment