Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SDLJsonEncoder, SDLJsonDecoder, SDLDecoder.h, and SDLEncoder.h should be removed. #8

Closed
justinjdickow opened this issue Oct 24, 2014 · 1 comment
Labels
proposal Accepted SDL Evolution Proposal
Milestone

Comments

@justinjdickow
Copy link
Contributor

SDLJsonEncoder and Decoder classes add unnecessary complexity and improperly built singletons to call a single line of code

NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dict options:kNilOptions error:&error];

The error is ignored in both cases. It also defines two protocols, that are only used in those classes (Defined in SDLDecoder.h and SDLEncoder.h)

SDLDecoder.h and SDLJsonDecoder can be removed and the line

NSDictionary* rpcMessageAsDictionary = [[SDLJsonDecoder instance] decode:self.payload];

can be replaced in SDLV1ProtocolMessage and SDLV2ProtocolMessage with

NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:msgBytes options:kNilOptions error:nil];

The same can be applied to SDLJsonEncoder, and the one class which calls its encode message

@joeljfischer joeljfischer added enhancement proposal Accepted SDL Evolution Proposal labels Oct 24, 2014
@joeljfischer joeljfischer added this to the 4.0.0 milestone Feb 19, 2015
@joeljfischer joeljfischer modified the milestones: 5.0.0, 4.0.0 Mar 18, 2015
@joeljfischer joeljfischer modified the milestones: 4.X, 5.0.0 Jan 25, 2016
@joeljfischer
Copy link
Contributor

Should be deprecated in a 4.X release.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
proposal Accepted SDL Evolution Proposal
Projects
None yet
Development

No branches or pull requests

2 participants