Skip to content

Instantly share code, notes, and snippets.

View AlexanderGrom's full-sized avatar

Alexander Gromov AlexanderGrom

View GitHub Profile
@AlexanderGrom
AlexanderGrom / specification.go
Last active March 16, 2024 21:20
Golang Pattern Specification (sketch)
// Pattern Specification
//
// In the following example, we are retrieving invoices and sending them to a collection agency if
// 1. they are overdue,
// 2. notices have been sent, and
// 3. they are not already with the collection agency.
// This example is meant to show the end result of how the logic is 'chained' together.
//
// This usage example assumes a previously defined OverdueSpecification class
// that is satisfied when an invoice's due date is 30 days or older,