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

feat: move stakerapp creation from main to stakerservice #157

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

wnjoon
Copy link
Contributor

@wnjoon wnjoon commented Mar 12, 2025

This PR addresses the // TODO: consider moving this to stakerservice comment in main.go.

Changes:

  • Added the NewStakerServiceFromConfig function.
  • Within NewStakerServiceFromConfig, the StakerService is now created after calling NewStakerAppFromConfig.

Benefits of this refactoring:

  • Separation of Concerns: main.go now primarily serves as a high-level coordinator, reducing its responsibilities and simplifying the code.
  • Encapsulation: Future changes to how stakerApp instance is created will no longer require modifications to main.go.
  • Improved Testability: By creating the stakerApp instance within stakerService, mock objects can be injected more easily for testing.
  • Better Dependency Management: Having stakerService directly instantiate stakerApp clarifies the dependency relationship between the components.

@wnjoon wnjoon changed the title feat: move new stakerapp function into service feat: move stakerapp creation from main to stakerservice Mar 12, 2025
@wnjoon wnjoon marked this pull request as ready for review March 12, 2025 00:58
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

Successfully merging this pull request may close these issues.

1 participant