Let’s say I want to write an FTP client from scratch. In the command channel various status and error codes can be passed between server and client such as :
- 200 Command okay
- 331 User name okay, need password
- 421 Service not available
- …
Ideally, the numeric code and a human-readable message should be kept.
How should these be represented ? As an enum in some sort of Connection class ? What could be done to accomodate different messages or new codes ?
I would prefer the enums with some logic contains:
Since the FTP doesn’t change since 1985 (rfc959), you can add all FTP response codes into the enum class.