Arrow icon indicating copy to clipboard operation
Arrow copied to clipboard

Codable

Open s4cha opened this issue 6 years ago • 3 comments

TODO

Look for all differences with codable and list them.

Codable

  • 1 parsing fails all fails
  • Fine grained error handling
  • Need 1 custom parsing need to write all encodable method
  • Default parsing matching existing keys
  • No type inference (apart from dates)
  • Yields a new object
  • Quite verbose

Arrow

  • Best effort parsing, ignoring fails
  • No error handling (seldom used when getting data from a webservice)
  • No default parsing
  • Type inference out of the box (sy string identifier to an int for example)
  • Can parse and fill an existing object
  • Custom date parsing on a case per case basis
  • Very concise syntax

Having compared Arrow with Codable in a big iOS App, I still believe there's an advantage using Arrow.

@maxkonovalov I would love to know your feelings on Codable vs Arrow :)

s4cha avatar Sep 28 '17 12:09 s4cha

Hey @s4cha! Arrow has a big advantage when your project is based on the Arrow+then+ws combo :) I haven't given a try to Codable yet, but definitely will do. The best way to compare the two would be seeing side-by-side code listings from some real project.

maxkonovalov avatar Sep 28 '17 12:09 maxkonovalov

@maxkonovalov agreed! I've started trying Codable out but as much as I want to use the native solution I still prefer Arrow somehow. I must not be very objective though :) Your answer brings me to something cool that we can do, support Codable on ws! At first sight it would kinda look like duplicating whatever we have for ArrowParsable with Codable. I guess it would make ws more attractive for users, since they would not have to use Arrow if they don't want to :)

s4cha avatar Sep 28 '17 14:09 s4cha

@s4cha I believe if ws supported Codable, then it could be very powerful

I have not used Codable but at first look it seems like it is both wonderful when it works, and horrible when it doesn't.

I do a lot of debugging networking calls (real life = bad documentation) and Arrow looks a lot better than Codable for that.

n13 avatar Jun 26 '19 05:06 n13