Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1228)

Issue 63530048: upgrades: remove unnecessary indirection layer

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 2 months ago by rog
Modified:
10 years, 2 months ago
Reviewers:
mp+206361, fwereade
Visibility:
Public.

Description

upgrades: remove unnecessary indirection layer The upgrade description is just data - it doesn't need any behaviour associated with it, so it's sufficient, simpler and more direct to just use structs where we can, making the code easier to understand and shorter. https://code.launchpad.net/~rogpeppe/juju-core/502-upgrades-simplify/+merge/206361 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : upgrades: remove unnecessary indirection layer #

Unified diffs Side-by-side diffs Delta from patch set Stats (+137 lines, -196 lines) Patch
A [revision details] View 1 chunk +2 lines, -0 lines 0 comments Download
M upgrades/lockdirectory.go View 1 chunk +2 lines, -2 lines 0 comments Download
M upgrades/lockdirectory_test.go View 2 chunks +4 lines, -2 lines 0 comments Download
M upgrades/operations.go View 1 chunk +5 lines, -10 lines 0 comments Download
M upgrades/rsyslogconf.go View 3 chunks +7 lines, -7 lines 0 comments Download
M upgrades/rsyslogconf_test.go View 2 chunks +4 lines, -4 lines 0 comments Download
M upgrades/steps118.go View 1 chunk +13 lines, -16 lines 0 comments Download
M upgrades/upgrade.go View 5 chunks +21 lines, -75 lines 0 comments Download
M upgrades/upgrade_test.go View 5 chunks +79 lines, -80 lines 0 comments Download

Messages

Total messages: 3
rog
Please take a look.
10 years, 2 months ago (2014-02-14 09:20:19 UTC) #1
fwereade
AFAICS, this just makes the code harder to change. Opinions may reasonably differ re likelihood ...
10 years, 2 months ago (2014-02-17 10:34:34 UTC) #2
rog
10 years, 2 months ago (2014-02-17 12:24:43 UTC) #3
On 17 February 2014 10:34,  <fwereade@gmail.com> wrote:
> AFAICS, this just makes the code harder to change. Opinions may
> reasonably differ re likelihood of changes that'd cause the interface
> implementation to pay off, but IME the aggregated cost of designing for
> change is trivial compared to the cost of failing to do so, and so a CL
> that just removes flexibility does not lgtm.

For the record, my view is precisely the opposite in this case.
For methods that simply return some data, it is easier just
to have a field containing the data rather than an extra method
to call that returns the data and an interface type that encapsulates
that.

Adding an extra layer of indirection does *not* make things easier
to change, particularly when we are talking about a package-internal
detail here.

Any change is likely to require changes to the signature of the interface
type, and therefore to the user of that type. Given that, we may as well
just store the data in fields and avoid the need to change all the
interface implementations as *well* as the users of the type.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b