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?

if (!DirectoryExists(path_name)) { CreateMissingDirectoriesInPath(path_name); CreateDirectory(path_name); }(actually, in this example, I'd probably try to use recursion to solve the problem, but I don't think that helps you in a more general case.) – pdr Nov 22 '12 at 14:01IDirectoryCreator(orDirectoryCreatorin Java) interface with aCreate(path)method. Then I'd implement that on aMultiLevelDirectoryCreatorclass. The calling code doesn't need to know about implementation details, it only needs to know that it can create a directory and it has aDirectoryCreatorto help it do that, so you can inject theMultiLevelDirectorCreatorobject via the constructor or fetch it from an IoC Container. – pdr Nov 24 '12 at 14:55