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

SDK: Remove code duplication #95

Open
m-linner-ericsson opened this issue Sep 7, 2021 · 3 comments
Open

SDK: Remove code duplication #95

m-linner-ericsson opened this issue Sep 7, 2021 · 3 comments

Comments

@m-linner-ericsson
Copy link
Collaborator

Today the SDK contains a lot of boilerplate code to send an event. This can be seen when writing the unit test (see https://github.com/cdfoundation/sig-events/pull/92/files for an example). We could probably reduce the amount of code one needs to write to generate an event.

Some ideas on doing this could be:

  • Generate the code from a specification
  • Write the code smarter
@e-backmark-ericsson
Copy link
Collaborator

Is this issue still valid, @m-linner-ericsson , @afrittoli ? If so, it should be re-created in the cdevents/sdk-go repo

@afrittoli
Copy link
Member

When developing the new SDK I tried to avoid where possible code duplication.
It is the nature of go to be explicit though, it is harder in go than in python to reduce the amount of code as there is no such thing as polymorphism in go.
I've used a simple shell script to generate the base file for most events, but the limitation is that the generated files need then to be manually updated, so it is not possible to regenerate existing files. It is rather straight forward to add new events to the SDK though, and I plan to document the process eventually.
I would close this one and open an issue in the SDK about documenting how to add new events and new fields to existing events.

@e-backmark-ericsson
Copy link
Collaborator

@m-linner-ericsson , are you satisfied with that proposal, and thus could we close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants