dusk-rs / dusk-social

Cross-world social communication server.
https://dusk.rs
Other
4 stars 1 forks source link

Packet meta data configuration - is annotation the best way #8

Open kiairatech opened 4 years ago

kiairatech commented 4 years ago

Enum can be used to simplify encoding/decoding. Removes the requirement of packet id and type definition from the decoder. Used for encoding as well.

GregHib commented 4 years ago

I like the fact that the opcode size and codec can be found in the same file, enum separates the two but does give a centralized place to find the information. No real benefits just different based on opinion.

The other similar ways would be to make the parent file abstract and pass the values in the constructor. OR have abstract values that need overriding (verbose).

Probably not worth wasting time over small issues like this which would take a notable amount of time to migrate but don't really provide any tangible benefit other than clarity