[Branch ~go-bot/juju-core/trunk] Rev 1666
Henning Eggers
henning at keeeb.com
Mon Aug 19 08:52:07 UTC 2013
On 16.08.2013 13:11, Nate Finch wrote:
> Personally, I prefer variables in the 1-4 character range, because they are
> less prone to typos and I find them easier to read when embedded in complex
> expressions.
That is something I was surprised to see in many places when browsing the juju
go source. Abbreviations or even single letters for variable names are against
what I have been taught and practiced as good software engineering over the
last twenty years or so. The rule may be emphasized differently in different
software projects but it really struck me as very lax in the juju source.
Is there a coding style guide for go juju?
>
> Being able to see more of the line at once helps me keep it in my head. Long
> names make it harder for me, because it just requires so much reading to get
> through the same amount of code on a line.
Well, AFAIK the benefit is usually considered the other way round. Using
English words as variables makes the code easier to read because it speaks. I
am not sure if not having to remember the meaning of abbreviations does not
outweigh the benefit of short code lines. I can look at a piece of code more
easily without having to go back up further to find out what type or meaning a
variable is or has.
For me as newcomer to the code, this made the code definitely harder to read.
(There are other issues, too, though).
Henning
More information about the Juju-dev
mailing list