Community
We are currently doing some domain driven design to understand our primary business domains and identify the appropriate core APIs required. This is an exciting yet daunting time - some domains look far too simple while others seem overly complex and almost impossible to model. One such domain is the payments domain.
A few weeks ago, during one of the payment domain workshops, one of my colleagues compared payments to a butterfly and challenged me with the question: "How do you model a butterfly?" My knee-jerk reaction was to rise to the challenge and prove it possible, but I soon ran into the problem. Butterflies are the end state of metamorphosis.
The butterfly has four stages to its lifecycle; egg, caterpillar, pupa, butterfly. Each stage is different and has a different goal. The challenging part is, while the creature is the same, its life stages are completely different. The egg is simply a sphere with something growing inside. The caterpillar is a long cylindrical creature with a lot of legs. The pupa is a mass of thread woven into a cocoon shape. The butterfly has wings and six legs. How can the same creature be modeled if it is a completely different object during the stages of its life.
This stuck with me for a while as I consciously left it to percolate in the back of my mind. Yesterday, while on my way home on the metro, I had the "Aha" moment!
The answer is you can model a butterfly - by the individual stages of the creature at any moment. The question leads you to assume you need to model all stages of the creature as one model since it is one creature. This you cannot model. The relationship between metamorphosis and the butterfly is the same as payment to transaction. Both are a process, not an entity
So, simply put, model the stages of the payment process as separate entities and serve these as core domain APIs. Next, create process APIs that manage and orchestrate these core domain APIs to fulfil the payment process.
It's just as important to phrase the question as it is to understand it.
Craig Hughes
Photo by Ahmed Aqtai from Pexels
This content is provided by an external author without editing by Finextra. It expresses the views and opinions of the author.
Nkahiseng Ralepeli VP of Product: Digital Assets at Absa Bank, CIB.
10 March
Nicholas Holt Head of Solutions and Delivery, Europe at Marqeta
07 March
Ivan Nevzorov Head of Fintech Department at SBSB FinTech Lawyers
Kate Leaman Chief Analyst at AvaTrade
06 March
Welcome to Finextra. We use cookies to help us to deliver our services. You may change your preferences at our Cookie Centre.
Please read our Privacy Policy.