To new or not to new

Alejandro Martínez alemartinez2112 at gmail.com
Fri Sep 28 04:58:50 UTC 2007


Hello list. I'm searching for the opinion of experienced developers:

In which case do you create specialized class message for instantiating an
object?

I think two factors are fundamental:
1) You want to enforce correcteness of your objects by making sure they are
complete, so you "minimize" #new and provide specialized messages for
creation.
2) You do not want to enforce anything until real usage experience shows you
which messages you must "promote" to the class side.

My personal view is 2) would be more humble at first, but since this is a
question so dependent of the domain you're implementing and your knowledge
about it, I'd like to know which patterns or approaches have you seen or
taken through the years.
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20070928/5f0fa62c/attachment.htm


More information about the Squeak-dev mailing list