When building an integration between two systems, you will face a choice where to put different pieces of business logic.
For example, I was working on a Laravel application for managing employee data that integrated with an e-commerce platform.
While on a call with the e-commerce team, the question came up about where to put the logic for sending welcome emails. All new employees would need an invitation to the e-commerce platform where they could order uniforms and other supplies.
From a purely technical perspective, the responsibility for sending the welcome email could live in the Laravel app or the e-commerce platform.
But from a business perspective, what makes the most sense? How would you decide?
One question I considered is "How prone is the email template to change?" The Laravel app was a middleware API with no user interface, so any template changes would require a developer to do the work.
It wouldn't necessarily take a lot of time to make a text change, but it is a little bit of friction, whereas the e-commerce platform had a robust user interface for managing email content. For this reason, it made sense to let the e-commerce platform manage the email content and send the welcome email.
Another question I think about is how complex is the functionality? The e-commerce platform can do a lot, but it has limits. Our Laravel middleware app was custom-built for this integration. If there were some custom requirements for when to send the welcome email, it might have made sense to let Laravel manage it.
As developers, sometimes our preference is to control all the logic in the app we build. But it's always good to consider the needs of the business when making an architectural decision like this.
Here to help,
Joel
P.S. Have a big architectural decision coming up and want to talk it through with me?