views:

31

answers:

1

Evening,

Is there a common or standardised name given to a function or method whose execution is not crucial or necessary for the successful execution of a program? Whether the function fails or succeeds in its purpose is not important, only that it was attempted.

I've been naming such functions as "volatile" (e.g. volatileInsertSearchLog()), as they're not always expected to succeed, but still may return a value for error reporting purposes. I was curious to see whether there was a more suitable name?

Cheers!

+3  A: 

I'd use a 'Try' prefix and maybe have it return a boolean, which would be true on success, and false on failure. So something like:

bool TryInsertSearchLog()

The .NET framework uses this for parsing, for example bool Int32.TryParse(string, out int)

Razzie
I never liked using the word "try" in function names because of try-catch blocks, but this definitely makes sense.
Lachlan McDonald