I'm building a Librarian module -- it has a couple of methods for basic object creation, getting, setting and cleanup. These objects are actually used to access documents in a file system.
So far I have a new method that creates a new object with a supplied name if that name is available. If the name's not available, the new method fails.
I'm doing development by testing, so as I add more code I write tests, and continue when the tests pass. It's a very neat way to develop code, but now I want to add tests that try to access an object that already exists, and the current new method won't allow that -- so I've figured I want to write an init method that will also be a method constructor, but only for names that already exist.
Obviously there's some common functionality between the two methods .. I'm not concerned about that. But is there a usual and customary naming convention or approach to do this in Object Oriented Programming?
In reply to Determining what new and init methods do by talexb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |