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

Simplify function names and make it overridable #158

Closed
lerenn opened this issue Mar 14, 2024 · 0 comments · Fixed by #161
Closed

Simplify function names and make it overridable #158

lerenn opened this issue Mar 14, 2024 · 0 comments · Fixed by #161
Assignees
Labels
enhancement New feature or request

Comments

@lerenn
Copy link
Owner

lerenn commented Mar 14, 2024

Current situation

Some function names can be really long because :

  • Using the operation names directly is not recommanded as we cannot derive the name from sender to receiver and vice/versa;
  • There can be some ambiguity can appear in some minor cases when mixing messages and channels, so we put the request function as Request<MsgName>On<ChannelName>ChannelWith<MsgName>On<ChannelName>Channel.

Problem

  • Really long names. Example: RequestServiceInfoResponseOnServiceInfoResponseChannelWithServiceInfoRequestOnServiceInfoRequestChannel
  • Not reflecting the operations

Proposition

Change function names

  • Send: Send[To (User)/ As (App)]<OperationName>Operation[With<MessageName>]
  • Subscribe: SubscribeTo<OperationName>Operation[With<MessageName>]
  • Receive: <OperationName>Operation[With<MessageName>]Received
  • Request: RequestTo<OperationName>Operation[With<ReplyMessageName>][With<RequestMessageName>]
  • Reply: ReplyTo<OperationName>Operation[With<RequestMessageName>][WithReply<MessageName>]

Note: [With<MessageName>] and others should be implemented with issue 140 for multiple messages

Examples:

  • Operation receiveHello with side receive:
    • Send (user): SendToReceiveHelloOperation
    • Subscribe (app): SubscribeToReceiveHelloOperation
    • Receive (app): ReceiveHelloOperationReceived
    • Request/Reply: N/A
  • Operation sendHello with side send:
    • Send (app): SendAsSendHelloOperation
    • Subscribe (user): SubscribeToSendHelloOperation
    • Receive (user): SendHelloOperationReceived
    • Request/Reply: N/A
  • Operation pingRequest with sidereceive:
    • Send (user): SendToPingRequestOperation
    • Subscribe (app): SubscribeToPingRequestOperation
    • Receive (app): PingRequestOperationReceived
    • Request (user): RequestPingRequestOperation
    • Reply (app): ReplyToPingRequestOperation
  • Operation onUserSignedUp with side send:
    • Send (app): SendAsOnUserSignedUpOperation
    • Subscribe (user): SubscribeToOnUserSignedUpOperation
    • Receive (user): OnUserSignedUpOperationReceived
    • Request/Reply: N/A

Note: Could be prefixed with With if there is multiple messages

@lerenn lerenn self-assigned this Mar 14, 2024
@lerenn lerenn added the enhancement New feature or request label Mar 14, 2024
@lerenn lerenn changed the title Simplify name generation when there is no ambiguity Simplify function names and make it overridable Mar 14, 2024
@lerenn lerenn linked a pull request Mar 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant