So I have a webservice that has something like a
getAccount where it would return an identifier to the account if it got it, else throw an exception. The client will always want to create an account if an exception is thrown with the same info the get is done with.
I am creating a convenience library for clients that will be handling all of the webservice calls inside so they don't need to know how to do the calls themselves.
What I am wondering is in this library if I were to create a
getAccount(accountName) that will get the account if it exists, and if it does not then create it and return the info, is that a bad thing to do? Should I leave it to the client to handle the exceptions or simply name it something like getOrCreateAccount? Does it matter?
Is it bad practice to create something in a get operation?