$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: David Abrahams (dave_at_[hidden])
Date: 2007-03-15 14:05:17
on Thu Mar 15 2007, gast128 <gast128-AT-hotmail.com> wrote:
>> > I agree. At my workplace we have a convention. For heavyweight objects
>> > that would do interesting things in their constructors we instead use the
>> > alloc-init paradigm of Objective-C. In this model, the constructor does
>> > simply non-error things, then a corresponding init (or even suite of init
>> > methods) does the interesting things. This has the added benefit that the
>> > init method can be overridden in subclasses, and you don't need to
>> > re-implement all the behaviors.
>>
>> The alloc-init paradigm _really_ sucks. Instead of considering
>> exceptions in your constructors you end up having to guard all the
>> rest of the code with "what if this object failed its initialization?"
>> checks/handlers.
>>
> I wouldn't use that strong words. At least you have the advantage to use
> virtual functions which are not behaving like virtuals in constructors as the
> orginal poster describes. Buschmann describes in 'posa' the use of MVC in this
> way.
That's a small convenience, true, but it's hardly worth weakening your
class invariants to get it.
-- Dave Abrahams Boost Consulting www.boost-consulting.com