You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking back, working with SNSService.kt was weird. Changes in events rippled over to several listener files.
Working with enums within the events probably does not help, as switches would start adding new warnings for not covering all cases or default to not doing anything. Using ReferralSentEvent would be better than ReferralEvent(type=SENT, ...).
In general, though, we should pick one and stick to it.
The text was updated successfully, but these errors were encountered:
Short problem statement; why is this a problem?
We have a few strategies to name our listeners. We should explicitly pick one or guide when to pick one or the other.
The typical "find" pattern is "what happens after {event}", so naming should probably support that use case.
Link to different approaches
One file per multiple listeners listening to the same event; the file is named after the event:
hmpps-interventions-service/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/listeners/ReferralConcludedListener.kt
Lines 19 to 22 in d1f7c15
hmpps-interventions-service/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/listeners/ReferralConcludedListener.kt
Lines 63 to 70 in d1f7c15
One file per listener; the file is named after what it is doing:
hmpps-interventions-service/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/listeners/ReferralMetricsListener.kt
Lines 18 to 22 in d1f7c15
One huge service file, with several
@Service
classes for doing similar things; the file is named after the "similar thing":hmpps-interventions-service/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/SNSService.kt
Lines 22 to 25 in d1f7c15
hmpps-interventions-service/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/SNSService.kt
Lines 54 to 57 in d1f7c15
hmpps-interventions-service/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/SNSService.kt
Lines 88 to 91 in d1f7c15
Do you have a proposed solution? Why?
Looking back, working with
SNSService.kt
was weird. Changes in events rippled over to several listener files.Working with enums within the events probably does not help, as switches would start adding new warnings for not covering all cases or default to not doing anything. Using
ReferralSentEvent
would be better thanReferralEvent(type=SENT, ...)
.In general, though, we should pick one and stick to it.
The text was updated successfully, but these errors were encountered: