Re: Keyword Arguments

Friedrich Dominicus <[email protected]> Thu, 14 Jun 2012 14:58:28 +0200
Newsgroups gmane.comp.lang.io
Organization Q-Software Solutions GmbH
Message-ID <[email protected]>
Steve Dekorte <[email protected]> writes:

> As objects are about coupling data and logic, if you're passing a lot of
> arguments(data) around
> to methods (logic), then it looks suspiciously like you've failed to couple
> your data and logic.
>
> If I were to take the position that all uses of multiple arguments (and
> therefore keyword arguments)
> are failures to use proper OO design, could you provide a counter example?
>
> For example, in this:
>
>
>         def render(view, formats = ["html"], cache = false)
>
>
> formats and cache seem like natural instance variables of the
> receiver.

I agree with you but there is one area which I will call functional
abstraction. You can see often that there are quite some long methods
which are called e.g as constructors.  I think templates for functions
are a kind of "counter" example. Well yes if it's get too much you may
recconsider using classes as Commands but still there are examples where
at least 2 arguments are "needed" sorting blocks eg. And if you look
over to the Common Lispers I  think there multiple dispatch stuff is an
argument for functions with some more parameters.

But I agree too many parameters suggest that some abstraction might have
been overseen.

Regards
Friedrich
-- 
Q-Software Solutions GmbH; Sitz: Bruchsal; Registergericht: Mannheim 
Registriernummer: HRB232138; Geschaeftsfuehrer: Friedrich Dominicus