Skip to content

Instantly share code, notes, and snippets.

@AntonStoeckl
Created June 3, 2022 07:33
Show Gist options
  • Save AntonStoeckl/13b01eeab874a07f843b31fedbeeff1e to your computer and use it in GitHub Desktop.
Save AntonStoeckl/13b01eeab874a07f843b31fedbeeff1e to your computer and use it in GitHub Desktop.
Example for Blog Post "Hexagonal Architecture: Structuring a project and the influence of granularity V2
##### the coarse-grained version #####
type ForPlayingTheGame interface {
SelectDeck(command SelectDeckCommand) error
UnselectDeck(command UnselectDeckCommand) error
EnrollPlayer(command EnrollPlayerCommand) error
SignOutPlayer(command SignOutPlayerCommand) error
PurgeInactivePlayers(command PurgeInactivePlayersCommand) (count uint, err error)
FinishCard(command FinishCardCommand) error
RejectCard(command RejectCardCommand) error
}
##### a coarse-grained version, but sliced into logical groups #####
type ForSelectingDecks interface {
Select(command SelectDeckCommand) error
Unselect(command UnselectDeckCommand) error
}
type ForEnrollingPlayers interface {
EnrollPlayer(command EnrollPlayerCommand) error
SignOutPlayer(command SignOutPlayerCommand) error
PurgeInactivePlayers(command PurgeInactivePlayersCommand) (count uint, err error)
}
type ForPlayingCards interface {
FinishCard(command FinishCardCommand) error
RejectCard(command RejectCardCommand) error
}
##### the fine-grained version #####
type ForSelectingDecks interface {
Select(command SelectDeckCommand) error
}
type ForUnselectingDecks interface {
Unselect(command UnselectDeckCommand) error
}
###
type ForEnrollingPlayers interface {
Enroll(command EnrollPlayerCommand) error
}
type ForsigningOutPlayers interface {
SignOut(command SignOutPlayerCommand) error
}
type ForPurgingInactivePlayers interface {
Purge(command PurgeInactivePlayersCommand) (count uint, err error)
}
###
type ForFinishingCards interface {
Finish(command FinishCardCommand) error
}
type ForRejectingCards interface {
Reject(command RejectCardCommand) error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment