Constructors Other Than New

Some programmers avoid "new" as a constructor name.

What are some examples of how this can improve code?

This one's not bad, though some would still consider naming it "newTraversing" to make it a bit more consistent.

What are some examples of how this can worsen code?
Why throw away the existing habits of object-oriented programmers if you don't get any clear benefit? I've heard it argued that you're not creating a "new" user, only "instantiating" one. However, in this case, the one-line description of the "User" class would be something like, "Represents a user of the system". So, you actually are creating a "new" representation of a user of the system.


See also FactoryMethodPattern, NamedConstructor


EditText of this page (last edited January 8, 2002) or FindPage with title or text search