bitbubbler / yet-another-dcs-server

YADS: A work in progress dcs server
The Unlicense
5 stars 3 forks source link

Command parser complexity (boilerplate) with optional vs required properties #33

Open bitbubbler opened 2 years ago

bitbubbler commented 2 years ago

this complexity feels like something we should address 🤔 I feel like it makes it harder to write code here. with so much boilerplate

being commands, I lean towards being explicit. Separating the logic of "what did the user put in" (the command knows about radius, but the user input nothing for radius) vs "what does this module want to do with that data"

where a coalition is explicitly required in the command?? but the user can also input nothing for coalition.

The "shape" of a DestroyCommand should, imo, always have every property. as that's the command. a command doesn't lack a radius just because the user didn't input one, it has explicit knowledge ( the property existing with value undefined) that the user intentionally didn't provide the value.

I haven't entirely convinced myself here yet, and welcome other input.

_Originally posted by @bitbubbler in https://github.com/bitbubbler/yet-another-dcs-server/pull/31#discussion_r924072093_