-
Notifications
You must be signed in to change notification settings - Fork 1
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
Change naming of APIs for state and fetching state #73
Comments
We went with We specifically didn't choose room.status.current In this example it's quite clear that you're getting the current room status.
Initially we wanted to call these enums We wanted to avoid the term If you feel there's a better name, then happy to discuss alternatives! |
@AndyTWF I just had a look at our JS code. I think if we swap the names everything makes more sense.
|
I agree with context to room I'm also fine with Do we need to achieve parity with the core SDKs? or was this something that felt right but perhaps doesn't matter as long as we try to keep parity between the Chat SDKs? |
It was a deliberate design decision - we're expecting the Chat SDK to be used in concert with the core SDK in many applications (people using PubSub for other aspects of their app). So we went for parity whenever there's overlapping concepts between the two so that that things are intuitive between SDKs. We did deviate in one or two places where it was an obvious improvement, however (e.g. the subscribe behaviour). |
That's definitely a possible! |
Ahh I've done some digging... most of my confusion stemmed from the PR this is linked to in which we have a property on the This is Leaning into @vladvelici's suggestion, the API would make a lot more sense with that change too. Where we currently have:
this would become:
this makes a lot more sense! Can we confirm we're happy to make the following changes:
|
In the core API we only use |
SGTM - for JS we'll swap the interface and enum names for consistency, as well as the |
Sweet, we'll do the same - thanks all! I've also added this to the divergence log |
I imagine we want to make the same change for connection lifecycle, right? That is, call the enum |
We: - rename the RoomLifecycle enum to RoomLifecycleStatus (which makes more sense); - rename the RoomStatus protocol to RoomLifecycle and rename its `current` property to `status` ("current" what?; it wasn’t clear, and was inconsistent with the core SDKs, which only use `current` for state _changes_) The net effect is that instead of writing `room.status.current` you now write `room.lifecycle.status`, which still seems pretty readable and gives the benefits listed above. This change has been agreed with the Chat team and the decision is recorded in [1]; they will make this change in JS. As part of this, I’ve also corrected references to room “state” to the correct terminology of “status” (in [2] Andy explains why they used the word “status”, choosing to reserve “state” for some larger composite state). Outstanding spec question about whether to rename the RoomInFailedState error [3]; that can wait. [1] https://ably.atlassian.net/wiki/spaces/CHA/pages/3307405320/SDK+Divergence+Decision+Log [2] #73 (comment) [3] https://github.com/ably/specification/pull/200/files#r1783542331
Same motivation. Resolves #73.
For this we already have |
Are you sure about that? From what I’m seeing, |
Ahh sorry, was looking at the wrong file! Then yes, I agree we should do the same here :) |
@AndyTWF Do we need to update this as a part of the spec. I strongly feel, if spec is ambiguous, we need to update it. |
The spec for Chat doesn't currently specify down to the property level what everything needs to be called - its a work in progress primarily focused on making sure we capture the intended behaviour in clear language, as well as providing testing points for the UTS. If we decide to add an IDL to the spec - then of course we'll include it. |
@AndyTWF wrote CHADR-062 to describe the change, I've left a comment there initially but moving it here to keep the conversation in one place. I think the The In JS, inside the implementation of the class, we actually have private variable called |
I strongly feel we should have IDL for the spec. Otherwise, there will be implicit assumptions in the future that will lead to more confusion |
Also, it's difficult to keep track of related discussions. I mean current discussion isn't really related to Swift and has impact across other chat SDKs |
We apply the changes that we decided upon in [1]; that is, we: - remove the RoomStatus protocol, moving its functionality directly into the Room protocol, and rename the `current` property to `status`; - rename the RoomLifecycle enum to RoomStatus As part of this, I’ve also corrected references to room “state” to the correct terminology of “status” (in [2] Andy explains why they used the word “status”, choosing to reserve “state” for some larger composite state). [1] https://ably.atlassian.net/wiki/spaces/CHA/pages/3410526209/CHADR-062+Renaming+Lifecycle+Types+for+Clarity [2] #73 (comment)
We apply the changes that we decided upon in [1]; that is, we: - remove the RoomStatus protocol, moving its functionality directly into the Room protocol, and rename the `current` property to `status`; - rename the RoomLifecycle enum to RoomStatus As part of this, I’ve also corrected references to room “state” to the correct terminology of “status” (in [2] Andy explains why they used the word “status”, choosing to reserve “state” for some larger composite state). [1] https://ably.atlassian.net/wiki/spaces/CHA/pages/3410526209/CHADR-062+Renaming+Lifecycle+Types+for+Clarity [2] #73 (comment)
Done in #92. |
#54 (comment)
@umair-ably wasn’t a fan of:
current
as a property to mean "the current state of this object", and would prefer it be namedstate
current
is used in the public API of the SDK, which matches the JS naming and also matches the naming used in the core SDKs, and personally whilst I think it could be clearer ("current" what?), I can also live with itRoomLifecycle
enum, which he thinks should be calledRoomState
orRoomLifecycleState
See comment for agreed outcome to resolve this issue.
┆Issue is synchronized with this Jira Story by Unito
The text was updated successfully, but these errors were encountered: