function names - "standartised" prefixes
- by dnsmkl
Imagine you have such routines
/*just do X. Fail if any precondition is not met*/
doX()
/*take care of preconditions and then do X*/
takeCareOfPreconditionsCheckIfNeededAtAllAndThenDoX()
A little bit more concrete example:
/*create directory. Most probably fail with error if any precondition is not met (folder already exists, parent does not exists)*/
createDirectory(path_name)
/*take care of preconditions (creates full path till folder if needed, checks if not exists yet) and then creates the directory*/
CheckIfNotExistsYet_CreateDirectory_andFullPathIfNeeded(path_name)
How do you name such routines, so it would be clear what does what?
I have come to some my own "convetion" like:
naiveCreateDirectory, ForceDirectoryExists, ...
But I imagine this is very standard situation.
Maybe there already exists some norms/convetions for this?