I was hoping you could give some feedback on an idea I had for designing functions.
I am trying to think of a unifying principle for choosing what functions should return. The specific project is mostly data access classes.
So the principle is this: "When deciding what value to return as a status code, either True or False, opt to return True if the desired state is achieved."
For example, if you made a call to remove_email('email') and the email that you passed as an argument was not in the list, return True because the desired state, one in which the email is not in the database, now exists. An alternative principle might be, always return False if the exact functionality is not executed. Like removing when the email doesn't exist or the table does not exist.
I think I unifying principle like that would be helpful in creating a shared mindset in the code where we can all use it as a guiding principle.
So first, can you tell me if the principle itself is a good idea? Should a function return True if it doesn't actually do what it claims to do, like remove an item? And if this is a bad principle, is there any other principle or set of principles that are accepted as a good standard? Always throw an error code if the exact behavior does not match? Always return False? etc.
And second, is it common to have common design philosophies like this in code bases? Is so, could you provide me some examples? The closest thing that comes to mind is the Unix philosophy that a program should do one thing and one thing only. But that is more of a higher level design principle than an implementation principle.
I apologize if this is not a good question, but I am trying to learn and develop a strong fundamental understanding and I want to run these ideas by more experienced programmers to get feedback.