> People complain about single letter variable names, but if the function is
> only 10 lines long, does it really matter? You can see s := thing.State()
>  ... so you know it's a state.  Does it make it clearer to call it state
> when you see it used 2 lines below?  I don't think so.  That being said,
> it's fine to call it state, too.  It's just when you call it
> thingStateForReviewLater that it actually makes the code harder to read
> when it's used in more than trivial expressions.
>

You said an important fact here: if the function is only 10 lines. Beside
speaking type and function names, and variables that may have very short
names based on their visibility, it is helpful to keep the functions short.
They should be readable on a screen without problems (and no, Roger, I
don't mean your 20"+ screen in portrait mode *smile*). Otherwise nested
blocks should be moved into own functions (with speaking names) even if
they are only used once. In that case the top level function using those
sub-functions reads better and the maintainer gets a fester overview about
the intention of the function.

mue

-- 
** Frank Mueller <frank.muel...@canonical.com>
** Software Engineer - Juju Development
** Canonical
-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev

Reply via email to