Skip to content
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

ART* should match IDL definition #557

Closed
4 tasks
ricardopereira opened this issue Dec 13, 2016 · 7 comments
Closed
4 tasks

ART* should match IDL definition #557

ricardopereira opened this issue Dec 13, 2016 · 7 comments
Labels
enhancement New feature or improved functionality.

Comments

@ricardopereira
Copy link
Contributor

ricardopereira commented Dec 13, 2016

As agreed on the call, we will update the ART* classes to match the IDL. The ones we know need changing are below, but @ricardopereira please review all classes before submitting a PR for this issue:

  • ARTRealtimeConnectionState -> ARTConnectionState
  • ARTRealtimeConnectionEvent -> ARTConnectionEvent
  • ARTRealtimeChannelState -> ARTChannelState
  • ARTRealtimeChannelEvent -> ARTChannelEvent

The IDL is at http://docs.ably.io/client-lib-development-guide/features/#idl

@ricardopereira ricardopereira added the enhancement New feature or improved functionality. label Dec 13, 2016
@mattheworiordan
Copy link
Member

@ricardopereira @tcard further to the conversation at #543 (review), I have given this some thought, and I am in fact now against the change. My thinking is:

In short whilst I think the naming is not perfect, changing it does not really achieve much, but will cause pain for customers and us in regards to documentation, examples we have, tutorials etc.

Is there really any compelling reason to change this now?

FYI @paddybyers @SimonWoolf

@ricardopereira
Copy link
Contributor Author

@mattheworiordan Ok, I agree with most of it. We should at least rename each cases from ARTRealtimeConnectionState:

typedef NS_ENUM(NSUInteger, ARTRealtimeConnectionState) {
    ARTRealtimeInitialized, //<---- ARTRealtimeInitialized to ARTRealtimeConnectionInitialized
    ARTRealtimeConnecting,
    ARTRealtimeConnected,
    ARTRealtimeDisconnected,
    ARTRealtimeSuspended,
    ARTRealtimeClosing,
    ARTRealtimeClosed,
    ARTRealtimeFailed
};

@ricardopereira
Copy link
Contributor Author

Well, maybe it's not so important because in Swift, it gets translated to ARTRealtimeConnectionState.Initialized so it will only affect Objective-C code. Could be something to be done after the v0.9.

@ricardopereira
Copy link
Contributor Author

BTW, @tcard I need some feedback from you.

From IDL de ConnectionEvent embeds the ConnectionState:

enum ConnectionState:
  INITIALIZED
  CONNECTING
  CONNECTED
  DISCONNECTED
  SUSPENDED
  CLOSING
  CLOSED
  FAILED

enum ConnectionEvent:
  embeds ConnectionState
  UPDATE // RTL4h

Which change seems more correct to you?

  1. Duplicate the ARTRealtimeConnectionState as ARTRealtimeConnectionEvent and add the new UPDATE case
  2. Use the last ARTRealtimeConnectionState and increment it on the ARTRealtimeConnectionEvent:
typedef NS_ENUM(NSUInteger, ARTRealtimeConnectionState) {
    ARTRealtimeInitialized,
    ARTRealtimeConnecting,
    ARTRealtimeConnected,
    ARTRealtimeDisconnected,
    ARTRealtimeSuspended,
    ARTRealtimeClosing,
    ARTRealtimeClosed,
    ARTRealtimeFailed
};

typedef NS_ENUM(NSUInteger, ARTRealtimeConnectionEvent) {
    ARTRealtimeUpdate = ARTRealtimeFailed + 1
};

This will be translated to Swift like:

public enum ARTRealtimeConnectionState : UInt {
    case Initialized
    case Connecting
    case Connected
    case Disconnected
    case Suspended
    case Closing
    case Closed
    case Failed
}

public enum ARTRealtimeConnectionEvent : UInt {
    case Update
}

@tcard
Copy link
Contributor

tcard commented Dec 13, 2016

The first case. The second case is not correct at all. ARTRealtimeConnectionEvent must have all those variants, not only Update.

I'm not opposed to dropping the name changes, by the way. I'd rather have them match the IDL (ie. ConnectionState and ChannelState), but well.

@mattheworiordan
Copy link
Member

@tcard @ricardopereira can we perhaps discuss this tomorrow as it's important we get this right in 0.9 and minimise breaking changes at the same time.

@ricardopereira
Copy link
Contributor Author

@tcard @mattheworiordan By implementing the UPDATE event, I noticed that it will always exist a breaking change (at least for ObjC) because the Emitter will change (it will emit an ARTRealtimeConnectionEvent instead of an ARTRealtimeConnectionState), so code like:

[self.connection once:ARTRealtimeClosed callback:^(ARTConnectionStateChange *stateChange) {
    [expectation fulfill];
}];

should be updated to

[self.connection once:ARTRealtimeConnectionEventClosed callback:^(ARTConnectionStateChange *stateChange) {
    [expectation fulfill];
}];

@mattheworiordan mattheworiordan changed the title ARTRealtimeConnection* -> ARTConnectionState* ART* should match IDL definition Dec 14, 2016
@tcard tcard closed this as completed Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improved functionality.
Development

No branches or pull requests

3 participants