Re: Desing Question re Multiple Constructors




"Roedy Green" <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx> wrote in
message news:ov58m1hcu3gq4oh9hkcr07iblk8cju7e7e@xxxxxxxxxx
> On Sat, 29 Oct 2005 11:12:09 -0400, "Rhino"
> <no.offline.contact.please@xxxxxxxxxx> wrote, quoted or indirectly
> quoted someone who said :
>
> >I have a design question about constructors.
>
> Here is a way to tackle that class of problem.
>
> Let's say you have three competing approaches.
>
> Write out the signatures for approximately what the three approaches
> would be.
>
> Now write some application code using the three approaches and see
> which you like best. You will soon discover which flows most naturally
> and which is easiest to maintain.
>
> You will only have to do the implementation once, but will be using it
> over and over.
>
> NOW go back and do the full implementation on the best design.
>
> This will block you from making the common error of designing classes
> easy to write rather than easy to use.

It sounds like you're saying that whichever one "feels" most natural is the
best one to use. Aren't there some sort of theoretical guidelines that can
be used to help me judge which approach is most appropriate? Surely it can't
be purely a "gut feel" kind of thing?

Rhino


.



Relevant Pages

  • Re: Classes derived from ServicedComponent do not support constructors with arguments?
    ... You have to be careful when you design this stuff as well. ... if you are going to use transactions, or just in time activation, or object ... implementations, with default, parameterless constructors. ... Classes derived from ServicedComponent do not support ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Many questions about partially constructed objects !!!???
    ... I agree with your story and design decisions etc. ... problems because constructors are a bad place to have problems as this ... When the constructors fails the whole ... only common framework is delphi's constructor/destructor framework. ...
    (alt.comp.lang.borland-delphi)
  • Re: [Class]Ridiculous question
    ... These schools of thought are not opposite or immiscible but rather complementary and both can be used in the same design. ... aa.setIndexation(sosaRoot2); ... On the other side of the coin there is something called POJO. ... There are also a myriad of configurations available for the average Swing object, which would require a confusing myriad of constructors to support if they went the POJO route, so again Beans win here by virtue of simplicity. ...
    (comp.lang.java.help)
  • Re: Where to put user interface
    ... >constructors to get the data needed to build an object. ... >used to create an object initialized with the arguments from the I/O. ... whole slew of design issues they either may not be ... Comeau C/C++ with Dinkumware's Libraries... ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Constructor inheritance
    ... because we often don't want the same set of constructors on derived ... :> Inheritance is supposed to promote code resuse. ... a much more preferable OO design is to instantiate a Thread ... :> So it was surprising the compiler generates missing default constructors. ...
    (comp.lang.java.programmer)