mallet icon indicating copy to clipboard operation
mallet copied to clipboard

StringCodec.java

Open Tokarak opened this issue 3 years ago • 4 comments
trafficstars

resolves: #13 Replaces StringCodec.groovy with StringCodec.java

Tokarak avatar Jun 19 '22 17:06 Tokarak

I will also remove Encoder/Decoder, to save space and avoid confusing newcomers. I do not see when you would need only one of them, and high level users can type in the classname. If you disagree, rebase this commit out of the merge.

Tokarak avatar Jun 19 '22 17:06 Tokarak

If common protocols are transferred from groovy scripts to statically typed implementations, that would be a step towards documentation.

Tokarak avatar Jun 19 '22 18:06 Tokarak

For what it is worth, I created the groovy implementation to serve as an example of how to create your own ScriptHandlers. And it can absolutely be possible to have a StringDecoder or StringEncoder by itself. For example, a protocol that reads the name of an image, and responds with the image itself. It is absolutely true that many people will simply go with the StringCodec, though, which is why that was also provided. I think perhaps a better/bigger change might be to group symmetric codecs in one tab, and independent Encoders and Decoders in an adjacent tab? What do you think?

RoganDawes avatar Jun 19 '22 21:06 RoganDawes

The best organisation may be by protocol, grouping into String, Http, Ssl etc.; provides a sensible organisation for the (future) docs too, and makes it easier to import an external set of Handlers for a protocol (which won't be stored here if the project ever reaches a large size); in short, scalable. I think again each class should be wrapped somehow to allow automation of the templates.

Tokarak avatar Jun 19 '22 21:06 Tokarak