PRE-PROPOSAL: Named method parameters with defaults.
Marek Kozieł
develop4lasu at gmail.com
Sun Mar 22 17:07:36 PDT 2009
2009/3/23 Reinier Zwitserloot <reinier at zwitserloot.com>:
[snip]
> 3. [Builder pattern still needed because of order] But you CAN change the
> order.
>
> --Reinier Zwitserloot
Yes i know.
But functionality of this solution is limited, while interactions are huge.
If you will need give all for example 9 parameters, you will still
need to check if you didn't omitted any, this mean more text for
analyse.
In this code you can ignore some parameter if you need:
class SomeBuilder{
SomeBuilder setA(A a){...};
SomeBuilder setB(B a){...};
...
}
call:
new Some( new SomeBuilder().setA(a).setB(b)... );
When there is a lot parameters soon or later you will need builder
(more or less).
What more when happen that you will want obtain A & B & C from some
new created object D:
All modification for builder will be adding method:
SomeBuilder setABC(D d){...};
, while in given solution you will need copy & paste constructor and modify it.
--
Pozdrowionka. / Regards.
Lasu aka Marek Kozieł
http://lasu2string.blogspot.com/
More information about the coin-dev
mailing list