[metrics-bugs] #20765 [Metrics/metrics-lib]: adapt to new lines in votes and consensus and make the adaption to protocol changes easier

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Feb 14 13:22:42 UTC 2017


#20765: adapt to new lines in votes and consensus and make the adaption to protocol
changes easier
---------------------------------+-----------------------------------
 Reporter:  iwakeh               |          Owner:  metrics-team
     Type:  enhancement          |         Status:  needs_review
 Priority:  Medium               |      Milestone:  metrics-lib 1.6.0
Component:  Metrics/metrics-lib  |        Version:
 Severity:  Normal               |     Resolution:
 Keywords:                       |  Actual Points:
Parent ID:                       |         Points:
 Reviewer:                       |        Sponsor:
---------------------------------+-----------------------------------

Comment (by iwakeh):

 Replying to [comment:9 karsten]:
 > ...
 > > The new `private void parse*` methods just set a global variable each;
 why not have the `this.* = ParseHelper.parseProtocolVersions(line, line,
 parts);` lines in the switch stmt w/o the method calls?
 >
 > I'm not sure.  I think the switch statement is more readable if we just
 make one simple method call per line and move the parsing logic to
 separate methods.  And what if this parsing logic ever gets more
 complicated and requires another line; would we have to move that logic to
 a new method then?  Let's just stick to the current scheme if you don't
 mind.

 The switch is quite long and having the one line assignment there and
 method calls only when there is more to be done would save an unfamiliar
 reader from checking the method call to find that it just hides an
 assigment, but I don't feel strongly about this.  And, you're right that
 the newly created methods just continue the existing scheme.  Maybe, we
 should try to have a different approach in new classes :-)

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/20765#comment:11>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the metrics-bugs mailing list