Policies for coding
Ian Booth
ian.booth at canonical.com
Mon Aug 26 23:46:38 UTC 2013
>
>>> This is considered good programming practice.
>>
>> I'm concerned that this statement is much more true
>> in a Java-centric world than a Go-centric one.
>
> Information hiding and abstracting implementation details from use is
> pretty general.
>
> Tim
>
Agree with everything Tim has said, particularly the above bit.
I have several times run into issues (particularly in tests) where the use of
structs directly in code caused too much friction trying to stub/mock things, as
William highlighted with an example.
Another +1 for using interfaces instead of structs directly is that using
interfaces is AFAIK the only way to achieve polymorphism in Go, since with
structs, methods are statically bound at compile time.
More information about the Juju-dev
mailing list