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

refactor: don't design interfaces, discover them. #111

Merged
merged 2 commits into from
Sep 6, 2024

Conversation

muktihari
Copy link
Member

"Don't design with interfaces, discover them" - Rob Pike

Interfaces should be created by the consumer instead of the producer. The consumer, in this case service/service.go (Service{}), are the one who decides which methods are needed to carry the operation. We as software engineer should discover it this way, not by designing interfaces. The producer, in this case fit, gpx, and tcx, only responsible to satisfy the interface.

The interface named Service in activity/service.go is removed, the name of Service interface is renamed to DecodeEncoder as it only needs to do two things, to decode and to encode. This also eliminates the ambiguity surrounding the name 'Service'.

@muktihari muktihari added the enhancement New feature or request label Sep 6, 2024
@muktihari muktihari self-assigned this Sep 6, 2024
@muktihari
Copy link
Member Author

I accidentally delete the remote branch for #110 and it's auto closed so I make new PR. I have update the commit related to the previous conversation. Please kindly review @raditzlawliet .

@muktihari muktihari merged commit 72bae09 into openivity:master Sep 6, 2024
1 check passed
@muktihari muktihari deleted the refactor/discover-interfaces branch September 23, 2024 12:32
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 this pull request may close these issues.

2 participants