2 ms·
I dunno, are you sure you can manually write correct de/serializaiton for JSON and XML so strings, floats and integer formats correctly get parsed between JavaS
by izacus 9mo ago
I dunno, are you sure you can manually write correct de/serializaiton for JSON and XML so strings, floats and integer formats correctly get parsed between JavaScript, Java, Python, Go, Rust, C++ and any other languages?
Do you want to maintain that and debug that? Do you want to do all of that without help of a compiler enforcing the schema and failing compiles/CI when someone accidentally changes the schema?
Because you get all of that with protobuf if you use them appropriately.
You can of course build all of this yourself... and maybe it'll even be as efficient, performant and supported. Maybe.
- nicman23 9mo agoi mean you can always go mono or duo language and then it is really not that of an issue
- eklavya 9mo agoThat would make sense if protobuf was complex, bloated, slow. But it's not, so the question should be why not use it, unless you are doing browser stuff.
- 9rx 9mo agoIf you are going to use it elsewhere, why not use it for browser stuff too?
- eklavya 9mo agoI would advise against it. Too much friction, try it, maybe you will have a different experience than mine.
- 9rx 9mo agoI am curious about what kind of friction you encountered. Were you generating ad-hoc protobuf messages? Assuming you were using Protobufs as they are usually used, meaning under generated code, I saw no difference between using it in Javascript and any other language in my experience. The wire format is beyond your concern. At least it is no more of your concern than it is in any other environment. There are a number of different generator implementations for Javascript/Typescript. Some of them have some peculiar design choices. Is that where you found issue? I would certainly agree with that, but others aren't so bad. That doesn't really have anything to do with the browser, though. You'd have the same problem using protobufs under Node.js.
- t-writescode 9mo agoI mean, the entire internet has been doing that for decades and there’s a lot of tooling, libraries and generators that already do that, so … sure? And it works in a browser, too!