--000e0cd4d24078aa210472e21d2b
Content-Type: text/plain; charset=ISO-8859-1

On Sat, Sep 5, 2009 at 11:33 PM, spiralofhope <spiralofhope / lavabit.com>wrote:

> Along the lines of this thread..
>
> I'm rough around the edges, so I'll just use some general language.
>
> I have a habit of building my code like bunches of little black boxes.
> Each box accepts a certain kind of input and returns a certain kind
> of output.
>
> For each of the boxes, I create a sort of gateway that ensures that a
> box only receives its expected input, and it intelligently reports an
> error if that's not the case.
>
> Should I be loosening my grip and removing some or perhaps all of
> those gateways, just like the explanations for duck typing?
>
>
> --
> http://spiralofhope.com
>
>
>
I would, if you provide the correct input, the gateway is not necessary (and
it provides additional steps, hence adding some small increase in execution
time). If you do not provide the correct input, it can be expected to break,
or at least work incorrectly, which should indicate that you need to check
how you are calling it. Creating a gateway that breaks it intentionally
seems redundant, and it creates more places you have to go look if you want
to change something, more code you need to manage, etc. Instead, I would
just name my variables something intuitive, and explain what variables the
code expects, in a comment.

--000e0cd4d24078aa210472e21d2b--