You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code in Program.cs around handling and printing out packets needs some cleaning up. There's a decent amount of copy and paste, the position encoding isn't human readable, gridsquare printout doesn't print the right number of characters for the accuracy in the position object.
There are many ways of fixing this. A few potentials:
This could go all the way to implementing interfaces on the packet info field objects for each property (e.g. IPositionPacket and ITimestampPacket) and then just printing if the interface is implemented. That would be a really clean way to reduce duplicating logic on common properties. Though would require large refactors. Potentially beneficial to other client types (e.g. UI apps).
Alternatively, extension/helper methods to put the UI string printing to each (e.g. public static PrintPacket(this WeatherStatus packet).
A case could be made for overriding .ToString() on each packet type, though that risks mixing UI logic with application logic.
Potentially this is a mix of those methods.
This is split off of #80.
Related to, but different from, #118.
Acceptance Criteria
Output is clean and human readable
Code for printing packets has reduced copy/paste repeats
Code for printing packets is extensible for future packet types
Tests, as appropriate
The text was updated successfully, but these errors were encountered:
Description
The code in
Program.cs
around handling and printing out packets needs some cleaning up. There's a decent amount of copy and paste, the position encoding isn't human readable, gridsquare printout doesn't print the right number of characters for the accuracy in the position object.There are many ways of fixing this. A few potentials:
IPositionPacket
andITimestampPacket
) and then just printing if the interface is implemented. That would be a really clean way to reduce duplicating logic on common properties. Though would require large refactors. Potentially beneficial to other client types (e.g. UI apps).public static PrintPacket(this WeatherStatus packet)
..ToString()
on each packet type, though that risks mixing UI logic with application logic.Potentially this is a mix of those methods.
This is split off of #80.
Related to, but different from, #118.
Acceptance Criteria
The text was updated successfully, but these errors were encountered: