State should not depend on the API server

roger peppe roger.peppe at canonical.com
Tue Sep 16 09:19:49 UTC 2014


On 16 September 2014 02:12, Tim Penhey <tim.penhey at canonical.com> wrote:
> On 12/09/14 01:35, Nate Finch wrote:
>> Separation of logic is absolutely a good thing.  Separation of data is
>> not nearly so useful.
>
> What I see as the real benefit of this work is based behind the
> "interface segregation principle".
>
> Effectively this boils down to "don't depend on things you don't need".

I agree with this sentiment. Dependency hygiene is very important
(though it seems to me that dependencies
are perhaps more about implementation than interface).

> The state package should never depend on packages from the API.
>
> This work is not just busy work, but clear separation, and generally
> what is considered good software development principles.

I have difficulty with this though. The state package and the API package
are clearly linked - their concerns are not entirely separate. In my view,
the state package exists only to serve the purposes of the API, which is
*the* externally visible part of Juju.

As such, many of the concerns and data structures dealt with by the state
package will be the same as those dealt with by the API implementation.

To my mind, it makes sense to define those shared pieces in a place
(or places) that can
be used by both implementations.

I don't uphold DRY as an invariable law, but I think that "every piece
of knowledge
must have a single, unambiguous, authoritative representation within a system"
applies quite well in this case.

Perhaps the problem is mostly a naming one - if api/params did not include "api"
in the name, would we still be so concerned about the dependency?

  cheers,
    rog.



More information about the Juju-dev mailing list