ministryofjustice / hmpps-interventions-service

Business/domain interface for providing rehabilitation services to service users
MIT License
1 stars 1 forks source link

Email template variable naming prevent DRY #1218

Open sldblog opened 2 years ago

sldblog commented 2 years ago

Short problem statement; why is this a problem?

Variables in our email templates are not consistent. This leads to unnecessary code duplication.

This leads to dealing with errors like EventException: NullPointerException: null; while processing ReferralEvent more difficult (there's no assignee).

Link to different approaches

With camelCase:

https://github.com/ministryofjustice/hmpps-interventions-service/blob/bf2b2519cdd175c1882b32627c7d1a78bcef432a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/notifications/ReferralNotificationService.kt#L71-L73

With snake_case:

https://github.com/ministryofjustice/hmpps-interventions-service/blob/bf2b2519cdd175c1882b32627c7d1a78bcef432a/src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsinterventionsservice/service/notifications/ReferralNotificationService.kt#L85-L87

Do you have a proposed solution? Why?

Standardise on one casing. Use it everywhere.

This requires duplicating templates until the switchover happens.

sldblog commented 2 years ago

1219 partially DRYs the code up, but there are still templates with different casing and names for the same values.