<rdlugosz.1044583 / bloglines.com> schrieb im Newsbeitrag
news:1098279415.3771384755.15079.sendItem / bloglines.com...
> > Or slightly simpler:
> > DEFAULT_OPTIONS = { ... }
> > def my_func( arg1,
> .. argN, options = { } )
> > options = DEFAULT_OPTIONS.merge(options)
> >
> # ...
> > end
>
> Seems like this is all a bit complicated for what you're
> doing.  I mean - once you do all of this fancy default hash stuff, won't
you
> still have to go look it up in the docs / source every time to see what
options
> are available?  Why not just set the parameters for things like rounded
edges
> and fill colors after the fact using method calls on your new object?
Granted
> you won't be able to do it in just one call to new() as you can with the
hash,
> but is that really more clear to an outsider (or *you* later on) looking
at
> your code?

Definitely!  I just felt that the OP wanted to do it with one method
invocation, but of course the approach to set properties individually is
much more flexible - especially if inheritance comes into play.

> Another option (which I'm betting won't be popular here...)
> would be to have a separate RectangleBuilder class that will make
Rectangles
> for you.  You could have multiple methods here that would take
reasonable
> parameter sets based on their name.
>
> Just a couple of options I wanted
> to throw out there.

Good that you pointed that out.

    robert