New issue

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

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

Already on GitHub? Sign in to your account

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

Closed
justinjdickow opened this Issue Oct 24, 2014 · 1 comment

Comments

Projects
2 participants
@justinjdickow
Contributor

justinjdickow commented Oct 24, 2014

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 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

This comment has been minimized.

Show comment
Hide comment
@joeljfischer

joeljfischer Jan 25, 2016

Member

Should be deprecated in a 4.X release.

Member

joeljfischer commented Jan 25, 2016

Should be deprecated in a 4.X release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment