Hi Everyone! I am a Kotlin noob (but have about 21...
# serialization
a
Hi Everyone! I am a Kotlin noob (but have about 21 years of Java on-and-off, so I got that goin for me which is nice) — and I am playing with serialisation of immutable, signed objects to send over the network. I am starting to read up on Kotlin serialisation but - in parallel with that - I was wondering if anyone had enough experience of Square.com's "Wire" library (https://square.github.io/wire/ - see
Wire Kotlin
section) which I've used in Java before to provide elegant/ish cross-platform serialisation. What I am seeking is: perspective on whether the problems which Wire addresses for Java, are still an issue with native Kotlin protobuf support and/or serialisation? Typically Java coders who like Wire are looking for generation of lightweight (field-not-getter) code for Java - to reduce method proliferation - and simpler syntax. Wire has Kotlin support, but given Kotlin's pragmatism, I am wondering how necessary it is, please?
g
I think it depends on your case. If you want protobuf (let's say it's protocol of choice for some of your services), I would just use Wire, it's protobuf generator Kotlin serialization is able to serialize/deserilize to protobuf, but it also means that instead of creating proto scheme and generate code from it, you encode your scheme in code, which makes it impossible to reuse outside of Kotlin. It may be fine for your use case of course, but I think that lack of proto scheme may become a problem one day
❤️ 1
kotlinx.serializatiob though is good as generic serialization solution
a
So, interoperability wins. Thanks @gildor
g
For protobuf yes, I think it’s one of the biggest advantages of formants with scheme