Please, no more types called "State"

Tim Penhey tim.penhey at canonical.com
Thu Mar 12 06:53:09 UTC 2015


On 12/03/15 18:13, Ian Booth wrote:
> I see the point. But it could be considered analogous to having lots of methods
> called New() etc. So long as the types are relevant for the package in which
> they're declared then isn't that ok? If we have lots of packages where state
> needs to be persisted, how is that different to having lots of packages where a
> struct needs to be created, hence there will be several different New() methods.
> 
> Many of the current usages are client facades in the various API packages, which
> is indeed unfortunate and I wish were different. But let's not universally
> reject State types without considering the intended semantics.

*cough* *bullshit* *cough*

State is a terrible name for a structure.

I've also heard you say as much before too.

I think people have just gotten lazy, and rather than thinking of a more
appropriate name, just use State because others have.  I know I'm guilty
of doing this.

I'm with Dave on this one.

Think about this... describe the job to someone (or a teddy bear).  Sure
it is the state of the instance, but the state of what?

Tim

> 
> 
> 
> On 12/03/15 15:01, David Cheney wrote:
>> lucky(~/src/github.com/juju/juju) % pt -i type\ State\ | wc -l
>>
>> 23
>>
>> Thank you.
>>
>> Dave
>>
> 




More information about the Juju-dev mailing list